mirror of
https://github.com/MariaDB/server.git
synced 2025-07-20 10:18:13 +02:00

Remove one of the major sources of race condiitons in mariadb-test. Normally, mariadb_close() sends COM_QUIT to the server and immediately disconnects. In mariadb-test it means the test can switch to another connection and sends queries to the server before the server even started parsing the COM_QUIT packet and these queries can see the connection as fully active, as it didn't reach dispatch_command yet. This is a major source of instability in tests and many - but not all, still less than a half - tests employ workarounds. The correct one is a pair count_sessions.inc/wait_until_count_sessions.inc. Also very popular was wait_until_disconnected.inc, which was completely useless, because it verifies that the connection is closed, and after disconnect it always is, it didn't verify whether the server processed COM_QUIT. Sadly the placebo was as widely used as the real thing. Let's fix this by making mariadb-test `disconnect` command _to wait_ for the server to confirm. This makes almost all workarounds redundant. In some cases count_sessions.inc/wait_until_count_sessions.inc is still needed, though, as only `disconnect` command is changed: * after external tools, like `exec $MYSQL` * after failed `connect` command * replication, after `STOP SLAVE` * Federated/CONNECT/SPIDER/etc after `DROP TABLE` and also in some XA tests, because an XA transaction is dissociated from the THD very late, after the server has closed the client connection. Collateral cleanups: fix comments, remove some redundant statements: * DROP IF EXISTS if nothing is known to exist * DROP table/view before DROP DATABASE * REVOKE privileges before DROP USER etc
76 lines
2.8 KiB
Text
76 lines
2.8 KiB
Text
--source include/have_innodb.inc
|
|
--source include/have_file_key_management_plugin.inc
|
|
|
|
SET @save_threads = @@GLOBAL.innodb_encryption_threads;
|
|
|
|
SET default_storage_engine = InnoDB;
|
|
|
|
#
|
|
# MDEV-8173: InnoDB; Failing assertion: crypt_data->type == 1
|
|
#
|
|
|
|
SET GLOBAL innodb_encryption_threads = 4;
|
|
|
|
CREATE TABLE `table10_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;
|
|
INSERT /*! IGNORE */ INTO table10_int_autoinc VALUES (NULL, NULL, -474021888) , (1, NULL, NULL) , (1141047296, NULL, NULL) , (NULL, NULL, NULL) , (NULL, NULL, 1) , (NULL, NULL, 9) , (0, NULL, 1225785344) , (NULL, NULL, 1574174720) , (2, NULL, NULL) , (6, NULL, 3);
|
|
|
|
CREATE TABLE `table1_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int,key (`col_int_key` ), primary key (pk)) engine=innodb;
|
|
|
|
CREATE TABLE `table0_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;
|
|
|
|
INSERT /*! IGNORE */ INTO table1_int_autoinc VALUES (4, NULL, NULL);
|
|
INSERT IGNORE INTO `table0_int_autoinc` ( `col_int_key` ) VALUES ( 1 ), ( 3 ), ( 4 ), ( 1 );
|
|
INSERT IGNORE INTO `table1_int_autoinc` ( `col_int` ) VALUES ( 1 ), ( 0 ), ( 7 ), ( 9 );
|
|
INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3 ), ( 6 );
|
|
|
|
--connect (con1,localhost,root,,test)
|
|
--connect (con2,localhost,root,,test)
|
|
|
|
--disable_query_log
|
|
|
|
let $i = 100;
|
|
while ($i)
|
|
{
|
|
connection con1;
|
|
send SET GLOBAL innodb_encrypt_tables = ON;
|
|
connection default;
|
|
CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`;
|
|
connection con2;
|
|
send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table10_int_autoinc`;
|
|
connection default;
|
|
send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table0_int_autoinc`;
|
|
connection con1;
|
|
--reap;
|
|
send SET GLOBAL innodb_encrypt_tables = OFF;
|
|
connection con2;
|
|
--reap;
|
|
connection default;
|
|
--reap;
|
|
send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`;
|
|
connection con2;
|
|
send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table10_int_autoinc`;
|
|
connection con1;
|
|
--reap;
|
|
send SET GLOBAL innodb_encrypt_tables = ON;
|
|
connection default;
|
|
--reap;
|
|
send CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table1_int_autoinc`;
|
|
connection con2;
|
|
--reap;
|
|
CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table10_int_autoinc`;
|
|
CREATE OR REPLACE TABLE `create_or_replace_t` AS SELECT * FROM `table0_int_autoinc`;
|
|
connection con1;
|
|
--reap;
|
|
connection default;
|
|
--reap;
|
|
dec $i;
|
|
}
|
|
|
|
--enable_query_log
|
|
disconnect con1;
|
|
disconnect con2;
|
|
connection default;
|
|
drop table create_or_replace_t, table1_int_autoinc, table0_int_autoinc,
|
|
table10_int_autoinc;
|
|
|
|
SET GLOBAL innodb_encryption_threads = @save_threads;
|