summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/galera/t/galera_concurrent_ctas.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:24:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:24:36 +0000
commit06eaf7232e9a920468c0f8d74dcf2fe8b555501c (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/galera/t/galera_concurrent_ctas.test
parentInitial commit. (diff)
downloadmariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.tar.xz
mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/galera/t/galera_concurrent_ctas.test')
-rw-r--r--mysql-test/suite/galera/t/galera_concurrent_ctas.test86
1 files changed, 86 insertions, 0 deletions
diff --git a/mysql-test/suite/galera/t/galera_concurrent_ctas.test b/mysql-test/suite/galera/t/galera_concurrent_ctas.test
new file mode 100644
index 00000000..e22ac811
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_concurrent_ctas.test
@@ -0,0 +1,86 @@
+--source include/galera_cluster.inc
+--source include/big_test.inc
+--source include/have_debug_sync.inc
+
+#
+# To have real concurrent CTAS this test uses DEBUG_SYNC
+#
+
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+
+--connection node_1
+#
+# Send CTAS it will block before open_tables call
+#
+SET DEBUG_SYNC = 'wsrep_create_table_as_select WAIT_FOR continue';
+--send CREATE table t1 as SELECT SLEEP(0.1);
+
+--connection node_1a
+#
+# Wait for CTAS to block
+#
+--echo # Wait until CTAS is on debug sync point
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: wsrep_create_table_as_select'
+--source include/wait_condition.inc
+
+--connection node_1b
+#
+# Block node_1 applier
+#
+SET SESSION wsrep_sync_wait = 0;
+SET GLOBAL debug_dbug = '+d,sync.wsrep_apply_cb';
+
+#
+# Send concurrent CTAS it will block on applier
+#
+--connection node_2
+--send CREATE table t1 as SELECT SLEEP(0.2);
+
+#
+# Wait until second CTAS is blocked
+#
+--connection node_1b
+SET SESSION debug_sync = 'now WAIT_FOR sync.wsrep_apply_cb_reached';
+
+--echo # Signal first CTAS to continue and wait until CTAS has executed
+SET DEBUG_SYNC= 'now SIGNAL continue';
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Creating table CREATE table t1 as SELECT SLEEP(0.1)'
+--source include/wait_condition.inc
+#
+# Release second CTAS and cleanup
+#
+SET GLOBAL debug_dbug= '';
+SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb';
+#
+# Wait until second CTAS continues
+#
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'debug sync point: now%'
+--source include/wait_condition.inc
+#
+# Wait until second CTAS finishes
+#
+--connection node_2a
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Creating table CREATE table t1 as SELECT SLEEP(0.2)'
+--source include/wait_condition.inc
+#
+# Cleanup
+#
+--connection node_1b
+SET DEBUG_SYNC= 'RESET';
+#
+# Verify that at least one is successful
+#
+--connection node_2
+--reap
+
+--connection node_1
+--error 0,ER_TABLE_EXISTS_ERROR,ER_QUERY_INTERRUPTED
+--reap
+DROP TABLE t1;
+
+
+--source include/galera_end.inc
+--echo # End of test
+