1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489
|
--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 before 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
|