From 7d3d3838c1b8af98a9704120b79c481a4113b862 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Mon, 23 May 2022 13:11:14 +0200 Subject: [PATCH 01/13] MDEV-28583: post-merge fixes --- .../r/galera_ist_MDEV-28423,debug.rdiff | 202 ++----- .../galera/r/galera_ist_MDEV-28423.result | 558 +++++------------- .../r/galera_ist_MDEV-28583,debug.rdiff | 202 ++----- .../galera/r/galera_ist_MDEV-28583.result | 558 +++++------------- scripts/wsrep_sst_mariabackup.sh | 5 +- 5 files changed, 454 insertions(+), 1071 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff index 8c84321e774..f9f81ea3b40 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff @@ -1,27 +1,27 @@ --- r/galera_ist_MDEV-28423.result -+++ r/galera_ist_MDEV-28423,debug.reject -@@ -517,3 +517,187 @@ - 1 ++++ r/galera_ist_MDEV-28423.reject +@@ -286,3 +286,111 @@ DROP TABLE t1; COMMIT; + SET AUTOCOMMIT=ON; +Performing State Transfer on a server that has been killed and restarted +while a DDL was in progress on it +connection node_1; -+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 VALUES (1,'node1_committed_before'); -+INSERT INTO t1 VALUES (2,'node1_committed_before'); -+INSERT INTO t1 VALUES (3,'node1_committed_before'); -+INSERT INTO t1 VALUES (4,'node1_committed_before'); -+INSERT INTO t1 VALUES (5,'node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); +connection node_2; +START TRANSACTION; -+INSERT INTO t1 VALUES (6,'node2_committed_before'); -+INSERT INTO t1 VALUES (7,'node2_committed_before'); -+INSERT INTO t1 VALUES (8,'node2_committed_before'); -+INSERT INTO t1 VALUES (9,'node2_committed_before'); -+INSERT INTO t1 VALUES (10,'node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); +COMMIT; +SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; +connection node_1; @@ -32,26 +32,26 @@ +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); +COMMIT; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +connection node_2; @@ -59,132 +59,56 @@ +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); +COMMIT; +connection node_1; -+INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave_ddl; -+INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +ROLLBACK; -+SET AUTOCOMMIT=ON; -+SET SESSION wsrep_sync_wait=15; -+SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -+EXPECT_3 -+3 -+SELECT COUNT(*) AS EXPECT_35 FROM t1; -+EXPECT_35 -+35 -+SELECT * FROM t1; -+id f1 f2 -+1 node1_committed_before NULL -+2 node1_committed_before NULL -+3 node1_committed_before NULL -+4 node1_committed_before NULL -+5 node1_committed_before NULL -+6 node2_committed_before NULL -+7 node2_committed_before NULL -+8 node2_committed_before NULL -+9 node2_committed_before NULL -+10 node2_committed_before NULL -+11 node1_committed_during NULL -+12 node1_committed_during NULL -+13 node1_committed_during NULL -+14 node1_committed_during NULL -+15 node1_committed_during NULL -+16 node1_to_be_committed_after NULL -+17 node1_to_be_committed_after NULL -+18 node1_to_be_committed_after NULL -+19 node1_to_be_committed_after NULL -+20 node1_to_be_committed_after NULL -+26 node2_committed_after NULL -+27 node2_committed_after NULL -+28 node2_committed_after NULL -+29 node2_committed_after NULL -+30 node2_committed_after NULL -+31 node1_to_be_committed_after NULL -+32 node1_to_be_committed_after NULL -+33 node1_to_be_committed_after NULL -+34 node1_to_be_committed_after NULL -+35 node1_to_be_committed_after NULL -+36 node1_committed_after NULL -+37 node1_committed_after NULL -+38 node1_committed_after NULL -+39 node1_committed_after NULL -+40 node1_committed_after NULL ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; -+connection node_1; +SET AUTOCOMMIT=ON; -+SET SESSION wsrep_sync_wait=15; -+SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -+EXPECT_3 -+3 -+SELECT COUNT(*) AS EXPECT_35 FROM t1; -+EXPECT_35 -+35 -+SELECT * FROM t1; -+id f1 f2 -+1 node1_committed_before NULL -+2 node1_committed_before NULL -+3 node1_committed_before NULL -+4 node1_committed_before NULL -+5 node1_committed_before NULL -+6 node2_committed_before NULL -+7 node2_committed_before NULL -+8 node2_committed_before NULL -+9 node2_committed_before NULL -+10 node2_committed_before NULL -+11 node1_committed_during NULL -+12 node1_committed_during NULL -+13 node1_committed_during NULL -+14 node1_committed_during NULL -+15 node1_committed_during NULL -+16 node1_to_be_committed_after NULL -+17 node1_to_be_committed_after NULL -+18 node1_to_be_committed_after NULL -+19 node1_to_be_committed_after NULL -+20 node1_to_be_committed_after NULL -+26 node2_committed_after NULL -+27 node2_committed_after NULL -+28 node2_committed_after NULL -+29 node2_committed_after NULL -+30 node2_committed_after NULL -+31 node1_to_be_committed_after NULL -+32 node1_to_be_committed_after NULL -+33 node1_to_be_committed_after NULL -+34 node1_to_be_committed_after NULL -+35 node1_to_be_committed_after NULL -+36 node1_committed_after NULL -+37 node1_committed_after NULL -+38 node1_committed_after NULL -+39 node1_committed_after NULL -+40 node1_committed_after NULL ++connection node_1; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; ++SET AUTOCOMMIT=ON; +SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result b/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result index 5a71b490a80..80a28d349ba 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28423.result @@ -1,519 +1,287 @@ -connection node_2; -connection node_1; connection node_1; connection node_2; Performing State Transfer on a server that has been temporarily disconnected connection node_1; -CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (1,'node1_committed_before'); -INSERT INTO t1 VALUES (2,'node1_committed_before'); -INSERT INTO t1 VALUES (3,'node1_committed_before'); -INSERT INTO t1 VALUES (4,'node1_committed_before'); -INSERT INTO t1 VALUES (5,'node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (6,'node2_committed_before'); -INSERT INTO t1 VALUES (7,'node2_committed_before'); -INSERT INTO t1 VALUES (8,'node2_committed_before'); -INSERT INTO t1 VALUES (9,'node2_committed_before'); -INSERT INTO t1 VALUES (10,'node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (11,'node1_committed_during'); -INSERT INTO t1 VALUES (12,'node1_committed_during'); -INSERT INTO t1 VALUES (13,'node1_committed_during'); -INSERT INTO t1 VALUES (14,'node1_committed_during'); -INSERT INTO t1 VALUES (15,'node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); connection node_2; Loading wsrep provider ... -disconnect node_2; -connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2; -connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (26,'node2_committed_after'); -INSERT INTO t1 VALUES (27,'node2_committed_after'); -INSERT INTO t1 VALUES (28,'node2_committed_after'); -INSERT INTO t1 VALUES (29,'node2_committed_after'); -INSERT INTO t1 VALUES (30,'node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (36,'node1_committed_after'); -INSERT INTO t1 VALUES (37,'node1_committed_after'); -INSERT INTO t1 VALUES (38,'node1_committed_after'); -INSERT INTO t1 VALUES (39,'node1_committed_after'); -INSERT INTO t1 VALUES (40,'node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; connection node_1a_galera_st_disconnect_slave; -INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ROLLBACK; -SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 -connection node_1; +COMMIT; SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +connection node_1; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; +SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been shut down cleanly and restarted connection node_1; -CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (1,'node1_committed_before'); -INSERT INTO t1 VALUES (2,'node1_committed_before'); -INSERT INTO t1 VALUES (3,'node1_committed_before'); -INSERT INTO t1 VALUES (4,'node1_committed_before'); -INSERT INTO t1 VALUES (5,'node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (6,'node2_committed_before'); -INSERT INTO t1 VALUES (7,'node2_committed_before'); -INSERT INTO t1 VALUES (8,'node2_committed_before'); -INSERT INTO t1 VALUES (9,'node2_committed_before'); -INSERT INTO t1 VALUES (10,'node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Shutting down server ... connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (11,'node1_committed_during'); -INSERT INTO t1 VALUES (12,'node1_committed_during'); -INSERT INTO t1 VALUES (13,'node1_committed_during'); -INSERT INTO t1 VALUES (14,'node1_committed_during'); -INSERT INTO t1 VALUES (15,'node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); connection node_2; Starting server ... SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (26,'node2_committed_after'); -INSERT INTO t1 VALUES (27,'node2_committed_after'); -INSERT INTO t1 VALUES (28,'node2_committed_after'); -INSERT INTO t1 VALUES (29,'node2_committed_after'); -INSERT INTO t1 VALUES (30,'node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (36,'node1_committed_after'); -INSERT INTO t1 VALUES (37,'node1_committed_after'); -INSERT INTO t1 VALUES (38,'node1_committed_after'); -INSERT INTO t1 VALUES (39,'node1_committed_after'); -INSERT INTO t1 VALUES (40,'node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; connection node_1a_galera_st_shutdown_slave; -INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ROLLBACK; -SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_15 FROM t1; -EXPECT_15 -35 -SELECT * from t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 COMMIT; -connection node_1; SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_15 FROM t1; -EXPECT_15 -35 -SELECT * from t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +connection node_1; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; +SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been killed and restarted connection node_1; -CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (1,'node1_committed_before'); -INSERT INTO t1 VALUES (2,'node1_committed_before'); -INSERT INTO t1 VALUES (3,'node1_committed_before'); -INSERT INTO t1 VALUES (4,'node1_committed_before'); -INSERT INTO t1 VALUES (5,'node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (6,'node2_committed_before'); -INSERT INTO t1 VALUES (7,'node2_committed_before'); -INSERT INTO t1 VALUES (8,'node2_committed_before'); -INSERT INTO t1 VALUES (9,'node2_committed_before'); -INSERT INTO t1 VALUES (10,'node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Killing server ... connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (11,'node1_committed_during'); -INSERT INTO t1 VALUES (12,'node1_committed_during'); -INSERT INTO t1 VALUES (13,'node1_committed_during'); -INSERT INTO t1 VALUES (14,'node1_committed_during'); -INSERT INTO t1 VALUES (15,'node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); connection node_2; Performing --wsrep-recover ... Starting server ... Using --wsrep-start-position when starting mysqld ... SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (26,'node2_committed_after'); -INSERT INTO t1 VALUES (27,'node2_committed_after'); -INSERT INTO t1 VALUES (28,'node2_committed_after'); -INSERT INTO t1 VALUES (29,'node2_committed_after'); -INSERT INTO t1 VALUES (30,'node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (36,'node1_committed_after'); -INSERT INTO t1 VALUES (37,'node1_committed_after'); -INSERT INTO t1 VALUES (38,'node1_committed_after'); -INSERT INTO t1 VALUES (39,'node1_committed_after'); -INSERT INTO t1 VALUES (40,'node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; connection node_1a_galera_st_kill_slave; -INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ROLLBACK; -SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 COMMIT; -connection node_1; SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +connection node_1; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; +SET AUTOCOMMIT=ON; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff index 51d2a6bf157..ce78050538d 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff @@ -1,27 +1,27 @@ --- r/galera_ist_MDEV-28583.result -+++ r/galera_ist_MDEV-28583,debug.reject -@@ -517,3 +517,187 @@ - 1 ++++ r/galera_ist_MDEV-28583.reject +@@ -285,3 +285,111 @@ DROP TABLE t1; COMMIT; + SET AUTOCOMMIT=ON; +Performing State Transfer on a server that has been killed and restarted +while a DDL was in progress on it +connection node_1; -+CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; ++CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 VALUES (1,'node1_committed_before'); -+INSERT INTO t1 VALUES (2,'node1_committed_before'); -+INSERT INTO t1 VALUES (3,'node1_committed_before'); -+INSERT INTO t1 VALUES (4,'node1_committed_before'); -+INSERT INTO t1 VALUES (5,'node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); ++INSERT INTO t1 VALUES ('node1_committed_before'); +connection node_2; +START TRANSACTION; -+INSERT INTO t1 VALUES (6,'node2_committed_before'); -+INSERT INTO t1 VALUES (7,'node2_committed_before'); -+INSERT INTO t1 VALUES (8,'node2_committed_before'); -+INSERT INTO t1 VALUES (9,'node2_committed_before'); -+INSERT INTO t1 VALUES (10,'node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); ++INSERT INTO t1 VALUES ('node2_committed_before'); +COMMIT; +SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; +connection node_1; @@ -32,26 +32,26 @@ +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); -+INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_during'); +COMMIT; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +connection node_2; @@ -59,132 +59,56 @@ +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node2_committed_after'); +COMMIT; +connection node_1; -+INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; -+INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); -+INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); ++INSERT INTO t1 (f1) VALUES ('node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave_ddl; -+INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); -+INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); ++INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +ROLLBACK; -+SET AUTOCOMMIT=ON; -+SET SESSION wsrep_sync_wait=15; -+SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -+EXPECT_3 -+3 -+SELECT COUNT(*) AS EXPECT_35 FROM t1; -+EXPECT_35 -+35 -+SELECT * FROM t1; -+id f1 f2 -+1 node1_committed_before NULL -+2 node1_committed_before NULL -+3 node1_committed_before NULL -+4 node1_committed_before NULL -+5 node1_committed_before NULL -+6 node2_committed_before NULL -+7 node2_committed_before NULL -+8 node2_committed_before NULL -+9 node2_committed_before NULL -+10 node2_committed_before NULL -+11 node1_committed_during NULL -+12 node1_committed_during NULL -+13 node1_committed_during NULL -+14 node1_committed_during NULL -+15 node1_committed_during NULL -+16 node1_to_be_committed_after NULL -+17 node1_to_be_committed_after NULL -+18 node1_to_be_committed_after NULL -+19 node1_to_be_committed_after NULL -+20 node1_to_be_committed_after NULL -+26 node2_committed_after NULL -+27 node2_committed_after NULL -+28 node2_committed_after NULL -+29 node2_committed_after NULL -+30 node2_committed_after NULL -+31 node1_to_be_committed_after NULL -+32 node1_to_be_committed_after NULL -+33 node1_to_be_committed_after NULL -+34 node1_to_be_committed_after NULL -+35 node1_to_be_committed_after NULL -+36 node1_committed_after NULL -+37 node1_committed_after NULL -+38 node1_committed_after NULL -+39 node1_committed_after NULL -+40 node1_committed_after NULL ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; -+connection node_1; +SET AUTOCOMMIT=ON; -+SET SESSION wsrep_sync_wait=15; -+SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; -+EXPECT_3 -+3 -+SELECT COUNT(*) AS EXPECT_35 FROM t1; -+EXPECT_35 -+35 -+SELECT * FROM t1; -+id f1 f2 -+1 node1_committed_before NULL -+2 node1_committed_before NULL -+3 node1_committed_before NULL -+4 node1_committed_before NULL -+5 node1_committed_before NULL -+6 node2_committed_before NULL -+7 node2_committed_before NULL -+8 node2_committed_before NULL -+9 node2_committed_before NULL -+10 node2_committed_before NULL -+11 node1_committed_during NULL -+12 node1_committed_during NULL -+13 node1_committed_during NULL -+14 node1_committed_during NULL -+15 node1_committed_during NULL -+16 node1_to_be_committed_after NULL -+17 node1_to_be_committed_after NULL -+18 node1_to_be_committed_after NULL -+19 node1_to_be_committed_after NULL -+20 node1_to_be_committed_after NULL -+26 node2_committed_after NULL -+27 node2_committed_after NULL -+28 node2_committed_after NULL -+29 node2_committed_after NULL -+30 node2_committed_after NULL -+31 node1_to_be_committed_after NULL -+32 node1_to_be_committed_after NULL -+33 node1_to_be_committed_after NULL -+34 node1_to_be_committed_after NULL -+35 node1_to_be_committed_after NULL -+36 node1_committed_after NULL -+37 node1_committed_after NULL -+38 node1_committed_after NULL -+39 node1_committed_after NULL -+40 node1_committed_after NULL ++connection node_1; ++SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++COUNT(*) = 2 ++1 ++SELECT COUNT(*) = 35 FROM t1; ++COUNT(*) = 35 ++1 +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; ++SET AUTOCOMMIT=ON; +SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result b/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result index 5a71b490a80..80a28d349ba 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28583.result @@ -1,519 +1,287 @@ -connection node_2; -connection node_1; connection node_1; connection node_2; Performing State Transfer on a server that has been temporarily disconnected connection node_1; -CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (1,'node1_committed_before'); -INSERT INTO t1 VALUES (2,'node1_committed_before'); -INSERT INTO t1 VALUES (3,'node1_committed_before'); -INSERT INTO t1 VALUES (4,'node1_committed_before'); -INSERT INTO t1 VALUES (5,'node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (6,'node2_committed_before'); -INSERT INTO t1 VALUES (7,'node2_committed_before'); -INSERT INTO t1 VALUES (8,'node2_committed_before'); -INSERT INTO t1 VALUES (9,'node2_committed_before'); -INSERT INTO t1 VALUES (10,'node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (11,'node1_committed_during'); -INSERT INTO t1 VALUES (12,'node1_committed_during'); -INSERT INTO t1 VALUES (13,'node1_committed_during'); -INSERT INTO t1 VALUES (14,'node1_committed_during'); -INSERT INTO t1 VALUES (15,'node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); connect node_1a_galera_st_disconnect_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); connection node_2; Loading wsrep provider ... -disconnect node_2; -connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2; -connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (26,'node2_committed_after'); -INSERT INTO t1 VALUES (27,'node2_committed_after'); -INSERT INTO t1 VALUES (28,'node2_committed_after'); -INSERT INTO t1 VALUES (29,'node2_committed_after'); -INSERT INTO t1 VALUES (30,'node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (36,'node1_committed_after'); -INSERT INTO t1 VALUES (37,'node1_committed_after'); -INSERT INTO t1 VALUES (38,'node1_committed_after'); -INSERT INTO t1 VALUES (39,'node1_committed_after'); -INSERT INTO t1 VALUES (40,'node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; connection node_1a_galera_st_disconnect_slave; -INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ROLLBACK; -SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 -connection node_1; +COMMIT; SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +connection node_1; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; +SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been shut down cleanly and restarted connection node_1; -CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (1,'node1_committed_before'); -INSERT INTO t1 VALUES (2,'node1_committed_before'); -INSERT INTO t1 VALUES (3,'node1_committed_before'); -INSERT INTO t1 VALUES (4,'node1_committed_before'); -INSERT INTO t1 VALUES (5,'node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (6,'node2_committed_before'); -INSERT INTO t1 VALUES (7,'node2_committed_before'); -INSERT INTO t1 VALUES (8,'node2_committed_before'); -INSERT INTO t1 VALUES (9,'node2_committed_before'); -INSERT INTO t1 VALUES (10,'node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Shutting down server ... connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (11,'node1_committed_during'); -INSERT INTO t1 VALUES (12,'node1_committed_during'); -INSERT INTO t1 VALUES (13,'node1_committed_during'); -INSERT INTO t1 VALUES (14,'node1_committed_during'); -INSERT INTO t1 VALUES (15,'node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); connection node_2; Starting server ... SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (26,'node2_committed_after'); -INSERT INTO t1 VALUES (27,'node2_committed_after'); -INSERT INTO t1 VALUES (28,'node2_committed_after'); -INSERT INTO t1 VALUES (29,'node2_committed_after'); -INSERT INTO t1 VALUES (30,'node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (36,'node1_committed_after'); -INSERT INTO t1 VALUES (37,'node1_committed_after'); -INSERT INTO t1 VALUES (38,'node1_committed_after'); -INSERT INTO t1 VALUES (39,'node1_committed_after'); -INSERT INTO t1 VALUES (40,'node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; connection node_1a_galera_st_shutdown_slave; -INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ROLLBACK; -SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_15 FROM t1; -EXPECT_15 -35 -SELECT * from t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 COMMIT; -connection node_1; SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_15 FROM t1; -EXPECT_15 -35 -SELECT * from t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +connection node_1; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; +SET AUTOCOMMIT=ON; Performing State Transfer on a server that has been killed and restarted connection node_1; -CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (1,'node1_committed_before'); -INSERT INTO t1 VALUES (2,'node1_committed_before'); -INSERT INTO t1 VALUES (3,'node1_committed_before'); -INSERT INTO t1 VALUES (4,'node1_committed_before'); -INSERT INTO t1 VALUES (5,'node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; connection node_2; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (6,'node2_committed_before'); -INSERT INTO t1 VALUES (7,'node2_committed_before'); -INSERT INTO t1 VALUES (8,'node2_committed_before'); -INSERT INTO t1 VALUES (9,'node2_committed_before'); -INSERT INTO t1 VALUES (10,'node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Killing server ... connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (11,'node1_committed_during'); -INSERT INTO t1 VALUES (12,'node1_committed_during'); -INSERT INTO t1 VALUES (13,'node1_committed_during'); -INSERT INTO t1 VALUES (14,'node1_committed_during'); -INSERT INTO t1 VALUES (15,'node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); COMMIT; START TRANSACTION; -INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); connection node_2; Performing --wsrep-recover ... Starting server ... Using --wsrep-start-position when starting mysqld ... SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (26,'node2_committed_after'); -INSERT INTO t1 VALUES (27,'node2_committed_after'); -INSERT INTO t1 VALUES (28,'node2_committed_after'); -INSERT INTO t1 VALUES (29,'node2_committed_after'); -INSERT INTO t1 VALUES (30,'node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; connection node_1; -INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); -INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); COMMIT; SET AUTOCOMMIT=OFF; START TRANSACTION; -INSERT INTO t1 VALUES (36,'node1_committed_after'); -INSERT INTO t1 VALUES (37,'node1_committed_after'); -INSERT INTO t1 VALUES (38,'node1_committed_after'); -INSERT INTO t1 VALUES (39,'node1_committed_after'); -INSERT INTO t1 VALUES (40,'node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); COMMIT; connection node_1a_galera_st_kill_slave; -INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); -INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); ROLLBACK; -SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 COMMIT; -connection node_1; SET AUTOCOMMIT=ON; -SET SESSION wsrep_sync_wait=15; -SELECT COUNT(*) AS EXPECT_35 FROM t1; -EXPECT_35 -35 -SELECT * FROM t1; -id f1 -1 node1_committed_before -2 node1_committed_before -3 node1_committed_before -4 node1_committed_before -5 node1_committed_before -6 node2_committed_before -7 node2_committed_before -8 node2_committed_before -9 node2_committed_before -10 node2_committed_before -11 node1_committed_during -12 node1_committed_during -13 node1_committed_during -14 node1_committed_during -15 node1_committed_during -16 node1_to_be_committed_after -17 node1_to_be_committed_after -18 node1_to_be_committed_after -19 node1_to_be_committed_after -20 node1_to_be_committed_after -26 node2_committed_after -27 node2_committed_after -28 node2_committed_after -29 node2_committed_after -30 node2_committed_after -31 node1_to_be_committed_after -32 node1_to_be_committed_after -33 node1_to_be_committed_after -34 node1_to_be_committed_after -35 node1_to_be_committed_after -36 node1_committed_after -37 node1_committed_after -38 node1_committed_after -39 node1_committed_after -40 node1_committed_after +connection node_1; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; COUNT(*) = 0 1 DROP TABLE t1; COMMIT; +SET AUTOCOMMIT=ON; diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index a3fc4b78718..a66a792b5ea 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -86,7 +86,6 @@ encrypt_threads="" encrypt_chunk="" readonly SECRET_TAG='secret' -readonly TOTAL_TAG='secret /total' # Required for backup locks # For backup locks it is 1 sent by joiner @@ -419,7 +418,7 @@ get_transfer() get_footprint() { - pushd "$WSREP_SST_OPT_DATA" 1>/dev/null + cd "$DATA_DIR" payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' \ -type f -print0 | du --files0-from=- --block-size=1 -c -s | \ awk 'END { print $1 }') @@ -428,7 +427,7 @@ get_footprint() # When compression/compaction used, the progress is only an approximate. payload=$(( payload*1/2 )) fi - popd 1>/dev/null + cd "$OLD_PWD" pcmd="$pcmd -s $payload" adjust_progress } From 7fe474fe7e25cb503b585755c7e0a036e01e0df7 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Thu, 12 May 2022 17:10:58 +0530 Subject: [PATCH 02/13] MDEV-25257 SEGV in fts_get_next_doc_id upon some INSERT - InnoDB fails to create a fts cache while loading the innodb fts table which is stored in system tablespace. InnoDB should create the fts cache while loading FTS_DOC_ID column from system column. --- mysql-test/suite/innodb_fts/r/fulltext.result | 14 ++++++++++++++ mysql-test/suite/innodb_fts/t/fulltext.test | 16 ++++++++++++++++ storage/innobase/dict/dict0load.cc | 1 + 3 files changed, 31 insertions(+) diff --git a/mysql-test/suite/innodb_fts/r/fulltext.result b/mysql-test/suite/innodb_fts/r/fulltext.result index abcdebca01d..7775a46e0d8 100644 --- a/mysql-test/suite/innodb_fts/r/fulltext.result +++ b/mysql-test/suite/innodb_fts/r/fulltext.result @@ -718,4 +718,18 @@ t1 CREATE TABLE `t1` ( FULLTEXT KEY `a_2` (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE t1; +# +# MDEV-25257 SEGV in fts_get_next_doc_id upon some INSERT +# +SET @save = @@global.innodb_file_per_table; +SET @@global.innodb_file_per_table = 0; +CREATE TABLE t1 ( +col_int INTEGER, col_text TEXT, +col_int_g INTEGER GENERATED ALWAYS AS (col_int) +) ENGINE = InnoDB ROW_FORMAT = Redundant ; +ALTER TABLE t1 ADD FULLTEXT KEY `ftidx` ( col_text ) ; +ALTER TABLE t1 DROP KEY `ftidx` ; +INSERT INTO t1 (col_int, col_text) VALUES ( 1255, NULL); +DROP TABLE t1; +SET @@global.innodb_file_per_table = @save; # End of 10.3 tests diff --git a/mysql-test/suite/innodb_fts/t/fulltext.test b/mysql-test/suite/innodb_fts/t/fulltext.test index f3bcaaec5cc..4878a0bee3f 100644 --- a/mysql-test/suite/innodb_fts/t/fulltext.test +++ b/mysql-test/suite/innodb_fts/t/fulltext.test @@ -741,4 +741,20 @@ ALTER TABLE t1 ADD FULLTEXT INDEX (a); SHOW CREATE TABLE t1; DROP TABLE t1; +--echo # +--echo # MDEV-25257 SEGV in fts_get_next_doc_id upon some INSERT +--echo # +SET @save = @@global.innodb_file_per_table; +SET @@global.innodb_file_per_table = 0; + +CREATE TABLE t1 ( + col_int INTEGER, col_text TEXT, + col_int_g INTEGER GENERATED ALWAYS AS (col_int) +) ENGINE = InnoDB ROW_FORMAT = Redundant ; +ALTER TABLE t1 ADD FULLTEXT KEY `ftidx` ( col_text ) ; +ALTER TABLE t1 DROP KEY `ftidx` ; +INSERT INTO t1 (col_int, col_text) VALUES ( 1255, NULL); +DROP TABLE t1; +SET @@global.innodb_file_per_table = @save; + --echo # End of 10.3 tests diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index 386b99bcaad..dade0c5b19e 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -1851,6 +1851,7 @@ dict_load_columns( the flag is set before the table is created. */ if (table->fts == NULL) { table->fts = fts_create(table); + table->fts->cache = fts_cache_create(table); fts_optimize_add_table(table); } From f85d488ad2132db7b294cde3909cb5992b752143 Mon Sep 17 00:00:00 2001 From: kkz Date: Tue, 24 May 2022 20:02:54 +0800 Subject: [PATCH 03/13] remove obsolete fix_session_vcol_expr{,_for_read} function declarations --- sql/table.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/sql/table.h b/sql/table.h index 34de21a39d5..097deca46b2 100644 --- a/sql/table.h +++ b/sql/table.h @@ -3117,9 +3117,6 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, uint ha_open_flags, TABLE *outparam, bool is_create_table, List *partitions_to_open= NULL); -bool fix_session_vcol_expr(THD *thd, Virtual_column_info *vcol); -bool fix_session_vcol_expr_for_read(THD *thd, Field *field, - Virtual_column_info *vcol); bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, bool *error_reported, vcol_init_mode expr); TABLE_SHARE *alloc_table_share(const char *db, const char *table_name, From 31e30329a368a32d9de202748987592cc86db241 Mon Sep 17 00:00:00 2001 From: Ting Nian Date: Tue, 3 May 2022 17:25:48 +0000 Subject: [PATCH 04/13] Add option --enable-cleartext-plugin to the MariaDB client For compatibility reasons, add the option to the MariaDB client without any functional changes besides simply accepting the option and emitting a warning that it is obsolete. In MySQL this security related option is compulsory in certain use cases. When users switch to MariaDB, this client command that used to work starts failing without a sensible error message. In worst case users resort to re-installing the mysql client from MySQL. In MariaDB the option is obsolete and should simply be ignored. Users however don't have any opportunity to learn that unless the client program tells them so. Before: mysql --enable-cleartext-plugin ... mysql: unknown option '--enable-cleartext-plugin' (program terminates) After: mysql --enable-cleartext-plugin ... WARNING: option '--enable-cleartext-plugin' is obsolete. (program executes) All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc. --- client/client_priv.h | 1 + client/mysql.cc | 10 ++++++++++ man/mysql.1 | 15 +++++++++++++++ mysql-test/main/mysql.result | 5 ++++- mysql-test/main/mysql.test | 8 ++++++++ 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/client/client_priv.h b/client/client_priv.h index 5e764cc33fd..275d3c6853b 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -102,6 +102,7 @@ enum options_client OPT_IGNORE_DATA, OPT_PRINT_ROW_COUNT, OPT_PRINT_ROW_EVENT_POSITIONS, OPT_CHECK_IF_UPGRADE_NEEDED, + OPT_COMPATIBILTY_CLEARTEXT_PLUGIN, OPT_MAX_CLIENT_OPTION /* should be always the last */ }; diff --git a/client/mysql.cc b/client/mysql.cc index 558b54e3909..ea92c84e1d1 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1521,6 +1521,8 @@ static struct my_option my_long_options[] = &delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"execute", 'e', "Execute command and quit. (Disables --force and history file.)", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"enable-cleartext-plugin", OPT_COMPATIBILTY_CLEARTEXT_PLUGIN, "Obsolete option. Exists only for MySQL compatibility.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"vertical", 'E', "Print the output of a query (rows) vertically.", &vertical, &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -1817,6 +1819,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), printf("WARNING: --server-arg option not supported in this configuration.\n"); #endif break; + case OPT_COMPATIBILTY_CLEARTEXT_PLUGIN: + /* + This option exists in MySQL client but not in MariaDB. Users switching from + MySQL might still have this option in their commands, and it will not work + in MariaDB unless it is handled. Therefore output a warning and continue. + */ + printf("WARNING: option '--enable-cleartext-plugin' is obsolete.\n"); + break; case 'A': opt_rehash= 0; break; diff --git a/man/mysql.1 b/man/mysql.1 index 3ae8fdf9d69..238106843ef 100644 --- a/man/mysql.1 +++ b/man/mysql.1 @@ -507,6 +507,21 @@ the section called \(lqMYSQL COMMANDS\(rq\&. .sp -1 .IP \(bu 2.3 .\} +.\" mysql: enable cleartext plugin option +.\" enable cleartext plugin option: mysql +\fB\-\-enable\-cleartext\-plugin\fR +.sp +Obsolete option\&. Exists only for MySQL compatibility\&. +.RE +.sp +.RS 4 +.ie n \{\ +\h'-04'\(bu\h'+03'\c +.\} +.el \{\ +.sp -1 +.IP \(bu 2.3 +.\} .\" mysql: execute option .\" execute option: mysql \fB\-\-execute=\fR\fB\fIstatement\fR\fR, diff --git a/mysql-test/main/mysql.result b/mysql-test/main/mysql.result index ec2760ce8a7..9b0936b5924 100644 --- a/mysql-test/main/mysql.result +++ b/mysql-test/main/mysql.result @@ -629,4 +629,7 @@ drop table t1; # # MDEV-15538 '-N' Produce html output wrong # -
1
\ No newline at end of file +
1
+WARNING: option '--enable-cleartext-plugin' is obsolete. +1 +1 diff --git a/mysql-test/main/mysql.test b/mysql-test/main/mysql.test index 1cb4977a32d..0f41add821a 100644 --- a/mysql-test/main/mysql.test +++ b/mysql-test/main/mysql.test @@ -708,3 +708,11 @@ drop table t1; --echo # MDEV-15538 '-N' Produce html output wrong --echo # --exec $MYSQL -NHe "select 1 as a" + + +# +# Test obsolete option --enable-cleartext-plugin +# This should proceed with a warning +# +--echo +--exec $MYSQL test --enable-cleartext-plugin -e "select 1" From c4e87cb22cd78b5539202d9dcf13954375decb67 Mon Sep 17 00:00:00 2001 From: Mathew Heard Date: Thu, 3 Feb 2022 17:39:29 +1100 Subject: [PATCH 05/13] MDEV-9020: Connect issues ALTER TABLE DISABLE KEYS when inserting data If the connecting user doesn't have alter table privilege this isn't allowed. This patch removes enable / disable key commands that should never have been here Closes #2002 --- storage/connect/tabmysql.cpp | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index a701db1e8e9..0d7cb6d50c4 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -946,15 +946,6 @@ bool TDBMYSQL::OpenDB(PGLOBAL g) } // endif MakeInsert - if (m_Rc != RC_FX) { - char cmd[64]; - int w; - - sprintf(cmd, "ALTER TABLE `%s` DISABLE KEYS", TableName); - - m_Rc = Myc.ExecSQL(g, cmd, &w); // may fail for some engines - } // endif m_Rc - } else // m_Rc = (Mode == MODE_DELETE) ? MakeDelete(g) : MakeUpdate(g); m_Rc = (MakeCommand(g)) ? RC_FX : RC_OK; @@ -1216,16 +1207,6 @@ int TDBMYSQL::DeleteDB(PGLOBAL g, int irc) void TDBMYSQL::CloseDB(PGLOBAL g) { if (Myc.Connected()) { - if (Mode == MODE_INSERT) { - char cmd[64]; - int w; - PDBUSER dup = PlgGetUser(g); - - dup->Step = "Enabling indexes"; - sprintf(cmd, "ALTER TABLE `%s` ENABLE KEYS", TableName); - Myc.m_Rows = -1; // To execute the query - m_Rc = Myc.ExecSQL(g, cmd, &w); // May fail for some engines - } // endif m_Rc Myc.Close(); } // endif Myc From c8fabbed425140332038537c8baeaa33c96a9db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 30 May 2022 11:11:48 +0300 Subject: [PATCH 06/13] MDEV-20627 : Galera 4 not able to report proper wsrep_incoming_addresses wsrep_server_incoming_address function always returned value of the wsrep_node_incoming_address even when actual incoming address was resolved to inc_addr variable. Fixed by returning inc_addr if it does contain incoming address. --- sql/wsrep_mysqld.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index d53fb7320e4..3a5db89d02b 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -593,7 +593,7 @@ static std::string wsrep_server_incoming_address() bool is_ipv6= false; unsigned int my_bind_ip= INADDR_ANY; // default if not set - if (my_bind_addr_str && strlen(my_bind_addr_str) && + if (my_bind_addr_str && strlen(my_bind_addr_str) && strcmp(my_bind_addr_str, "*") != 0) { my_bind_ip= wsrep_check_ip(my_bind_addr_str, &is_ipv6); @@ -658,9 +658,13 @@ static std::string wsrep_server_incoming_address() snprintf(inc_addr, inc_addr_max, fmt, addr.get_address(), port); } - + done: - ret= wsrep_node_incoming_address; + if (!strlen(inc_addr)) + ret= wsrep_node_incoming_address; + else + ret= inc_addr; + WSREP_DEBUG("wsrep_incoming_address = %s", ret.c_str()); return ret; } From ebbd5ef6e2902a51a46e47dbb8a8667593cb25e7 Mon Sep 17 00:00:00 2001 From: mkaruza Date: Tue, 10 May 2022 11:15:32 +0200 Subject: [PATCH 07/13] MDEV-27862 Galera should replicate nextval()-related changes in sequences with INCREMENT <> 0, at least NOCACHE ones with engine=InnoDB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sequence storage engine is not transactionl so cache will be written in stmt_cache that is not replicated in cluster. To fix this replicate what is available in both trans_cache and stmt_cache. Sequences will only work when NOCACHE keyword is used when sequnce is created. If WSREP is enabled and we don't have this keyword report error indicting that sequence will not work correctly in cluster. When binlog is enabled statement cache will be cleared in transaction before COMMIT so cache generated from sequence will not be replicated. We need to keep cache until replication. Tests are re-recorded because of replication changes that were introducted with this PR. Reviewed-by: Jan Lindström --- mysql-test/suite/galera/r/MDEV-18832.result | 3 + mysql-test/suite/galera/r/MDEV-27862.result | 54 +++++++++++++++ .../suite/galera/r/galera_sequences.result | 5 +- mysql-test/suite/galera/t/MDEV-18832.test | 8 +++ .../suite/galera/t/MDEV-27862.combinations | 4 ++ mysql-test/suite/galera/t/MDEV-27862.test | 67 +++++++++++++++++++ .../suite/galera/t/galera_sequences.test | 6 ++ sql/ha_sequence.cc | 3 + sql/log.cc | 10 ++- sql/log.h | 2 +- sql/sql_sequence.cc | 11 +++ sql/wsrep_binlog.cc | 8 +-- sql/wsrep_client_service.cc | 29 ++++++-- 13 files changed, 197 insertions(+), 13 deletions(-) create mode 100644 mysql-test/suite/galera/r/MDEV-27862.result create mode 100644 mysql-test/suite/galera/t/MDEV-27862.combinations create mode 100644 mysql-test/suite/galera/t/MDEV-27862.test diff --git a/mysql-test/suite/galera/r/MDEV-18832.result b/mysql-test/suite/galera/r/MDEV-18832.result index 700a0bbefb1..2e0872b9f2e 100644 --- a/mysql-test/suite/galera/r/MDEV-18832.result +++ b/mysql-test/suite/galera/r/MDEV-18832.result @@ -12,3 +12,6 @@ INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' DROP SEQUENCE Seq1_1; DROP TABLE t1; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +connection node_2; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); diff --git a/mysql-test/suite/galera/r/MDEV-27862.result b/mysql-test/suite/galera/r/MDEV-27862.result new file mode 100644 index 00000000000..25b7bc6cfd2 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-27862.result @@ -0,0 +1,54 @@ +connection node_2; +connection node_1; +CREATE SEQUENCE seq_nocache ENGINE=InnoDB; +DROP SEQUENCE seq_nocache; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +connection node_2; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +connection node_1; +CREATE SEQUENCE seq NOCACHE ENGINE=InnoDB; +SELECT NEXTVAL(seq) = 1; +NEXTVAL(seq) = 1 +1 +connection node_2; +SELECT NEXTVAL(seq) = 2; +NEXTVAL(seq) = 2 +1 +connection node_1; +SELECT NEXTVAL(seq) = 3; +NEXTVAL(seq) = 3 +1 +SELECT SETVAL(seq, 100); +SETVAL(seq, 100) +100 +connection node_2; +SELECT NEXTVAL(seq) = 101; +NEXTVAL(seq) = 101 +1 +connection node_1; +SELECT NEXTVAL(seq) = 102; +NEXTVAL(seq) = 102 +1 +DROP SEQUENCE seq; +CREATE TABLE t1(f1 INT); +CREATE SEQUENCE seq_transaction NOCACHE ENGINE=InnoDB; +START TRANSACTION; +INSERT INTO t1 VALUES (0); +SELECT NEXTVAL(seq_transaction); +NEXTVAL(seq_transaction) +1 +INSERT INTO t1 VALUES (NEXTVAL(seq_transaction)); +COMMIT; +connection node_2; +SELECT COUNT(*) = 2 FROM t1; +COUNT(*) = 2 +1 +SELECT NEXTVAL(seq_transaction) = 3; +NEXTVAL(seq_transaction) = 3 +1 +connection node_1; +SELECT NEXTVAL(seq_transaction) = 4; +NEXTVAL(seq_transaction) = 4 +1 +DROP SEQUENCE seq_transaction; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sequences.result b/mysql-test/suite/galera/r/galera_sequences.result index 48593d2a258..7276cb8dbde 100644 --- a/mysql-test/suite/galera/r/galera_sequences.result +++ b/mysql-test/suite/galera/r/galera_sequences.result @@ -44,6 +44,9 @@ Table Create Table Seq1_1 CREATE SEQUENCE `Seq1_1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB select NEXT VALUE FOR Seq1_1; NEXT VALUE FOR Seq1_1 -1 +3001 connection node_1; DROP SEQUENCE Seq1_1; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +connection node_2; +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); diff --git a/mysql-test/suite/galera/t/MDEV-18832.test b/mysql-test/suite/galera/t/MDEV-18832.test index e2f1b2afd45..ba93761435a 100644 --- a/mysql-test/suite/galera/t/MDEV-18832.test +++ b/mysql-test/suite/galera/t/MDEV-18832.test @@ -13,3 +13,11 @@ CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1; INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1); DROP SEQUENCE Seq1_1; DROP TABLE t1; + +# Supress warning for SEQUENCES that are declared without `NOCACHE` introduced with MDEV-27862 + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); + +--connection node_2 + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); diff --git a/mysql-test/suite/galera/t/MDEV-27862.combinations b/mysql-test/suite/galera/t/MDEV-27862.combinations new file mode 100644 index 00000000000..1eeb8fb4614 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-27862.combinations @@ -0,0 +1,4 @@ +[binlogoff] + +[binlogon] +log-bin diff --git a/mysql-test/suite/galera/t/MDEV-27862.test b/mysql-test/suite/galera/t/MDEV-27862.test new file mode 100644 index 00000000000..89d3465b91f --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-27862.test @@ -0,0 +1,67 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +# Report WARNING when SEQUENCE is created without `NOCACHE` + +CREATE SEQUENCE seq_nocache ENGINE=InnoDB; +DROP SEQUENCE seq_nocache; + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); + +--connection node_2 + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); + +# NEXTVAL + +--connection node_1 + +CREATE SEQUENCE seq NOCACHE ENGINE=InnoDB; + +SELECT NEXTVAL(seq) = 1; + +--connection node_2 + +SELECT NEXTVAL(seq) = 2; + +--connection node_1 + +SELECT NEXTVAL(seq) = 3; + + +# SETVAL + +SELECT SETVAL(seq, 100); + +--connection node_2 + +SELECT NEXTVAL(seq) = 101; + +--connection node_1 + +SELECT NEXTVAL(seq) = 102; + +DROP SEQUENCE seq; + +# TRANSACTIONS + +CREATE TABLE t1(f1 INT); +CREATE SEQUENCE seq_transaction NOCACHE ENGINE=InnoDB; + +START TRANSACTION; +INSERT INTO t1 VALUES (0); +SELECT NEXTVAL(seq_transaction); +INSERT INTO t1 VALUES (NEXTVAL(seq_transaction)); +COMMIT; + +--connection node_2 + +SELECT COUNT(*) = 2 FROM t1; +SELECT NEXTVAL(seq_transaction) = 3; + +--connection node_1 +SELECT NEXTVAL(seq_transaction) = 4; + +DROP SEQUENCE seq_transaction; +DROP TABLE t1; + diff --git a/mysql-test/suite/galera/t/galera_sequences.test b/mysql-test/suite/galera/t/galera_sequences.test index 480366f6a6f..d469cc73516 100644 --- a/mysql-test/suite/galera/t/galera_sequences.test +++ b/mysql-test/suite/galera/t/galera_sequences.test @@ -44,3 +44,9 @@ select NEXT VALUE FOR Seq1_1; --connection node_1 DROP SEQUENCE Seq1_1; + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); + +--connection node_2 + +CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc index b0611c1505a..1331fea74d1 100644 --- a/sql/ha_sequence.cc +++ b/sql/ha_sequence.cc @@ -434,6 +434,9 @@ static int sequence_initialize(void *p) HTON_HIDDEN | HTON_TEMPORARY_NOT_SUPPORTED | HTON_ALTER_NOT_SUPPORTED | +#ifdef WITH_WSREP + HTON_WSREP_REPLICATION | +#endif HTON_NO_PARTITION); DBUG_RETURN(0); } diff --git a/sql/log.cc b/sql/log.cc index 25cf0831469..ec96a2f9b23 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2013,7 +2013,13 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all) thd->backup_stage(&org_stage); THD_STAGE_INFO(thd, stage_binlog_write); +#ifdef WITH_WSREP + // DON'T clear stmt cache in case we are in transaction + if (!cache_mngr->stmt_cache.empty() && + (!wsrep_on(thd) || ending_trans(thd, all))) +#else if (!cache_mngr->stmt_cache.empty()) +#endif { error= binlog_commit_flush_stmt_cache(thd, all, cache_mngr); } @@ -10777,13 +10783,13 @@ maria_declare_plugin_end; #ifdef WITH_WSREP #include "wsrep_mysqld.h" -IO_CACHE *wsrep_get_trans_cache(THD * thd) +IO_CACHE *wsrep_get_cache(THD * thd, bool is_transactional) { DBUG_ASSERT(binlog_hton->slot != HA_SLOT_UNDEF); binlog_cache_mngr *cache_mngr = (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton); if (cache_mngr) - return cache_mngr->get_binlog_cache_log(true); + return cache_mngr->get_binlog_cache_log(is_transactional); WSREP_DEBUG("binlog cache not initialized, conn: %llu", thd->thread_id); diff --git a/sql/log.h b/sql/log.h index 5cb75c97b5e..2520c8fede8 100644 --- a/sql/log.h +++ b/sql/log.h @@ -1239,7 +1239,7 @@ static inline TC_LOG *get_tc_log_implementation() } #ifdef WITH_WSREP -IO_CACHE* wsrep_get_trans_cache(THD *); +IO_CACHE* wsrep_get_cache(THD *, bool); void wsrep_thd_binlog_trx_reset(THD * thd); void wsrep_thd_binlog_stmt_rollback(THD * thd); #endif /* WITH_WSREP */ diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc index 367fbad144c..8488fa67ecb 100644 --- a/sql/sql_sequence.cc +++ b/sql/sql_sequence.cc @@ -308,6 +308,11 @@ bool sequence_insert(THD *thd, LEX *lex, TABLE_LIST *org_table_list) DBUG_RETURN(TRUE); } +#ifdef WITH_WSREP + if (WSREP_ON && seq->cache != 0) + WSREP_WARN("CREATE SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +#endif + /* If not temporary table */ if (!temporary_table) { @@ -904,12 +909,18 @@ bool Sql_cmd_alter_sequence::execute(THD *thd) No_such_table_error_handler no_such_table_handler; DBUG_ENTER("Sql_cmd_alter_sequence::execute"); + if (check_access(thd, ALTER_ACL, first_table->db.str, &first_table->grant.privilege, &first_table->grant.m_internal, 0, 0)) DBUG_RETURN(TRUE); /* purecov: inspected */ +#ifdef WITH_WSREP + if (WSREP_ON && new_seq->cache != 0) + WSREP_WARN("ALTER SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster."); +#endif + if (check_grant(thd, ALTER_ACL, first_table, FALSE, 1, FALSE)) DBUG_RETURN(TRUE); /* purecov: inspected */ diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc index d04d9989e99..5c1c899fcde 100644 --- a/sql/wsrep_binlog.cc +++ b/sql/wsrep_binlog.cc @@ -155,10 +155,10 @@ static int wsrep_write_cache_inc(THD* const thd, goto cleanup; cache->read_pos= cache->read_end; } while ((cache->file >= 0) && (length= my_b_fill(cache))); - } - if (ret == 0) - { - assert(total_length + thd->wsrep_sr().log_position() == saved_pos); + if (ret == 0) + { + assert(total_length + thd->wsrep_sr().log_position() == saved_pos); + } } cleanup: diff --git a/sql/wsrep_client_service.cc b/sql/wsrep_client_service.cc index 464296ea6cf..59ba8c30e43 100644 --- a/sql/wsrep_client_service.cc +++ b/sql/wsrep_client_service.cc @@ -86,18 +86,37 @@ int Wsrep_client_service::prepare_data_for_replication() DBUG_ASSERT(m_thd == current_thd); DBUG_ENTER("Wsrep_client_service::prepare_data_for_replication"); size_t data_len= 0; - IO_CACHE* cache= wsrep_get_trans_cache(m_thd); + IO_CACHE* transactional_cache= wsrep_get_cache(m_thd, true); + IO_CACHE* stmt_cache= wsrep_get_cache(m_thd, false); - if (cache) + if (transactional_cache || stmt_cache) { m_thd->binlog_flush_pending_rows_event(true); - if (wsrep_write_cache(m_thd, cache, &data_len)) + + size_t transactional_data_len= 0; + size_t stmt_data_len= 0; + + // Write transactional cache + if (transactional_cache && + wsrep_write_cache(m_thd, transactional_cache, &transactional_data_len)) { WSREP_ERROR("rbr write fail, data_len: %zu", data_len); // wsrep_override_error(m_thd, ER_ERROR_DURING_COMMIT); DBUG_RETURN(1); } + + // Write stmt cache + if (stmt_cache && wsrep_write_cache(m_thd, stmt_cache, &stmt_data_len)) + { + WSREP_ERROR("rbr write fail, data_len: %zu", + data_len); + // wsrep_override_error(m_thd, ER_ERROR_DURING_COMMIT); + DBUG_RETURN(1); + } + + // Complete data written from both caches + data_len = transactional_data_len + stmt_data_len; } if (data_len == 0) @@ -139,7 +158,7 @@ int Wsrep_client_service::prepare_fragment_for_replication( DBUG_ASSERT(m_thd == current_thd); THD* thd= m_thd; DBUG_ENTER("Wsrep_client_service::prepare_fragment_for_replication"); - IO_CACHE* cache= wsrep_get_trans_cache(thd); + IO_CACHE* cache= wsrep_get_cache(thd, true); thd->binlog_flush_pending_rows_event(true); if (!cache) @@ -221,7 +240,7 @@ bool Wsrep_client_service::statement_allowed_for_streaming() const size_t Wsrep_client_service::bytes_generated() const { - IO_CACHE* cache= wsrep_get_trans_cache(m_thd); + IO_CACHE* cache= wsrep_get_cache(m_thd, true); if (cache) { size_t pending_rows_event_length= 0; From f7137a619f8518edb7eab096e59e3c825046eaeb Mon Sep 17 00:00:00 2001 From: Masashi Tomooka Date: Mon, 30 May 2022 19:28:44 +0900 Subject: [PATCH 08/13] MDEV-28599 EXCHANGE PARTITION on view causes ER_CHECK_NO_SUCH_TABLE instead of ER_WRONG_OBJECT ER_CHECK_NO_SUCH_TABLE was raised because a view does not have the corresponding TABLE instance connected to TABLE_LIST and the server interprets the absence as the absence of the table itself. To fix the problem, we add a check to ensure that the target table to be swapped with a partition is not a view. Reviewed by: Nayuta Yanagisawa --- mysql-test/main/partition_error.result | 13 ++++++++++++- mysql-test/main/partition_error.test | 14 +++++++++++++- sql/sql_partition_admin.cc | 8 ++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/partition_error.result b/mysql-test/main/partition_error.result index d99473d0718..fdedb5a4633 100644 --- a/mysql-test/main/partition_error.result +++ b/mysql-test/main/partition_error.result @@ -6,7 +6,18 @@ drop table if exists t1, t2; CREATE TABLE t1 (a int); CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1; ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1; -ERROR 42000: Can't open table +ERROR HY000: 'test.v1' is not of type 'BASE TABLE' +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-28599 EXCHANGE PARTITION on view causes ER_CHECK_NO_SUCH_TABLE instead of ER_WRONG_OBJECT +# +CREATE TABLE t1 (a int) +PARTITION BY HASH (a) +PARTITIONS 2; +CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1; +ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1; +ERROR HY000: 'test.v1' is not of type 'BASE TABLE' DROP VIEW v1; DROP TABLE t1; # diff --git a/mysql-test/main/partition_error.test b/mysql-test/main/partition_error.test index 8739c93fe92..7d8e76dabf7 100644 --- a/mysql-test/main/partition_error.test +++ b/mysql-test/main/partition_error.test @@ -16,7 +16,19 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`; --echo # CREATE TABLE t1 (a int); CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1; ---error ER_CHECK_NO_SUCH_TABLE +--error ER_WRONG_OBJECT +ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1; +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-28599 EXCHANGE PARTITION on view causes ER_CHECK_NO_SUCH_TABLE instead of ER_WRONG_OBJECT +--echo # +CREATE TABLE t1 (a int) +PARTITION BY HASH (a) +PARTITIONS 2; +CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1; +--error ER_WRONG_OBJECT ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1; DROP VIEW v1; DROP TABLE t1; diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc index cec7ecc6806..90b114b792c 100644 --- a/sql/sql_partition_admin.cc +++ b/sql/sql_partition_admin.cc @@ -539,6 +539,14 @@ bool Sql_cmd_alter_table_exchange_partition:: part_table= table_list->table; swap_table= swap_table_list->table; + /* Don't allow to exchange with a VIEW */ + if (unlikely(swap_table_list->view)) + { + my_error(ER_WRONG_OBJECT, MYF(0), table_list->db.str, + swap_table_list->table_name.str, "BASE TABLE"); + DBUG_RETURN(TRUE); + } + if (unlikely(check_exchange_partition(swap_table, part_table))) DBUG_RETURN(TRUE); From 863c3eda872b19f70ce6045119bf621584e1312d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 30 May 2022 15:49:45 +0300 Subject: [PATCH 09/13] MDEV-28689, MDEV-28690: Incorrect error handling for ctrl_mutex comp_thread_ctxt_t: Remove ctrl_mutex, ctrl_cond, started. We do not actually need them for anything. destroy_worker_thread(): Split from destroy_worker_threads(). create_worker_threads(): We already initialize thd->data_avail=FALSE and thd->cancelled=FALSE before invoking pthread_create(). If any thread creation fails, clean up by destroy_worker_thread(). compress_worker_thread_func(): Assume that thd->started and thd->data_avail are already initialized. Reviewed by: Vladislav Vaintroub --- extra/mariabackup/ds_compress.cc | 77 +++++++++----------------------- 1 file changed, 22 insertions(+), 55 deletions(-) diff --git a/extra/mariabackup/ds_compress.cc b/extra/mariabackup/ds_compress.cc index 514c86f5a17..dcfb3d5a82f 100644 --- a/extra/mariabackup/ds_compress.cc +++ b/extra/mariabackup/ds_compress.cc @@ -1,5 +1,6 @@ /****************************************************** Copyright (c) 2011-2013 Percona LLC and/or its affiliates. +Copyright (c) 2022, MariaDB Corporation. Compressing datasink implementation for XtraBackup. @@ -32,11 +33,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA typedef struct { pthread_t id; uint num; - pthread_mutex_t ctrl_mutex; - pthread_cond_t ctrl_cond; pthread_mutex_t data_mutex; pthread_cond_t data_cond; - my_bool started; my_bool data_avail; my_bool cancelled; const char *from; @@ -208,14 +206,13 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len) thd = threads + i; - pthread_mutex_lock(&thd->ctrl_mutex); + pthread_mutex_lock(&thd->data_mutex); chunk_len = (len > COMPRESS_CHUNK_SIZE) ? COMPRESS_CHUNK_SIZE : len; thd->from = ptr; thd->from_len = chunk_len; - pthread_mutex_lock(&thd->data_mutex); thd->data_avail = TRUE; pthread_cond_signal(&thd->data_cond); pthread_mutex_unlock(&thd->data_mutex); @@ -260,7 +257,6 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len) } pthread_mutex_unlock(&threads[i].data_mutex); - pthread_mutex_unlock(&threads[i].ctrl_mutex); } } @@ -330,6 +326,23 @@ write_uint64_le(ds_file_t *file, ulonglong n) return ds_write(file, tmp, sizeof(tmp)); } +static +void +destroy_worker_thread(comp_thread_ctxt_t *thd) +{ + pthread_mutex_lock(&thd->data_mutex); + thd->cancelled = TRUE; + pthread_cond_signal(&thd->data_cond); + pthread_mutex_unlock(&thd->data_mutex); + + pthread_join(thd->id, NULL); + + pthread_cond_destroy(&thd->data_cond); + pthread_mutex_destroy(&thd->data_mutex); + + my_free(thd->to); +} + static comp_thread_ctxt_t * create_worker_threads(uint n) @@ -344,7 +357,6 @@ create_worker_threads(uint n) comp_thread_ctxt_t *thd = threads + i; thd->num = i + 1; - thd->started = FALSE; thd->cancelled = FALSE; thd->data_avail = FALSE; @@ -352,46 +364,25 @@ create_worker_threads(uint n) MY_QLZ_COMPRESS_OVERHEAD, MYF(MY_FAE)); - /* Initialize the control mutex and condition var */ - if (pthread_mutex_init(&thd->ctrl_mutex, NULL) || - pthread_cond_init(&thd->ctrl_cond, NULL)) { - goto err; - } - /* Initialize and data mutex and condition var */ if (pthread_mutex_init(&thd->data_mutex, NULL) || pthread_cond_init(&thd->data_cond, NULL)) { goto err; } - pthread_mutex_lock(&thd->ctrl_mutex); - if (pthread_create(&thd->id, NULL, compress_worker_thread_func, thd)) { msg("compress: pthread_create() failed: " "errno = %d", errno); - pthread_mutex_unlock(&thd->ctrl_mutex); goto err; } } - /* Wait for the threads to start */ - for (i = 0; i < n; i++) { - comp_thread_ctxt_t *thd = threads + i; - - while (thd->started == FALSE) - pthread_cond_wait(&thd->ctrl_cond, &thd->ctrl_mutex); - pthread_mutex_unlock(&thd->ctrl_mutex); - } - return threads; err: - while (i > 0) { - comp_thread_ctxt_t *thd; - i--; - thd = threads + i; - pthread_mutex_unlock(&thd->ctrl_mutex); + for (; i; i--) { + destroy_worker_thread(threads + i); } my_free(threads); @@ -405,21 +396,7 @@ destroy_worker_threads(comp_thread_ctxt_t *threads, uint n) uint i; for (i = 0; i < n; i++) { - comp_thread_ctxt_t *thd = threads + i; - - pthread_mutex_lock(&thd->data_mutex); - threads[i].cancelled = TRUE; - pthread_cond_signal(&thd->data_cond); - pthread_mutex_unlock(&thd->data_mutex); - - pthread_join(thd->id, NULL); - - pthread_cond_destroy(&thd->data_cond); - pthread_mutex_destroy(&thd->data_mutex); - pthread_cond_destroy(&thd->ctrl_cond); - pthread_mutex_destroy(&thd->ctrl_mutex); - - my_free(thd->to); + destroy_worker_thread(threads + i); } my_free(threads); @@ -431,19 +408,9 @@ compress_worker_thread_func(void *arg) { comp_thread_ctxt_t *thd = (comp_thread_ctxt_t *) arg; - pthread_mutex_lock(&thd->ctrl_mutex); - pthread_mutex_lock(&thd->data_mutex); - thd->started = TRUE; - pthread_cond_signal(&thd->ctrl_cond); - - pthread_mutex_unlock(&thd->ctrl_mutex); - while (1) { - thd->data_avail = FALSE; - pthread_cond_signal(&thd->data_cond); - while (!thd->data_avail && !thd->cancelled) { pthread_cond_wait(&thd->data_cond, &thd->data_mutex); } From 131c318b165cfee1af4494c5581dd57990fe1a5d Mon Sep 17 00:00:00 2001 From: Monty Date: Mon, 30 May 2022 13:04:14 +0300 Subject: [PATCH 10/13] Remove compiler warning about unused variables --- sql/partition_info.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sql/partition_info.cc b/sql/partition_info.cc index fb55091f05e..cf2536f3969 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -900,10 +900,12 @@ void partition_info::vers_check_limit(THD *thd) bitmap_set_all(), but this is not optimal since there can be quite a number of partitions. */ +#ifndef DBUG_OFF const uint32 sub_factor= num_subparts ? num_subparts : 1; uint32 part_id= vers_info->hist_part->id * sub_factor; const uint32 part_id_end= part_id + sub_factor; DBUG_ASSERT(part_id_end <= num_parts * sub_factor); +#endif ha_partition *hp= (ha_partition*)(table->file); ha_rows hist_rows= hp->part_records(vers_info->hist_part); From 9d10b7107cf022b939dc61cedf8fc8985443c880 Mon Sep 17 00:00:00 2001 From: Monty Date: Mon, 30 May 2022 13:07:21 +0300 Subject: [PATCH 11/13] Fixed bug in ma_loghandler.cc that could cause an assert The assert happens in 10.6 with the following command: ./mtr --no-reorder --verbose-restart main.update_ignore_216 main.upgrade_MDEV-19650 main.upgrade_MDEV-23102-1 main.upgrade_MDEV-23102-2 main.upgrade_geometrycolumn_procedure_definer main.upgrade_mdev_24363 main.varbinary sys_vars.aria_log_file_size_basic Reviewer: Oleksandr Byelkin --- storage/maria/ma_loghandler.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index b601a25966a..7e4fb5a8263 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -7993,22 +7993,14 @@ void translog_flush_buffers(TRANSLOG_ADDRESS *lsn, } else { - if (log_descriptor.bc.buffer->last_lsn == LSN_IMPOSSIBLE) + if (log_descriptor.bc.buffer->last_lsn == LSN_IMPOSSIBLE && + log_descriptor.bc.buffer->prev_last_lsn == LSN_IMPOSSIBLE) { - /* - In this case both last_lsn & prev_last_lsn are LSN_IMPOSSIBLE - otherwise it will go in the first IF because LSN_IMPOSSIBLE less - then any real LSN and cmp_translog_addr(*lsn, - log_descriptor.bc.buffer->prev_last_lsn) will be TRUE - */ - DBUG_ASSERT(log_descriptor.bc.buffer->prev_last_lsn == - LSN_IMPOSSIBLE); DBUG_PRINT("info", ("There is no LSNs yet generated => do nothing")); translog_unlock(); DBUG_VOID_RETURN; } - DBUG_ASSERT(log_descriptor.bc.buffer->prev_last_lsn != LSN_IMPOSSIBLE); /* fix lsn if it was horizon */ *lsn= log_descriptor.bc.buffer->prev_last_lsn; DBUG_PRINT("info", ("LSN to flush fixed to prev last lsn: " LSN_FMT, From fde99e006d0947977f196854dd1f5a2eaa030c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 1 Jun 2022 11:13:15 +0300 Subject: [PATCH 12/13] MDEV-28716: Portability: unlink() can return EPERM instead of EISDIR --- storage/innobase/os/os0file.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 8c76e86ef0f..2c94ea6e393 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -2479,6 +2479,7 @@ os_file_get_last_error_low( case EXDEV: case ENOTDIR: case EISDIR: + case EPERM: return(OS_FILE_PATH_ERROR); case EAGAIN: if (srv_use_native_aio) { From 91d5fffa0796b8208c3d6633c8f296da8914af4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 1 Jun 2022 11:20:47 +0300 Subject: [PATCH 13/13] MDEV-28719: compress_write() leaks data_mutex on error --- extra/mariabackup/ds_compress.cc | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/extra/mariabackup/ds_compress.cc b/extra/mariabackup/ds_compress.cc index dcfb3d5a82f..39a72cdca34 100644 --- a/extra/mariabackup/ds_compress.cc +++ b/extra/mariabackup/ds_compress.cc @@ -238,25 +238,24 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len) xb_a(threads[i].to_len > 0); - if (ds_write(dest_file, "NEWBNEWB", 8) || - write_uint64_le(dest_file, - comp_file->bytes_processed)) { - msg("compress: write to the destination stream " - "failed."); - return 1; - } - + bool fail = ds_write(dest_file, "NEWBNEWB", 8) || + write_uint64_le(dest_file, + comp_file->bytes_processed); comp_file->bytes_processed += threads[i].from_len; - if (write_uint32_le(dest_file, threads[i].adler) || - ds_write(dest_file, threads[i].to, - threads[i].to_len)) { - msg("compress: write to the destination stream " - "failed."); - return 1; + if (!fail) { + fail = write_uint32_le(dest_file, threads[i].adler) || + ds_write(dest_file, threads[i].to, + threads[i].to_len); } pthread_mutex_unlock(&threads[i].data_mutex); + + if (fail) { + msg("compress: write to the destination stream " + "failed."); + return 1; + } } }