1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Merge branch '10.5' into '10.6'

This commit is contained in:
Julius Goryavsky
2024-09-01 06:47:32 +02:00
42 changed files with 591 additions and 117 deletions

View File

@@ -1684,7 +1684,8 @@ static struct my_option my_long_options[] =
"if the output is suspended. Doesn't use history file.",
&quick, &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"quick-max-column-width", 0,
"Maximal field length limit in case of --qick", &quick_max_column_width,
"Maximum number of characters displayed in a column header"
" when using --quick", &quick_max_column_width,
&quick_max_column_width, 0, GET_ULONG, REQUIRED_ARG, LONG_MAX, 0, ULONG_MAX,
0, 1, 0},
{"raw", 'r', "Write fields without conversion. Used with --batch.",

View File

@@ -58,5 +58,5 @@ insert into t1 values ("01234", "0123456789", "01234567890123456789", "1");
+-----------+------------+----------------------+------+
drop table t1;
#
# End of 10.7 tests
# End of 10.5 tests
#

View File

@@ -42,5 +42,5 @@ insert into t1 values ("01234", "0123456789", "01234567890123456789", "1");
drop table t1;
--echo #
--echo # End of 10.7 tests
--echo # End of 10.5 tests
--echo #

View File

@@ -5183,4 +5183,14 @@ HAVING (SELECT MAX(b) FROM t1) = a AND a > b;
a b
2 1
DROP TABLE t1;
#
# MDEV-25084: Moving equality with constant right side
# from HAVING to WHERE
# (fixed by the patch for MDEV-26402)
#
CREATE TABLE t1 (a CHAR(3)) CHARSET=sjis;
INSERT INTO t1 VALUES ('foo'),('bar');
SELECT LOAD_FILE('') AS f, a FROM t1 GROUP BY f, a HAVING f = a;
f a
DROP TABLE t1;
End of 10.5 tests

View File

@@ -1588,4 +1588,16 @@ eval $q;
DROP TABLE t1;
--echo #
--echo # MDEV-25084: Moving equality with constant right side
--echo # from HAVING to WHERE
--echo # (fixed by the patch for MDEV-26402)
--echo #
CREATE TABLE t1 (a CHAR(3)) CHARSET=sjis;
INSERT INTO t1 VALUES ('foo'),('bar');
SELECT LOAD_FILE('') AS f, a FROM t1 GROUP BY f, a HAVING f = a;
DROP TABLE t1;
--echo End of 10.5 tests

View File

@@ -10,8 +10,8 @@ if (!$wsrep_recover_additional)
--perl
use strict;
my $wsrep_start_position_str = "grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'";
my $wsrep_start_position = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
my $wsrep_start_position_str = "grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'";
my $wsrep_start_position = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
chomp($wsrep_start_position);
die if $wsrep_start_position eq '';

View File

@@ -0,0 +1,70 @@
connection node_2;
connection node_1;
connection node_1;
SET @@global.wsrep_ignore_apply_errors = 7;
connection node_2;
SET @@global.wsrep_ignore_apply_errors = 7;
connection node_1;
CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY);
connection node_1;
DROP TABLE nonexistent;
ERROR 42S02: Unknown table 'test.nonexistent'
INSERT INTO t1 VALUES (DEFAULT);
connection node_2;
connection node_1;
TRUNCATE TABLE nonexistent;
ERROR 42S02: Table 'test.nonexistent' doesn't exist
INSERT INTO t1 VALUES (DEFAULT);
connection node_2;
connection node_1;
CREATE TABLE nonexistent.t1 (s INT);
ERROR 42000: Unknown database 'nonexistent'
INSERT INTO t1 VALUES (DEFAULT);
connection node_2;
connection node_1;
CREATE TABLE t1 (s INT);
ERROR 42S01: Table 't1' already exists
INSERT INTO t1 VALUES (DEFAULT);
connection node_2;
connection node_1;
ALTER TABLE nonexistent ADD COLUMN (c INT);
ERROR 42S02: Table 'test.nonexistent' doesn't exist
INSERT INTO t1 VALUES (DEFAULT);
connection node_2;
DROP TABLE t1;
connection node_1;
SET @@global.wsrep_ignore_apply_errors = 0;
connection node_2;
SET @@global.wsrep_ignore_apply_errors = 0;
connection node_1;
CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY);
connection node_1;
DROP TABLE nonexistent;
ERROR 42S02: Unknown table 'test.nonexistent'
INSERT INTO t1 VALUES (DEFAULT);
connection node_2;
connection node_1;
TRUNCATE TABLE nonexistent;
ERROR 42S02: Table 'test.nonexistent' doesn't exist
INSERT INTO t1 VALUES (DEFAULT);
connection node_2;
connection node_1;
CREATE TABLE nonexistent.t1 (s INT);
ERROR 42000: Unknown database 'nonexistent'
INSERT INTO t1 VALUES (DEFAULT);
connection node_2;
connection node_1;
CREATE TABLE t1 (s INT);
ERROR 42S01: Table 't1' already exists
INSERT INTO t1 VALUES (DEFAULT);
connection node_2;
connection node_1;
ALTER TABLE nonexistent ADD COLUMN (c INT);
ERROR 42S02: Table 'test.nonexistent' doesn't exist
INSERT INTO t1 VALUES (DEFAULT);
connection node_2;
DROP TABLE t1;
connection node_1;
SET @@global.wsrep_ignore_apply_errors = 7;
connection node_2;
SET @@global.wsrep_ignore_apply_errors = 7;

View File

@@ -0,0 +1,27 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_1;
call mtr.add_suppression("WSREP: async IST sender failed to serve.*");
SET @wsrep_provider_options_orig = @@GLOBAL.wsrep_provider_options;
connection node_2;
SET @wsrep_cluster_address_orig = @@GLOBAL.wsrep_cluster_address;
SET GLOBAL WSREP_ON=0;
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
EXPECT_2
2
connection node_1;
SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true';
connection node_2;
Killing server ...
connection node_1;
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options ='pc.ignore_sb=false';

View File

@@ -38,10 +38,10 @@ SELECT COUNT(*) = 1 FROM t1;
--perl
use strict;
my $wsrep_start_position1 = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.1.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
my $wsrep_start_position1 = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.1.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
chomp($wsrep_start_position1);
my $wsrep_start_position2 = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.2.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
my $wsrep_start_position2 = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.2.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
chomp($wsrep_start_position2);
die if $wsrep_start_position1 eq '' || $wsrep_start_position2 eq '';

View File

@@ -1,5 +1,9 @@
!include ../galera_2nodes.cnf
[mysqld]
loose-galera-ssl-upgrade=1
wsrep-debug=1
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem'

View File

@@ -7,6 +7,8 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_ssl_communication.inc
--source include/have_openssl.inc
--source include/force_restart.inc
# Save original auto_increment_offset values.
--let $node_1=node_1

View File

@@ -0,0 +1,54 @@
--connection node_1
CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY);
--connection node_1
--error 1051
DROP TABLE nonexistent;
# Verify cluster is intact
INSERT INTO t1 VALUES (DEFAULT);
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
--connection node_1
--error 1146
TRUNCATE TABLE nonexistent;
# Verify cluster is intact
INSERT INTO t1 VALUES (DEFAULT);
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
--source include/wait_condition.inc
--connection node_1
--error 1049
CREATE TABLE nonexistent.t1 (s INT);
# Verify cluster is intact
INSERT INTO t1 VALUES (DEFAULT);
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
--source include/wait_condition.inc
--connection node_1
--error 1050
CREATE TABLE t1 (s INT);
# Verify cluster is intact
INSERT INTO t1 VALUES (DEFAULT);
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
--source include/wait_condition.inc
--connection node_1
--error 1146
ALTER TABLE nonexistent ADD COLUMN (c INT);
# Verify cluster is intact
INSERT INTO t1 VALUES (DEFAULT);
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
--source include/wait_condition.inc
DROP TABLE t1;

View File

@@ -0,0 +1,34 @@
#
# Test voting on identical DDL errors (error messages should match)
#
--source include/galera_cluster.inc
--source include/have_binlog_format_row.inc
#
# 1. Ignore all DDL errors (avoids voting)
#
--connection node_1
--let $wsrep_ignore_apply_errors_saved1 = `SELECT @@global.wsrep_ignore_apply_errors`
SET @@global.wsrep_ignore_apply_errors = 7;
--connection node_2
--let $wsrep_ignore_apply_errors_saved2 = `SELECT @@global.wsrep_ignore_apply_errors`
SET @@global.wsrep_ignore_apply_errors = 7;
--source galera_vote_ddl.inc
#
# 2. Don't ignore any errors (forces voting)
#
--connection node_1
SET @@global.wsrep_ignore_apply_errors = 0;
--connection node_2
SET @@global.wsrep_ignore_apply_errors = 0;
--source galera_vote_ddl.inc
--connection node_1
--eval SET @@global.wsrep_ignore_apply_errors = $wsrep_ignore_apply_errors_saved1
--connection node_2
--eval SET @@global.wsrep_ignore_apply_errors = $wsrep_ignore_apply_errors_saved2

View File

@@ -0,0 +1,39 @@
--source include/galera_cluster.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_1
call mtr.add_suppression("WSREP: async IST sender failed to serve.*");
SET @wsrep_provider_options_orig = @@GLOBAL.wsrep_provider_options;
--connection node_2
SET @wsrep_cluster_address_orig = @@GLOBAL.wsrep_cluster_address;
SET GLOBAL WSREP_ON=0;
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) AS EXPECT_1 FROM mysql.wsrep_cluster;
SELECT COUNT(*) AS EXPECT_2 FROM mysql.wsrep_cluster_members;
--connection node_1
SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true';
--connection node_2
--source include/kill_galera.inc
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
--connection node_2
--source include/start_mysqld.inc
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SET GLOBAL wsrep_provider_options ='pc.ignore_sb=false';
# Cleanup
--source include/auto_increment_offset_restore.inc

View File

@@ -11,11 +11,6 @@
##############################################################################
galera_2_cluster : MDEV-32631 galera_2_cluster: before_rollback(): Assertion `0' failed
galera_gtid_2_cluster : MDEV-32633 galera_gtid_2_cluster: Assertion `thd->wsrep_next_trx_id() != (0x7fffffffffffffffLL * 2ULL + 1)'
galera_ssl_reload : MDEV-32778 galera_ssl_reload failed with warning message
galera_pc_bootstrap : temporarily disabled at the request of Codership
galera_ipv6_mariabackup_section : temporarily disabled at the request of Codership
# Opensuse/suse/rocky9/rocky84/rhel9/rhel8-ppc64le .. - all same IPv6 isn't configured right or skipping or galera
galera_ipv6_rsync : Can't connect to server on '::1' (115)
galera_ipv6_rsync_section : Can't connect to server on '::1' (115)
GCF-354 : MDEV-25614 Galera test failure on GCF-354
galera_ipv6_rsync : MDEV-34842 Can't connect to server on '::1' (115)
galera_ipv6_rsync_section : MDEV-34842 Can't connect to server on '::1' (115)
galera_ipv6_mariabackup_section : MDEV-34842 Can't connect to server on '::1' (115)

View File

@@ -1,6 +1,9 @@
connection node_2;
connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_1;
connection node_2;
connection node_3;
connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
set wsrep_sync_wait=0;
connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
@@ -44,9 +47,9 @@ connection node_1b;
connection node_1;
connection node_3;
connection node_1;
CALL insert_row('node1', 500);
CALL insert_row('node1', 100);
connection node_3;
CALL insert_row('node3', 500);
CALL insert_row('node3', 100);
CREATE TABLE t2(i int primary key) engine=innodb;
connection node_2;
# Restart node_2
@@ -60,7 +63,7 @@ Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2503
gtid_binlog_pos 1111-1-1703
connection node_2;
# GTID in node2
show variables like 'wsrep_gtid_domain_id';
@@ -68,7 +71,7 @@ Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2503
gtid_binlog_pos 1111-1-1703
connection node_3;
# GTID in node3
show variables like 'wsrep_gtid_domain_id';
@@ -76,7 +79,7 @@ Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2503
gtid_binlog_pos 1111-1-1703
# Shutdown node_3
connection node_3;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
@@ -98,7 +101,7 @@ Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2554
gtid_binlog_pos 1111-1-1754
connection node_2;
# GTID in node2
show variables like 'wsrep_gtid_domain_id';
@@ -106,7 +109,7 @@ Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2554
gtid_binlog_pos 1111-1-1754
connection node_3;
# GTID in node3
show variables like 'wsrep_gtid_domain_id';
@@ -114,7 +117,7 @@ Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2554
gtid_binlog_pos 1111-1-1754
# One by one shutdown all nodes
connection node_3;
# shutdown node_3
@@ -132,7 +135,7 @@ Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2554
gtid_binlog_pos 1111-1-1754
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
@@ -163,7 +166,7 @@ Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2756
gtid_binlog_pos 1111-1-1956
connection node_2;
node2 GTID
show variables like 'wsrep_gtid_domain_id';
@@ -171,7 +174,7 @@ Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2756
gtid_binlog_pos 1111-1-1956
connection node_3;
node3 GTID
show variables like 'wsrep_gtid_domain_id';
@@ -179,22 +182,22 @@ Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2756
gtid_binlog_pos 1111-1-1956
connection node_1;
table size in node1
SELECT COUNT(*) FROM t1;
COUNT(*)
2750
1950
connection node_2;
table size in node2
SELECT COUNT(*) FROM t1;
COUNT(*)
2750
1950
connection node_3;
table size in node3
SELECT COUNT(*) FROM t1;
COUNT(*)
2750
1950
connection node_2;
call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node");
call mtr.add_suppression("Sending JOIN failed: ");

View File

@@ -7,8 +7,9 @@ connection node_3;
SET SESSION wsrep_on=OFF;
DROP SCHEMA test;
connection node_1;
SET SESSION lc_messages='fr_FR';
CREATE SCHEMA test;
ERROR HY000: Can't create database 'test'; database exists
ERROR HY000: Ne peut cr<63>er la base 'test'; elle existe d<>j<EFBFBD>
connection node_1;
SET SESSION wsrep_sync_wait=0;
connection node_2;

View File

@@ -1,38 +1,31 @@
!include ../galera_3nodes.cnf
[mysqld]
loose-galera-gtid-consistency=1
wsrep_sst_auth="root:"
wsrep_sst_method=mariabackup
log_slave_updates=ON
log_bin=mariadb-bin-log
binlog-format=row
wsrep-gtid-mode=ON
wsrep-debug=1
gtid-strict-mode=1
[mysqld.1]
wsrep-node-name="node1"
wsrep_gtid_domain_id=1111
gtid_domain_id=2
server_id=10999
wsrep_sst_auth="root:"
wsrep_sst_method=mariabackup
log_slave_updates=ON
log_bin=mariadb-bin-log
binlog-format=row
wsrep-gtid-mode=ON
wsrep_gtid_domain_id=1111
[mysqld.2]
wsrep-node-name="node2"
wsrep_gtid_domain_id=1112
gtid_domain_id=3
wsrep_sst_auth="root:"
wsrep_sst_method=mariabackup
log_slave_updates=ON
log_bin=mariadb-bin-log
binlog-format=row
wsrep-gtid-mode=ON
wsrep_gtid_domain_id=1112
[mysqld.3]
wsrep-node-name="node3"
wsrep_gtid_domain_id=1113
gtid_domain_id=4
wsrep_sst_auth="root:"
wsrep_sst_method=mariabackup
log_slave_updates=ON
log_bin=mariadb-bin-log
binlog-format=row
wsrep-gtid-mode=ON
wsrep_gtid_domain_id=1113
[sst]
transferfmt=@ENV.MTR_GALERA_TFMT

View File

@@ -2,7 +2,6 @@
--source include/big_test.inc
--source include/force_restart.inc
#
# Testing gtid consistency in 3 node cluster when nodes drop
# and join back to cluster.
@@ -13,6 +12,13 @@
# from the bootstrap node (node_1), and use it
#
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--let $node_3=node_3
--source ../galera/include/auto_increment_offset_save.inc
--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2
set wsrep_sync_wait=0;
--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1
@@ -98,10 +104,10 @@ show variables like '%gtid_binlog_pos%';
# while node 2 is absent
#
--connection node_1
CALL insert_row('node1', 500);
CALL insert_row('node1', 100);
--connection node_3
CALL insert_row('node3', 500);
CALL insert_row('node3', 100);
CREATE TABLE t2(i int primary key) engine=innodb;
@@ -225,12 +231,19 @@ show variables like '%gtid_binlog_pos%';
# bootstap cluster in order node1 - node2 - node3
# send some inserts and DDL after each node started
#
--sleep 5
--echo # Bootstrap from node_1
--connection node_1
--let $restart_parameters = --wsrep_new_cluster
--source include/start_mysqld.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'
--source include/wait_condition.inc
show variables like 'wsrep_gtid_domain_id';
show variables like '%gtid_binlog_pos%';
@@ -243,6 +256,13 @@ ANALYZE TABLE t2;
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'
--source include/wait_condition.inc
#
# connection node_1b may not be functional anymore, after node was
# shutdown, open node_1c for controlling node 1 state
@@ -265,6 +285,14 @@ ALTER TABLE t2 ADD COLUMN (k int);
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
--source include/start_mysqld.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'
--source include/wait_condition.inc
--connection node_1c
--echo # wait until all nodes are back in cluster
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
@@ -335,12 +363,16 @@ DROP TABLE t2;
DROP TABLE t3;
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't3'
--source include/wait_condition.inc
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't3'
--source include/wait_condition.inc
# Restore original auto_increment_offset values.
--let $galera_cluster_size=3
--source ../galera/include/auto_increment_offset_restore.inc
--disconnect node_3
--disconnect node_2b
--disconnect node_1b

View File

@@ -24,6 +24,9 @@ DROP SCHEMA test;
# This should fail on nodes 1 and 2 and succeed on node 3
--connection node_1
# Make error message on source node different by changing locale
# It should still agree with node 2
SET SESSION lc_messages='fr_FR';
--error ER_DB_CREATE_EXISTS
CREATE SCHEMA test;

View File

@@ -0,0 +1,38 @@
SET SESSION wsrep_osu_method=RSU;
SET autocommit=0;
CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2;
INSERT INTO t VALUES (1);
INSERT INTO t SELECT 1 ;
COMMIT;
SELECT * FROM t;
c
1
1
DROP TABLE t;
SET autocommit=1;
SET SESSION wsrep_osu_method=RSU;
CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2;
INSERT INTO t SELECT 1 ;
SELECT * FROM t;
c
1
DROP TABLE t;
SET autocommit=1;
SET SESSION wsrep_osu_method=RSU;
CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2;
INSERT INTO t SELECT 1 ;
ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine'
SELECT * FROM t;
c
DROP TABLE t;
SET SESSION wsrep_osu_method=RSU;
SET autocommit=0;
CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2;
INSERT INTO t VALUES (1);
INSERT INTO t SELECT 1 ;
ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine'
COMMIT;
SELECT * FROM t;
c
1
DROP TABLE t;

View File

@@ -0,0 +1,9 @@
!include ../my.cnf
[mysqld.1]
wsrep-on=ON
binlog-format=ROW
innodb-flush-log-at-trx-commit=1
wsrep-cluster-address=gcomm://
wsrep-provider=@ENV.WSREP_PROVIDER
innodb-autoinc-lock-mode=2

View File

@@ -0,0 +1,4 @@
[binlogon]
log-bin
[binlogoff]

View File

@@ -0,0 +1,49 @@
--source include/have_wsrep.inc
--source include/have_innodb.inc
--source include/have_wsrep_provider.inc
--source include/have_partition.inc
#
# MDEV-33997: Assertion `((WSREP_PROVIDER_EXISTS_ && this->variables.wsrep_on) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()' failed in int THD::binlog_write_row(TABLE*, bool, const uchar*)
#
SET SESSION wsrep_osu_method=RSU;
SET autocommit=0;
CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2;
INSERT INTO t VALUES (1);
INSERT INTO t SELECT 1 ;
COMMIT;
SELECT * FROM t;
DROP TABLE t;
#
# MDEV-27296 : Assertion `((thd && (WSREP_PROVIDER_EXISTS_ && thd->variables.wsrep_on)) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()' failed
# Second test case
#
SET autocommit=1;
SET SESSION wsrep_osu_method=RSU;
CREATE TABLE t (c INT) ENGINE=INNODB PARTITION BY KEY(c) PARTITIONS 2;
INSERT INTO t SELECT 1 ;
SELECT * FROM t;
DROP TABLE t;
#
# We should not allow RSU for MyISAM
#
SET autocommit=1;
SET SESSION wsrep_osu_method=RSU;
CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2;
--error ER_NOT_SUPPORTED_YET
INSERT INTO t SELECT 1 ;
SELECT * FROM t;
DROP TABLE t;
SET SESSION wsrep_osu_method=RSU;
SET autocommit=0;
CREATE TABLE t (c INT) ENGINE=MYISAM PARTITION BY KEY(c) PARTITIONS 2;
INSERT INTO t VALUES (1);
--error ER_NOT_SUPPORTED_YET
INSERT INTO t SELECT 1 ;
COMMIT;
SELECT * FROM t;
DROP TABLE t;

View File

@@ -18,7 +18,7 @@
--perl
use strict;
my $wsrep_start_position = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
my $wsrep_start_position = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
chomp($wsrep_start_position);
die if $wsrep_start_position eq '';
open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die;

View File

@@ -81,10 +81,10 @@ wsrep_recover_position() {
# Parse server's error log for recovered position. The server prints
# "..skipping position recovery.." if started without wsrep.
recovered_pos="$(grep 'WSREP: Recovered position:' $log_file)"
recovered_pos="$(grep -a 'WSREP: Recovered position:' $log_file)"
if [ -z "$recovered_pos" ]; then
skipped="$(grep WSREP $log_file | grep 'skipping position recovery')"
skipped="$(grep -a WSREP $log_file | grep 'skipping position recovery')"
if [ -z "$skipped" ]; then
log "WSREP: Failed to recover position: '`cat $log_file`'"
exit 1

View File

@@ -260,9 +260,9 @@ wsrep_recover_position() {
exit 1
fi
local rp="$(grep 'WSREP: Recovered position:' $wr_logfile)"
local rp="$(grep -a 'WSREP: Recovered position:' $wr_logfile)"
if [ -z "$rp" ]; then
local skipped="$(grep WSREP $wr_logfile | grep 'skipping position recovery')"
local skipped="$(grep -a WSREP $wr_logfile | grep 'skipping position recovery')"
if [ -z "$skipped" ]; then
log_error "WSREP: Failed to recover position: '`cat $wr_logfile`'"
ret=1

View File

@@ -5606,13 +5606,15 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
#ifdef WITH_WSREP
if (WSREP(thd))
{
WSREP_WARN("BF applier failed to open_and_lock_tables: %u, fatal: %d "
WSREP_WARN("BF applier thread=%lu failed to open_and_lock_tables for "
"%s, fatal: %d "
"wsrep = (exec_mode: %d conflict_state: %d seqno: %lld)",
thd->get_stmt_da()->sql_errno(),
thd->is_fatal_error,
thd->wsrep_cs().mode(),
thd->wsrep_trx().state(),
(long long) wsrep_thd_trx_seqno(thd));
thd_get_thread_id(thd),
thd->get_stmt_da()->message(),
thd->is_fatal_error,
thd->wsrep_cs().mode(),
thd->wsrep_trx().state(),
wsrep_thd_trx_seqno(thd));
}
#endif /* WITH_WSREP */
if (thd->is_error() &&

View File

@@ -25,6 +25,10 @@
#include "my_stacktrace.h"
#include <source_revision.h>
#ifdef WITH_WSREP
#include "wsrep_server_state.h"
#endif /* WITH_WSREP */
#ifdef _WIN32
#include <crtdbg.h>
#include <direct.h>
@@ -222,6 +226,10 @@ extern "C" sig_handler handle_fatal_signal(int sig)
"the equation.\n\n");
}
#ifdef WITH_WSREP
Wsrep_server_state::handle_fatal_signal();
#endif /* WITH_WSREP */
#ifdef HAVE_STACKTRACE
thd= current_thd;

View File

@@ -4705,29 +4705,36 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
#ifdef WITH_WSREP
if (wsrep && !first_table->view)
{
bool is_innodb= first_table->table->file->partition_ht()->db_type == DB_TYPE_INNODB;
// For consistency check inserted table needs to be InnoDB
if (!is_innodb && thd->wsrep_consistency_check != NO_CONSISTENCY_CHECK)
const legacy_db_type db_type= first_table->table->file->partition_ht()->db_type;
// For InnoDB we don't need to worry about anything here:
if (db_type != DB_TYPE_INNODB)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
"Galera cluster does support consistency check only"
" for InnoDB tables.");
thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK;
}
// For !InnoDB we start TOI if it is not yet started and hope for the best
if (!is_innodb && !wsrep_toi)
{
const legacy_db_type db_type= first_table->table->file->partition_ht()->db_type;
/* Currently we support TOI for MyISAM only. */
if (db_type == DB_TYPE_MYISAM && wsrep_replicate_myisam)
WSREP_TO_ISOLATION_BEGIN(first_table->db.str, first_table->table_name.str, NULL);
// For consistency check inserted table needs to be InnoDB
if (thd->wsrep_consistency_check != NO_CONSISTENCY_CHECK)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
"Galera cluster does support consistency check only"
" for InnoDB tables.");
thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK;
}
/* Only TOI allowed to !InnoDB tables */
if (wsrep_OSU_method_get(thd) != WSREP_OSU_TOI)
{
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "RSU on this table engine");
break;
}
// For !InnoDB we start TOI if it is not yet started and hope for the best
if (!wsrep_toi)
{
/* Currently we support TOI for MyISAM only. */
if (db_type == DB_TYPE_MYISAM && wsrep_replicate_myisam)
WSREP_TO_ISOLATION_BEGIN(first_table->db.str, first_table->table_name.str, NULL);
}
}
}
#endif /* WITH_WSREP */
/*
Only the INSERT table should be merged. Other will be handled by
select.

View File

@@ -280,17 +280,6 @@ const char *fn_frm_ext(const char *name)
TABLE_CATEGORY get_table_category(const Lex_ident_db &db,
const Lex_ident_table &name)
{
#ifdef WITH_WSREP
if (db.str && db.streq(MYSQL_SCHEMA_NAME))
{
if (name.streq(Lex_ident_table{STRING_WITH_LEN(WSREP_STREAMING_TABLE)}) ||
name.streq(Lex_ident_table{STRING_WITH_LEN(WSREP_CLUSTER_TABLE)}) ||
name.streq(Lex_ident_table{STRING_WITH_LEN(WSREP_MEMBERS_TABLE)}))
{
return TABLE_CATEGORY_INFORMATION;
}
}
#endif /* WITH_WSREP */
if (is_infoschema_db(&db))
return TABLE_CATEGORY_INFORMATION;
@@ -312,6 +301,18 @@ TABLE_CATEGORY get_table_category(const Lex_ident_db &db,
return TABLE_CATEGORY_LOG;
}
#ifdef WITH_WSREP
if (db.streq(WSREP_LEX_SCHEMA))
{
if(name.streq(WSREP_LEX_STREAMING))
return TABLE_CATEGORY_INFORMATION;
if (name.streq(WSREP_LEX_CLUSTER))
return TABLE_CATEGORY_INFORMATION;
if (name.streq(WSREP_LEX_MEMBERS))
return TABLE_CATEGORY_INFORMATION;
}
#endif /* WITH_WSREP */
return TABLE_CATEGORY_USER;
}

View File

@@ -82,7 +82,9 @@ wsrep_get_apply_format(THD* thd)
return thd->wsrep_rgi->rli->relay_log.description_event_for_exec;
}
void wsrep_store_error(const THD* const thd, wsrep::mutable_buffer& dst)
void wsrep_store_error(const THD* const thd,
wsrep::mutable_buffer& dst,
bool const include_msg)
{
Diagnostics_area::Sql_condition_iterator it=
thd->get_stmt_da()->sql_conditions();
@@ -100,8 +102,16 @@ void wsrep_store_error(const THD* const thd, wsrep::mutable_buffer& dst)
uint const err_code= cond->get_sql_errno();
const char* const err_str= cond->get_message_text();
slider+= my_snprintf(slider, buf_end - slider, " %s, Error_code: %d;",
err_str, err_code);
if (include_msg)
{
slider+= snprintf(slider, buf_end - slider, " %s, Error_code: %d;",
err_str, err_code);
}
else
{
slider+= snprintf(slider, buf_end - slider, " Error_code: %d;",
err_code);
}
}
if (slider != dst.data())

View File

@@ -35,7 +35,21 @@ int wsrep_apply_events(THD* thd,
#define WSREP_ERR_FAILED 6 // Operation failed for some internal reason
#define WSREP_ERR_ABORTED 7 // Operation was aborted externally
void wsrep_store_error(const THD* thd, wsrep::mutable_buffer& buf);
/* Loops over THD diagnostic area and concatenates all error messages
* and error codes to a single continuous buffer to create a unique
* but consistent failure signature which provider can use for voting
* between the nodes in the cluster.
*
* @param thd THD context
* @param dst buffer to store the signature
* @param include_msg whether to use MySQL error message in addition to
* MySQL error code. Note that in the case of a TOI
* operation the message may be not consistent between
* the nodes e.g. due to a different client locale setting
* and should be omitted */
void wsrep_store_error(const THD* thd,
wsrep::mutable_buffer& buf,
bool include_msg);
class Format_description_log_event;
void wsrep_set_apply_format(THD*, Format_description_log_event*);

View File

@@ -123,14 +123,15 @@ static void wsrep_setup_uk_and_fk_checks(THD* thd)
static int apply_events(THD* thd,
Relay_log_info* rli,
const wsrep::const_buffer& data,
wsrep::mutable_buffer& err)
wsrep::mutable_buffer& err,
bool const include_msg)
{
int const ret= wsrep_apply_events(thd, rli, data.data(), data.size());
if (ret || wsrep_thd_has_ignored_error(thd))
{
if (ret)
{
wsrep_store_error(thd, err);
wsrep_store_error(thd, err, include_msg);
}
wsrep_dump_rbr_buf_with_header(thd, data.data(), data.size());
}
@@ -427,7 +428,7 @@ int Wsrep_high_priority_service::apply_toi(const wsrep::ws_meta& ws_meta,
#endif
thd->set_time();
int ret= apply_events(thd, m_rli, data, err);
int ret= apply_events(thd, m_rli, data, err, false);
wsrep_thd_set_ignored_error(thd, false);
trans_commit(thd);
@@ -595,7 +596,7 @@ int Wsrep_applier_service::apply_write_set(const wsrep::ws_meta& ws_meta,
#endif /* ENABLED_DEBUG_SYNC */
wsrep_setup_uk_and_fk_checks(thd);
int ret= apply_events(thd, m_rli, data, err);
int ret= apply_events(thd, m_rli, data, err, true);
thd->close_temporary_tables();
if (!ret && !(ws_meta.flags() & wsrep::provider::flag::commit))
@@ -764,7 +765,7 @@ int Wsrep_replayer_service::apply_write_set(const wsrep::ws_meta& ws_meta,
ws_meta,
thd->wsrep_sr().fragments());
}
ret= ret || apply_events(thd, m_rli, data, err);
ret= ret || apply_events(thd, m_rli, data, err, true);
thd->close_temporary_tables();
if (!ret && !(ws_meta.flags() & wsrep::provider::flag::commit))
{

View File

@@ -2829,7 +2829,10 @@ static void wsrep_TOI_end(THD *thd) {
if (thd->is_error() && !wsrep_must_ignore_error(thd))
{
wsrep_store_error(thd, err);
/* use only error code, for the message can be inconsistent
* between the nodes due to differing lc_message settings
* in client session and server applier thread */
wsrep_store_error(thd, err, false);
}
int const ret= client_state.leave_toi_local(err);

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2015-2021 Codership Oy <info@codership.com>
/* Copyright (C) 2015-2023 Codership Oy <info@codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -35,6 +35,16 @@
#include <string>
#include <sstream>
#define WSREP_SCHEMA "mysql"
#define WSREP_STREAMING_TABLE "wsrep_streaming_log"
#define WSREP_CLUSTER_TABLE "wsrep_cluster"
#define WSREP_MEMBERS_TABLE "wsrep_cluster_members"
LEX_CSTRING WSREP_LEX_SCHEMA= {STRING_WITH_LEN(WSREP_SCHEMA)};
LEX_CSTRING WSREP_LEX_STREAMING= {STRING_WITH_LEN(WSREP_STREAMING_TABLE)};
LEX_CSTRING WSREP_LEX_CLUSTER= {STRING_WITH_LEN(WSREP_CLUSTER_TABLE)};
LEX_CSTRING WSREP_LEX_MEMBERS= {STRING_WITH_LEN(WSREP_MEMBERS_TABLE)};
const char* wsrep_sr_table_name_full= WSREP_SCHEMA "/" WSREP_STREAMING_TABLE;
static const std::string wsrep_schema_str= WSREP_SCHEMA;

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2015-2019 Codership Oy <info@codership.com>
/* Copyright (C) 2015-2023 Codership Oy <info@codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -33,11 +33,6 @@ struct TABLE_LIST;
struct st_mysql_lex_string;
typedef struct st_mysql_lex_string LEX_STRING;
#define WSREP_SCHEMA "mysql"
#define WSREP_STREAMING_TABLE "wsrep_streaming_log"
#define WSREP_CLUSTER_TABLE "wsrep_cluster"
#define WSREP_MEMBERS_TABLE "wsrep_cluster_members"
/** Name of the table in `wsrep_schema_str` used for storing streaming
replication data. In an InnoDB full format, e.g. "database/tablename". */
extern const char* wsrep_sr_table_name_full;
@@ -146,4 +141,9 @@ class Wsrep_schema
extern Wsrep_schema* wsrep_schema;
extern LEX_CSTRING WSREP_LEX_SCHEMA;
extern LEX_CSTRING WSREP_LEX_STREAMING;
extern LEX_CSTRING WSREP_LEX_CLUSTER;
extern LEX_CSTRING WSREP_LEX_MEMBERS;
#endif /* !WSREP_SCHEMA_H */

View File

@@ -166,9 +166,16 @@ void Wsrep_server_service::bootstrap()
wsrep_set_SE_checkpoint(wsrep::gtid::undefined(), wsrep_gtid_server.undefined());
}
static std::atomic<bool> suppress_logging{false};
void wsrep_suppress_error_logging() { suppress_logging= true; }
void Wsrep_server_service::log_message(enum wsrep::log::level level,
const char* message)
const char *message)
{
if (suppress_logging.load(std::memory_order_relaxed))
{
return;
}
switch (level)
{
case wsrep::log::debug:

View File

@@ -99,4 +99,8 @@ class Wsrep_storage_service;
Wsrep_storage_service*
wsrep_create_storage_service(THD *orig_thd, const char *ctx);
/**
Suppress all error logging from wsrep/Galera library.
*/
void wsrep_suppress_error_logging();
#endif /* WSREP_SERVER_SERVICE */

View File

@@ -18,6 +18,8 @@
#include "wsrep_server_state.h"
#include "wsrep_binlog.h" /* init/deinit group commit */
#include "my_stacktrace.h" /* my_safe_printf_stderr() */
mysql_mutex_t LOCK_wsrep_server_state;
mysql_cond_t COND_wsrep_server_state;
@@ -82,3 +84,24 @@ void Wsrep_server_state::destroy()
mysql_cond_destroy(&COND_wsrep_server_state);
}
}
void Wsrep_server_state::handle_fatal_signal()
{
if (m_instance)
{
/* Galera background threads are still running and the logging may be
relatively verbose in case of networking error. Silence all wsrep
logging before shutting down networking to avoid garbling signal
handler output. */
my_safe_printf_stderr("WSREP: Suppressing further logging\n");
wsrep_suppress_error_logging();
/* Shut down all communication with other nodes to fail silently. */
my_safe_printf_stderr("WSREP: Shutting down network communications\n");
if (m_instance->provider().set_node_isolation(
wsrep::provider::node_isolation::isolated)) {
my_safe_printf_stderr("WSREP: Galera library does not support node isolation\n");
}
my_safe_printf_stderr("\n");
}
}

View File

@@ -56,6 +56,8 @@ public:
return (get_provider().capabilities() & capability);
}
static void handle_fatal_signal();
private:
Wsrep_server_state(const std::string& name,
const std::string& incoming_address,

View File

@@ -1841,6 +1841,8 @@ wait_signal:
else
{
WSREP_WARN("Received unknown signal: '%s'", out);
/* since it is the end of the loop, we must set error code */
err=-EINVAL;
proc.wait();
}
}