| 1 |
# Bug#20205934 - ENABLE VALGRIND FOR MEMCACHED TESTS |
| 2 |
source include/not_valgrind.inc; |
| 3 |
source include/have_memcached_plugin.inc; |
| 4 |
# Memcached SDI APIs are enabled only for debug version |
| 5 |
source include/have_debug.inc; |
| 6 |
|
| 7 |
--disable_query_log |
| 8 |
CALL mtr.add_suppression("daemon-memcached-w-batch-size': unsigned"); |
| 9 |
CALL mtr.add_suppression("Could not obtain server's UPN to be used as target service name"); |
| 10 |
CALL mtr.add_suppression("Warning: MySQL is trying to drop"); |
| 11 |
# Create the memcached tables |
| 12 |
source include/memcache_config.inc; |
| 13 |
--enable_query_log |
| 14 |
|
| 15 |
INSERT INTO cache_policies VALUES('cache_policy', 'innodb_only', |
| 16 |
'innodb_only', 'innodb_only', 'innodb_only'); |
| 17 |
|
| 18 |
INSERT INTO config_options VALUES('separator', '|'); |
| 19 |
|
| 20 |
# describe table for memcache |
| 21 |
INSERT INTO containers VALUES ('desc_t1', 'test', 't1', |
| 22 |
'c1', 'c2', '0', '0', '0', 'PRIMARY'); |
| 23 |
|
| 24 |
USE test; |
| 25 |
let MEMCACHED_PORT=11287; |
| 26 |
let MYSQLD_DATADIR=`select @@datadir`; |
| 27 |
let INNODB_PAGE_SIZE=`select @@innodb_page_size`; |
| 28 |
|
| 29 |
CREATE TABLE t1 (c1 INT PRIMARY KEY, |
| 30 |
c2 VARCHAR(30), |
| 31 |
c3 FLOAT, |
| 32 |
KEY idx1(c3), |
| 33 |
KEY idx2(c2(20))) |
| 34 |
ENGINE = INNODB; |
| 35 |
|
| 36 |
# Tables must exist before plugin can be started! |
| 37 |
--let $memcached_address=127.0.0.1:11287 |
| 38 |
--source ../include/load_daemon_memcached_expecting_success.inc |
| 39 |
|
| 40 |
--echo # 1. Corrupt SDI Leaf Page |
| 41 |
let SDI_PAGE_NUM = 22; |
| 42 |
--source ../include/sdi_corrupt_table.inc |
| 43 |
|
| 44 |
# TRUNCATE will not re-create SDI indexes for now. So drop+create table |
| 45 |
DROP TABLE t1; |
| 46 |
CREATE TABLE t1 (c1 INT PRIMARY KEY, |
| 47 |
c2 VARCHAR(30), |
| 48 |
c3 FLOAT, |
| 49 |
KEY idx1(c3), |
| 50 |
KEY idx2(c2(20))) |
| 51 |
ENGINE = INNODB; |
| 52 |
|
| 53 |
--echo # 2. Corrupt SDI Non-Leaf Page |
| 54 |
let SDI_PAGE_NUM = 21; |
| 55 |
--source ../include/sdi_corrupt_table.inc |
| 56 |
|
| 57 |
# TRUNCATE will not re-create SDI indexes for now. So drop+create table |
| 58 |
DROP TABLE t1; |
| 59 |
CREATE TABLE t1 (c1 INT PRIMARY KEY, |
| 60 |
c2 VARCHAR(30), |
| 61 |
c3 FLOAT, |
| 62 |
KEY idx1(c3), |
| 63 |
KEY idx2(c2(20))) |
| 64 |
ENGINE = INNODB; |
| 65 |
|
| 66 |
--echo # 3. Corrupt SDI Root Page. We cannot drop and create SDI Indexes |
| 67 |
--echo # We expect crash when dropping SDI indexes. |
| 68 |
SET GLOBAL innodb_limit_optimistic_insert_debug = 2; |
| 69 |
|
| 70 |
let TABLE_NAME = t1; |
| 71 |
let MEMCACHED_TABLE_MAPPING = desc_t1; |
| 72 |
--source ../include/sdi_insert_get_row.inc |
| 73 |
|
| 74 |
let SDI_PAGE_NUM = 3; |
| 75 |
|
| 76 |
--source include/shutdown_mysqld.inc |
| 77 |
perl; |
| 78 |
my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd"; |
| 79 |
open(FILE, "+<", $fname) or die; |
| 80 |
binmode FILE; |
| 81 |
seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * $ENV{'SDI_PAGE_NUM'}, SEEK_SET); |
| 82 |
print FILE chr(0) x 4; |
| 83 |
close FILE; |
| 84 |
EOF |
| 85 |
|
| 86 |
let SEARCH_FILE = $MYSQLTEST_VARDIR/tmp/crash.log; |
| 87 |
|
| 88 |
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR |
| 89 |
let $restart_parameters = restart: --log-error=$MYSQLTEST_VARDIR/tmp/crash.log --innodb_buffer_pool_load_at_startup=OFF; |
| 90 |
--source include/start_mysqld.inc |
| 91 |
|
| 92 |
--let $memcached_check_attempts=20 |
| 93 |
--let $memcached_expect=success |
| 94 |
--source ../include/check_daemon_memcached.inc |
| 95 |
|
| 96 |
# Write file to make mysql-test-run.pl expect the "crash", but don't |
| 97 |
# start it until it's told to |
| 98 |
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 99 |
|
| 100 |
--source ../include/sdi_drop_index.inc |
| 101 |
|
| 102 |
--source include/wait_until_disconnected.inc |
| 103 |
|
| 104 |
let $restart_parameters = restart: --innodb_buffer_pool_load_at_startup=OFF; |
| 105 |
--source include/start_mysqld.inc |
| 106 |
|
| 107 |
--let $memcached_check_attempts=20 |
| 108 |
--let $memcached_expect=success |
| 109 |
--source ../include/check_daemon_memcached.inc |
| 110 |
|
| 111 |
let SEARCH_PATTERN = Unable to read page \\[page id: space=\d+, page number=\d+\\] into the buffer pool after \d+ attempts; |
| 112 |
--source include/search_pattern.inc |
| 113 |
|
| 114 |
# Do not use memcached commands (below) on table t1 because we corrupted root |
| 115 |
# page of SDI Index. Re-create the table before using memcached SDI |
| 116 |
# commands on table t1. |
| 117 |
|
| 118 |
DROP TABLE t1; |
| 119 |
DROP DATABASE innodb_memcache; |
| 120 |
# Stop plugin before innodb_memcached configuration |
| 121 |
UNINSTALL PLUGIN daemon_memcached; |
| 122 |
--remove_file $SEARCH_FILE |