1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge branch '10.6' into '10.11'

This commit is contained in:
Julius Goryavsky
2025-04-15 21:40:26 +02:00
130 changed files with 1586 additions and 110 deletions

View File

@@ -1,6 +1,7 @@
--source include/big_test.inc
# Valgrind is to slow for this test
# Valgrind and msan is to slow for this test
--source include/not_valgrind.inc
--source include/not_msan.inc
--source include/have_archive.inc
CREATE TABLE t1(a BLOB) ENGINE=ARCHIVE;
--disable_query_log

View File

@@ -7,9 +7,6 @@ connection default;
set global federated_pushdown=1;
#Enable after fix MDEV-31846 or in v. 10.5 and later
--disable_cursor_protocol
connection slave;
DROP TABLE IF EXISTS federated.t1;
@@ -168,11 +165,13 @@ insert into federated.t4 select * from federated.t1;
--sorted_result
select * from federated.t4;
--disable_cursor_protocol
select name into @var from federated.t1 where id=3 limit 1 ;
select @var;
--disable_ps2_protocol
select name into outfile 'tmp.txt' from federated.t1;
--enable_ps2_protocol
--enable_cursor_protocol
let $path=`select concat(@@datadir, 'test/tmp.txt')`;
remove_file $path;
@@ -439,7 +438,5 @@ DEALLOCATE PREPARE stmt;
set global federated_pushdown=0;
--enable_cursor_protocol
source include/federated_cleanup.inc;

View File

@@ -0,0 +1,112 @@
connection node_4;
connection node_3;
connection node_2;
connection node_1;
# Correct Galera library found
connection node_1;
connection node_2;
connection node_3;
connection node_4;
connection node_1;
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
CALL p1(130);
connection node_4;
Shutting down server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
Server 4 left the cluster
connection node_1;
CALL p1(130);
connection node_1;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_2;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_3;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
INSERT INTO t2 VALUES (DEFAULT);
CALL p1(130);
connection node_1;
SET GLOBAL debug = "+d,sync.wsrep_sst_donor_after_donation";
Restarting server 4
Wait for server 1 to become a donor
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_sst_donor_after_donation_reached";
Server 1 got SST request from server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_sst_donor_after_donation_continue";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
Waiting for server 4 to leave the cluster
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_4;
Server 4 left the cluster, killing it...
Killed server 4...
Restarting server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SELECT count(*) AS expect1_390 FROM t1;
expect1_390
390
SELECT count(*) AS expect1_1 FROM t2;
expect1_1
1
connection node_2;
SELECT count(*) AS expect2_390 FROM t1;
expect2_390
390
SELECT count(*) AS expect2_1 FROM t2;
expect2_1
1
connection node_3;
SELECT count(*) AS expect3_390 FROM t1;
expect3_390
390
SELECT count(*) AS expect3_1 FROM t2;
expect3_1
1
connection node_4;
SELECT count(*) AS expect4_390 FROM t1;
expect4_390
390
SELECT count(*) AS expect4_1 FROM t2;
expect4_1
1
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Failed on preordered");
CALL mtr.add_suppression("Failed to apply write set");
CALL mtr.add_suppression("Sending JOIN failed: -103");
CALL mtr.add_suppression("Failed to JOIN the cluster after SST");

View File

@@ -0,0 +1,94 @@
connection node_4;
connection node_3;
connection node_2;
connection node_1;
# Correct Galera library found
connection node_1;
connection node_2;
connection node_3;
connection node_4;
connection node_1;
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
CALL p1(130);
connection node_4;
Shutting down server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
SET GLOBAL debug = "+d,sync.wsrep_donor_state";
connection node_4;
Restarting server 4...
connection node_1;
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_donor_state_reached";
Tables on server 1 flushed and locked for SST to server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_donor_state";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
Wait for the state snapshot to be copied to server 4
SST script unlocked server 1
connection node_1;
CALL p1(130);
connection node_1;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_2;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_3;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
INSERT INTO t2 VALUES (DEFAULT);
CALL p1(130);
Waiting for server 4 to leave the cluster
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_4;
Server 4 left the cluster, killing it...
Killed server 4...
Restarting server 4...
DROP TABLE t2;
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SELECT count(*) AS expect1_390 FROM t1;
expect1_390
390
connection node_2;
SELECT count(*) AS expect2_390 FROM t1;
expect2_390
390
connection node_3;
SELECT count(*) AS expect3_390 FROM t1;
expect3_390
390
connection node_4;
SELECT count(*) AS expect4_390 FROM t1;
expect4_390
390
DROP TABLE t1;
DROP PROCEDURE p1;
connection node_4;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus");
CALL mtr.add_suppression("Failed to apply write set: gtid:");

View File

@@ -0,0 +1,102 @@
connection node_4;
connection node_3;
connection node_2;
connection node_1;
# Correct Galera library found
connection node_1;
connection node_2;
connection node_3;
connection node_4;
connection node_1;
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
CALL p1(130);
connection node_4;
Shutting down server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
SET GLOBAL debug = "+d,sync.wsrep_donor_state";
connection node_4;
Restarting server 4...
connection node_1;
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_donor_state_reached";
Tables on server 1 flushed and locked for SST to server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_donor_state";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
Wait for the state snapshot to be copied to server 4
SST script unlocked server 1
connection node_1;
CALL p1(130);
connection node_3;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
INSERT INTO t2 VALUES (DEFAULT);
SET SESSION wsrep_on = OFF;
connection node_1;
CALL p1(130);
Waiting for server 3 to leave the cluster
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_4;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
Server 3 left the cluster, killing it...
Killed server 3.
Restarting server 3...
Waiting for server 3 to rejoin the cluster
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
sleeping for 20
Waiting ready
Server 3 restarted.
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SELECT count(*) AS expect1_390 FROM t1;
expect1_390
390
connection node_2;
SELECT count(*) AS expect2_390 FROM t1;
expect2_390
390
connection node_3;
SELECT count(*) AS expect3_390 FROM t1;
expect3_390
390
connection node_4;
SELECT count(*) AS expect4_390 FROM t1;
expect4_390
390
DROP TABLE t1;
DROP PROCEDURE p1;
connection node_1;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
connection node_2;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
connection node_3;
CALL mtr.add_suppression("Vote 0 \\(success\\) on .+ is inconsistent with group");
connection node_4;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");

View File

@@ -0,0 +1,20 @@
!include ../galera_4nodes.cnf
[mysqld]
wsrep-ignore-apply-errors=0
[mysqld.1]
wsrep_node_name='node_1'
[mysqld.2]
wsrep_node_name='node_2'
[mysqld.3]
wsrep_node_name='node_3'
[mysqld.4]
wsrep_node_name='node_4'
wsrep_sst_donor='node_1'
[ENV]
galera_cluster_size=4

View File

@@ -0,0 +1,165 @@
#
# Test a case where a joiner encounters an error during IST
# Instead of voting it should assume error and bail out.
#
--source include/galera_cluster.inc
--source include/big_test.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
# Make sure that the test is operating on the right version of galera library.
--let $galera_version=26.4.19
source ../wsrep/include/check_galera_version.inc;
--let $node_1=node_1
--let $node_2=node_2
--let $node_3=node_3
--let $node_4=node_4
--source ../include/auto_increment_offset_save.inc
# create table t1 and procedure p1 to generate wirtesets
--connection node_1
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
DELIMITER |;
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
DELIMITER ;|
CALL p1(130);
--connection node_4
--echo Shutting down server 4...
--let $node_4_server_id= `SELECT @@server_id`
--let $node_4_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$node_4_server_id.expect
--let $node_4_pid_file= `SELECT @@pid_file`
--source include/shutdown_mysqld.inc
# Wait for node #4 to leave cluster
--let $members = 3
--connection node_1
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_3
--source include/wsrep_wait_membership.inc
--echo Server 4 left the cluster
# Create some writesets for IST
--connection node_1
CALL p1(130);
# Create a writeset that node 4 won't be able to apply by creating a table
# that won't be present in the replication stream
--connection node_1
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_2
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_3
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
# This should cause error during IST
INSERT INTO t2 VALUES (DEFAULT);
# make sure nodes 1,2,3 progress far enough for commit cut update
CALL p1(130);
--connection node_1
# prepare to stop SST donor thread when it receives a request from starting node #4
SET GLOBAL debug = "+d,sync.wsrep_sst_donor_after_donation";
--echo Restarting server 4
# Need to use this form instead of start_mysqld.inc because the latter is blocking
--exec echo "restart:$start_mysqld_params" > $node_4_expect_file_name
--echo Wait for server 1 to become a donor
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_sst_donor_after_donation_reached";
--echo Server 1 got SST request from server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_sst_donor_after_donation_continue";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
#
# After this point node #4 shall proceed to IST and bail out
#
--echo Waiting for server 4 to leave the cluster
--let $members = 3
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_3
--source include/wsrep_wait_membership.inc
--connection node_4
--echo Server 4 left the cluster, killing it...
# Kill the connected server
--exec echo "wait" > $node_4_expect_file_name
--let KILL_NODE_PIDFILE = $node_4_pid_file
--perl
my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
system("kill -9 $mysqld_pid");
exit(0);
EOF
--echo Killed server 4...
--source include/wait_until_disconnected.inc
--echo Restarting server 4...
--source include/start_mysqld.inc
--source include/galera_wait_ready.inc
# Confirm node #4 has rejoined
--connection node_1
--let $members = 4
--source include/wsrep_wait_membership.inc
# Confirm that all is good and all nodes have identical data
--connection node_1
SELECT count(*) AS expect1_390 FROM t1;
SELECT count(*) AS expect1_1 FROM t2;
--connection node_2
SELECT count(*) AS expect2_390 FROM t1;
SELECT count(*) AS expect2_1 FROM t2;
--connection node_3
SELECT count(*) AS expect3_390 FROM t1;
SELECT count(*) AS expect3_1 FROM t2;
--connection node_4
SELECT count(*) AS expect4_390 FROM t1;
SELECT count(*) AS expect4_1 FROM t2;
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Failed on preordered");
CALL mtr.add_suppression("Failed to apply write set");
CALL mtr.add_suppression("Sending JOIN failed: -103");
CALL mtr.add_suppression("Failed to JOIN the cluster after SST");
--source ../include/auto_increment_offset_restore.inc

View File

@@ -0,0 +1,21 @@
!include ../galera_4nodes.cnf
[mysqld]
wsrep-ignore-apply-errors=0
[mysqld.1]
wsrep_node_name='node_1'
[mysqld.2]
wsrep_node_name='node_2'
[mysqld.3]
wsrep_node_name='node_3'
[mysqld.4]
wsrep_node_name='node_4'
wsrep_sst_donor='node_1'
[ENV]
galera_cluster_size=4
MTR_SST_JOINER_DELAY=20

View File

@@ -0,0 +1,73 @@
#
# Test a case where a vote happens in JOINED state after SST on a writeset
# that should be applied.
#
--source galera_vote_joined_begin.inc
#
# At this point state snapshot has been copied, node 1 is operational and
# we have about 10 seconds while everything we do will go into the replication
# queue on node 4 which it will have to apply on top of the snapshot.
#
# Increase replication queue on node_4
--connection node_1
CALL p1(130);
# Create a writeset that node 4 won't be able to apply by creating a table
# that won't be present in the replication stream
--connection node_1
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_2
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_3
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
# This should cause node #4 to initiate a vote and leave the cluster
INSERT INTO t2 VALUES (DEFAULT);
# make sure nodes 1,2,3 progress far enough for commit cut update
CALL p1(130);
--echo Waiting for server 4 to leave the cluster
--let $members = 3
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_1
--source include/wsrep_wait_membership.inc
--connection node_4
--echo Server 4 left the cluster, killing it...
# Kill the connected server
--exec echo "wait" > $node_4_expect_file_name
--let KILL_NODE_PIDFILE = $node_4_pid_file
--perl
my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
system("kill -9 $mysqld_pid");
exit(0);
EOF
--echo Killed server 4...
--source include/wait_until_disconnected.inc
--echo Restarting server 4...
--source include/start_mysqld.inc
--source include/galera_wait_ready.inc
DROP TABLE t2;
--source galera_vote_joined_end.inc
--connection node_4
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus");
CALL mtr.add_suppression("Failed to apply write set: gtid:");

View File

@@ -0,0 +1,79 @@
# This file purpose is to set up node 4 to require SST which is artificaially
# prolonged and as a result accumulate sufficient relication queue.
# The contents of the qeuee are controlled in the sourcing test files.
--source include/galera_cluster.inc
--source include/big_test.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
# Make sure that the test is operating on the right version of galera library.
--let $galera_version=26.4.19
source ../wsrep/include/check_galera_version.inc;
--let $node_1=node_1
--let $node_2=node_2
--let $node_3=node_3
--let $node_4=node_4
--source ../include/auto_increment_offset_save.inc
# create table t1 and procedure p1 to generate wirtesets
--connection node_1
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
DELIMITER |;
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
DELIMITER ;|
# 130 events move the commit cut, it is essential in voting
CALL p1(130);
--connection node_4
--echo Shutting down server 4...
--let $node_4_server_id= `SELECT @@server_id`
--let $node_4_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$node_4_server_id.expect
--let $node_4_pid_file= `SELECT @@pid_file`
--source include/shutdown_mysqld.inc
# enforce SST
--exec rm -rf $MYSQLTEST_VARDIR/mysqld.4/data/grastate.dat
# Wait for node #4 to leave cluster
--connection node_1
--let $members = 3
--source include/wsrep_wait_membership.inc
# prepare to stop SST donor thread when node is in donor state
SET GLOBAL debug = "+d,sync.wsrep_donor_state";
--connection node_4
--echo Restarting server 4...
# Need to use this form instead of start_mysqld.inc because the latter is blocking
--exec echo "restart:$start_mysqld_params" > $node_4_expect_file_name
# Wait for node #1 to become a donor
--connection node_1
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_donor_state_reached";
--echo Tables on server 1 flushed and locked for SST to server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_donor_state";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
--echo Wait for the state snapshot to be copied to server 4
--source include/galera_wait_ready.inc
--echo SST script unlocked server 1
#
# At this point state snapshot has been copied, node 1 is operational and
# we have about 20 seconds while everything we do will go into the replication
# queue on node 4 which it will have to apply on top of the snapshot.
#

View File

@@ -0,0 +1,33 @@
# Confirm node #4 has rejoined
--connection node_1
--let $members = 4
--source include/wsrep_wait_membership.inc
#DROP TABLE IF EXISTS t2;
# Confirm that all is good and all nodes have identical data
--connection node_1
SELECT count(*) AS expect1_390 FROM t1;
#CALL mtr.add_suppression("Replica SQL: Could not execute Delete_rows");
#CALL mtr.add_suppression("Event 3 Delete_rows apply failed: 120, seqno [0-9]+");
--connection node_2
SELECT count(*) AS expect2_390 FROM t1;
#CALL mtr.add_suppression("mysqld: Can't find record in 't1'");
#CALL mtr.add_suppression("Replica SQL: Could not execute Delete_rows");
#CALL mtr.add_suppression("Event 3 Delete_rows apply failed: 120, seqno seqno [0-9]+");
--connection node_3
SELECT count(*) AS expect3_390 FROM t1;
--connection node_4
SELECT count(*) AS expect4_390 FROM t1;
DROP TABLE t1;
DROP PROCEDURE p1;
#CALL mtr.add_suppression("inconsistent with group");
--source ../include/auto_increment_offset_restore.inc

View File

@@ -0,0 +1,21 @@
!include ../galera_4nodes.cnf
[mysqld]
wsrep-ignore-apply-errors=0
[mysqld.1]
wsrep_node_name='node_1'
[mysqld.2]
wsrep_node_name='node_2'
[mysqld.3]
wsrep_node_name='node_3'
[mysqld.4]
wsrep_node_name='node_4'
wsrep_sst_donor='node_1'
[ENV]
galera_cluster_size=4
MTR_SST_JOINER_DELAY=20

View File

@@ -0,0 +1,100 @@
#
# Test a case where a vote happens in JOINED state after SST on a writeset
# that should be skipped. I.e. JOINED node should continue operation.
#
--source galera_vote_joined_begin.inc
#
# At this point state snapshot has been copied, node 1 is operational and
# we have about 10 seconds while everything we do will go into the replication
# queue on node 4 which it will have to apply on top of the snapshot.
#
# Increase replication queue on node_4
--connection node_1
CALL p1(130);
#
# Create a writeset that node 4 won't be able to apply by making node 3
# inconsisitent
#
--connection node_3
--let $node_3_server_id= `SELECT @@server_id`
--let $node_3_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$node_3_server_id.expect
--let $node_3_pid_file= `SELECT @@pid_file`
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
# This should cause nodes #1 and #2 to initiate a vote and kick node #3
# out of the cluster, node #4 should recover the vote when fails to apply
# the event and continue
INSERT INTO t2 VALUES (DEFAULT);
SET SESSION wsrep_on = OFF;
# make sure nodes 1,2 progress far enough for commit cut update
--connection node_1
CALL p1(130);
--let $members = 3
--echo Waiting for server 3 to leave the cluster
--connection node_1
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_4
# need to wait for extra SST delay on joiner
--sleep $MTR_SST_JOINER_DELAY
--sleep $MTR_SST_JOINER_DELAY
--enable_reconnect
--let $wait_timeout = 60
--source include/wsrep_wait_membership.inc
--connection node_3
--echo Server 3 left the cluster, killing it...
# Kill the connected server
--exec echo "wait" > $node_3_expect_file_name
--let KILL_NODE_PIDFILE = $node_3_pid_file
--perl
my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
system("kill -9 $mysqld_pid");
exit(0);
EOF
--echo Killed server 3.
--source include/wait_until_disconnected.inc
--echo Restarting server 3...
--exec echo "restart:$start_mysqld_params" > $node_3_expect_file_name
--echo Waiting for server 3 to rejoin the cluster
--connection node_1
--let $members = 3
--source include/wsrep_wait_membership.inc
--connection node_3
--echo sleeping for $MTR_SST_JOINER_DELAY
# need to wait for extra SST delay on joiner
--sleep $MTR_SST_JOINER_DELAY
--sleep $MTR_SST_JOINER_DELAY
--echo Waiting ready
--enable_reconnect
--source include/galera_wait_ready.inc
--echo Server 3 restarted.
--source galera_vote_joined_end.inc
--connection node_1
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
--connection node_2
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
--connection node_3
CALL mtr.add_suppression("Vote 0 \\(success\\) on .+ is inconsistent with group");
--connection node_4
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");

View File

@@ -77,6 +77,8 @@ select @@gtid_binlog_state;
--echo cluster 2 node 1
--connection node_4
--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (2, 21, 1);
select @@gtid_binlog_state;
@@ -85,11 +87,16 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 2
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (1, 12, 3);
select @@gtid_binlog_state;
@@ -99,10 +106,14 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 3
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (1, 13, 4);
select @@gtid_binlog_state;
@@ -112,10 +123,14 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 2 node 2
--connection node_5
--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (2, 22, 2);
select @@gtid_binlog_state;
@@ -125,37 +140,55 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 2 node 3
--connection node_6
--let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (2, 23, 3);
select @@gtid_binlog_state;
--echo #wait for sync cluster 2 and 1
--connection node_4
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo # check other nodes are consistent
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_5
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_6
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 1
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
drop table t1;
stop slave;
@@ -250,6 +283,8 @@ select @@gtid_binlog_state;
--sleep 2
--echo cluster 2 node 1
--connection node_4
--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1;
--source include/wait_condition.inc
insert into t1 values (2, 21, 1);
select @@gtid_binlog_state;
@@ -258,11 +293,16 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 2
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (1, 12, 3);
select @@gtid_binlog_state;
@@ -272,10 +312,14 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 3
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (1, 13, 4);
select @@gtid_binlog_state;
@@ -285,10 +329,14 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 2 node 2
--connection node_5
--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (2, 22, 2);
select @@gtid_binlog_state;
@@ -298,10 +346,14 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 2 node 3
--connection node_6
--let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (2, 23, 3);
select @@gtid_binlog_state;
@@ -311,24 +363,36 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo # check other nodes are consistent
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_5
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_6
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 1
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
drop table t1;
stop slave;

View File

@@ -155,7 +155,6 @@ INSERT INTO parent SET a=0;
FLUSH TABLES;
# restart
disconnect incomplete;
SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent = 0;
INSERT INTO child SET a=0;
INSERT INTO child SET a=1;
@@ -1182,6 +1181,25 @@ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fail
ALTER TABLE t2 ADD KEY(b), ALGORITHM=NOCOPY;
DELETE FROM t1;
DROP TABLE t2, t1;
#
# MDEV-33167 ASAN errors after failing to load foreign key
# relation for the table
#
call mtr.add_suppression("InnoDB: Load table `test`.`t3` failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again.");
SET STATEMENT FOREIGN_KEY_CHECKS = 0 FOR
CREATE TABLE t1(f1 VARCHAR(8),
FOREIGN KEY(f1) REFERENCES test.t3(f1))ENGINE=InnoDB;
SET STATEMENT FOREIGN_KEY_CHECKS = 0 FOR
CREATE TABLE t2(f1 VARCHAR(8),
FOREIGN KEY(f1) REFERENCES test.t3(f1))
ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
SET STATEMENT FOREIGN_KEY_CHECKS = 0 FOR
CREATE TABLE t3(f1 VARCHAR(8) PRIMARY KEY)
ENGINE=InnoDB DEFAULT CHARSET=latin1;
set GLOBAL innodb_fast_shutdown=0;
# restart
ALTER TABLE t2 FORCE;
DROP TABLE t2, t1, t3;
# End of 10.6 tests
CREATE TABLE t1
(
@@ -1204,5 +1222,4 @@ ALTER TABLE t2 ADD FOREIGN KEY (f2) REFERENCES t2 (f2),
ADD UNIQUE INDEX(f3);
ERROR HY000: Cannot delete rows from table which is parent in a foreign key constraint 't1_ibfk_1' of table 't1'
drop table t1, t2;
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
# End of 10.11 tests

View File

@@ -1,10 +1,11 @@
SET @save_innodb_timeout=@@innodb_lock_wait_timeout;
SET GLOBAL innodb_lock_wait_timeout=1;
set session transaction isolation level read committed;
create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key
(what, id)) engine=innodb;
insert into innodb_bug52663 values ('total', 0, 0);
begin;
connect addconroot, localhost, root,,;
connection addconroot;
set session transaction isolation level read committed;
begin;
connection default;
@@ -31,3 +32,4 @@ select * from innodb_bug52663;
what id count
total 0 2
drop table innodb_bug52663;
SET GLOBAL innodb_lock_wait_timeout=@save_innodb_timeout;

View File

@@ -1,8 +1,9 @@
@@ -527,6 +527,6 @@
@@ -576,7 +576,7 @@
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
-37
+38
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
# End of 10.6 tests
CREATE TABLE t1(f1 INT, f2 TEXT)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 'a');
ALTER TABLE t1 ADD COLUMN f3 TEXT FIRST;

View File

@@ -575,5 +575,16 @@ FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
37
CREATE TABLE t1(f1 INT, f2 TEXT)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 'a');
ALTER TABLE t1 ADD COLUMN f3 TEXT FIRST;
SET STATEMENT DEBUG_DBUG="+d,instant_insert_fail" FOR
ALTER TABLE t1 DROP COLUMN f1;
ERROR HY000: Internal error: InnoDB: Insert into SYS_COLUMNS failed
ALTER TABLE t1 DROP COLUMN f1;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
# End of 10.6 tests

View File

@@ -133,7 +133,6 @@ FLUSH TABLES;
--let $shutdown_timeout=
disconnect incomplete;
SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent = 0;
INSERT INTO child SET a=0;
@@ -1245,6 +1244,33 @@ ALTER TABLE t2 ADD KEY(b), ALGORITHM=NOCOPY;
DELETE FROM t1;
DROP TABLE t2, t1;
--echo #
--echo # MDEV-33167 ASAN errors after failing to load foreign key
--echo # relation for the table
--echo #
call mtr.add_suppression("InnoDB: Load table `test`.`t3` failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again.");
SET STATEMENT FOREIGN_KEY_CHECKS = 0 FOR
CREATE TABLE t1(f1 VARCHAR(8),
FOREIGN KEY(f1) REFERENCES test.t3(f1))ENGINE=InnoDB;
SET STATEMENT FOREIGN_KEY_CHECKS = 0 FOR
CREATE TABLE t2(f1 VARCHAR(8),
FOREIGN KEY(f1) REFERENCES test.t3(f1))
ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
SET STATEMENT FOREIGN_KEY_CHECKS = 0 FOR
CREATE TABLE t3(f1 VARCHAR(8) PRIMARY KEY)
ENGINE=InnoDB DEFAULT CHARSET=latin1;
set GLOBAL innodb_fast_shutdown=0;
--let $shutdown_timeout=
--source include/restart_mysqld.inc
# Error encountered while loading the foreign key
# constraint for t3. t1 wasn't loaded into memory yet
# t2 failed to find index for foreign key relation
ALTER TABLE t2 FORCE;
DROP TABLE t2, t1, t3;
--echo # End of 10.6 tests
CREATE TABLE t1
@@ -1270,7 +1296,5 @@ ALTER TABLE t1 ADD FOREIGN KEY (f1) REFERENCES t2 (f2);
ALTER TABLE t2 ADD FOREIGN KEY (f2) REFERENCES t2 (f2),
ADD UNIQUE INDEX(f3);
drop table t1, t2;
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
--echo # End of 10.11 tests
--source include/wait_until_count_sessions.inc

View File

@@ -1,6 +1,7 @@
--source include/long_test.inc
--source include/have_innodb.inc
SET @save_innodb_timeout=@@innodb_lock_wait_timeout;
SET GLOBAL innodb_lock_wait_timeout=1;
set session transaction isolation level read committed;
create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key
@@ -9,7 +10,6 @@ insert into innodb_bug52663 values ('total', 0, 0);
begin;
connect (addconroot, localhost, root,,);
connection addconroot;
set session transaction isolation level read committed;
begin;
@@ -33,3 +33,4 @@ select * from innodb_bug52663;
connection default;
select * from innodb_bug52663;
drop table innodb_bug52663;
SET GLOBAL innodb_lock_wait_timeout=@save_innodb_timeout;

View File

@@ -657,11 +657,19 @@ DROP TABLE t1;
SET DEBUG_SYNC=RESET;
--echo # End of 10.5 tests
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
CREATE TABLE t1(f1 INT, f2 TEXT)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 'a');
ALTER TABLE t1 ADD COLUMN f3 TEXT FIRST;
--error ER_INTERNAL_ERROR
SET STATEMENT DEBUG_DBUG="+d,instant_insert_fail" FOR
ALTER TABLE t1 DROP COLUMN f1;
ALTER TABLE t1 DROP COLUMN f1;
CHECK TABLE t1;
DROP TABLE t1;
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
--echo # End of 10.6 tests