mirror of
https://github.com/MariaDB/server.git
synced 2025-02-09 23:24:11 +01:00
![MikkoJaakola](/assets/img/avatar_default.png)
The galera.galera_parallel_autoinc_manytrx mtr test opens and runs test scenario through 3 connections to node 1 and one connection to node 2. In the test initialization phase, the test creates two tables 't1' and 'ten' and then creates a stored procedure 'p1' to operate on these tables. These 3 create DDL statements are issued through same connection to node 1. In the next test phase, the mtr script uses send command to launch the call for the p1 stored procedure through all 3 connections to node 1 and through one connection to node 2. As the mtr send command is asynchronous, this test phase is non blocking and fast operation. Now, if the replication between nodes is slow, it may happen that the initialization phase DDL statements have not been received or have not been fully applied in node 2. Therefore there is no guarantee that the test tables and the stored procedure have been created in node 2. Yet, the test is trying to call p1 in node 2. In the failure case error logs, there is error message "MTR failed: query 'reap' failed: 1305: PROCEDURE test.p1 does not exist" The reap command through connection to node 2, is the first place where test execution may observe that test tables and/or stored procedure are not yet created in node 2. The fix in this commit adds a wait condition in connection to node 2, to wait until the stored procedure is created before calling the stored procedure. The wait is implemented by looking in information_schema.routines for the p1 stored procedure.
95 lines
2.2 KiB
Text
95 lines
2.2 KiB
Text
##
|
|
## Tests the parallel application of many small-ish auto-increment insert transactions
|
|
##
|
|
|
|
--source include/galera_cluster.inc
|
|
--source include/have_innodb.inc
|
|
--source include/big_test.inc
|
|
--source include/force_restart.inc
|
|
|
|
--connection node_1
|
|
CREATE TABLE ten (f1 INTEGER) Engine=InnoDB;
|
|
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
|
|
|
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
|
|
|
|
# Create few connections to node1 so that we can run transactions concurrently
|
|
--let $galera_connection_name = node_1a
|
|
--let $galera_server_number = 1
|
|
--source include/galera_connect.inc
|
|
|
|
--let $galera_connection_name = node_1b
|
|
--let $galera_server_number = 1
|
|
--source include/galera_connect.inc
|
|
|
|
--connection node_2
|
|
set session wsrep_sync_wait=15;
|
|
--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads`
|
|
|
|
SET GLOBAL wsrep_slave_threads = 4;
|
|
--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
|
--source include/wait_condition.inc
|
|
|
|
--connection node_1
|
|
DELIMITER |;
|
|
CREATE PROCEDURE p1 (repeat_count int)
|
|
BEGIN
|
|
DECLARE current_num int;
|
|
SET current_num = 0;
|
|
WHILE current_num < repeat_count do
|
|
INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1;
|
|
COMMIT;
|
|
SET current_num = current_num + 1;
|
|
END WHILE;
|
|
END|
|
|
DELIMITER ;|
|
|
|
|
--disable_query_log
|
|
send call p1(1000);
|
|
|
|
--connection node_1a
|
|
--disable_query_log
|
|
send call p1(1000);
|
|
|
|
--connection node_1b
|
|
--disable_query_log
|
|
send call p1(1000);
|
|
|
|
--connection node_2
|
|
--disable_query_log
|
|
--let $wait_condition = select count(*)=1 from information_schema.routines WHERE routine_name='p1';
|
|
--source include/wait_condition.inc
|
|
send call p1(1000);
|
|
|
|
--connection node_1
|
|
reap;
|
|
--enable_query_log
|
|
|
|
--connection node_1a
|
|
reap;
|
|
--enable_query_log
|
|
|
|
--connection node_1b
|
|
reap;
|
|
--enable_query_log
|
|
|
|
--connection node_2
|
|
reap;
|
|
--enable_query_log
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
SELECT COUNT(DISTINCT f1) FROM t1;
|
|
|
|
--disconnect node_1a
|
|
--disconnect node_1b
|
|
|
|
--disable_query_log
|
|
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
|
|
--enable_query_log
|
|
|
|
--connection default
|
|
DROP TABLE t1;
|
|
DROP TABLE ten;
|
|
DROP PROCEDURE p1;
|
|
|
|
|