Skip to content
Permalink
Browse files
Write information about restart in .result
Idea comes from MySQL which does something similar
  • Loading branch information
montywi committed Apr 1, 2019
1 parent 6fd7a4b commit b5615ef
Show file tree
Hide file tree
Showing 231 changed files with 537 additions and 45 deletions.
@@ -1,13 +1,37 @@
# Include this script only after using shutdown_mysqld.inc
# where $_expect_file_name was initialized.
# Write file to make mysql-test-run.pl start up the server again

# restart_noprint defines how much is printed to the .result file
# if 0 (default) then '# result' and restart_parameters are printed
# if 1 then print #result but not the content of restart_parameters
# if 2 then nothing is printed

if (!$restart_noprint)
{
--let $restart_noprint=0
}

if ($restart_parameters)
{
--exec echo "restart: $restart_parameters" > $_expect_file_name
if (!$restart_noprint)
{
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec echo "# restart: $restart_parameters"
}
if ($restart_noprint == 1)
{
--exec echo "# restart: with restart_parameters"
}
}
if (!$restart_parameters)
{
--exec echo "restart" > $_expect_file_name
if ($restart_noprint < 2)
{
--exec echo "# restart"
}
}

# Turn on reconnect
@@ -18,4 +42,3 @@ if (!$restart_parameters)

# Turn off reconnect again
--disable_reconnect

@@ -1,10 +1,13 @@
drop table if exists t1;
# Kill the server
# restart
drop table t1;
# Kill the server
# restart
drop table t1;
ERROR 42S02: Unknown table 'test.t1'
# Kill the server
# restart
drop table t1;
End of 5.1 tests
#
@@ -15,8 +18,10 @@ SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb'
and SUPPORT='YES';

# Kill the server
# restart
End of 5.5 tests
# Kill the server
# restart
flush tables;
show create table t1;
Table Create Table
@@ -29,3 +34,4 @@ name dl
EXAMPLE ha_example.so
truncate table mysql.plugin;
# Kill the server
# restart
@@ -15,6 +15,7 @@ insert into event_like select * from mysql.event;
alter table mysql.event
change column body body longtext character set utf8 collate utf8_bin;
"Now we restart the server"
# restart
use events_test;
select @@event_scheduler;
@@event_scheduler
@@ -75,6 +76,7 @@ events_test abc1 root@localhost SYSTEM RECURRING # 1 SECOND # # ENABLED 1 latin1
events_test abc2 root@localhost SYSTEM RECURRING # 1 SECOND # # ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
events_test abc3 root@localhost SYSTEM RECURRING # 1 SECOND # # ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
Now let's restart the server again
# restart
use events_test;
select @@event_scheduler;
@@event_scheduler
@@ -95,6 +97,7 @@ SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
test e1 root@localhost SYSTEM RECURRING # 1 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
"Now we restart the server"
# restart
USE test;
SELECT @@event_scheduler;
@@event_scheduler
@@ -1,4 +1,5 @@
# Kill the server
# restart: --ssl-key=MYSQLTEST_VARDIR/tmp/ssl_key.pem --ssl-cert=MYSQLTEST_VARDIR/tmp/ssl_cert.pem
connect ssl_con,localhost,root,,,,,SSL;
SELECT VARIABLE_VALUE INTO @ssl_not_after FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after';
# Use a different certificate ("Not after" certificate field changed)
@@ -24,3 +25,4 @@ SSL_ACCEPTS 0
SSL_FINISHED_ACCEPTS 0
# Cleanup
# Kill the server
# restart
@@ -5,9 +5,11 @@ Setting root password
Creating my.ini file
Creation of the database was successful
# Kill the server
# restart: --datadir=MYSQLTEST_VARDIR/tmp/ddir --loose-innodb
connect root,localhost,root,foo;
SELECT @@datadir;
@@datadir
DATADIR/
# Kill the server
connection default;
# restart
@@ -581,6 +581,7 @@ GRANT USAGE ON *.* TO 'user3'@'%';
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
alter table mysql.user drop column Delete_history_priv;
alter table mysql.db drop column Delete_history_priv;
# restart
Run mysql_upgrade with all privileges on a user
flush privileges;
SHOW GRANTS FOR 'user3'@'%';
@@ -292,6 +292,7 @@ DROP DATABASE shared;
CALL mtr.add_suppression("Missing system table mysql.proxies_priv.");
DROP TABLE mysql.proxies_priv;
# Must come back with mysql.proxies_priv absent.
# restart
SELECT * FROM mysql.proxies_priv;
ERROR 42S02: Table 'mysql.proxies_priv' doesn't exist
CREATE USER u1@localhost;
@@ -3,6 +3,7 @@ create table t1(a int) engine=example;
drop table t1;
alter table mysql.plugin engine=innodb;
restart
# restart
create table t1(a int) engine=example;
select * from t1;
a
@@ -31,6 +31,7 @@ Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'foo'
EXECUTE stmt;
ERROR 22007: Truncated incorrect DOUBLE value: 'foo'
# restart
SELECT 'All done';
All done
All done
@@ -111,3 +111,4 @@ CREATE USER for baz@baz
CREATE USER 'baz'@'baz' IDENTIFIED BY PASSWORD '*E52096EF8EB0240275A7FE9E069101C33F98CF07'
drop user bar@foo;
drop user baz@baz;
# restart
@@ -56,6 +56,7 @@ grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA";
Variable_name Value
Ssl_cipher AES256-SHA
drop user mysqltest_1@localhost;
# restart: --ssl-cipher=AES128-SHA
connect ssl_con,localhost,root,,,,,SSL;
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
@@ -27,6 +27,7 @@ FOUND 3 /was in the XA prepared state/ in mysqld.1.err
FOUND 1 /Found 1 prepared transactions!/ in mysqld.1.err
FOUND 2 /\[ERROR\] Can\'t init tc log/ in mysqld.1.err
FOUND 2 /Please restart mysqld without --tc-heuristic-recover/ in mysqld.1.err
# restart
FOUND 3 /was in the XA prepared state/ in mysqld.1.err
FOUND 1 /Found 1 prepared transactions!/ in mysqld.1.err
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
@@ -2,5 +2,6 @@ create function udf_sequence returns integer soname "UDF_EXAMPLE_LIB";
create table t1 (n int key not null auto_increment, msg int as (udf_sequence()) virtual);
select * from t1;
n msg
# restart
drop table t1;
drop function udf_sequence;
@@ -145,6 +145,7 @@ master-bin.000009
master-bin.000010
master-bin.000011

# restart
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
@@ -171,6 +172,7 @@ master-bin.000010
master-bin.000011
master-bin.000012

# restart
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
@@ -145,6 +145,7 @@ master-bin.000009
master-bin.000010
master-bin.000011

# restart
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
@@ -171,6 +172,7 @@ master-bin.000010
master-bin.000011
master-bin.000012

# restart
SET @index=LOAD_FILE('MYSQLTEST_VARDIR/mysqld.1/data//master-bin.index');
SELECT @index;
@index
@@ -24,3 +24,4 @@ SET GLOBAL innodb_encryption_threads = 4;
# Success!
SET GLOBAL innodb_encryption_threads = 0;
SET GLOBAL innodb_encrypt_tables = OFF;
# restart
@@ -18,6 +18,7 @@ SET GLOBAL debug_dbug = '+d,ib_log';
SET GLOBAL innodb_log_checkpoint_now = 1;
SET GLOBAL innodb_flush_log_at_trx_commit = 1;
INSERT INTO t1 VALUES(NULL);
# restart
set global innodb_encrypt_tables=OFF;
set global debug_key_management_version=1;
select * from t1;
@@ -27,6 +27,7 @@ NOT FOUND /tempsecret/ in t2.ibd
FOUND 12 /dummysecret/ in t3.ibd
# ibdata1 expecting NOT FOUND
NOT FOUND /foobarsecret/ in ibdata1
# restart
# Now turn off encryption and wait for threads to decrypt everything
SET GLOBAL innodb_encrypt_tables = off;
# Wait max 10 min for key encryption threads to decrypt all spaces
@@ -49,6 +50,7 @@ FOUND 12 /tempsecret/ in t2.ibd
FOUND 12 /dummysecret/ in t3.ibd
# ibdata1 expecting NOT FOUND
NOT FOUND /foobarsecret/ in ibdata1
# restart
# Now turn on encryption and wait for threads to encrypt all spaces
SET GLOBAL innodb_encrypt_tables = on;
# Wait max 10 min for key encryption threads to encrypt all spaces
@@ -71,4 +73,5 @@ NOT FOUND /tempsecret/ in t2.ibd
FOUND 12 /dummysecret/ in t3.ibd
# ibdata1 expecting NOT FOUND
NOT FOUND /foobarsecret/ in ibdata1
# restart
drop table t1, t2, t3;
@@ -35,4 +35,5 @@ CREATE TABLE t6 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
# Run innochecksum on t3
# Run innochecksum on t6
# Restore the original tables
# restart
DROP TABLE t1, t2, t3, t4, t5, t6;
@@ -6,6 +6,7 @@ call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1");
call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found");
# Start server with keys2.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
SET GLOBAL innodb_file_per_table = ON;
CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2;
INSERT INTO t1 VALUES ('foobar');
@@ -27,17 +28,21 @@ foobar 1
foobar 2

# Restart server with keysbad3.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keysbad3.txt
SELECT * FROM t1;
ERROR 42S02: Table 'test.t1' doesn't exist in engine
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keysbad3.txt
DROP TABLE t1;
Warnings:
Warning 192 Table test/t1 in file ./test/t1.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
# Start server with keys3.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys3.txt
SET GLOBAL innodb_default_encryption_key_id=5;
CREATE TABLE t2 (c VARCHAR(8), id int not null primary key, b int, key(b)) ENGINE=InnoDB ENCRYPTED=YES;
INSERT INTO t2 VALUES ('foobar',1,2);

# Restart server with keys2.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
SELECT * FROM t2;
ERROR 42S02: Table 'test.t2' doesn't exist in engine
SELECT * FROM t2 where id = 1;
@@ -67,3 +72,4 @@ ERROR 42S02: Table 'test.t2' doesn't exist in engine
DROP TABLE t2;

# Start server with keys2.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
@@ -3,10 +3,12 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page n
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
call mtr.add_suppression("InnoDB: Tablespace for table \`test\`.\`t1\` is set as discarded\\.");
# restart: --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
SET GLOBAL innodb_file_per_table = ON;
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB
ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
# restart: --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys3.txt
SELECT * FROM t1;
ERROR 42S02: Table 'test.t1' doesn't exist in engine
SHOW WARNINGS;
@@ -30,16 +32,19 @@ test.t1 check Error Table 'test.t1' doesn't exist in engine
test.t1 check status Operation failed
SHOW WARNINGS;
Level Code Message
# restart: --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
# restart: --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys3.txt
ALTER TABLE t1 DISCARD TABLESPACE;
ERROR 42S02: Table 'test.t1' doesn't exist in engine
DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB
ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
ALTER TABLE t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
# restart: --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
ALTER TABLE t1 IMPORT TABLESPACE;
Warnings:
Warning 1814 Tablespace has been discarded for table `t1`
@@ -50,6 +55,7 @@ t1 CREATE TABLE `t1` (
`f` varchar(8) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTED`=YES `ENCRYPTION_KEY_ID`=4
# restart: --innodb-encrypt-tables --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys3.txt
RENAME TABLE t1 TO t1new;
ERROR HY000: Error on rename of './test/t1' to './test/t1new' (errno: 155 "The table does not exist in the storage engine")
ALTER TABLE t1 RENAME TO t1new;
@@ -22,6 +22,7 @@ backup: t1
UNLOCK TABLES;
ALTER TABLE t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
# restart
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW CREATE TABLE t1;
@@ -2,10 +2,12 @@ call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root pa
call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t1\\.ibd' cannot be decrypted\\.");
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
# restart: --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
SET GLOBAL innodb_file_per_table = ON;
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB
ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
# restart: --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys3.txt
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize Warning Table test/t1 in file ./test/t1.ibd is encrypted but encryption service or used key_id is not available. Can't continue reading table.
@@ -19,4 +21,5 @@ test.t1 check Error Table 'test.t1' doesn't exist in engine
test.t1 check status Operation failed
SHOW WARNINGS;
Level Code Message
# restart: --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
DROP TABLE t1;
@@ -2,6 +2,7 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page n
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
call mtr.add_suppression("InnoDB: Unable to decompress ..test.t[1-3]\\.ibd\\[page id: space=[1-9][0-9]*, page number=[0-9]+\\]");
# Restart mysqld --file-key-management-filename=keys2.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
SET GLOBAL innodb_file_per_table = ON;
set GLOBAL innodb_default_encryption_key_id=4;
create table t1(a int not null primary key, b blob, index(b(10))) engine=innodb row_format=compressed;
@@ -13,6 +14,7 @@ insert into t1 values (1, repeat('secret',6000));
insert into t2 values (1, repeat('secret',6000));
insert into t3 values (1, repeat('secret',6000));
# Restart mysqld --file-key-management-filename=keys3.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys3.txt
select count(*) from t1 FORCE INDEX (b) where b like 'secret%';
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
select count(*) from t2 FORCE INDEX (b) where b like 'secret%';
@@ -21,4 +23,5 @@ select count(*) from t3 FORCE INDEX (b) where b like 'secret%';
count(*)
1
# Restart mysqld --file-key-management-filename=keys2.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
drop table t1,t2,t3;
@@ -96,6 +96,7 @@ connection default;
SET DEBUG_SYNC = 'now WAIT_FOR done';
SET GLOBAL innodb_flush_log_at_trx_commit=1;
COMMIT;
# restart
disconnect con1;
select * from t1;
f1 f2

0 comments on commit b5615ef

Please sign in to comment.