490 lines
14 KiB
Plaintext
490 lines
14 KiB
Plaintext
--echo #
|
|
--echo # Test for IBD2SDI tool
|
|
--echo #
|
|
|
|
# Bug#20205934 - ENABLE VALGRIND FOR MEMCACHED TESTS
|
|
source include/not_valgrind.inc;
|
|
source include/have_memcached_plugin.inc;
|
|
# Memcached SDI APIs are enabled only for debug version
|
|
source include/have_debug.inc;
|
|
source include/have_ibd2sdi_debug.inc;
|
|
|
|
set global innodb_limit_optimistic_insert_debug = 2;
|
|
|
|
|
|
--disable_query_log
|
|
CALL mtr.add_suppression("daemon-memcached-w-batch-size': unsigned");
|
|
CALL mtr.add_suppression("Could not obtain server's UPN to be used as target service name");
|
|
CALL mtr.add_suppression("Warning: MySQL is trying to drop");
|
|
source include/memcache_config.inc;
|
|
--enable_query_log
|
|
|
|
INSERT INTO cache_policies VALUES('cache_policy', 'innodb_only',
|
|
'innodb_only', 'innodb_only', 'innodb_only');
|
|
|
|
INSERT INTO config_options VALUES('separator', '|');
|
|
|
|
# describe table for memcache
|
|
INSERT INTO containers VALUES ('desc_t1', 'test', 't1',
|
|
'c1', 'c2', '0', '0', '0', 'PRIMARY');
|
|
|
|
USE test;
|
|
--let MEMCACHED_PORT=11293
|
|
--let $MYSQLD_DATADIR= `SELECT @@datadir`
|
|
--let DUMP_FILE=$MYSQLTEST_VARDIR/log/ibd2sdi_out.txt
|
|
--let IBD_FILE=$MYSQLD_DATADIR/test/t1.ibd
|
|
--let IBD_PAGE_SIZE=`select @@innodb_page_size`
|
|
|
|
--echo # Case 1. Test with small SDI data
|
|
SET DEBUG = '+d, skip_sdi';
|
|
CREATE TABLE t1(c1 VARCHAR(32),
|
|
c2 TEXT,
|
|
primary key(c1))
|
|
ENGINE = INNODB;
|
|
SET DEBUG = '-d, skip_sdi';
|
|
|
|
# Tables must exist before plugin can be started!
|
|
--let $memcached_address=127.0.0.1:11293
|
|
--source ../include/load_daemon_memcached_expecting_success.inc
|
|
|
|
# Create SDI Indexes in the tablespace
|
|
let MEMCACHED_TABLE_MAPPING = desc_t1;
|
|
|
|
# Clear the current SDI in table
|
|
--source ../include/sdi_drop_index.inc
|
|
--source ../include/sdi_create_index.inc
|
|
|
|
SET GLOBAL innodb_buf_flush_list_now = ON;
|
|
|
|
# Test with Empty SDI
|
|
--exec $IBD2SDI $IBD_FILE 2>&1
|
|
|
|
# Insert into SDI tables via memcached
|
|
--source ../include/create_ibd2sdi_data.inc
|
|
|
|
# Shutdown server
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
--source ../include/ibd2sdi_common.inc
|
|
|
|
# This should succeed with SDI pages
|
|
--exec $INNOCHECKSUM $IBD_FILE
|
|
|
|
--let restart_parameters=restart: --innodb_checksum_algorithm=innodb
|
|
--source include/start_mysqld.inc
|
|
--let $memcached_check_attempts=20
|
|
--let $memcached_expect=success
|
|
--source ../include/check_daemon_memcached.inc
|
|
|
|
INSERT INTO innodb_memcache.containers VALUES ('desc_t2', 'test', 't2',
|
|
'c1', 'c2', '0', '0', '0', 'PRIMARY');
|
|
|
|
--echo # test with innodb checksum
|
|
SET DEBUG = '+d, skip_sdi';
|
|
CREATE TABLE t2(c1 VARCHAR(32),
|
|
c2 TEXT,
|
|
primary key(c1)) ENGINE=INNODB;
|
|
SET DEBUG = '-d, skip_sdi';
|
|
|
|
# Insert into SDI tables via memcached
|
|
let MEMCACHED_TABLE_MAPPING = desc_t2;
|
|
--let IBD_FILE=$MYSQLD_DATADIR/test/t2.ibd
|
|
|
|
# Clear the current SDI in table
|
|
--source ../include/sdi_drop_index.inc
|
|
--source ../include/sdi_create_index.inc
|
|
|
|
--source ../include/create_ibd2sdi_data.inc
|
|
|
|
# Shutdown server
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
--exec $IBD2SDI --skip-pretty $IBD_FILE -c innodb 2>&1
|
|
|
|
--let restart_parameters=restart: --innodb_checksum_algorithm=none
|
|
--source include/start_mysqld.inc
|
|
--let $memcached_check_attempts=20
|
|
--let $memcached_expect=success
|
|
--source ../include/check_daemon_memcached.inc
|
|
--let restart_parameters=
|
|
SET DEBUG = '+d, skip_sdi';
|
|
DROP TABLE t2;
|
|
SET DEBUG = '-d, skip_sdi';
|
|
|
|
INSERT INTO innodb_memcache.containers VALUES ('desc_t3', 'test', 't3',
|
|
'c1', 'c2', '0', '0', '0', 'PRIMARY');
|
|
|
|
--echo # test with none checksum
|
|
SET DEBUG = '+d, skip_sdi';
|
|
CREATE TABLE t3(c1 VARCHAR(32),
|
|
c2 TEXT,
|
|
primary key(c1)) ENGINE=INNODB;
|
|
SET DEBUG = '-d, skip_sdi';
|
|
|
|
# Insert into SDI tables via memcached
|
|
let MEMCACHED_TABLE_MAPPING = desc_t3;
|
|
--let IBD_FILE=$MYSQLD_DATADIR/test/t3.ibd
|
|
|
|
# Clear the current SDI in table
|
|
--source ../include/sdi_drop_index.inc
|
|
--source ../include/sdi_create_index.inc
|
|
|
|
--source ../include/create_ibd2sdi_data.inc
|
|
|
|
# Shutdown server
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
--exec $IBD2SDI --skip-pretty $IBD_FILE --strict-check=none 2>&1
|
|
|
|
--let IBD_FILE=$MYSQLD_DATADIR/test/t1.ibd
|
|
|
|
--error 1
|
|
--exec $IBD2SDI --debug=d,ib_tmp_file_fail $IBD_FILE -d $MYSQL_TMP_DIR/out.txt 2>&1
|
|
--remove_files_wildcard $MYSQL_TMP_DIR/ ib_sdi*
|
|
|
|
## header contains version/platform information
|
|
--replace_result $IBD2SDI IBD2SDI
|
|
# see: Bug #29525890 REPLACE_REGEX DOLAR DOES NOT MATCH END OF LINE WITH EXEC
|
|
--replace_regex / Ver [0-9].*\n?$// /(Copyright \(c\)) [0-9]+, [0-9]+(.*)/\1 YEAR, YEAR\2/
|
|
--error 1
|
|
--exec $IBD2SDI 2>&1
|
|
--replace_regex /descriptor [0-9]*/descriptor X/
|
|
--error 1
|
|
--exec $IBD2SDI --debug=d,ib_seek_error $IBD_FILE 2>&1
|
|
|
|
--error 1
|
|
--exec $IBD2SDI --debug=d,ib_invalid_page $IBD_FILE 2>&1
|
|
|
|
--error 1
|
|
--exec $IBD2SDI --debug=d,ib_file_open_error $IBD_FILE 2>&1
|
|
|
|
--exec $IBD2SDI --skip-pretty --debug=d,ib_partial_page $IBD_FILE 2>&1
|
|
|
|
--error 1
|
|
--exec $IBD2SDI --debug=d,ib_no_sdi $IBD_FILE 2>&1
|
|
|
|
# searching non-existent id & type
|
|
--exec $IBD2SDI -t 2 -i 2 $IBD_FILE 2>&1
|
|
|
|
--echo # 18. Corrupt Root page numbers in Page 1
|
|
--echo # We should still see data because of the good
|
|
--echo # page numbers in Page 2
|
|
|
|
--copy_file $IBD_FILE $MYSQLD_DATADIR/test/t1.ibd.backup
|
|
--let IBD_CHAR = 0
|
|
--let IBD_PAGE_NO = 1
|
|
--let IBD_OFFSET = 26
|
|
--let IBD_CHAR_LEN= 8
|
|
--source include/corrupt_ibd2sdi.inc
|
|
|
|
--exec $IBD2SDI --skip-pretty $IBD_FILE 2>&1
|
|
|
|
# Restore original copy
|
|
--remove_file $IBD_FILE
|
|
--copy_file $MYSQLD_DATADIR/test/t1.ibd.backup $IBD_FILE
|
|
|
|
--echo # 19. Test with broken node-page link. The child page_no
|
|
--echo # will be zero. Use --no-checksum as the page is corrupted.
|
|
|
|
--let IBD_PAGE_NO = 3
|
|
# 137 = PAGE_NEW_INFIMUM(99) + next_rec_offset(27) + ID_LEN(8) +
|
|
# TYPE_LEN(4)
|
|
--let IBD_OFFSET = 137
|
|
--let IBD_CHAR_LEN= 4
|
|
--source include/corrupt_ibd2sdi.inc
|
|
|
|
--replace_regex /into file.*\./into file: FILENAME/
|
|
--error 1
|
|
--exec $IBD2SDI --skip-pretty -n $IBD_FILE 2>&1
|
|
|
|
# Restore original copy
|
|
--remove_file $IBD_FILE
|
|
--copy_file $MYSQLD_DATADIR/test/t1.ibd.backup $IBD_FILE
|
|
|
|
--echo # 20. Test with broken leaf-page link. The child page_no
|
|
--echo # will be zero. Use --no-checksum as the page is corrupted
|
|
# FIL_PAGE_NEXT = 12
|
|
|
|
--let IBD_CHAR = 0
|
|
--let IBD_PAGE_NO = 10
|
|
--let IBD_OFFSET = 12
|
|
--let IBD_CHAR_LEN= 4
|
|
--source include/corrupt_ibd2sdi.inc
|
|
|
|
--replace_regex /into file.*\./into file: FILENAME/
|
|
--error 1
|
|
--exec $IBD2SDI --skip-pretty -n $IBD_FILE 2>&1
|
|
|
|
--echo # Retrieve from .ibd file
|
|
--replace_regex /space=[0-9]*/space=X/
|
|
--error 1
|
|
--exec $IBD2SDI --skip-pretty $IBD_FILE 2>&1
|
|
|
|
# Restore original copy
|
|
--remove_file $IBD_FILE
|
|
--copy_file $MYSQLD_DATADIR/test/t1.ibd.backup $IBD_FILE
|
|
|
|
--echo # 21. Test with Leaf Page full of Zeros
|
|
--echo # Checksum will be valid. Skip checksum is not necessary
|
|
--let IBD_CHAR = 0
|
|
--let IBD_PAGE_NO = 10
|
|
--let IBD_OFFSET = 0
|
|
--let IBD_CHAR_LEN= $IBD_PAGE_SIZE
|
|
--source include/corrupt_ibd2sdi.inc
|
|
|
|
--replace_regex /into file.*\./into file: FILENAME/
|
|
--error 1
|
|
--exec $IBD2SDI --skip-pretty $IBD_FILE 2>&1
|
|
|
|
# Restore original copy
|
|
--remove_file $IBD_FILE
|
|
--copy_file $MYSQLD_DATADIR/test/t1.ibd.backup $IBD_FILE
|
|
|
|
--echo # 22. Test with Record corruption. User record pointing to
|
|
--echo # INFIMUM Causing INFINITE loops.
|
|
--let IBD_PAGE_NO = 10
|
|
--let IBD_OFFSET = 124
|
|
|
|
# On page at the rec (position 126, next rec will be read from
|
|
# position 124, We write offset such that it points to INFIMIUM
|
|
# which at 99th byte from page origin. So at 124th byte, we need to write
|
|
# (99-126) = -27 in big endian format at next_rec_offset position
|
|
# (i.e. at 124). In big endian, it would 0x10000-0x1b(27) = 65509
|
|
--let IBD_CHAR = 65509
|
|
--let IBD_CHAR_LEN= 2
|
|
--source include/corrupt_ibd2sdi.inc
|
|
|
|
--replace_regex /into file.*\./into file: FILENAME/
|
|
--error 1
|
|
--exec $IBD2SDI --skip-pretty $IBD_FILE -n -d $DUMP_FILE 2>&1
|
|
--cat_file $DUMP_FILE
|
|
|
|
# Restore original copy
|
|
--remove_file $IBD_FILE
|
|
--copy_file $MYSQLD_DATADIR/test/t1.ibd.backup $IBD_FILE
|
|
|
|
--echo # 23. Test with INFIMUM payload corruption. We should just
|
|
--echo # see a msg in error log but data retrieval should be OK
|
|
--let IBD_PAGE_NO = 10
|
|
--let IBD_CHAR = 0
|
|
--let IBD_OFFSET = 99
|
|
--let IBD_CHAR_LEN = 4
|
|
--source include/corrupt_ibd2sdi.inc
|
|
|
|
--exec $IBD2SDI --skip-pretty $IBD_FILE -n -d $DUMP_FILE 2>&1
|
|
--cat_file $DUMP_FILE
|
|
|
|
# Restore original copy
|
|
--remove_file $IBD_FILE
|
|
--copy_file $MYSQLD_DATADIR/test/t1.ibd.backup $IBD_FILE
|
|
|
|
--echo # 24. Test with SUPREMUM payload corruption. We should just
|
|
--echo # see a msg in error log but data retrieval should be OK
|
|
--let IBD_PAGE_NO = 7
|
|
--let IBD_CHAR = 0
|
|
--let IBD_OFFSET = 112
|
|
--let IBD_CHAR_LEN = 4
|
|
--source include/corrupt_ibd2sdi.inc
|
|
|
|
--exec $IBD2SDI --skip-pretty $IBD_FILE -n -d $DUMP_FILE 2>&1
|
|
--cat_file $DUMP_FILE
|
|
|
|
# Restore original copy
|
|
--remove_file $IBD_FILE
|
|
--copy_file $MYSQLD_DATADIR/test/t1.ibd.backup $IBD_FILE
|
|
|
|
--echo # 25. Test with SUPREMUM next-rec offset corruption. We should just
|
|
--echo # see a msg in error log but data retrieval should be OK
|
|
--let IBD_PAGE_NO = 6
|
|
--let IBD_CHAR = 20
|
|
--let IBD_CHAR_LEN = 2
|
|
--let IBD_OFFSET = 110
|
|
--source include/corrupt_ibd2sdi.inc
|
|
|
|
--exec $IBD2SDI --skip-pretty $IBD_FILE -n -d $DUMP_FILE 2>&1
|
|
--cat_file $DUMP_FILE
|
|
|
|
# Restore original copy
|
|
--remove_file $IBD_FILE
|
|
--copy_file $MYSQLD_DATADIR/test/t1.ibd.backup $IBD_FILE
|
|
|
|
--echo # 26. Test with SPACE FLAGS Corruption
|
|
--let IBD_PAGE_NO = "0"
|
|
--let IBD_CHAR = 512
|
|
--let IBD_CHAR_LEN = 4
|
|
--let IBD_OFFSET = 54
|
|
--source include/corrupt_ibd2sdi.inc
|
|
|
|
--exec $IBD2SDI --skip-pretty $IBD_FILE -n -d $DUMP_FILE 2>&1
|
|
--cat_file $DUMP_FILE
|
|
|
|
# Restore original copy
|
|
--remove_file $IBD_FILE
|
|
--copy_file $MYSQLD_DATADIR/test/t1.ibd.backup $IBD_FILE
|
|
|
|
--source include/start_mysqld.inc
|
|
--let $memcached_check_attempts=20
|
|
--let $memcached_expect=success
|
|
--source ../include/check_daemon_memcached.inc
|
|
|
|
# Clean up
|
|
SET DEBUG = '+d, skip_sdi';
|
|
DROP TABLE t1;
|
|
SET DEBUG = '-d, skip_sdi';
|
|
|
|
SET GLOBAL innodb_limit_optimistic_insert_debug = default;
|
|
--let SKIP_LARGE_DATA_FILE = > $MYSQLTEST_VARDIR/log/large_ibd2sdi.err
|
|
|
|
--echo # Case 2: Insert large SDI in uncompressed table
|
|
SET DEBUG = '+d, skip_sdi';
|
|
CREATE TABLE t1(c1 VARCHAR(32),
|
|
c2 TEXT,
|
|
primary key(c1))
|
|
ENGINE = INNODB;
|
|
SET DEBUG = '-d, skip_sdi';
|
|
|
|
let MEMCACHED_TABLE_MAPPING = desc_t1;
|
|
# Clear the current SDI in table
|
|
--source ../include/sdi_drop_index.inc
|
|
--source ../include/sdi_create_index.inc
|
|
|
|
# Insert into SDI tables via memcached
|
|
--source ../include/create_ibd2sdi_data_large.inc
|
|
|
|
# Shutdown server
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
--echo # Section I: Test options
|
|
--source ../include/ibd2sdi_common.inc
|
|
|
|
# Start server
|
|
--source include/start_mysqld.inc
|
|
--let $memcached_check_attempts=20
|
|
--let $memcached_expect=success
|
|
--source ../include/check_daemon_memcached.inc
|
|
|
|
SET DEBUG = '+d, skip_sdi';
|
|
DROP TABLE t1;
|
|
SET DEBUG = '-d, skip_sdi';
|
|
|
|
--echo # Case 3: Insert large SDI in compressed table
|
|
|
|
SET DEBUG = '+d, skip_sdi';
|
|
CREATE TABLE t1(c1 VARCHAR(32),
|
|
c2 TEXT,
|
|
primary key(c1))
|
|
ENGINE = INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
|
|
SET DEBUG = '-d, skip_sdi';
|
|
|
|
let MEMCACHED_TABLE_MAPPING = desc_t1;
|
|
# Clear the current SDI in table
|
|
--source ../include/sdi_drop_index.inc
|
|
--source ../include/sdi_create_index.inc
|
|
|
|
# Insert into SDI tables via memcached
|
|
--source ../include/create_ibd2sdi_data_large.inc
|
|
|
|
# Shutdown server
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
--echo # Section I: Test options
|
|
--source ../include/ibd2sdi_common.inc
|
|
|
|
# Start server
|
|
--source include/start_mysqld.inc
|
|
--let $memcached_check_attempts=20
|
|
--let $memcached_expect=success
|
|
--source ../include/check_daemon_memcached.inc
|
|
|
|
SET DEBUG = '+d, skip_sdi';
|
|
DROP TABLE t1;
|
|
SET DEBUG = '-d, skip_sdi';
|
|
|
|
--echo # Case 3: Insert large SDI in compressed table
|
|
|
|
SET DEBUG = '+d, skip_sdi';
|
|
CREATE TABLE t1(c1 VARCHAR(32),
|
|
c2 TEXT,
|
|
primary key(c1))
|
|
ENGINE = INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
|
|
SET DEBUG = '-d, skip_sdi';
|
|
|
|
let MEMCACHED_TABLE_MAPPING = desc_t1;
|
|
# Clear the current SDI in table
|
|
--source ../include/sdi_drop_index.inc
|
|
--source ../include/sdi_create_index.inc
|
|
|
|
# Insert into SDI tables via memcached
|
|
--source ../include/create_ibd2sdi_data_large.inc
|
|
|
|
# Shutdown server
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
--echo # Section I: Test options
|
|
--source ../include/ibd2sdi_common.inc
|
|
|
|
--replace_regex /space=[0-9]*/space=X/ /.*page_zip_decompress/page_zip_decompress/
|
|
--error 1
|
|
--exec $IBD2SDI --debug=d,ib_decompress_fail $IBD_FILE 2>&1
|
|
|
|
--exec $INNOCHECKSUM $IBD_FILE -D $MYSQL_TMP_DIR/out.txt
|
|
--remove_file $MYSQL_TMP_DIR/out.txt
|
|
|
|
# Start server
|
|
--source include/start_mysqld.inc
|
|
--let $memcached_check_attempts=20
|
|
--let $memcached_expect=success
|
|
--source ../include/check_daemon_memcached.inc
|
|
|
|
SET DEBUG = '+d, skip_sdi';
|
|
DROP TABLE t1;
|
|
SET DEBUG = '-d, skip_sdi';
|
|
|
|
--echo # Case 4: Insert large SDI in General Tablespace
|
|
|
|
--let IBD_FILE=$MYSQLD_DATADIR/ts1.ibd
|
|
SET DEBUG = '+d, skip_sdi';
|
|
CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd';
|
|
CREATE TABLE t1(c1 VARCHAR(32),
|
|
c2 TEXT,
|
|
primary key(c1))
|
|
ENGINE = INNODB TABLESPACE=ts1;
|
|
SET DEBUG = '-d, skip_sdi';
|
|
|
|
let MEMCACHED_TABLE_MAPPING = desc_t1;
|
|
# Clear the current SDI in table
|
|
--source ../include/sdi_drop_index.inc
|
|
--source ../include/sdi_create_index.inc
|
|
|
|
# Insert into SDI tables via memcached
|
|
--source ../include/create_ibd2sdi_data_large.inc
|
|
|
|
# Shutdown server
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
--echo # Section I: Test options
|
|
--source ../include/ibd2sdi_common.inc
|
|
|
|
# Start server
|
|
--source include/start_mysqld.inc
|
|
--let $memcached_check_attempts=20
|
|
--let $memcached_expect=success
|
|
--source ../include/check_daemon_memcached.inc
|
|
|
|
SET DEBUG = '+d, skip_sdi';
|
|
DROP TABLE t1;
|
|
DROP TABLESPACE ts1;
|
|
SET DEBUG = '-d, skip_sdi';
|
|
|
|
# Stop plugin befor innodb_memcached configuration
|
|
UNINSTALL PLUGIN daemon_memcached;
|
|
|
|
DROP DATABASE innodb_memcache;
|
|
SET GLOBAL transaction_isolation = default;
|
|
SET DEBUG = '+d, skip_sdi';
|
|
DROP TABLE t3;
|
|
SET DEBUG = '-d, skip_sdi';
|
|
--remove_file $DUMP_FILE
|
|
--remove_file $MYSQLTEST_VARDIR/log/large_ibd2sdi.err
|
|
--remove_file $MYSQLD_DATADIR/test/t1.ibd.backup
|