[MDEV-28378] galera.galera_as_slave_ctas fails with a timeout Created: 2022-04-21  Updated: 2023-12-15

Status: Stalled
Project: MariaDB Server
Component/s: Galera, Tests
Affects Version/s: 10.4, 10.5
Fix Version/s: 10.4

Type: Bug Priority: Critical
Reporter: Marko Mäkelä Assignee: Denis Protivensky
Resolution: Unresolved Votes: 0
Labels: None

Attachments: File ctas.diff     File galera_as_slave_ctas.test    
Issue Links:
Blocks
blocks MDEV-30172 Galera test case cleanup Stalled
Relates
relates to MDEV-32780 galera_as_slave_replay: assertion in ... In Testing
relates to MDEV-24912 Assertion `state() == s_executing || ... Closed
relates to MDEV-32193 Assertion `state() == s_executing || ... Stalled

 Description   

The test fails for me with a timeout:

CURRENT_TEST: galera.galera_as_slave_ctas
--- /mariadb/10.4/mysql-test/suite/galera/r/galera_as_slave_ctas.result	2022-01-24 10:38:52.049546080 +0200
+++ /mariadb/10.4/mysql-test/suite/galera/r/galera_as_slave_ctas.reject	2022-04-21 11:22:43.595270214 +0300
@@ -13,7 +13,32 @@
 CREATE TABLE source (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
 CREATE TABLE target AS SELECT * FROM source;
 connection node_1;
+Timeout in wait_condition.inc for SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target';
+Id	User	Host	db	Command	Time	State	Info	Progress
+1	system user		NULL	Sleep	36	wsrep aborter idle	NULL	0.000
+2	system user		NULL	Sleep	36	Closing tables	NULL	0.000
+3	system user		NULL	Daemon	NULL	InnoDB purge coordinatorNULL	0.000
+4	system user		NULL	Daemon	NULL	InnoDB purge worker	NULL	0.000
+5	system user		NULL	Daemon	NULL	InnoDB purge worker	NULL	0.000
+6	system user		NULL	Daemon	NULL	InnoDB purge worker	NULL	0.000
+7	system user		NULL	Daemon	NULL	InnoDB shutdown handlerNULL	0.000
+17	root	localhost	test	Sleep	32		NULL	0.000
+18	root	localhost:52110	test	Query	0	Init	show full processlist	0.000
+19	system user		NULL	Slave_IO	30	Waiting for master to send event	NULL	0.000
+20	system user		test	Slave_SQL	30	Slave has read all relay log; waiting for the slave I/O thread to update it	CREATE TABLE `target` (
+  `f1` int(11) NOT NULL
+)	0.000
 connection node_2;
+Timeout in wait_condition.inc for SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target';
+Id	User	Host	db	Command	Time	State	Info	Progress
+1	system user		NULL	Sleep	65	wsrep aborter idle	NULL	0.000
+2	system user		NULL	Sleep	60	After apply log event	NULL	0.000
+4	system user		NULL	Daemon	NULL	InnoDB purge coordinatorNULL	0.000
+5	system user		NULL	Daemon	NULL	InnoDB purge worker	NULL	0.000
+6	system user		NULL	Daemon	NULL	InnoDB purge worker	NULL	0.000
+7	system user		NULL	Daemon	NULL	InnoDB purge worker	NULL	0.000
+8	system user		NULL	Daemon	NULL	InnoDB shutdown handlerNULL	0.000
+16	root	localhost:41988	test	Query	0	Init	show full processlist	0.000
 connection node_3;
 DROP TABLE target;
 INSERT INTO source VALUES(1);
 
mysqltest: Result length mismatch

The table target will not appear in INFORMATION_SCHEMA.TABLES even after a delay of several seconds. I double-checked it by editing the test.



 Comments   
Comment by Jan Lindström [ 2023-11-20 ]

I could reproduce timeout after ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; was added to test case, because we need it.

Comment by Jan Lindström [ 2023-12-15 ]

denis.protivensky I could not fully figure this out, I do not really know is some earlier change on CTAS causing problems. Original timeout can be fixed on wsrep_peak_event (slave.cc) with adding

+    // Make sure that future position is not larger than EOF
+    // because e.g. in CTAS where selected table is empty
+    // there will be no row events.
+    if (future_pos >= rgi->rli->cur_log->end_of_file)
+      break;
+

Before we seek to future pos. However, this is not enough. There is two cases (1) mysql.gtid_slave_pos engine is InnoDB (I think this is default on releases) and (2) it is MyISAM (not sure if we need to fix this). I have attached test case to this MDEV.

Generated at Thu Feb 08 10:00:16 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.