Merge 11.1 into 11.2

This commit is contained in:
Marko Mäkelä 2024-01-05 13:06:56 +02:00
commit f6d21a8855
111 changed files with 1531 additions and 460 deletions
extra/mariabackup
include
mysql-test
include
main
suite
encryption
galera
galera_3nodes
galera_3nodes_sr
galera_sr
innodb
wsrep
scripts
sql

View file

@ -1618,6 +1618,7 @@ ibx_copy_incremental_over_full()
NULL};
const char *sup_files[] = {MB_BINLOG_INFO,
MB_GALERA_INFO,
XTRABACKUP_DONOR_GALERA_INFO,
MB_SLAVE_INFO,
MB_INFO,
XTRABACKUP_BINLOG_INFO,

View file

@ -9,6 +9,7 @@
/* special files, backward compatibility */
#define XTRABACKUP_SLAVE_INFO "xtrabackup_slave_info"
#define XTRABACKUP_GALERA_INFO "xtrabackup_galera_info"
#define XTRABACKUP_DONOR_GALERA_INFO "donor_galera_info"
#define XTRABACKUP_BINLOG_INFO "xtrabackup_binlog_info"
#define XTRABACKUP_INFO "xtrabackup_info"
#define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints"

View file

@ -1360,6 +1360,7 @@ write_galera_info(ds_ctxt *datasink, MYSQL *connection)
{
char *state_uuid = NULL, *state_uuid55 = NULL;
char *last_committed = NULL, *last_committed55 = NULL;
char *domain_id = NULL, *domain_id55 = NULL;
bool result;
mysql_variable status[] = {
@ -1370,6 +1371,12 @@ write_galera_info(ds_ctxt *datasink, MYSQL *connection)
{NULL, NULL}
};
mysql_variable value[] = {
{"Wsrep_gtid_domain_id", &domain_id},
{"wsrep_gtid_domain_id", &domain_id55},
{NULL, NULL}
};
/* When backup locks are supported by the server, we should skip
creating MB_GALERA_INFO file on the backup stage, because
wsrep_local_state_uuid and wsrep_last_committed will be inconsistent
@ -1388,9 +1395,26 @@ write_galera_info(ds_ctxt *datasink, MYSQL *connection)
goto cleanup;
}
read_mysql_variables(connection, "SHOW VARIABLES LIKE 'wsrep%'", value, true);
if (domain_id == NULL && domain_id55 == NULL) {
msg("Warning: failed to get master wsrep state from SHOW VARIABLES.");
result = true;
goto cleanup;
}
result = datasink->backup_file_printf(MB_GALERA_INFO,
"%s:%s\n", state_uuid ? state_uuid : state_uuid55,
last_committed ? last_committed : last_committed55);
"%s:%s %s\n", state_uuid ? state_uuid : state_uuid55,
last_committed ? last_committed : last_committed55,
domain_id ? domain_id : domain_id55);
if (result)
{
result= datasink->backup_file_printf(XTRABACKUP_DONOR_GALERA_INFO,
"%s:%s %s\n", state_uuid ? state_uuid : state_uuid55,
last_committed ? last_committed : last_committed55,
domain_id ? domain_id : domain_id55);
}
if (result)
{
write_current_binlog_file(datasink, connection);

View file

@ -54,6 +54,7 @@ permission notice:
/*! Name of file where Galera info is stored on recovery */
#define XB_GALERA_INFO_FILENAME "xtrabackup_galera_info"
#define MB_GALERA_INFO_FILENAME "mariadb_backup_galera_info"
#define XB_GALERA_DONOR_INFO_FILENAME "donor_galera_info"
/***********************************************************************
Store Galera checkpoint info in the MB_GALERA_INFO_FILENAME file, if that
@ -68,7 +69,7 @@ xb_write_galera_info(bool incremental_prepare)
long long seqno;
MY_STAT statinfo;
/* Do not overwrite existing an existing file to be compatible with
/* Do not overwrite an existing file to be compatible with
servers with older server versions */
if (!incremental_prepare &&
(my_stat(XB_GALERA_INFO_FILENAME, &statinfo, MYF(0)) != NULL ||
@ -103,10 +104,11 @@ xb_write_galera_info(bool incremental_prepare)
seqno = wsrep_xid_seqno(&xid);
msg("mariabackup: Recovered WSREP position: %s:%lld\n",
uuid_str, (long long) seqno);
msg("mariabackup: Recovered WSREP position: %s:%lld domain_id: %lld\n",
uuid_str, (long long) seqno, (long long)wsrep_get_domain_id());
if (fprintf(fp, "%s:%lld", uuid_str, (long long) seqno) < 0) {
if (fprintf(fp, "%s:%lld %lld", uuid_str, (long long) seqno,
(long long)wsrep_get_domain_id()) < 0) {
die(
"could not write to " MB_GALERA_INFO_FILENAME

View file

@ -673,10 +673,10 @@ extern void my_mutex_end(void);
by GCC 12.3.0, GCC 13.2.0, or clang 16.0.6
would fail ./mtr main.1st when the stack size is 5 MiB.
The minimum is more than 6 MiB for CMAKE_BUILD_TYPE=RelWithDebInfo and
more than 8 MiB for CMAKE_BUILD_TYPE=Debug.
more than 10 MiB for CMAKE_BUILD_TYPE=Debug.
Let us add some safety margin.
*/
# define DEFAULT_THREAD_STACK (10L<<20)
# define DEFAULT_THREAD_STACK (11L<<20)
# else
# define DEFAULT_THREAD_STACK (292*1024L) /* 299008 */
# endif

View file

@ -95,6 +95,7 @@ extern struct wsrep_service_st {
void (*wsrep_thd_kill_LOCK_func)(const MYSQL_THD thd);
void (*wsrep_thd_kill_UNLOCK_func)(const MYSQL_THD thd);
void (*wsrep_thd_set_wsrep_PA_unsafe_func)(MYSQL_THD thd);
uint32 (*wsrep_get_domain_id_func)();
} *wsrep_service;
#define MYSQL_SERVICE_WSREP_INCLUDED
@ -144,6 +145,7 @@ extern struct wsrep_service_st {
#define wsrep_thd_set_ignored_error(T,V) wsrep_service->wsrep_thd_set_ignored_error_func(T,V)
#define wsrep_report_bf_lock_wait(T,I) wsrep_service->wsrep_report_bf_lock_wait(T,I)
#define wsrep_thd_set_PA_unsafe(T) wsrep_service->wsrep_thd_set_PA_unsafe_func(T)
#define wsrep_get_domain_id(T) wsrep_service->wsrep_get_domain_id_func(T)
#else
#define MYSQL_SERVICE_WSREP_STATIC_INCLUDED
@ -253,5 +255,6 @@ extern "C" void wsrep_report_bf_lock_wait(const THD *thd,
unsigned long long trx_id);
/* declare parallel applying unsafety for the THD */
extern "C" void wsrep_thd_set_PA_unsafe(MYSQL_THD thd);
extern "C" uint32 wsrep_get_domain_id();
#endif
#endif /* MYSQL_SERVICE_WSREP_INCLUDED */

View file

@ -0,0 +1,5 @@
[rsync]
wsrep-sst-method=rsync
[mariabackup]
wsrep_sst_method=mariabackup

View file

@ -0,0 +1,4 @@
# The goal of including this file is to enable galera_sst_method combinations
# (see include/galera_sst_method.combinations)
--source include/have_innodb.inc

View file

@ -11,3 +11,39 @@ Database Create Database
mysql_TEST CREATE DATABASE `mysql_TEST` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */
DROP DATABASE mysql_test;
DROP DATABASE mysql_TEST;
#
# Start of 10.4 tests
#
#
# MDEV-33019 The database part is not case sensitive in SP names
#
CREATE DATABASE DB1;
CREATE DATABASE db1;
CREATE PROCEDURE DB1.sp() SELECT 'This is DB1.sp' AS ret;
CREATE PROCEDURE db1.sp() SELECT 'This is db1.sp' AS ret;
CALL DB1.sp();
ret
This is DB1.sp
CALL db1.sp();
ret
This is db1.sp
DROP DATABASE DB1;
CALL DB1.sp();
ERROR 42000: PROCEDURE DB1.sp does not exist
CALL db1.sp();
ret
This is db1.sp
DROP DATABASE db1;
CREATE PROCEDURE SP() SELECT 'This is SP' AS ret;
CREATE PROCEDURE sp() SELECT 'This is sp' AS ret;
ERROR 42000: PROCEDURE sp already exists
CALL SP();
ret
This is SP
CALL sp();
ret
This is SP
DROP PROCEDURE SP;
#
# End of 10.4 tests
#

View file

@ -18,3 +18,34 @@ DROP DATABASE mysql_test;
DROP DATABASE mysql_TEST;
# End of 10.0 tests
--echo #
--echo # Start of 10.4 tests
--echo #
--echo #
--echo # MDEV-33019 The database part is not case sensitive in SP names
--echo #
CREATE DATABASE DB1;
CREATE DATABASE db1;
CREATE PROCEDURE DB1.sp() SELECT 'This is DB1.sp' AS ret;
CREATE PROCEDURE db1.sp() SELECT 'This is db1.sp' AS ret;
CALL DB1.sp();
CALL db1.sp();
DROP DATABASE DB1;
--error ER_SP_DOES_NOT_EXIST
CALL DB1.sp();
CALL db1.sp();
DROP DATABASE db1;
CREATE PROCEDURE SP() SELECT 'This is SP' AS ret;
--error ER_SP_ALREADY_EXISTS
CREATE PROCEDURE sp() SELECT 'This is sp' AS ret;
CALL SP();
CALL sp();
DROP PROCEDURE SP;
--echo #
--echo # End of 10.4 tests
--echo #

View file

@ -3252,4 +3252,104 @@ FROM x
)
);
ERROR 21000: Operand should contain 2 column(s)
#
# MDEV-29362: Constant subquery used as left part of IN subquery
#
CREATE TABLE t1 (a int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (15), (1), (2);
CREATE TABLE t2 (b int) ENGINE=MyISAM;
INSERT INTO t2 VALUES (15), (1);
CREATE TABLE t3 (c int) ENGINE=MyISAM;
INSERT INTO t3 VALUES (15), (1);
SET optimizer_switch='condition_pushdown_from_having=off';
SELECT a FROM t1 GROUP BY a
HAVING a = ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) ) + 1;
a
2
SELECT a FROM t1 GROUP BY a
HAVING a IN ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) );
a
1
SET optimizer_switch='condition_pushdown_from_having=on';
SELECT a FROM t1 GROUP BY a
HAVING a = ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) ) + 1;
a
2
SELECT a FROM t1 GROUP BY a
HAVING a IN ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) );
a
1
EXPLAIN FORMAT=JSON SELECT a FROM t1 GROUP BY a
HAVING a = ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) ) + 1;
EXPLAIN
{
"query_block": {
"select_id": 1,
"cost": 0.012403489,
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"rows": 3,
"cost": 0.010504815,
"filtered": 100,
"attached_condition": "t1.a = <cache>((<in_optimizer>((subquery#2),<exists>(subquery#3))) + 1)"
}
}
],
"subqueries": [
{
"query_block": {
"select_id": 3,
"cost": 0.01034841,
"having_condition": "trigcond(t3.c is null)",
"nested_loop": [
{
"table": {
"table_name": "t3",
"access_type": "ALL",
"loops": 1,
"rows": 2,
"cost": 0.01034841,
"filtered": 100,
"attached_condition": "trigcond(1 = t3.c or t3.c is null)"
}
}
]
}
},
{
"query_block": {
"select_id": 2,
"cost": 0.01034841,
"nested_loop": [
{
"table": {
"table_name": "t2",
"access_type": "ALL",
"loops": 1,
"rows": 2,
"cost": 0.01034841,
"filtered": 100,
"attached_condition": "t2.b = 1"
}
}
]
}
}
]
}
}
PREPARE stmt FROM "SELECT a FROM t1 GROUP BY a
HAVING a = ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) ) + 1";
EXECUTE stmt;
a
2
EXECUTE stmt;
a
2
DEALLOCATE PREPARE stmt;
DROP TABLE t1,t2,t3;
# End of 10.4 tests

View file

@ -2637,6 +2637,42 @@ SELECT
)
);
--echo #
--echo # MDEV-29362: Constant subquery used as left part of IN subquery
--echo #
CREATE TABLE t1 (a int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (15), (1), (2);
CREATE TABLE t2 (b int) ENGINE=MyISAM;
INSERT INTO t2 VALUES (15), (1);
CREATE TABLE t3 (c int) ENGINE=MyISAM;
INSERT INTO t3 VALUES (15), (1);
let $q1=
SELECT a FROM t1 GROUP BY a
HAVING a = ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) ) + 1;
let $q2=
SELECT a FROM t1 GROUP BY a
HAVING a IN ( (SELECT b FROM t2 where b=1) IN (SELECT c FROM t3) );
SET optimizer_switch='condition_pushdown_from_having=off';
eval $q1;
eval $q2;
SET optimizer_switch='condition_pushdown_from_having=on';
eval $q1;
eval $q2;
eval EXPLAIN FORMAT=JSON $q1;
eval PREPARE stmt FROM "$q1";
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1,t2,t3;
--echo # End of 10.4 tests

View file

@ -1370,7 +1370,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
#
# End of 10.10 tests
# End of 10.5 tests
#
#
# MDEV-32203 Raise notes when an index cannot be used on data type mismatch
@ -1491,3 +1491,4 @@ indexed_col not_indexed_col
DROP TABLE t2;
DROP TABLE t1;
SET note_verbosity=DEFAULT;
# End of 10.6 tests

View file

@ -921,7 +921,7 @@ show create table t1;
drop table t1;
--echo #
--echo # End of 10.10 tests
--echo # End of 10.5 tests
--echo #
--echo #
@ -941,3 +941,5 @@ DELIMITER ;$$
--source unusable_keys_joins.inc
DROP TABLE t1;
SET note_verbosity=DEFAULT;
--echo # End of 10.6 tests

View file

@ -9,7 +9,7 @@ INSERT INTO t2 VALUES(2);
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate.
Got one of the listed errors
SELECT * FROM t2;
a
2

View file

@ -60,7 +60,7 @@ call mtr.add_suppression("Table .*t1.* is corrupted. Please drop the table and r
let $restart_parameters=--innodb_force_recovery=1 --skip-innodb-buffer-pool-load-at-startup;
--source include/restart_mysqld.inc
--error ER_TABLE_CORRUPT
--error ER_NO_SUCH_TABLE_IN_ENGINE,ER_TABLE_CORRUPT
SELECT * FROM t1;
SELECT * FROM t2;
CHECK TABLE t2;

View file

@ -12,8 +12,6 @@
galera_as_slave_ctas : MDEV-28378 timeout
galera_pc_recovery : MDEV-25199 cluster fails to start up
galera_sst_encrypted : MDEV-29876 Galera test failure on galera_sst_encrypted
galera_var_node_address : MDEV-20485 Galera test failure
galera_bf_kill_debug : timeout after 900 seconds
galera_ssl_upgrade : [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 130: Incorrect file format 'gtid_slave_pos'
galera_parallel_simple : timeout related to wsrep_sync_wait
@ -29,3 +27,4 @@ mdev-31285 : MDEV-25089 Assertion `error.len > 0' failed in galera::ReplicatorSM
galera_var_ignore_apply_errors : MENT-1997 galera_var_ignore_apply_errors test freezes
MW-402 : temporarily disabled at the request of Codership
MDEV-22232 : temporarily disabled at the request of Codership
galera_desync_overlapped : MDEV-21538 galera_desync_overlapped MTR failed: Result content mismatch

View file

@ -0,0 +1,36 @@
connection node_2;
connection node_1;
connection node_1;
CREATE TABLE t1 (f1 int primary key, f2 int);
INSERT INTO t1 VALUES (1,0);
BEGIN;
INSERT INTO t1 VALUES (2,4),(1,1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
COMMIT;
Writesets replicated (expect 0)
0
connection node_1;
SELECT * FROM t1;
f1 f2
1 0
connection node_2;
SELECT * FROM t1;
f1 f2
1 0
DROP TABLE t1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER);
INSERT INTO t1 VALUES (1,0);
INSERT INTO t1 VALUES (2,4), (1,1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
Writesets replicated (expect 0)
0
connection node_1;
SELECT * FROM t1;
f1 f2
1 0
connection node_2;
SELECT * FROM t1;
f1 f2
1 0
DROP TABLE t1;

View file

@ -0,0 +1,24 @@
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) engine=innodb;
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) engine=aria;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
SELECT * FROM t2;
f1
SAVEPOINT s1;
ERROR 42000: The storage engine for the table doesn't support SAVEPOINT
INSERT INTO t1 VALUES (2);
COMMIT;
connection node_1;
SELECT * FROM t1;
f1
1
2
connection node_2;
SELECT * FROM t1;
f1
1
2
connection node_1;
DROP TABLE t1,t2;

View file

@ -47,4 +47,4 @@ SET GLOBAL debug_dbug = NULL;
SET debug_sync='RESET';
SELECT @@debug_sync;
@@debug_sync
ON - current signal: ''
ON - current signals: ''

View file

@ -4,7 +4,7 @@ SET @orig_debug=@@debug_dbug;
connection node_2;
SELECT @@debug_sync;
@@debug_sync
ON - current signal: ''
ON - current signals: ''
set debug_sync='RESET';
SET SESSION wsrep_sync_wait = 1;
SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
@ -45,4 +45,4 @@ SET SESSION wsrep_sync_wait = default;
DROP TABLE t_wait1;
SELECT @@debug_sync;
@@debug_sync
ON - current signal: ''
ON - current signals: ''

View file

@ -4,7 +4,7 @@ SET @orig_debug=@@debug_dbug;
connection node_2;
SELECT @@debug_sync;
@@debug_sync
ON - current signal: ''
ON - current signals: ''
SET SESSION wsrep_sync_wait = 8;
SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
connection node_1;
@ -46,4 +46,4 @@ SET SESSION wsrep_sync_wait = default;
DROP TABLE t_wait8;
SELECT @@debug_sync;
@@debug_sync
ON - current signal: ''
ON - current signals: ''

View file

@ -100,19 +100,19 @@ Killing server ...
connection node_1;
Killing server ...
connection node_1_insert_simple;
ERROR HY000: Lost connection to server during query
Got one of the listed errors
connection node_1_insert_multi;
ERROR HY000: Lost connection to server during query
Got one of the listed errors
connection node_1_insert_transaction;
ERROR HY000: Lost connection to server during query
Got one of the listed errors
connection node_1_update_simple;
ERROR HY000: Lost connection to server during query
Got one of the listed errors
connection node_1_insert_1k;
ERROR HY000: Lost connection to server during query
Got one of the listed errors
connection node_1_insert_1m;
ERROR HY000: Lost connection to server during query
Got one of the listed errors
connection node_1_insert_10m;
ERROR HY000: Lost connection to server during query
Got one of the listed errors
connection node_1;
Performing --wsrep-recover ...
Using --wsrep-start-position when starting mysqld ...

View file

@ -1,5 +1,6 @@
connection node_2;
connection node_1;
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2), (3);
@ -22,6 +23,8 @@ COUNT(*) = 0
1
SELECT COUNT(*) = 0 FROM t2;
COUNT(*) = 0
1
0
connection node_1;
DROP TABLE t1;
DROP TABLE t2;
SET GLOBAL wsrep_mode=DEFAULT;

View file

@ -36,10 +36,7 @@ SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
0
1
SET DEBUG_SYNC = 'RESET';
SET GLOBAL debug_dbug = NULL;
DROP TABLE t1;

View file

@ -71,13 +71,17 @@ push @::global_suppressions,
sub which($) { return `sh -c "command -v $_[0]"` }
sub skip_combinations {
my %skip = ();
my @combinations;
$skip{'include/have_mariabackup.inc'} = 'Need socket statistics utility'
unless which("lsof") || which("sockstat") || which("ss");
$skip{'include/have_stunnel.inc'} = "Need 'stunnel' utility"
unless which("stunnel");
$skip{'include/have_qpress.inc'} = "Need 'qpress' utility"
unless which("qpress");
$skip{'../encryption/include/have_file_key_management_plugin.combinations'} = [ 'ctr' ]
unless $::mysqld_variables{'version-ssl-library'} =~ /OpenSSL (\S+)/
and $1 ge "1.0.1";
%skip;
}

View file

@ -28,7 +28,7 @@ SET DEBUG_SYNC = 'create_table_select_before_create SIGNAL may_alter WAIT_FOR bf
--connection node_1
SET DEBUG_SYNC = 'now WAIT_FOR may_alter';
--disable_result_log
--error ER_ERROR_ON_RENAME
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP FOREIGN KEY b, ALGORITHM=COPY;
--enable_result_log

View file

@ -1,6 +1,8 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--disable_ps2_protocol
# NEXTVAL
--connection node_1
@ -54,3 +56,4 @@ SELECT NEXTVAL(seq_transaction) = 4;
DROP SEQUENCE seq_transaction;
DROP TABLE t1;
--enable_ps2_protocol

View file

@ -0,0 +1,5 @@
[binlogon]
log-bin
log-slave-updates=ON
[binlogoff]

View file

@ -0,0 +1,58 @@
#
# MDEV-31272: Statement rollback causes empty writeset replication
#
--source include/galera_cluster.inc
#
# Case 1: Multi statement transaction
#
--connection node_1
CREATE TABLE t1 (f1 int primary key, f2 int);
INSERT INTO t1 VALUES (1,0);
--let $replicated_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_replicated'`
BEGIN;
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (2,4),(1,1);
COMMIT;
--let $replicated_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_replicated'`
--disable_query_log
--eval SELECT $replicated_new - $replicated_old AS 'Writesets replicated (expect 0)';
--enable_query_log
--connection node_1
SELECT * FROM t1;
--connection node_2
SELECT * FROM t1;
DROP TABLE t1;
#
# Case 2: autocommit statement
#
--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER);
INSERT INTO t1 VALUES (1,0);
--let $replicated_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_replicated'`
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (2,4), (1,1);
--let $replicated_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_replicated'`
--disable_query_log
--eval SELECT $replicated_new - $replicated_old AS 'Writesets replicated (expect 0)';
--enable_query_log
--connection node_1
SELECT * FROM t1;
--connection node_2
SELECT * FROM t1;
DROP TABLE t1;

View file

@ -0,0 +1,28 @@
#
# MDEV-32549: Cluster is inconsitent after savepoint
# statement is rolled back
#
--source include/galera_cluster.inc
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) engine=innodb;
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) engine=aria;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
SELECT * FROM t2;
--error ER_CHECK_NOT_IMPLEMENTED
SAVEPOINT s1;
INSERT INTO t1 VALUES (2);
COMMIT;
--connection node_1
SELECT * FROM t1;
# If bug is present: only the second INSERT
# is replicated, causing an inconsistent
# cluster.
--connection node_2
SELECT * FROM t1;
--connection node_1
DROP TABLE t1,t2;

View file

@ -142,31 +142,31 @@ SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc
--connection node_1_insert_simple
--error 2013
--error 2013, 2026
--reap
--connection node_1_insert_multi
--error 2013
--error 2013, 2026
--reap
--connection node_1_insert_transaction
--error 2013
--error 2013, 2026
--reap
--connection node_1_update_simple
--error 2013
--error 2013, 2026
--reap
--connection node_1_insert_1k
--error 2013
--error 2013, 2026
--reap
--connection node_1_insert_1m
--error 2013
--error 2013, 2026
--reap
--connection node_1_insert_10m
--error 2013
--error 2013, 2026
--reap
--connection node_1

View file

@ -12,13 +12,17 @@ INSERT INTO t1 VALUES (1);
SELECT COUNT(*) > 0 FROM mysql.general_log;
--disable_ps2_protocol
SELECT 1 = 1 FROM t1;
SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 1 = 1 FROM t1';
--enable_ps2_protocol
--connection node_2
--disable_ps2_protocol
SELECT 2 = 2 FROM t1;
SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 2 = 2 FROM t1';
--enable_ps2_protocol
--connection node_1
DROP TABLE t1;

View file

@ -7,6 +7,8 @@
# Without a PK
SET GLOBAL wsrep_mode=REPLICATE_MYISAM;
CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1);
@ -41,5 +43,7 @@ TRUNCATE TABLE t1;
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) = 0 FROM t2;
--connection node_1
DROP TABLE t1;
DROP TABLE t2;
SET GLOBAL wsrep_mode=DEFAULT;

View file

@ -2,6 +2,8 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--disable_ps2_protocol
#
# Ensure that the query cache behaves properly with respect to Galera
#
@ -65,3 +67,4 @@ SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_
DROP TABLE t1;
--enable_ps2_protocol

View file

@ -4,6 +4,8 @@
--source include/have_query_cache.inc
--source include/galera_have_debug_sync.inc
--disable_ps2_protocol
CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
@ -88,3 +90,5 @@ DROP TABLE t1;
--connection node_2a
SET DEBUG_SYNC = "RESET";
--enable_ps2_protocol

View file

@ -12,9 +12,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_ipv6_mariabackup : MDEV-24097
galera_ipv6_mariabackup_section : MDEV-24097, MDEV-22195
galera_vote_rejoin_mysqldump : MDEV-24481: galera_3nodes.galera_vote_rejoin_mysqldump MTR failed: mysql_shutdown failed
galera_ssl_reload : MDEV-32778 galera_ssl_reload failed with warning message
galera_ipv6_mariabackup : temporarily disabled at the request of Codership
galera_pc_bootstrap : temporarily disabled at the request of Codership

View file

@ -14,6 +14,7 @@ select @@wsrep_gtid_domain_id,@@wsrep_node_name;
@@wsrep_gtid_domain_id @@wsrep_node_name
100 node3
connection node_3;
connection node_1;
connection node_2;
connection node_1;
connection node_1;

View file

@ -0,0 +1,219 @@
connection node_2;
connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_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;
set wsrep_sync_wait=0;
connection node_1;
CREATE PROCEDURE insert_row (IN node varchar(10), IN repeat_count int)
BEGIN
DECLARE current_num int;
SET current_num = 0;
WHILE current_num < repeat_count do
INSERT INTO t1(node, name) VALUES (node, UUID());
SET current_num = current_num + 1;
END WHILE;
END|
CREATE TABLE t1 (id bigint not null primary key auto_increment, node VARCHAR(10), name VARCHAR(64)) ENGINE=innodb;
# node_1
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2
connection node_2;
# node_2
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2
connection node_3;
# node_3
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2
connection node_1;
CALL insert_row('node1', 500);;
connection node_2;
CALL insert_row('node2', 500);;
connection node_3;
CALL insert_row('node3', 500);;
connection node_2;
# Shutdown node_2, force SST
connection node_2b;
# Wait until node_2 leaves cluster
connection node_1b;
connection node_1;
connection node_3;
connection node_1;
CALL insert_row('node1', 500);
connection node_3;
CALL insert_row('node3', 500);
CREATE TABLE t2(i int primary key) engine=innodb;
connection node_2;
# Restart node_2
# restart
connection node_1b;
# Wait until node_2 is back in cluster
# node2 has joined
# GTID in node1
show variables like 'wsrep_gtid_domain_id';
Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2503
connection node_2;
# GTID in node2
show variables like 'wsrep_gtid_domain_id';
Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2503
connection node_3;
# GTID in node3
show variables like 'wsrep_gtid_domain_id';
Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2503
# Shutdown node_3
connection node_3;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
# Wait until node_3 leaves cluster
connection node_1b;
connection node_1;
CALL insert_row('node1', 50);
CREATE TABLE t3(i int primary key) engine=innodb;
connection node_3;
# Rejoin node_3
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
connection node_1b;
# Wait until node_3 is back in cluster
# node3 has joined
connection node_1;
# GTID in node1
show variables like 'wsrep_gtid_domain_id';
Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2554
connection node_2;
# GTID in node2
show variables like 'wsrep_gtid_domain_id';
Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2554
connection node_3;
# GTID in node3
show variables like 'wsrep_gtid_domain_id';
Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2554
# One by one shutdown all nodes
connection node_3;
# shutdown node_3
connection node_2;
# wait until node_3 is out of cluster
# shutdown node_2
connection node_1;
# wait until node_2 is out of cluster
# shutdown node_1
# Bootstrap from node_1
connection node_1;
# restart: --wsrep_new_cluster
show variables like 'wsrep_gtid_domain_id';
Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2554
ANALYZE TABLE t2;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
CALL insert_row('node1', 100);;
# Restart node_2
connection node_2;
# restart
connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1;
set wsrep_sync_wait=0;
connection node_1c;
# wait until node_1 and node_2 are in cluster
connection node_2;
ALTER TABLE t2 ADD COLUMN (k int);
CALL insert_row('node2', 100);;
# Restart node_3
connection node_3;
# restart
connection node_1c;
# wait until all nodes are back in cluster
after cluster restart
connection node_2;
connection node_1;
connection node_1;
node1 GTID
show variables like 'wsrep_gtid_domain_id';
Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2756
connection node_2;
node2 GTID
show variables like 'wsrep_gtid_domain_id';
Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2756
connection node_3;
node3 GTID
show variables like 'wsrep_gtid_domain_id';
Variable_name Value
wsrep_gtid_domain_id 1111
show variables like '%gtid_binlog_pos%';
Variable_name Value
gtid_binlog_pos 1111-1-2756
connection node_1;
table size in node1
SELECT COUNT(*) FROM t1;
COUNT(*)
2750
connection node_2;
table size in node2
SELECT COUNT(*) FROM t1;
COUNT(*)
2750
connection node_3;
table size in node3
SELECT COUNT(*) FROM t1;
COUNT(*)
2750
connection node_2;
call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node");
call mtr.add_suppression("WSREP: Sending JOIN failed:.*");
call mtr.add_suppression("Sending JOIN failed:.*");
call mtr.add_suppression("WSREP: Failed to JOIN the cluster after SST.*");
connection node_3;
call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node");
call mtr.add_suppression("WSREP: Sending JOIN failed:.*");
call mtr.add_suppression("Sending JOIN failed:.*");
call mtr.add_suppression("WSREP: Failed to JOIN the cluster after SST.*");
# cleanup
connection node_1;
DROP PROCEDURE insert_row;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
connection node_3;
connection node_2;
disconnect node_3;
disconnect node_2b;
disconnect node_1b;
disconnect node_1c;

View file

@ -1,22 +1,22 @@
connection node_2;
connection node_1;
call mtr.add_suppression("WSREP: Stray state UUID msg: .*");
call mtr.add_suppression("WSREP: Protocol violation. JOIN message sender .*");
call mtr.add_suppression("WSREP: Sending JOIN failed: .*");
flush tables;
connection node_1;
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE
4
connection node_1;
3
CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB;
connection node_2;
set global wsrep_sync_wait=15;
INSERT INTO t1 VALUES (1);
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_3;
set global wsrep_sync_wait=15;
SELECT COUNT(*) FROM t1;
COUNT(*)
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
connection node_1;
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
DROP TABLE t1;

View file

@ -39,6 +39,9 @@ SELECT VARIABLE_VALUE AS expect_Disconnected FROM INFORMATION_SCHEMA.GLOBAL_STAT
expect_Disconnected
Disconnected
SET SESSION wsrep_on=ON;
SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
expect_3
3
SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
expect_Primary
Primary
@ -49,17 +52,11 @@ t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
connection node_2;
SET SESSION wsrep_on=OFF;
SET SESSION wsrep_on=ON;
# restart
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
SELECT COUNT(*) AS expect_0 FROM t1;
expect_0
0
CALL mtr.add_suppression("is inconsistent with group");
connection node_3;
SHOW CREATE TABLE t1;
@ -71,13 +68,16 @@ DROP TABLE t1;
CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'PRIMARY'; check that column/key exists'");
connection node_1;
connection node_1;
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
DROP USER sst;
connection node_2;
CALL mtr.add_suppression("Slave SQL: Error 'The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
CALL mtr.add_suppression("Slave SQL: Error 'The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement' on query");
CALL mtr.add_suppression("InnoDB: Error: Table \"mysql\"\\.\"innodb_index_stats\" not found");
CALL mtr.add_suppression("Can't open and lock time zone table");
CALL mtr.add_suppression("Can't open and lock privilege tables");
CALL mtr.add_suppression("Info table is not ready to be used");
CALL mtr.add_suppression("Native table .* has the wrong structure");
CALL mtr.add_suppression("Table \'mysql.gtid_slave_pos\' doesn\'t exist");
connection node_2;
# restart
connection node_1;

View file

@ -4,11 +4,13 @@
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/galera_sst_method.inc
--source include/force_restart.inc
#
# Initially wsrep gtid domain id is 100
#
--connection node_1
select @@wsrep_gtid_domain_id,@@wsrep_node_name;
@ -26,6 +28,10 @@ select @@wsrep_gtid_domain_id,@@wsrep_node_name;
--connection node_3
--source include/shutdown_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
--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
@ -36,6 +42,7 @@ select @@wsrep_gtid_domain_id,@@wsrep_node_name;
--source include/wait_condition.inc
--source include/shutdown_mysqld.inc
--sleep 5
#
# Bootstrap from node_1 and change wsrep_gtid_domain_id to 200
@ -45,12 +52,11 @@ select @@wsrep_gtid_domain_id,@@wsrep_node_name;
--source include/start_mysqld.inc
show variables like 'wsrep_gtid_domain_id';
#
# Restart node_2, expect that wsrep_gtid_domain_id has changed to 200
#
--connection node_2
--let $restart_parameters =
--let $restart_parameters =
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc
show variables like 'wsrep_gtid_domain_id';

View file

@ -0,0 +1,35 @@
!include ../galera_3nodes.cnf
[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
[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
[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

View file

@ -0,0 +1,346 @@
--source include/galera_cluster.inc
--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.
# The tests verify that wsrep_gtid_domain_id and gtid_binlog_pos
# remains same across the cluster
# In the configuration, nodes have different wsrep_gtid_domain_id
# but all nodes are supposed to receive effective domain id
# from the bootstrap node (node_1), and use it
#
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_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
set wsrep_sync_wait=0;
--connection node_1
DELIMITER |;
CREATE PROCEDURE insert_row (IN node varchar(10), IN repeat_count int)
BEGIN
DECLARE current_num int;
SET current_num = 0;
WHILE current_num < repeat_count do
INSERT INTO t1(node, name) VALUES (node, UUID());
SET current_num = current_num + 1;
END WHILE;
END|
DELIMITER ;|
CREATE TABLE t1 (id bigint not null primary key auto_increment, node VARCHAR(10), name VARCHAR(64)) ENGINE=innodb;
#
# report initial gtid positions after table t1 is created
#
--echo # node_1
show variables like '%gtid_binlog_pos%';
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
--source include/wait_condition.inc
--echo # node_2
show variables like '%gtid_binlog_pos%';
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
--source include/wait_condition.inc
--echo # node_3
show variables like '%gtid_binlog_pos%';
###########################################
# scenario: join node 2 by SST
##########################################
#
# start concurrent insert load and stop node2 while the load is on
#
--connection node_1
--send CALL insert_row('node1', 500);
--connection node_2
--send CALL insert_row('node2', 500);
--connection node_3
--send CALL insert_row('node3', 500);
#
# stop load to node 2 and shutdown the node, force SST
#
--connection node_2
--reap
--echo # Shutdown node_2, force SST
--connection node_2b
--source include/shutdown_mysqld.inc
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--echo # Wait until node_2 leaves cluster
--connection node_1b
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
#
# stop the remaining load to node 1 and 3
#
--connection node_1
--reap
--connection node_3
--reap
#
# some more inserts and DDL to nodes 1 and 3
# while node 2 is absent
#
--connection node_1
CALL insert_row('node1', 500);
--connection node_3
CALL insert_row('node3', 500);
CREATE TABLE t2(i int primary key) engine=innodb;
#
# restart node 2, should join by SST
#
--connection node_2
--echo # Restart node_2
--source include/start_mysqld.inc
--connection node_1b
--echo # Wait until node_2 is back in cluster
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
--echo # node2 has joined
#
# check gtid positions in all nodes
#
--echo # GTID in node1
show variables like 'wsrep_gtid_domain_id';
show variables like '%gtid_binlog_pos%';
--connection node_2
--echo # GTID in node2
show variables like 'wsrep_gtid_domain_id';
show variables like '%gtid_binlog_pos%';
--connection node_3
--echo # GTID in node3
show variables like 'wsrep_gtid_domain_id';
show variables like '%gtid_binlog_pos%';
###########################################
# scenario: join node 3 by IST
##########################################
--echo # Shutdown node_3
--connection node_3
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1';
--echo # Wait until node_3 leaves cluster
--connection node_1b
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
#
# do some inserts and DDL to node 1
# while node 3 is absent
#
--connection node_1
CALL insert_row('node1', 50);
CREATE TABLE t3(i int primary key) engine=innodb;
#
# remove isolation in node 3, should join by IST
#
--connection node_3
--echo # Rejoin node_3
SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0';
--connection node_1b
--echo # Wait until node_3 is back in cluster
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
--echo # node3 has joined
#
# check gtid positions in all nodes
#
--connection node_1
--echo # GTID in node1
show variables like 'wsrep_gtid_domain_id';
show variables like '%gtid_binlog_pos%';
--connection node_2
--echo # GTID in node2
show variables like 'wsrep_gtid_domain_id';
show variables like '%gtid_binlog_pos%';
--connection node_3
--echo # GTID in node3
show variables like 'wsrep_gtid_domain_id';
show variables like '%gtid_binlog_pos%';
###########################################
# scenario: restart full custer
##########################################
#
# stop all nodes, one by one
#
--echo # One by one shutdown all nodes
--connection node_3
--echo # shutdown node_3
--source include/shutdown_mysqld.inc
--remove_file $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat
--connection node_2
--echo # wait until node_3 is out of cluster
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
--echo # shutdown node_2
--source include/shutdown_mysqld.inc
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--connection node_1
--echo # wait until node_2 is out of cluster
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
--echo # shutdown node_1
--source include/shutdown_mysqld.inc
#
# 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
show variables like 'wsrep_gtid_domain_id';
show variables like '%gtid_binlog_pos%';
ANALYZE TABLE t2;
--send CALL insert_row('node1', 100);
--echo # Restart node_2
--connection node_2
--let $restart_parameters =
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc
#
# connection node_1b may not be functional anymore, after node was
# shutdown, open node_1c for controlling node 1 state
#
--connect node_1c, 127.0.0.1, root, , test, $NODE_MYPORT_1
set wsrep_sync_wait=0;
--connection node_1c
--echo # wait until node_1 and node_2 are in cluster
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
--connection node_2
ALTER TABLE t2 ADD COLUMN (k int);
--send CALL insert_row('node2', 100);
--echo # Restart node_3
--connection node_3
--let $restart_parameters =
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
--source include/start_mysqld.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';
--source include/wait_condition.inc
--echo after cluster restart
# stop load for nodes 1 and 2
--connection node_2
--reap
--connection node_1
--reap
#
# check gtid positions in all nodes
#
--connection node_1
--echo node1 GTID
show variables like 'wsrep_gtid_domain_id';
show variables like '%gtid_binlog_pos%';
--connection node_2
--echo node2 GTID
show variables like 'wsrep_gtid_domain_id';
show variables like '%gtid_binlog_pos%';
--connection node_3
--echo node3 GTID
show variables like 'wsrep_gtid_domain_id';
show variables like '%gtid_binlog_pos%';
#
# check table size in all nodes
#
--connection node_1
--echo table size in node1
SELECT COUNT(*) FROM t1;
--connection node_2
--echo table size in node2
SELECT COUNT(*) FROM t1;
--connection node_3
--echo table size in node3
SELECT COUNT(*) FROM t1;
#
# cleanups
#
--connection node_2
call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node");
call mtr.add_suppression("WSREP: Sending JOIN failed:.*");
call mtr.add_suppression("Sending JOIN failed:.*");
call mtr.add_suppression("WSREP: Failed to JOIN the cluster after SST.*");
--connection node_3
call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node");
call mtr.add_suppression("WSREP: Sending JOIN failed:.*");
call mtr.add_suppression("Sending JOIN failed:.*");
call mtr.add_suppression("WSREP: Failed to JOIN the cluster after SST.*");
--echo # cleanup
--connection node_1
DROP PROCEDURE insert_row;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'
--source include/wait_condition.inc
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'
--source include/wait_condition.inc
--disconnect node_3
--disconnect node_2b
--disconnect node_1b
--disconnect node_1c

View file

@ -1,4 +1,4 @@
!include ../galera_4nodes.cnf
!include ../galera_3nodes.cnf
[mysqld.2]
wsrep_node_address=127.0.0.1
@ -6,5 +6,3 @@ wsrep_node_address=127.0.0.1
[mysqld.3]
wsrep_node_address=localhost
[mysqld.4]
wsrep_node_address=lo

View file

@ -6,27 +6,27 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
call mtr.add_suppression("WSREP: Stray state UUID msg: .*");
call mtr.add_suppression("WSREP: Protocol violation. JOIN message sender .*");
call mtr.add_suppression("WSREP: Sending JOIN failed: .*");
flush tables;
--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--connection node_1
CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB;
--connection node_2
set global wsrep_sync_wait=15;
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
INSERT INTO t1 VALUES (1);
SELECT COUNT(*) AS EXPECT_1 FROM t1;
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
set global wsrep_sync_wait=15;
SELECT COUNT(*) FROM t1;
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_1 FROM t1;
--connection node_1
SELECT COUNT(*) AS EXPECT_1 FROM t1;
DROP TABLE t1;

View file

@ -59,6 +59,7 @@ SET SESSION wsrep_on=ON;
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
SELECT VARIABLE_VALUE AS expect_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
# Confirm that the table is now identical throughout
@ -67,18 +68,7 @@ SELECT VARIABLE_VALUE AS expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WH
SHOW CREATE TABLE t1;
--connection node_2
SET SESSION wsrep_on=OFF;
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--source include/galera_wait_ready.inc
SET SESSION wsrep_on=ON;
# restart node so we don't fail on WSREP_START_POSITION internal check
--source include/restart_mysqld.inc
--source include/wait_until_connected_again.inc
SHOW CREATE TABLE t1;
SELECT COUNT(*) AS expect_0 FROM t1;
CALL mtr.add_suppression("is inconsistent with group");
--connection node_3
@ -89,5 +79,14 @@ CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'PRIMARY'; check that col
--connection node_1
--source suite/galera/include/galera_sst_restore.inc
--connection node_2
# restart node so we don't fail on WSREP_START_POSITION internal check
--source include/restart_mysqld.inc
--source include/wait_until_connected_again.inc
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
# Restore original auto_increment_offset values.
--source ../galera/include/auto_increment_offset_restore.inc

View file

@ -9,5 +9,3 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
galera_sr_kill_slave_after_apply_rollback2 : MDEV-29892 Galera test failure on galera_sr_kill_slave_after_apply_rollback2

View file

@ -12,7 +12,7 @@ SET SESSION wsrep_trx_fragment_size=1;
START TRANSACTION;
INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
COMMIT;
ERROR HY000: Lost connection to server during query
Got one of the listed errors
# restart
connection node_1;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;

View file

@ -1,5 +1,7 @@
--source include/galera_cluster.inc
--disable_ps2_protocol
--connection node_2
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
@ -45,3 +47,6 @@ CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
--source include/galera_wait_ready.inc
--enable_ps2_protocol

View file

@ -26,7 +26,7 @@ SET SESSION wsrep_trx_fragment_size=1;
START TRANSACTION;
INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary');
--error 2013
--error 2013,2026
COMMIT;
--source include/start_mysqld.inc

View file

@ -1,6 +1,7 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--disable_ps2_protocol
#
# Test the effect of gmcast.isolate on master during an SR transaction
#
@ -133,3 +134,4 @@ CALL mtr.add_suppression("failed to send SR rollback for");
DROP TABLE t1;
--source ../galera/include/auto_increment_offset_restore.inc
--enable_ps2_protocol

View file

@ -11,6 +11,5 @@
##############################################################################
GCF-1060 : MDEV-32160 GCF-1060 test failure due to wsrep MDL conflict
galera_sr_cc_master : MDEV-29882 Galera test failure on galera_sr_cc_master
# Links to below failures in MDEV-30172
MDEV-25718 : timeout related to wsrep_sync_wait and DEBUG_SYNC

View file

@ -15,7 +15,7 @@ SET DEBUG_SYNC='now WAIT_FOR before_fragment';
SET GLOBAL wsrep_cluster_address = '';
SET DEBUG_SYNC = 'now SIGNAL continue';
connection node_2;
ERROR HY000: Lost connection to server during query
Got one of the listed errors
connection node_2a;
SELECT * FROM mysql.wsrep_streaming_log;
node_uuid trx_id seqno flags frag

View file

@ -13,12 +13,12 @@ INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
COUNT(*)
SELECT COUNT(*) AS EXPECT_5 FROM mysql.wsrep_streaming_log;
EXPECT_5
5
connection node_1;
SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
COUNT(*)
SELECT COUNT(*) AS EXPECT_5 FROM mysql.wsrep_streaming_log;
EXPECT_5
5
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2a;
@ -29,8 +29,8 @@ connection node_2;
INSERT INTO t1 VALUES (6);
ERROR HY000: Lost connection to server during query
connection node_1;
SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
COUNT(*)
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
connection node_2a;
connection node_1;
@ -38,8 +38,8 @@ connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2b;
SELECT * FROM mysql.wsrep_streaming_log;
node_uuid trx_id seqno flags frag
SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
COUNT(*)
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
SET AUTOCOMMIT=OFF;
START TRANSACTION;
@ -49,18 +49,20 @@ INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
COMMIT;
SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
COUNT(*)
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
SELECT COUNT(*) AS EXPECT_5 FROM t1;
EXPECT_5
5
SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
COUNT(*)
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
EXPECT_0
0
DROP TABLE t1;
connection node_2b;
CALL mtr.add_suppression("WSREP: Failed to replicate rollback fragment for");
disconnect node_2;
connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
disconnect node_2a;
disconnect node_2b;

View file

@ -26,6 +26,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@ -91,6 +92,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@ -156,6 +158,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@ -221,6 +224,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@ -286,6 +290,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@ -351,6 +356,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@ -416,6 +422,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@ -481,6 +488,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@ -546,6 +554,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@ -611,6 +620,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@ -676,6 +686,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@ -741,6 +752,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@ -806,6 +818,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@ -871,6 +884,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@ -936,6 +950,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2
@ -1001,6 +1016,7 @@ f1 f2
connection node_1c;
SET AUTOCOMMIT=ON;
INSERT INTO t1 VALUES (3, 'c');
connection node_1;
connection node_2;
SELECT * FROM t1;
f1 f2

View file

@ -43,7 +43,8 @@ SET DEBUG_SYNC = 'now SIGNAL continue';
# Disconnect causes connection to node_2 to be closed
#
--connection node_2
--error 2013 # CR_SERVER_LOST
# CR_SERVER_LOST, CR_SSL_CONNECTION_ERROR
--error 2013,2026
--reap

View file

@ -32,10 +32,13 @@ INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) AS EXPECT_5 FROM mysql.wsrep_streaming_log;
--connection node_1
SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
--let $wait_condition = SELECT COUNT(*) = 5 FROM mysql.wsrep_streaming_log
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_5 FROM mysql.wsrep_streaming_log;
#
# Trigger CC . The transaction is aborted and we expect the SR tables to be cleaned up
@ -56,7 +59,9 @@ SET SESSION wsrep_sync_wait = DEFAULT;
INSERT INTO t1 VALUES (6);
--connection node_1
SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
# Restore cluster
@ -73,8 +78,10 @@ SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connection node_2b
--source include/galera_wait_ready.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log
--source include/wait_condition.inc
SELECT * FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
# Repeat transaction to confirm no locks are left from previous transaction
@ -87,11 +94,13 @@ INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
COMMIT;
SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
--connection node_1
SELECT COUNT(*) FROM t1;
SELECT COUNT(*) FROM mysql.wsrep_streaming_log;
--let $wait_condition = SELECT COUNT(*) = 5 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_5 FROM t1;
SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log;
DROP TABLE t1;
@ -102,3 +111,6 @@ CALL mtr.add_suppression("WSREP: Failed to replicate rollback fragment for");
--connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2
# Restore original auto_increment_offset values.
--source ../galera/include/auto_increment_offset_restore.inc
--disconnect node_2a
--disconnect node_2b

View file

@ -6,6 +6,8 @@
--source include/have_innodb.inc
--source include/big_test.inc
--disable_ps2_protocol
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
@ -56,3 +58,4 @@ CALL mtr.add_suppression('InnoDB: Resizing redo log from');
CALL mtr.add_suppression('InnoDB: Starting to delete and rewrite log files');
CALL mtr.add_suppression('InnoDB: New log files created, LSN=');
--enable_ps2_protocol

View file

@ -6,6 +6,8 @@
--source include/have_innodb.inc
--source include/big_test.inc
--disable_ps2_protocol
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
@ -51,3 +53,5 @@ SELECT COUNT(*) = 0 FROM t1;
DROP TABLE ten;
DROP TABLE t1;
--enable_ps2_protocol

View file

@ -46,6 +46,10 @@ SELECT * FROM t1;
SET AUTOCOMMIT=ON;
--send INSERT INTO t1 VALUES (3, 'c')
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
--source include/wait_condition.inc
--connection node_2
SELECT * FROM t1;
@ -54,7 +58,7 @@ SELECT * FROM t1;
--send UPDATE t1 SET f2 = 'a' WHERE f1 = 2
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER != 'system user' AND STATE = 'Updating';
--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
--source include/wait_condition.inc
# Will deadlock

View file

@ -1 +0,0 @@
doublewrite_debug : MDEV-33098 occasionally fails to start up InnoDB

View file

@ -9,7 +9,7 @@ INSERT INTO t2 VALUES(1);
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
SELECT * FROM t1;
ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate.
Got one of the listed errors
SELECT * FROM t2;
a
1

View file

@ -12,7 +12,7 @@ innodb_fil_make_page_dirty_debug 0
show variables like 'innodb_saved_page_number_debug';
Variable_name Value
innodb_saved_page_number_debug 0
create table t1 (f1 int primary key, f2 blob) engine=innodb;
create table t1 (f1 int primary key, f2 blob) engine=innodb stats_persistent=0;
start transaction;
insert into t1 values(1, repeat('#',12));
insert into t1 values(2, repeat('+',12));
@ -23,7 +23,7 @@ commit work;
# Test Begin: Test if recovery works if 1st page and 2nd page
# of system tablespace is full of zeroes.
SET GLOBAL innodb_fast_shutdown = 0;
# restart
# restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0
begin;
insert into t1 values (6, repeat('%', 400));
# Make the first page dirty for system tablespace
@ -33,6 +33,7 @@ set global innodb_fil_make_page_dirty_debug = 0;
set global innodb_saved_page_number_debug = 1;
set global innodb_fil_make_page_dirty_debug = 0;
set global innodb_buf_flush_list_now = 1;
# Kill the server
# Make the 1st page (page_no=0) and 2nd page (page_no=1)
# of the system tablespace all zeroes.
# restart
@ -52,7 +53,7 @@ f1 f2
# ---------------------------------------------------------------
# Test Begin: Test if recovery works if 1st page of
# system tablespace is corrupted and 2nd page as corrupted.
set global innodb_log_checkpoint_now = 1;
# restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0
begin;
insert into t1 values (6, repeat('%', 400));
# Make the first page dirty for system tablespace
@ -62,6 +63,7 @@ set global innodb_fil_make_page_dirty_debug = 0;
set global innodb_saved_page_number_debug = 1;
set global innodb_fil_make_page_dirty_debug = 0;
set global innodb_buf_flush_list_now = 1;
# Kill the server
# Corrupt the 1st page (page_no=0) and 2nd page of the system tablespace.
# restart
FOUND 2 /InnoDB: Restoring page \[page id: space=0, page number=0\] of datafile/ in mysqld.1.err
@ -83,7 +85,7 @@ drop table t1;
# MDEV-12600 crash during install_db with innodb_page_size=32K
# and ibdata1=3M
#
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/doublewrite --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/doublewrite --innodb-data-file-path=ibdata1:1M;ibdata2:1M:autoextend
# restart: --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/doublewrite --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/doublewrite --innodb-undo-tablespaces=0 --innodb-data-file-path=ibdata1:1M;ibdata2:1M:autoextend
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');

View file

@ -9,13 +9,9 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
t1 1 idx1 1 col_1 A 0 NULL NULL YES BTREE NO
t1 1 idx2 1 col_2 A 0 NULL NULL YES BTREE NO
INSERT INTO t1 VALUES ("col1_00001", "col2_00001"), ("col1_00002", "col2_00002");
SHOW INDEXES FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored
t1 1 idx1 1 col_1 A 1 NULL NULL YES BTREE NO
t1 1 idx2 1 col_2 A 1 NULL NULL YES BTREE NO
SET STATEMENT use_stat_tables=never FOR
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SHOW INDEXES FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored

View file

@ -59,7 +59,7 @@ SELECT * FROM t1;
let $restart_parameters=--innodb_force_recovery=1;
--source include/restart_mysqld.inc
--error ER_TABLE_CORRUPT
--error ER_NO_SUCH_TABLE_IN_ENGINE,ER_TABLE_CORRUPT
SELECT * FROM t1;
SELECT * FROM t2;
CHECK TABLE t2;

View file

@ -1,9 +1,7 @@
[strict_crc32]
--innodb-checksum-algorithm=strict_crc32
--innodb-use-atomic-writes=0
--innodb-undo-tablespaces=0
[strict_full_crc32]
--innodb-checksum-algorithm=strict_full_crc32
--innodb-use-atomic-writes=0
--innodb-undo-tablespaces=0

View file

@ -28,7 +28,7 @@ show variables like 'innodb_doublewrite';
show variables like 'innodb_fil_make_page_dirty_debug';
show variables like 'innodb_saved_page_number_debug';
create table t1 (f1 int primary key, f2 blob) engine=innodb;
create table t1 (f1 int primary key, f2 blob) engine=innodb stats_persistent=0;
start transaction;
insert into t1 values(1, repeat('#',12));
@ -44,7 +44,9 @@ commit work;
# Slow shutdown and restart to make sure ibuf merge is finished
SET GLOBAL innodb_fast_shutdown = 0;
let $shutdown_timeout=;
let $restart_parameters="--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0";
--source include/restart_mysqld.inc
--source ../include/no_checkpoint_start.inc
begin;
insert into t1 values (6, repeat('%', 400));
@ -57,8 +59,20 @@ set global innodb_saved_page_number_debug = 1;
set global innodb_fil_make_page_dirty_debug = 0;
set global innodb_buf_flush_list_now = 1;
let $shutdown_timeout=0;
--source include/shutdown_mysqld.inc
--let CLEANUP_IF_CHECKPOINT=drop table t1, unexpected_checkpoint;
# Occasionally, a checkpoint would occur on the MSAN builder.
# We do not know the reason, because the failure can only be reproduced if there is
# enough load in that environment.
# Therefore, we allow the test to be skipped when run on MSAN.
# In other environments, we want the test to fail if a checkpoint occurs,
# so that we would catch it if it starts to happen regularly.
if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "MSAN%"`)
{
--let CLEANUP_IF_CHECKPOINT=drop table t1;
}
--source ../include/no_checkpoint_end.inc
--echo # Make the 1st page (page_no=0) and 2nd page (page_no=1)
--echo # of the system tablespace all zeroes.
@ -74,6 +88,7 @@ print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'});
close FILE;
EOF
let $restart_parameters=;
--source include/start_mysqld.inc
let SEARCH_PATTERN=InnoDB: Restoring page \[page id: space=0, page number=0\] of datafile;
@ -90,7 +105,9 @@ select f1, f2 from t1;
--echo # Test Begin: Test if recovery works if 1st page of
--echo # system tablespace is corrupted and 2nd page as corrupted.
set global innodb_log_checkpoint_now = 1;
let $restart_parameters="--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0";
--source include/restart_mysqld.inc
--source ../include/no_checkpoint_start.inc
begin;
insert into t1 values (6, repeat('%', 400));
@ -103,8 +120,8 @@ set global innodb_saved_page_number_debug = 1;
set global innodb_fil_make_page_dirty_debug = 0;
set global innodb_buf_flush_list_now = 1;
let $shutdown_timeout=0;
--source include/shutdown_mysqld.inc
--source ../include/no_checkpoint_end.inc
--echo # Corrupt the 1st page (page_no=0) and 2nd page of the system tablespace.
perl;
@ -119,6 +136,7 @@ print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}/2);
close FILE;
EOF
let $restart_parameters=;
--source include/start_mysqld.inc
let SEARCH_PATTERN=InnoDB: Restoring page \[page id: space=0, page number=0\] of datafile;
@ -145,7 +163,7 @@ WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
--let $ibp=--innodb-log-group-home-dir=$bugdir --innodb-data-home-dir=$bugdir
--let $ibd=$ibp --innodb-undo-tablespaces=0
--let $ibp=$ibp --innodb-undo-tablespaces=0
--let $ibp=$ibp --innodb-data-file-path=ibdata1:1M;ibdata2:1M:autoextend
--let $restart_parameters= $ibp

View file

@ -19,8 +19,10 @@ SHOW INDEXES FROM t1;
INSERT INTO t1 VALUES ("col1_00001", "col2_00001"), ("col1_00002", "col2_00002");
SHOW INDEXES FROM t1;
# Here, the cardinality would sometimes be 2 (already updated), sometimes 1.
# SHOW INDEXES FROM t1;
SET STATEMENT use_stat_tables=never FOR
ANALYZE TABLE t1;
SHOW INDEXES FROM t1;

View file

@ -11,7 +11,3 @@
##############################################################################
mdev_6832: wsrep_provider is read-only for security reasons
MDEV-23092: wsrep_provider is read-only for security reasons
wsrep_variables_no_provider: wsrep_provider is read-only for security reasons
MDEV-22443: it is no longer allowed enable wsrep_on if wsrep_provider is 'none'

View file

@ -1,3 +0,0 @@
SET SESSION wsrep_sync_wait=15;
SET SESSION wsrep_on=1;
START TRANSACTION READ WRITE;

View file

@ -1,13 +0,0 @@
SET COLLATION_CONNECTION='utf16le_bin';
SET GLOBAL wsrep_provider='/invalid/path/libgalera_smm.so';
ERROR 42000: Variable 'wsrep_provider' can't be set to the value of '/'
SET GLOBAL wsrep_cluster_address='OFF';
SET GLOBAL wsrep_slave_threads=10;
SELECT 1;
1
1
SET GLOBAL wsrep_cluster_address='gcomm://';
SET GLOBAL wsrep_slave_threads=DEFAULT;
CALL mtr.add_suppression("wsrep_load()");
CALL mtr.add_suppression("Failed to create a new provider");
CALL mtr.add_suppression("Failed to load provider");

View file

@ -1,11 +0,0 @@
#
# MDEV-6832: ER_LOCK_WAIT_TIMEOUT on SHOW STATUS
#
SHOW STATUS LIKE 'wsrep_ready';
Variable_name Value
wsrep_ready ON
SHOW STATUS LIKE 'wsrep_ready';
Variable_name Value
wsrep_ready OFF
SET @@global.wsrep_cluster_address='gcomm://';
# End of test.

View file

@ -1,44 +0,0 @@
SELECT @@wsrep_on;
@@wsrep_on
1
SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads;
SET @wsrep_debug_saved = @@global.wsrep_debug;
SET @wsrep_provider_options_saved= @@global.wsrep_provider_options;
SET @wsrep_cluster_address_saved= @@global.wsrep_cluster_address;
SET GLOBAL wsrep_provider=none;
SET SESSION wsrep_trx_fragment_size=DEFAULT;
ERROR HY000: Incorrect arguments to SET
SELECT @@session.wsrep_trx_fragment_size;
@@session.wsrep_trx_fragment_size
0
SET GLOBAL wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100'
SHOW WARNINGS;
Level Code Message
Warning 1231 Cannot set 'wsrep_start_position' because wsrep is switched off or provider is not loaded
Error 1231 Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100'
SELECT @@global.wsrep_start_position;
@@global.wsrep_start_position
00000000-0000-0000-0000-000000000000:-1
SET GLOBAL wsrep_debug=1;
Warnings:
Warning 1231 Setting 'wsrep_debug' has no effect because wsrep is switched off
SELECT @@global.wsrep_debug;
@@global.wsrep_debug
NONE
SET GLOBAL wsrep_slave_threads=5;
SELECT @@global.wsrep_slave_threads;
@@global.wsrep_slave_threads
5
SET GLOBAL wsrep_desync=1;
ERROR HY000: WSREP (galera) not started
SELECT @@global.wsrep_desync;
@@global.wsrep_desync
0
SET SESSION wsrep_trx_fragment_unit='rows';
ERROR HY000: Incorrect arguments to SET
SELECT @@session.wsrep_trx_fragment_unit;
@@session.wsrep_trx_fragment_unit
rows
SET @@global.wsrep_slave_threads = @wsrep_slave_threads_global_saved;
SET @@global.wsrep_debug = @wsrep_debug_saved;

View file

@ -1,8 +0,0 @@
!include ../my.cnf
[mysqld.1]
wsrep-on=OFF
binlog-format=ROW
wsrep-provider=none
wsrep-cluster-address='gcomm://'
innodb_autoinc_lock_mode=2

View file

@ -1,12 +0,0 @@
#
# MDEV-22443: terminate called after throwing an instance of
# 'wsrep::runtime_error' in std::terminate on START TRANSACTION
#
--source include/have_innodb.inc
--source include/have_wsrep.inc
--source include/have_binlog_format_row.inc
SET SESSION wsrep_sync_wait=15;
SET SESSION wsrep_on=1;
START TRANSACTION READ WRITE;

View file

@ -1,8 +0,0 @@
!include ../my.cnf
[mysqld.1]
wsrep-on=OFF
binlog-format=ROW
wsrep-provider=none
wsrep-cluster-address='gcomm://'
innodb_autoinc_lock_mode=2

View file

@ -1,22 +0,0 @@
#
# MDEV-23092: SIGABRT in wsrep::server_state::provider when setting
# invalid wsrep_provider (on optimized builds)
#
--source include/have_innodb.inc
--source include/have_wsrep.inc
--source include/have_binlog_format_row.inc
SET COLLATION_CONNECTION='utf16le_bin';
--error 1231
SET GLOBAL wsrep_provider='/invalid/path/libgalera_smm.so';
SET GLOBAL wsrep_cluster_address='OFF';
SET GLOBAL wsrep_slave_threads=10;
SELECT 1;
SET GLOBAL wsrep_cluster_address='gcomm://';
SET GLOBAL wsrep_slave_threads=DEFAULT;
CALL mtr.add_suppression("wsrep_load()");
CALL mtr.add_suppression("Failed to create a new provider");
CALL mtr.add_suppression("Failed to load provider");

View file

@ -1,7 +0,0 @@
!include ../my.cnf
[mysqld.1]
wsrep-on=ON
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep-cluster-address=gcomm://

View file

@ -1,17 +0,0 @@
--source include/have_innodb.inc
--source include/have_wsrep_provider.inc
--source include/have_binlog_format_row.inc
--echo #
--echo # MDEV-6832: ER_LOCK_WAIT_TIMEOUT on SHOW STATUS
--echo #
SHOW STATUS LIKE 'wsrep_ready';
--disable_query_log
eval SET @@global.wsrep_provider='$WSREP_PROVIDER';
--enable_query_log
SHOW STATUS LIKE 'wsrep_ready';
SET @@global.wsrep_cluster_address='gcomm://';
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
--echo # End of test.

View file

@ -1,12 +0,0 @@
# Use default setting for mysqld processes
!include include/default_mysqld.cnf
[mysqld.1]
wsrep-on=ON
binlog-format=ROW
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep-cluster-address='gcomm://'
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port

View file

@ -1,38 +0,0 @@
--source include/have_wsrep.inc
--source include/have_innodb.inc
SELECT @@wsrep_on;
SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads;
SET @wsrep_debug_saved = @@global.wsrep_debug;
SET @wsrep_provider_options_saved= @@global.wsrep_provider_options;
SET @wsrep_cluster_address_saved= @@global.wsrep_cluster_address;
SET GLOBAL wsrep_provider=none;
--error ER_WRONG_ARGUMENTS
SET SESSION wsrep_trx_fragment_size=DEFAULT;
SELECT @@session.wsrep_trx_fragment_size;
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
SHOW WARNINGS;
SELECT @@global.wsrep_start_position;
SET GLOBAL wsrep_debug=1;
SELECT @@global.wsrep_debug;
SET GLOBAL wsrep_slave_threads=5;
SELECT @@global.wsrep_slave_threads;
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_desync=1;
SELECT @@global.wsrep_desync;
--error ER_WRONG_ARGUMENTS
SET SESSION wsrep_trx_fragment_unit='rows';
SELECT @@session.wsrep_trx_fragment_unit;
--disable_query_log
eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
SET GLOBAL wsrep_cluster_address= @wsrep_cluster_address_saved;
SET GLOBAL wsrep_provider_options= @wsrep_provider_options_saved;
--source include/galera_wait_ready.inc
SET @@global.wsrep_slave_threads = @wsrep_slave_threads_global_saved;
SET @@global.wsrep_debug = @wsrep_debug_saved;
--enable_query_log

View file

@ -104,8 +104,10 @@ fi
DATA="$WSREP_SST_OPT_DATA"
INFO_FILE='mariadb_backup_galera_info'
DONOR_INFO_FILE='donor_galera_info'
IST_FILE='xtrabackup_ist'
MAGIC_FILE="$DATA/$INFO_FILE"
DONOR_MAGIC_FILE="$DATA/$DONOR_INFO_FILE"
INNOAPPLYLOG="$DATA/mariabackup.prepare.log"
INNOMOVELOG="$DATA/mariabackup.move.log"
@ -651,14 +653,14 @@ get_stream()
if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
strmcmd="'$STREAM_BIN' -x"
else
strmcmd="'$STREAM_BIN' -c '$INFO_FILE'"
strmcmd="'$STREAM_BIN' -c '$INFO_FILE' '$DONOR_INFO_FILE'"
fi
else
sfmt='tar'
if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
strmcmd='tar xfi -'
else
strmcmd="tar cf - '$INFO_FILE'"
strmcmd="tar cf - '$INFO_FILE' '$DONOR_INFO_FILE'"
fi
fi
wsrep_log_info "Streaming with $sfmt"
@ -680,6 +682,7 @@ cleanup_at_exit()
if [ $estatus -ne 0 ]; then
wsrep_log_error "Removing $MAGIC_FILE file due to signal"
[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" || :
[ -f "$DONOR_MAGIC_FILE" ] && rm -f "$DONOR_MAGIC_FILE" || :
fi
if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
@ -916,6 +919,7 @@ monitor_process()
}
[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE"
[ -f "$DONOR_MAGIC_FILE" ] && rm -rf "$DONOR_MAGIC_FILE"
read_cnf
setup_ports
@ -1048,7 +1052,7 @@ send_magic()
# Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id
# (separated by a space).
echo "$WSREP_SST_OPT_GTID $WSREP_SST_OPT_GTID_DOMAIN_ID" > "$MAGIC_FILE"
echo "$WSREP_SST_OPT_GTID $WSREP_SST_OPT_GTID_DOMAIN_ID" > "$DONOR_MAGIC_FILE"
if [ -n "$WSREP_SST_OPT_REMOTE_PSWD" ]; then
# Let joiner know that we know its secret
echo "$SECRET_TAG $WSREP_SST_OPT_REMOTE_PSWD" >> "$MAGIC_FILE"
@ -1594,9 +1598,16 @@ else # joiner
exit 2
fi
# use donor magic file, if present
# if IST was used, donor magic file was not created
# Remove special tags from the magic file, and from the output:
coords=$(head -n1 "$MAGIC_FILE")
wsrep_log_info "Galera co-ords from recovery: $coords"
if [ -r "$DONOR_MAGIC_FILE" ]; then
coords=$(head -n1 "$DONOR_MAGIC_FILE")
wsrep_log_info "Galera co-ords from donor: $coords"
else
coords=$(head -n1 "$MAGIC_FILE")
wsrep_log_info "Galera co-ords from recovery: $coords"
fi
echo "$coords" # Output : UUID:seqno wsrep_gtid_domain_id
wsrep_log_info "Total time on joiner: $totime seconds"

View file

@ -2797,11 +2797,11 @@ Item_sp::func_name_cstring(THD *thd, bool is_package_function) const
quoted `pkg` and `func` separately, so the entire result looks like:
`db`.`pkg`.`func`
*/
Database_qualified_name tmp= Database_qualified_name::split(m_name->m_name);
DBUG_ASSERT(tmp.m_db.length);
append_identifier(thd, &qname, &tmp.m_db);
Identifier_chain2 tmp= Identifier_chain2::split(m_name->m_name);
DBUG_ASSERT(tmp[0].length);
append_identifier(thd, &qname, &tmp[0]);
qname.append('.');
append_identifier(thd, &qname, &tmp.m_name);
append_identifier(thd, &qname, &tmp[1]);
}
else
append_identifier(thd, &qname, &m_name->m_name);

View file

@ -1483,6 +1483,23 @@ bool Item_in_optimizer::invisible_mode()
}
bool Item_in_optimizer::walk(Item_processor processor,
bool walk_subquery,
void *arg)
{
bool res= FALSE;
if (args[1]->type() == Item::SUBSELECT_ITEM &&
((Item_subselect *)args[1])->substype() != Item_subselect::EXISTS_SUBS &&
!(((Item_subselect *)args[1])->substype() == Item_subselect::IN_SUBS &&
((Item_in_subselect *)args[1])->test_strategy(SUBS_IN_TO_EXISTS)))
res= args[0]->walk(processor, walk_subquery, arg);
if (!res)
res= args[1]->walk(processor, walk_subquery, arg);
return res || (this->*processor)(arg);
}
/**
Add an expression cache for this subquery if it is needed

View file

@ -429,6 +429,7 @@ public:
void fix_after_pullout(st_select_lex *new_parent, Item **ref,
bool merge) override;
bool invisible_mode();
bool walk(Item_processor processor, bool walk_subquery, void *arg) override;
void reset_cache() { cache= NULL; }
void print(String *str, enum_query_type query_type) override;
void restore_first_argument();

View file

@ -12023,6 +12023,15 @@ IO_CACHE *wsrep_get_cache(THD * thd, bool is_transactional)
return NULL;
}
bool wsrep_is_binlog_cache_empty(THD *thd)
{
binlog_cache_mngr *cache_mngr=
(binlog_cache_mngr *) thd_get_ha_data(thd, binlog_hton);
if (cache_mngr)
return cache_mngr->trx_cache.empty() && cache_mngr->stmt_cache.empty();
return true;
}
void wsrep_thd_binlog_trx_reset(THD * thd)
{
DBUG_ENTER("wsrep_thd_binlog_trx_reset");
@ -12081,12 +12090,9 @@ void wsrep_register_binlog_handler(THD *thd, bool trx)
/*
Set an implicit savepoint in order to be able to truncate a trx-cache.
*/
if (cache_mngr->trx_cache.get_prev_position() == MY_OFF_T_UNDEF)
{
my_off_t pos= 0;
binlog_trans_log_savepos(thd, &pos);
cache_mngr->trx_cache.set_prev_position(pos);
}
my_off_t pos= 0;
binlog_trans_log_savepos(thd, &pos);
cache_mngr->trx_cache.set_prev_position(pos);
/*
Set callbacks in order to be able to call commmit or rollback.

View file

@ -1427,6 +1427,7 @@ static inline TC_LOG *get_tc_log_implementation()
#ifdef WITH_WSREP
IO_CACHE* wsrep_get_cache(THD *, bool);
bool wsrep_is_binlog_cache_empty(THD *);
void wsrep_thd_binlog_trx_reset(THD * thd);
void wsrep_thd_binlog_stmt_rollback(THD * thd);
#endif /* WITH_WSREP */

View file

@ -395,9 +395,13 @@ extern "C" void wsrep_thd_set_PA_unsafe(THD *thd)
}
}
extern "C" uint32 wsrep_get_domain_id()
{
return wsrep_gtid_domain_id;
}
extern "C" my_bool wsrep_thd_is_local_transaction(const THD *thd)
{
return (wsrep_thd_is_local(thd) &&
thd->wsrep_cs().transaction().active());
}

View file

@ -195,7 +195,7 @@ sp_head *sp_cache_lookup(sp_cache **cp, const Database_qualified_name *name)
sp_cache *c= *cp;
if (! c)
return NULL;
return c->lookup(buf, name->make_qname(buf, sizeof(buf)));
return c->lookup(buf, name->make_qname(buf, sizeof(buf), true));
}
@ -303,7 +303,7 @@ sp_cache::~sp_cache()
void
sp_cache::init()
{
my_hash_init(key_memory_sp_cache, &m_hashtable, system_charset_info, 0, 0, 0,
my_hash_init(key_memory_sp_cache, &m_hashtable, &my_charset_bin, 0, 0, 0,
hash_get_key_for_sp_head, hash_free_sp_head, 0);
}

View file

@ -7901,6 +7901,66 @@ public:
};
class Identifier_chain2
{
LEX_CSTRING m_name[2];
public:
Identifier_chain2()
:m_name{Lex_cstring(), Lex_cstring()}
{ }
Identifier_chain2(const LEX_CSTRING &a, const LEX_CSTRING &b)
:m_name{a, b}
{ }
const LEX_CSTRING& operator [] (size_t i) const
{
return m_name[i];
}
static Identifier_chain2 split(const LEX_CSTRING &txt)
{
DBUG_ASSERT(txt.str[txt.length] == '\0'); // Expect 0-terminated input
const char *dot= strchr(txt.str, '.');
if (!dot)
return Identifier_chain2(Lex_cstring(), txt);
size_t length0= dot - txt.str;
Lex_cstring name0(txt.str, length0);
Lex_cstring name1(txt.str + length0 + 1, txt.length - length0 - 1);
return Identifier_chain2(name0, name1);
}
// Export as a qualified name string: 'db.name'
size_t make_qname(char *dst, size_t dstlen, bool casedn_part1) const
{
size_t res= my_snprintf(dst, dstlen, "%.*s.%.*s",
(int) m_name[0].length, m_name[0].str,
(int) m_name[1].length, m_name[1].str);
if (casedn_part1 && dstlen > m_name[0].length)
my_casedn_str(system_charset_info, dst + m_name[0].length + 1);
return res;
}
// Export as a qualified name string, allocate on mem_root.
LEX_CSTRING make_qname(MEM_ROOT *mem_root, bool casedn_part1) const
{
LEX_STRING dst;
/* format: [pkg + dot] + name + '\0' */
size_t dst_size= m_name[0].length + 1 /*dot*/ + m_name[1].length + 1/*\0*/;
if (unlikely(!(dst.str= (char*) alloc_root(mem_root, dst_size))))
return {NULL, 0};
if (!m_name[0].length)
{
DBUG_ASSERT(!casedn_part1); // Should not be called this way
dst.length= my_snprintf(dst.str, dst_size, "%.*s",
(int) m_name[1].length, m_name[1].str);
return {dst.str, dst.length};
}
dst.length= make_qname(dst.str, dst_size, casedn_part1);
return {dst.str, dst.length};
}
};
/**
This class resembles the SQL Standard schema qualified object name:
<schema qualified name> ::= [ <schema name> <period> ] <qualified identifier>
@ -7941,41 +8001,16 @@ public:
void copy(MEM_ROOT *mem_root, const LEX_CSTRING &db,
const LEX_CSTRING &name);
static Database_qualified_name split(const LEX_CSTRING &txt)
{
DBUG_ASSERT(txt.str[txt.length] == '\0'); // Expect 0-terminated input
const char *dot= strchr(txt.str, '.');
if (!dot)
return Database_qualified_name(NULL, 0, txt.str, txt.length);
size_t dblen= dot - txt.str;
Lex_cstring db(txt.str, dblen);
Lex_cstring name(txt.str + dblen + 1, txt.length - dblen - 1);
return Database_qualified_name(db, name);
}
// Export db and name as a qualified name string: 'db.name'
size_t make_qname(char *dst, size_t dstlen) const
size_t make_qname(char *dst, size_t dstlen, bool casedn_name) const
{
return my_snprintf(dst, dstlen, "%.*s.%.*s",
(int) m_db.length, m_db.str,
(int) m_name.length, m_name.str);
return Identifier_chain2(m_db, m_name).make_qname(dst, dstlen, casedn_name);
}
// Export db and name as a qualified name string, allocate on mem_root.
bool make_qname(MEM_ROOT *mem_root, LEX_CSTRING *dst) const
LEX_CSTRING make_qname(MEM_ROOT *mem_root, bool casedn_name) const
{
const uint dot= !!m_db.length;
char *tmp;
/* format: [database + dot] + name + '\0' */
dst->length= m_db.length + dot + m_name.length;
if (unlikely(!(dst->str= tmp= (char*) alloc_root(mem_root,
dst->length + 1))))
return true;
snprintf(tmp, dst->length + 1, "%.*s%.*s%.*s",
(int) m_db.length, (m_db.length ? m_db.str : ""),
dot, ".",
(int) m_name.length, m_name.str);
DBUG_SLOW_ASSERT(ok_for_lower_case_names(m_db.str));
return false;
return Identifier_chain2(m_db, m_name).make_qname(mem_root, casedn_name);
}
bool make_package_routine_name(MEM_ROOT *mem_root,
@ -7986,9 +8021,8 @@ public:
size_t length= package.length + 1 + routine.length + 1;
if (unlikely(!(tmp= (char *) alloc_root(mem_root, length))))
return true;
m_name.length= my_snprintf(tmp, length, "%.*s.%.*s",
(int) package.length, package.str,
(int) routine.length, routine.str);
m_name.length= Identifier_chain2(package, routine).make_qname(tmp, length,
false);
m_name.str= tmp;
return false;
}
@ -8017,7 +8051,7 @@ public:
{ }
LEX_CSTRING lex_cstring() const override
{
size_t length= m_name->make_qname(err_buffer, sizeof(err_buffer));
size_t length= m_name->make_qname(err_buffer, sizeof(err_buffer), false);
return {err_buffer, length};
}
};

View file

@ -7502,7 +7502,8 @@ sp_head *LEX::make_sp_head(THD *thd, const sp_name *name,
name->m_name);
else
sp->init_sp_name(name);
sp->make_qname(sp->get_main_mem_root(), &sp->m_qname);
if (!(sp->m_qname= sp->make_qname(sp->get_main_mem_root(), true)).str)
return NULL;
}
sphead= sp;
}
@ -9397,7 +9398,7 @@ bool LEX::call_statement_start(THD *thd,
const Lex_ident_sys_st *proc)
{
Database_qualified_name q_db_pkg(db, pkg);
Database_qualified_name q_pkg_proc(pkg, proc);
Identifier_chain2 q_pkg_proc(*pkg, *proc);
sp_name *spname;
sql_command= SQLCOM_CALL;
@ -9415,7 +9416,7 @@ bool LEX::call_statement_start(THD *thd,
// Concat `pkg` and `name` to `pkg.name`
LEX_CSTRING pkg_dot_proc;
if (q_pkg_proc.make_qname(thd->mem_root, &pkg_dot_proc) ||
if (!(pkg_dot_proc= q_pkg_proc.make_qname(thd->mem_root, false)).str ||
check_ident_length(&pkg_dot_proc) ||
!(spname= new (thd->mem_root) sp_name(db, &pkg_dot_proc, true)))
return true;
@ -9482,7 +9483,8 @@ sp_package *LEX::create_package_start(THD *thd,
return NULL;
pkg->reset_thd_mem_root(thd);
pkg->init(this);
pkg->make_qname(pkg->get_main_mem_root(), &pkg->m_qname);
if (!(pkg->m_qname= pkg->make_qname(pkg->get_main_mem_root(), true)).str)
return NULL;
sphead= pkg;
return pkg;
}
@ -9816,7 +9818,7 @@ Item *LEX::make_item_func_call_generic(THD *thd,
static Lex_cstring dot(".", 1);
Lex_ident_sys db(thd, cdb), pkg(thd, cpkg), func(thd, cfunc);
Database_qualified_name q_db_pkg(db, pkg);
Database_qualified_name q_pkg_func(pkg, func);
Identifier_chain2 q_pkg_func(pkg, func);
sp_name *qname;
if (db.is_null() || pkg.is_null() || func.is_null())
@ -9833,7 +9835,7 @@ Item *LEX::make_item_func_call_generic(THD *thd,
// Concat `pkg` and `name` to `pkg.name`
LEX_CSTRING pkg_dot_func;
if (q_pkg_func.make_qname(thd->mem_root, &pkg_dot_func) ||
if (!(pkg_dot_func= q_pkg_func.make_qname(thd->mem_root, false)).str ||
check_ident_length(&pkg_dot_func) ||
!(qname= new (thd->mem_root) sp_name(&db, &pkg_dot_func, true)))
return NULL;

View file

@ -183,7 +183,8 @@ static struct wsrep_service_st wsrep_handler = {
wsrep_report_bf_lock_wait,
wsrep_thd_kill_LOCK,
wsrep_thd_kill_UNLOCK,
wsrep_thd_set_PA_unsafe
wsrep_thd_set_PA_unsafe,
wsrep_get_domain_id
};
static struct thd_specifics_service_st thd_specifics_handler=

View file

@ -167,3 +167,5 @@ void wsrep_report_bf_lock_wait(const THD*,
void wsrep_thd_set_PA_unsafe(THD*)
{}
uint32 wsrep_get_domain_id()
{ return 0;}

View file

@ -583,7 +583,8 @@ my_bool wsrep_ready_get (void)
return ret;
}
int wsrep_show_ready(THD *thd, SHOW_VAR *var, char *buff)
int wsrep_show_ready(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type)
{
var->type= SHOW_MY_BOOL;
var->value= buff;

View file

@ -162,7 +162,8 @@ extern char* wsrep_cluster_capabilities;
int wsrep_show_status(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *status_var, enum_var_type scope);
int wsrep_show_ready(THD *thd, SHOW_VAR *var, char *buff);
int wsrep_show_ready(THD *thd, SHOW_VAR *var, void *buff,
system_status_var *, enum_var_type);
void wsrep_free_status(THD *thd);
void wsrep_update_cluster_state_uuid(const char* str);

View file

@ -336,18 +336,6 @@ void wsrep_provider_plugin_set_sysvars(st_mysql_sys_var** vars)
Wsrep plugin
*/
static int wsrep_plugin_init(void *p)
{
WSREP_DEBUG("wsrep_plugin_init()");
return 0;
}
static int wsrep_plugin_deinit(void *p)
{
WSREP_DEBUG("wsrep_plugin_deinit()");
return 0;
}
struct Mysql_replication wsrep_plugin= {
MYSQL_REPLICATION_INTERFACE_VERSION
};
@ -360,8 +348,8 @@ maria_declare_plugin(wsrep)
"Codership Oy",
"Wsrep replication plugin",
PLUGIN_LICENSE_GPL,
wsrep_plugin_init,
wsrep_plugin_deinit,
NULL,
NULL,
0x0100,
NULL, /* Status variables */
NULL, /* System variables */

View file

@ -733,7 +733,9 @@ static void* sst_joiner_thread (void* a)
{
proc.wait();
// Read state ID (UUID:SEQNO) followed by wsrep_gtid_domain_id (if any).
unsigned long int domain_id= wsrep_gtid_domain_id;
const char *pos= strchr(out, ' ');
WSREP_DEBUG("SST state ID tmp=%s out=%s pos=%p", tmp, out, pos);
if (!pos) {
@ -743,6 +745,13 @@ static void* sst_joiner_thread (void* a)
WSREP_WARN("Did not find domain ID from SST script output '%s'. "
"Domain ID must be set manually to keep binlog consistent",
out);
if (wsrep_gtid_domain_id)
{
WSREP_INFO("This node is configured to use wsrep_gtid_domain_id=%lu by user.",
domain_id);
wsrep_gtid_server.domain_id= (uint32)domain_id;
wsrep_gtid_domain_id= (uint32)domain_id;
}
}
err= sst_scan_uuid_seqno (out, &ret_uuid, &ret_seqno);
@ -1770,6 +1779,8 @@ static int sst_flush_tables(THD* thd)
char content[100];
snprintf(content, sizeof(content), "%s:%lld %d\n", wsrep_cluster_state_uuid,
(long long)wsrep_locked_seqno, wsrep_gtid_server.domain_id);
WSREP_DEBUG("sst_flush_tables : %s:%lld %d", wsrep_cluster_state_uuid,
(long long)wsrep_locked_seqno, wsrep_gtid_server.domain_id);
err= sst_create_file(flush_success, content);
if (err)

View file

@ -36,7 +36,7 @@ static Wsrep_thd_queue* wsrep_rollback_queue= 0;
static Atomic_counter<uint64_t> wsrep_bf_aborts_counter;
int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff,
int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, void *, system_status_var *,
enum enum_var_type scope)
{
wsrep_local_bf_aborts= wsrep_bf_aborts_counter;

View file

@ -82,7 +82,7 @@ private:
mysql_cond_t COND_wsrep_thd_queue;
};
int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff,
int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, void *, system_status_var *,
enum enum_var_type scope);
bool wsrep_create_appliers(long threads, bool mutex_protected=false);
void wsrep_create_rollbacker();

Some files were not shown because too many files have changed in this diff Show more