Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mysql-test/suite/galera/r/MDEV-22232.result
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ connection node_1;
SET DEBUG_SYNC = 'now WAIT_FOR may_run';
TRUNCATE TABLE t1;
connection con1;
ERROR 70100: Query execution was interrupted
Got one of the listed errors
SET DEBUG_SYNC = 'RESET';
--- CTAS with non-empty result set ---
INSERT INTO t1 VALUES (10), (20), (30);
Expand All @@ -19,7 +19,7 @@ connection node_1;
SET DEBUG_SYNC = 'now WAIT_FOR may_run';
TRUNCATE TABLE t1;
connection con1;
ERROR 70100: Query execution was interrupted
Got one of the listed errors
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
disconnect con1;
Expand Down
7 changes: 3 additions & 4 deletions mysql-test/suite/galera/r/MDEV-32938.result
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ connection node_1;
connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1;
call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
CREATE TABLE t1(c1 INT PRIMARY KEY, c2 INT) ENGINE=InnoDB;
SET DEBUG_SYNC = 'wsrep_append_fk_toi_keys_before_close_tables SIGNAL may_alter WAIT_FOR bf_abort';
SET DEBUG_SYNC = 'wsrep_append_fk_toi_keys_before_close_tables SIGNAL may_alter';
ALTER TABLE t1 DROP COLUMN c2;
connection node_1;
SET DEBUG_SYNC = 'now WAIT_FOR may_alter';
ALTER TABLE t1 ADD COLUMN c3 INT;
connection con1;
ERROR 70100: Query execution was interrupted
INSERT INTO t1 (c1, c2, c3) VALUES (1, 0, 0);
INSERT INTO t1 (c1, c3) VALUES (1, 0);
connection node_2;
INSERT INTO t1 (c1, c2, c3) VALUES (2, 0, 0);
INSERT INTO t1 (c1, c3) VALUES (2, 0);
connection node_1;
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/suite/galera/r/galera_as_slave_ctas.result
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ connection node_3;
DROP TABLE source;
DROP TABLE target;
connection node_2;
call mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on");
call mtr.add_suppression("WSREP: Failed to apply write set: gtid:");
connection node_1;
STOP SLAVE;
RESET SLAVE ALL;
call mtr.add_suppression("WSREP: unexpected async replication event: 0");
connection node_3;
RESET MASTER;
3 changes: 3 additions & 0 deletions mysql-test/suite/galera/r/galera_bf_abort.result
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ connection node_2a;
connection node_2;
INSERT INTO t1 VALUES (2, 'node_2');
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
wsrep_local_aborts_increment
1
DROP TABLE t1;
disconnect node_2;
disconnect node_1;
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ COUNT(*) = 5
1
CREATE TABLE t1 AS SELECT * FROM t2;
connection node_1;
ERROR 70100: Query execution was interrupted
Got one of the listed errors
SET GLOBAL DEBUG_DBUG = '';
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1, t2;
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/galera/suite.pm
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ push @::global_suppressions,
qr|WSREP: Trying to continue unpaused monitor|,
qr|WSREP: Wait for gtid returned error 3 while waiting for prior transactions to commit before setting position|,
qr|WSREP: Failed to report last committed|,
qr|bytes freed by|,
);

sub which($) { return `sh -c "command -v $_[0]"` }
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/suite/galera/t/MDEV-22232.test
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TRUNCATE TABLE t1;

--connection con1
# CTAS gets BF aborted.
--error ER_QUERY_INTERRUPTED
--error ER_QUERY_INTERRUPTED, ER_LOCK_DEADLOCK
--reap

# Cleanup
Expand All @@ -56,7 +56,7 @@ TRUNCATE TABLE t1;

--connection con1
# CTAS gets BF aborted.
--error ER_QUERY_INTERRUPTED
--error ER_QUERY_INTERRUPTED, ER_LOCK_DEADLOCK
--reap

# Cleanup
Expand Down
18 changes: 9 additions & 9 deletions mysql-test/suite/galera/t/MDEV-32938.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
# - after entering TOI mode, it would later find it'd been killed, and complete with an error
# - at the same time, the command would successfully apply on every other node except the initiator.
#
# Fixed by checking killed state on THD before entering TOI.
#
# NOTE : After MDL-lock conflict resolution rework this test behaviour has
# changed.
#

--source include/galera_cluster.inc
Expand All @@ -28,26 +30,24 @@ call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
CREATE TABLE t1(c1 INT PRIMARY KEY, c2 INT) ENGINE=InnoDB;

# Run ALTER DROP COLUMN and hang before closing tables on adding FK keys and before entering TOI.
# Wait until it gets BF-aborted.
SET DEBUG_SYNC = 'wsrep_append_fk_toi_keys_before_close_tables SIGNAL may_alter WAIT_FOR bf_abort';
SET DEBUG_SYNC = 'wsrep_append_fk_toi_keys_before_close_tables SIGNAL may_alter';
--send
ALTER TABLE t1 DROP COLUMN c2;

--connection node_1
# Run ALTER ADD COLUMN and BF-abort the previous ALTER DROP COLUMN.
# Run ALTER ADD COLUMN
SET DEBUG_SYNC = 'now WAIT_FOR may_alter';
ALTER TABLE t1 ADD COLUMN c3 INT;

--connection con1
# ALTER DROP COLUMN gets BF aborted.
--error ER_QUERY_INTERRUPTED
# ALTER DROP COLUMN waits
--reap

INSERT INTO t1 (c1, c2, c3) VALUES (1, 0, 0);
INSERT INTO t1 (c1, c3) VALUES (1, 0);

--connection node_2
# ALTER DROP COLUMN must not be replicated.
INSERT INTO t1 (c1, c2, c3) VALUES (2, 0, 0);
# ALTER DROP COLUMN must be replicated.
INSERT INTO t1 (c1, c3) VALUES (2, 0);

# Cleanup.
--connection node_1
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/suite/galera/t/galera_as_slave_ctas.test
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,13 @@ DROP TABLE target;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target';
--source include/wait_condition.inc
call mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on");
call mtr.add_suppression("WSREP: Failed to apply write set: gtid:");

--connection node_1
STOP SLAVE;
RESET SLAVE ALL;
call mtr.add_suppression("WSREP: unexpected async replication event: 0");

--connection node_3
RESET MASTER;
2 changes: 2 additions & 0 deletions mysql-test/suite/galera/t/galera_bf_abort.test
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ INSERT INTO t1 VALUES (1,'node_1');
--connection node_2
--error ER_LOCK_DEADLOCK
INSERT INTO t1 VALUES (2, 'node_2');
COMMIT;

--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`

Expand All @@ -32,3 +33,4 @@ INSERT INTO t1 VALUES (2, 'node_2');
--enable_query_log

DROP TABLE t1;
--source include/galera_end.inc
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ SELECT COUNT(*) = 5 FROM t2;
CREATE TABLE t1 AS SELECT * FROM t2;

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

SET GLOBAL DEBUG_DBUG = '';
Expand Down
5 changes: 5 additions & 0 deletions sql/service_wsrep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ extern "C" my_bool wsrep_thd_bf_abort(THD *bf_thd, THD *victim_thd,
*/
if ((ret || !wsrep_on(victim_thd)) && signal)
{
WSREP_DEBUG("wsrep_thd_bf_abort thread %ld sending "
"KILL_QUERY_HARD to %ld ret=%d signal %d",
bf_thd->thread_id,
victim_thd->thread_id,
ret, signal);
victim_thd->wsrep_aborter= bf_thd->thread_id;
victim_thd->awake_no_mutex(KILL_QUERY_HARD);
} else {
Expand Down
8 changes: 8 additions & 0 deletions sql/sql_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2182,6 +2182,10 @@ int THD::killed_errno()
DBUG_RETURN(ER_CONNECTION_KILLED);
case KILL_QUERY:
case KILL_QUERY_HARD:
#ifdef WITH_WSREP
if (WSREP(this))
wsrep_report_query_interrupted(this, __FILE__, __LINE__);
#endif /* WITH_WSREP */
DBUG_RETURN(ER_QUERY_INTERRUPTED);
case KILL_TIMEOUT:
case KILL_TIMEOUT_HARD:
Expand Down Expand Up @@ -8352,6 +8356,10 @@ wait_for_commit::wait_for_prior_commit2(THD *thd, bool allow_kill)
wakeup_error= ER_QUERY_INTERRUPTED;
my_message(wakeup_error, ER_THD(thd, wakeup_error), MYF(0));
thd->EXIT_COND(&old_stage);
#ifdef WITH_WSREP
if (WSREP(thd))
wsrep_report_query_interrupted(thd, __FILE__, __LINE__);
#endif /* WITH_WSREP */
/*
Must do the DEBUG_SYNC() _after_ exit_cond(), as DEBUG_SYNC is not safe to
use within enter_cond/exit_cond.
Expand Down
Loading