| 1 |
--echo # |
| 2 |
--echo # Test for IBD2SDI tool |
| 3 |
--echo # |
| 4 |
|
| 5 |
# Bug#20205934 - ENABLE VALGRIND FOR MEMCACHED TESTS |
| 6 |
source include/not_valgrind.inc; |
| 7 |
source include/have_memcached_plugin.inc; |
| 8 |
# Memcached SDI APIs are enabled only for debug version |
| 9 |
source include/have_debug.inc; |
| 10 |
|
| 11 |
# bootstrap with multi-file ibdata system tablespace |
| 12 |
# Set different paths for --datadir |
| 13 |
let $MYSQLD_DATADIR1 = $MYSQL_TMP_DIR/datadir1/data; |
| 14 |
|
| 15 |
let $MYSQLD_BASEDIR= `select @@basedir`; |
| 16 |
|
| 17 |
--disable_query_log |
| 18 |
CALL mtr.add_suppression("daemon-memcached-w-batch-size': unsigned"); |
| 19 |
CALL mtr.add_suppression("Could not obtain server's UPN to be used as target service name"); |
| 20 |
CALL mtr.add_suppression("Warning: MySQL is trying to drop"); |
| 21 |
# We wiped out entire SDI created by Server. This is to avoid server |
| 22 |
# SDI interference with memcached inserted SDI. So server complains |
| 23 |
# on missing SDI |
| 24 |
CALL mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* sdi_delete*"); |
| 25 |
--enable_query_log |
| 26 |
|
| 27 |
# Create custom datadir path |
| 28 |
--mkdir $MYSQL_TMP_DIR/datadir1 |
| 29 |
|
| 30 |
let BOOTSTRAP_SQL=$MYSQL_TMP_DIR/boot.sql; |
| 31 |
let $start_page_size=`SELECT variable_value FROM performance_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'`; |
| 32 |
# Create bootstrap file |
| 33 |
write_file $BOOTSTRAP_SQL; |
| 34 |
CREATE DATABASE test; |
| 35 |
EOF |
| 36 |
|
| 37 |
let NEW_CMD = $MYSQLD --no-defaults --innodb_dedicated_server=OFF --initialize-insecure --lc_messages_dir=$MYSQL_SHAREDIR --innodb_data_file_path="ibdata1:16M;ibdata2:20M:autoextend" --datadir=$MYSQLD_DATADIR1 --innodb_redo_log_capacity=30M --init-file=$BOOTSTRAP_SQL --innodb-page-size=$start_page_size </dev/null>>$MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1; |
| 38 |
|
| 39 |
# Run the bootstrap command |
| 40 |
--exec $NEW_CMD |
| 41 |
|
| 42 |
--remove_file $BOOTSTRAP_SQL |
| 43 |
|
| 44 |
# Start the DB server |
| 45 |
--replace_result $MYSQLD_DATADIR1 MYSQLD_DATADIR1 |
| 46 |
--let $restart_parameters="restart: --datadir=$MYSQLD_DATADIR1 --innodb_data_file_path='ibdata1:16M;ibdata2:20M:autoextend' --innodb_redo_log_capacity=30M" |
| 47 |
--source include/restart_mysqld.inc |
| 48 |
|
| 49 |
--disable_query_log |
| 50 |
source include/memcache_config.inc; |
| 51 |
--enable_query_log |
| 52 |
|
| 53 |
set global innodb_limit_optimistic_insert_debug = 2; |
| 54 |
|
| 55 |
INSERT INTO cache_policies VALUES('cache_policy', 'innodb_only', |
| 56 |
'innodb_only', 'innodb_only', 'innodb_only'); |
| 57 |
|
| 58 |
INSERT INTO config_options VALUES('separator', '|'); |
| 59 |
|
| 60 |
# describe table for memcache |
| 61 |
INSERT INTO containers VALUES ('desc_t1', 'test', 't1', |
| 62 |
'c1', 'c2', '0', '0', '0', 'PRIMARY'); |
| 63 |
|
| 64 |
USE test; |
| 65 |
--let MEMCACHED_PORT=11292 |
| 66 |
--let DUMP_FILE=$MYSQLTEST_VARDIR/log/ibd2sdi_out.txt |
| 67 |
--let IBD_FILE=$MYSQLD_DATADIR1/ibdata* |
| 68 |
--let IBD_PAGE_SIZE=`select @@innodb_page_size` |
| 69 |
|
| 70 |
--echo # ---------------------------------------------- |
| 71 |
--echo # Case 1: Insert small SDI in uncompressed table |
| 72 |
--echo # ---------------------------------------------- |
| 73 |
|
| 74 |
SET GLOBAL innodb_file_per_table=OFF; |
| 75 |
|
| 76 |
CREATE TABLE t1(c1 VARCHAR(32), |
| 77 |
c2 TEXT, |
| 78 |
primary key(c1)) |
| 79 |
ENGINE = INNODB; |
| 80 |
|
| 81 |
SET GLOBAL innodb_file_per_table=ON; |
| 82 |
CREATE TABLE t2(a INT) ENGINE = INNODB; |
| 83 |
SET GLOBAL innodb_file_per_table=OFF; |
| 84 |
|
| 85 |
# Tables must exist before plugin can be started! |
| 86 |
--let $memcached_address=127.0.0.1:11292 |
| 87 |
--source ../include/load_daemon_memcached_expecting_success.inc |
| 88 |
|
| 89 |
# Insert into SDI tables via memcached |
| 90 |
let MEMCACHED_TABLE_MAPPING = desc_t1; |
| 91 |
|
| 92 |
# Clear the current SDI in table |
| 93 |
--source ../include/sdi_drop_index.inc |
| 94 |
--source ../include/sdi_create_index.inc |
| 95 |
|
| 96 |
--source ../include/create_ibd2sdi_data.inc |
| 97 |
|
| 98 |
# Shutdown server |
| 99 |
--source include/shutdown_mysqld.inc |
| 100 |
|
| 101 |
--echo # check if ibdata* exist |
| 102 |
--file_exists $MYSQLD_DATADIR1/ibdata1 |
| 103 |
--file_exists $MYSQLD_DATADIR1/ibdata2 |
| 104 |
|
| 105 |
--echo # Section I: Test options |
| 106 |
--source ../include/ibd2sdi_common.inc |
| 107 |
|
| 108 |
--replace_result $MYSQLD_DATADIR1 MYSQLD_DATADIR1 |
| 109 |
--error 1 |
| 110 |
--exec $IBD2SDI $MYSQLD_DATADIR1/ibdata1 $MYSQLD_DATADIR1/ibdata1 2>&1 |
| 111 |
|
| 112 |
--replace_result $MYSQLD_DATADIR1 MYSQLD_DATADIR1 |
| 113 |
--error 1 |
| 114 |
--exec $IBD2SDI $MYSQLD_DATADIR1/ibdata1 $MYSQLD_DATADIR1/test/t2.ibd 2>&1 |
| 115 |
|
| 116 |
--replace_result $MYSQLD_DATADIR1 MYSQLD_DATADIR1 |
| 117 |
--source include/start_mysqld.inc |
| 118 |
|
| 119 |
--let $memcached_check_attempts=20 |
| 120 |
--let $memcached_expect=success |
| 121 |
--source ../include/check_daemon_memcached.inc |
| 122 |
|
| 123 |
DROP TABLE t2; |
| 124 |
|
| 125 |
SET GLOBAL innodb_limit_optimistic_insert_debug = default; |
| 126 |
--let SKIP_LARGE_DATA_FILE = > $MYSQLTEST_VARDIR/log/large_ibd2sdi.err |
| 127 |
--echo # ---------------------------------------------- |
| 128 |
--echo # Case 2: Insert large SDI in uncompressed table |
| 129 |
--echo # ---------------------------------------------- |
| 130 |
|
| 131 |
# Create table not required because SDI is common for all tables |
| 132 |
# in a tablespace |
| 133 |
|
| 134 |
# Clear the current SDI in table |
| 135 |
--source ../include/sdi_drop_index.inc |
| 136 |
--source ../include/sdi_create_index.inc |
| 137 |
|
| 138 |
# Insert into SDI tables via memcached |
| 139 |
--source ../include/create_ibd2sdi_data_large.inc |
| 140 |
|
| 141 |
# Shutdown server |
| 142 |
--source include/shutdown_mysqld.inc |
| 143 |
|
| 144 |
--echo # Section I: Test options |
| 145 |
--source ../include/ibd2sdi_common.inc |
| 146 |
|
| 147 |
--echo # |
| 148 |
--echo # Bug#23036141 - IBD2SDI DOESN'T WORK IF ANY DATAFILE IS SMALLER THAN PREVIOUS DATAFILE |
| 149 |
--echo # |
| 150 |
|
| 151 |
--force-rmdir $MYSQL_TMP_DIR/datadir1/ |
| 152 |
--mkdir $MYSQL_TMP_DIR/datadir1 |
| 153 |
|
| 154 |
# Create bootstrap file |
| 155 |
write_file $BOOTSTRAP_SQL; |
| 156 |
CREATE DATABASE test; |
| 157 |
EOF |
| 158 |
|
| 159 |
let $BOOTSTRAP_CMD = $MYSQLD --no-defaults --innodb_dedicated_server=OFF --initialize-insecure --lc_messages_dir=$MYSQL_SHAREDIR --innodb_data_file_path="ibdata1:16M;ibdata2:2M:autoextend" --datadir=$MYSQLD_DATADIR1 --innodb_redo_log_capacity=30M --init-file=$BOOTSTRAP_SQL --innodb-page-size=$start_page_size </dev/null>$MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1; |
| 160 |
|
| 161 |
# Run the bootstrap command |
| 162 |
--exec $BOOTSTRAP_CMD |
| 163 |
|
| 164 |
--remove_file $BOOTSTRAP_SQL |
| 165 |
|
| 166 |
# Start the DB server |
| 167 |
--replace_result $MYSQLD_DATADIR1 MYSQLD_DATADIR1 |
| 168 |
--let $restart_parameters="restart: --datadir=$MYSQLD_DATADIR1 --innodb_data_file_path='ibdata1:16M;ibdata2:2M:autoextend' --innodb_redo_log_capacity=30M" |
| 169 |
--source include/start_mysqld.inc |
| 170 |
|
| 171 |
--disable_query_log |
| 172 |
source include/memcache_config.inc; |
| 173 |
--enable_query_log |
| 174 |
|
| 175 |
INSERT INTO cache_policies VALUES('cache_policy', 'innodb_only', |
| 176 |
'innodb_only', 'innodb_only', 'innodb_only'); |
| 177 |
|
| 178 |
INSERT INTO config_options VALUES('separator', '|'); |
| 179 |
|
| 180 |
# describe table for memcache |
| 181 |
INSERT INTO containers VALUES ('desc_t1', 'test', 't1', |
| 182 |
'c1', 'c2', '0', '0', '0', 'PRIMARY'); |
| 183 |
|
| 184 |
SET GLOBAL innodb_file_per_table=OFF; |
| 185 |
USE test; |
| 186 |
CREATE TABLE t1(c1 VARCHAR(32), |
| 187 |
c2 TEXT, |
| 188 |
primary key(c1)) |
| 189 |
ENGINE = INNODB; |
| 190 |
|
| 191 |
# Tables must exist before plugin can be started! |
| 192 |
--let $memcached_address=127.0.0.1:11292 |
| 193 |
--source ../include/load_daemon_memcached_expecting_success.inc |
| 194 |
|
| 195 |
# Clear the current SDI in table |
| 196 |
--source ../include/sdi_drop_index.inc |
| 197 |
--source ../include/sdi_create_index.inc |
| 198 |
|
| 199 |
--source ../include/create_ibd2sdi_data_large.inc |
| 200 |
|
| 201 |
# Shutdown server |
| 202 |
--source include/shutdown_mysqld.inc |
| 203 |
|
| 204 |
--echo # Section I: Test options |
| 205 |
--source ../include/ibd2sdi_common.inc |
| 206 |
|
| 207 |
--remove_file $DUMP_FILE |
| 208 |
--remove_file $MYSQLTEST_VARDIR/log/large_ibd2sdi.err |
| 209 |
let $restart_parameters=; |
| 210 |
--source include/start_mysqld.inc |
| 211 |
--force-rmdir $MYSQL_TMP_DIR/datadir1/ |