Skip to content

Commit

Permalink
Merge 10.6 into 10.9
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed May 22, 2023
2 parents 2f9e264 + eb2e074 commit 0796b7a
Show file tree
Hide file tree
Showing 37 changed files with 640 additions and 301 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ variables:
CMAKE_FLAGS: "-DWITH_SSL=system -DPLUGIN_COLUMNSTORE=NO -DPLUGIN_ROCKSDB=NO -DPLUGIN_S3=NO -DPLUGIN_MROONGA=NO -DPLUGIN_CONNECT=NO -DPLUGIN_MROONGA=NO -DPLUGIN_TOKUDB=NO -DPLUGIN_PERFSCHEMA=NO -DWITH_WSREP=OFF"
# Major version dictates which branches share the same ccache. E.g. 10.6-abc
# and 10.6-xyz will have the same cache.
MARIADB_MAJOR_VERSION: "10.8"
MARIADB_MAJOR_VERSION: "10.9"
# NOTE! Currently ccache is only used on the Centos8 build. As each job has
# sufficiently different environments they are unable to benefit from each
# other's ccaches. As each build generates about 1 GB of ccache, having
Expand Down
9 changes: 4 additions & 5 deletions include/mysql/service_wsrep.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ extern struct wsrep_service_st {
my_bool (*wsrep_on_func)(const MYSQL_THD thd);
bool (*wsrep_prepare_key_for_innodb_func)(MYSQL_THD thd, const unsigned char*, size_t, const unsigned char*, size_t, struct wsrep_buf*, size_t*);
void (*wsrep_thd_LOCK_func)(const MYSQL_THD thd);
int (*wsrep_thd_TRYLOCK_func)(const MYSQL_THD thd);
void (*wsrep_thd_UNLOCK_func)(const MYSQL_THD thd);
const char * (*wsrep_thd_query_func)(const MYSQL_THD thd);
int (*wsrep_thd_retry_counter_func)(const MYSQL_THD thd);
Expand Down Expand Up @@ -89,7 +90,6 @@ extern struct wsrep_service_st {
ulong (*wsrep_OSU_method_get_func)(const MYSQL_THD thd);
my_bool (*wsrep_thd_has_ignored_error_func)(const MYSQL_THD thd);
void (*wsrep_thd_set_ignored_error_func)(MYSQL_THD thd, my_bool val);
bool (*wsrep_thd_set_wsrep_aborter_func)(MYSQL_THD bf_thd, MYSQL_THD thd);
void (*wsrep_report_bf_lock_wait_func)(const MYSQL_THD thd,
unsigned long long trx_id);
void (*wsrep_thd_kill_LOCK_func)(const MYSQL_THD thd);
Expand All @@ -111,6 +111,7 @@ extern struct wsrep_service_st {
#define wsrep_on(thd) (thd) && WSREP_ON && wsrep_service->wsrep_on_func(thd)
#define wsrep_prepare_key_for_innodb(A,B,C,D,E,F,G) wsrep_service->wsrep_prepare_key_for_innodb_func(A,B,C,D,E,F,G)
#define wsrep_thd_LOCK(T) wsrep_service->wsrep_thd_LOCK_func(T)
#define wsrep_thd_TRYLOCK(T) wsrep_service->wsrep_thd_TRYLOCK_func(T)
#define wsrep_thd_UNLOCK(T) wsrep_service->wsrep_thd_UNLOCK_func(T)
#define wsrep_thd_kill_LOCK(T) wsrep_service->wsrep_thd_kill_LOCK_func(T)
#define wsrep_thd_kill_UNLOCK(T) wsrep_service->wsrep_thd_kill_UNLOCK_func(T)
Expand Down Expand Up @@ -141,7 +142,6 @@ extern struct wsrep_service_st {
#define wsrep_OSU_method_get(T) wsrep_service->wsrep_OSU_method_get_func(T)
#define wsrep_thd_has_ignored_error(T) wsrep_service->wsrep_thd_has_ignored_error_func(T)
#define wsrep_thd_set_ignored_error(T,V) wsrep_service->wsrep_thd_set_ignored_error_func(T,V)
#define wsrep_thd_set_wsrep_aborter(T) wsrep_service->wsrep_thd_set_wsrep_aborter_func(T1, T2)
#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)
#else
Expand Down Expand Up @@ -175,6 +175,8 @@ void wsrep_set_data_home_dir(const char *data_dir);
extern "C" my_bool wsrep_on(const MYSQL_THD thd);
/* Lock thd wsrep lock */
extern "C" void wsrep_thd_LOCK(const MYSQL_THD thd);
/* Try thd wsrep lock. Return non-zero if lock could not be taken. */
extern "C" int wsrep_thd_TRYLOCK(const MYSQL_THD thd);
/* Unlock thd wsrep lock */
extern "C" void wsrep_thd_UNLOCK(const MYSQL_THD thd);

Expand All @@ -197,8 +199,6 @@ extern "C" my_bool wsrep_thd_is_local(const MYSQL_THD thd);
/* Return true if thd is in high priority mode */
/* todo: rename to is_high_priority() */
extern "C" my_bool wsrep_thd_is_applying(const MYSQL_THD thd);
/* set wsrep_aborter for the target THD */
extern "C" bool wsrep_thd_set_wsrep_aborter(MYSQL_THD bf_thd, MYSQL_THD victim_thd);
/* Return true if thd is in TOI mode */
extern "C" my_bool wsrep_thd_is_toi(const MYSQL_THD thd);
/* Return true if thd is in replicating TOI mode */
Expand Down Expand Up @@ -249,7 +249,6 @@ extern "C" my_bool wsrep_thd_is_applying(const MYSQL_THD thd);
extern "C" ulong wsrep_OSU_method_get(const MYSQL_THD thd);
extern "C" my_bool wsrep_thd_has_ignored_error(const MYSQL_THD thd);
extern "C" void wsrep_thd_set_ignored_error(MYSQL_THD thd, my_bool val);
extern "C" bool wsrep_thd_set_wsrep_aborter(MYSQL_THD bf_thd, MYSQL_THD victim_thd);
extern "C" void wsrep_report_bf_lock_wait(const THD *thd,
unsigned long long trx_id);
/* declare parallel applying unsafety for the THD */
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/suite/galera/disabled.def
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ 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
galera_insert_bulk : MDEV-30536 no expected deadlock in galera_insert_bulk test
MDEV-27713 : test is using get_lock(), which is now rejected in cluster
galera_bf_abort_group_commit : MDEV-30855 PR to remove the test exists
21 changes: 21 additions & 0 deletions mysql-test/suite/galera/r/MDEV-29293.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
connection node_2;
connection node_1;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
set wsrep_sync_wait = 0;
CREATE TABLE t1(a int not null primary key auto_increment, b int) engine=InnoDB;
INSERT INTO t1 VALUES (1,2);
connection node_1a;
BEGIN;
UPDATE t1 SET b=3 WHERE a=1;
connection node_1;
set debug_sync='wsrep_kill_before_awake_no_mutex SIGNAL before_kill WAIT_FOR continue';
connection node_1b;
set debug_sync= 'now WAIT_FOR before_kill';
connection node_2;
UPDATE t1 SET b=7 WHERE a=1;
connection node_1b;
set debug_sync= 'now SIGNAL continue';
connection node_1;
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
LOCK TABLE t2 WRITE;
connection node_1;
CREATE TABLE t1 AS SELECT * FROM t2;;
connection node_1a;
connection node_2;
SELECT COUNT(*) = 5 FROM t2;
COUNT(*) = 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,3 @@ connection node_1;
call mtr.add_suppression("Error in Log_event::read_log_event():.*");
CALL mtr.add_suppression("conflict state 7 after post commit");
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
connection node_2;
call mtr.add_suppression("Error in Log_event::read_log_event():.*");
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
27 changes: 27 additions & 0 deletions mysql-test/suite/galera/r/galera_kill_group_commit.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
connection node_2;
connection node_1;
connect node_1_kill, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connect node_1_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET SESSION wsrep_sync_wait = 0;
connect node_1_follower, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET SESSION wsrep_sync_wait = 0;
connection node_1;
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
SET SESSION DEBUG_SYNC = "commit_before_enqueue SIGNAL leader_before_enqueue_reached WAIT_FOR leader_before_enqueue_continue";
INSERT INTO t1 VALUES (1);
connection node_1_ctrl;
SET DEBUG_SYNC = "now WAIT_FOR leader_before_enqueue_reached";
connection node_1_follower;
INSERT INTO t1 VALUES (2);;
connection node_1_ctrl;
connection node_1_kill;
# Execute KILL QUERY for group commit follower
SET DEBUG_SYNC = "now SIGNAL leader_before_enqueue_continue";
connection node_1_follower;
connection node_1;
SELECT * FROM t1;
f1
1
2
SET DEBUG_SYNC = "RESET";
DROP TABLE t1;
5 changes: 4 additions & 1 deletion mysql-test/suite/galera/r/galera_var_retry_autocommit.result
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
1
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
0
SET DEBUG_SYNC = 'RESET';
SET GLOBAL debug_dbug = NULL;
DROP TABLE t1;
Expand Down
41 changes: 41 additions & 0 deletions mysql-test/suite/galera/t/MDEV-29293.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source include/galera_have_debug_sync.inc

--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1
set wsrep_sync_wait = 0;

CREATE TABLE t1(a int not null primary key auto_increment, b int) engine=InnoDB;
INSERT INTO t1 VALUES (1,2);

--connection node_1a
--let $victim_id = `SELECT CONNECTION_ID()`
BEGIN;
UPDATE t1 SET b=3 WHERE a=1;

--connection node_1
set debug_sync='wsrep_kill_before_awake_no_mutex SIGNAL before_kill WAIT_FOR continue';
--disable_query_log
--disable_result_log
--send_eval KILL CONNECTION $victim_id
--enable_result_log
--enable_query_log

--connection node_1b
set debug_sync= 'now WAIT_FOR before_kill';

--connection node_2
UPDATE t1 SET b=7 WHERE a=1;

--connection node_1b
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE User = 'system user' AND State LIKE 'Update_rows_log_event%';
--source include/wait_condition.inc
set debug_sync= 'now SIGNAL continue';

--connection node_1
--reap
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';

6 changes: 5 additions & 1 deletion mysql-test/suite/galera/t/galera_create_table_as_select.test
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ LOCK TABLE t2 WRITE;
--connection node_1
--send CREATE TABLE t1 AS SELECT * FROM t2;

--connection node_1a
--let $wait_condition = SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE STATE LIKE 'Waiting for table metadata lock%'
--source include/wait_condition.inc

--connection node_2
SELECT COUNT(*) = 5 FROM t2;
CREATE TABLE t1 AS SELECT * FROM t2;
Expand All @@ -121,7 +125,7 @@ CREATE TABLE t1 AS SELECT * FROM t2;
UNLOCK TABLES;

--connection node_1
--error ER_TABLE_EXISTS_ERROR,ER_LOCK_DEADLOCK
--error ER_TABLE_EXISTS_ERROR,ER_QUERY_INTERRUPTED
--reap

DROP TABLE t1, t2;
Expand Down
5 changes: 5 additions & 0 deletions mysql-test/suite/galera/t/galera_kill_group_commit.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
!include ../galera_2nodes.cnf

[mysqld]
log-bin
log-slave-updates
69 changes: 69 additions & 0 deletions mysql-test/suite/galera/t/galera_kill_group_commit.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#
# Verify that transaction which has reached group commit queue
# cannot be killed. If the kill succeeds, assertion for
# wsrep transaction state will fail.
#
# If the bug is present, i.e. wsrep transaction gets killed during
# group commit wait, this test is enough to reproduce the crash
# most of the time.
#

--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source include/galera_cluster.inc

# Connection for KILL commands
--connect node_1_kill, 127.0.0.1, root, , test, $NODE_MYPORT_1
# Connection for sync point control
--connect node_1_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1
SET SESSION wsrep_sync_wait = 0;
# Connection for group commit follower
--connect node_1_follower, 127.0.0.1, root, , test, $NODE_MYPORT_1
# Need to disable sync wait to reach commit queue when leader
# is blocked.
SET SESSION wsrep_sync_wait = 0;
--let $follower_id = `SELECT CONNECTION_ID()`

--connection node_1
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;

SET SESSION DEBUG_SYNC = "commit_before_enqueue SIGNAL leader_before_enqueue_reached WAIT_FOR leader_before_enqueue_continue";
--send INSERT INTO t1 VALUES (1)

--connection node_1_ctrl
SET DEBUG_SYNC = "now WAIT_FOR leader_before_enqueue_reached";

--connection node_1_follower
# SET SESSION DEBUG_SYNC = "group_commit_waiting_for_prior SIGNAL follower_waiting_for_prior_reached WAIT_FOR follower_waiting_for_prior_continue";
--send INSERT INTO t1 VALUES (2);

--connection node_1_ctrl
# TODO: Is it possible to use sync points to enforce group commit to happen?
# The leader will hold commit monitor in commit_before_enqueue sync point,
# which prevents the follower to reach the group commit wait state.
# We now sleep and expect the follower to reach group commit, but this
# may cause false negatives.
--sleep 1

--connection node_1_kill
--echo # Execute KILL QUERY for group commit follower
--disable_query_log
--disable_result_log
# Because it is currently impossible to verify that the
# follower has reached group commit queue, the KILL may
# sometimes return success.
--error 0,ER_KILL_DENIED_ERROR
--eval KILL QUERY $follower_id
--enable_result_log
--enable_query_log

SET DEBUG_SYNC = "now SIGNAL leader_before_enqueue_continue";
--connection node_1_follower
--reap

--connection node_1
--reap
SELECT * FROM t1;

SET DEBUG_SYNC = "RESET";
DROP TABLE t1;
1 change: 1 addition & 0 deletions mysql-test/suite/galera/t/galera_var_retry_autocommit.test
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ SELECT COUNT(*) FROM t1;
SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';

--connection node_1
--error 0,ER_LOCK_DEADLOCK
--reap
SELECT COUNT(*) FROM t1;

Expand Down
Loading

0 comments on commit 0796b7a

Please sign in to comment.