Skip to content

Commit d74e3a5

Browse files
committed
Merge branch 'codership-10.4-MDEV-22666-v2' into 10.4
2 parents 2fbf751 + e04999c commit d74e3a5

File tree

5 files changed

+71
-6
lines changed

5 files changed

+71
-6
lines changed

mysql-test/suite/galera/r/galera_bf_kill.result

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,20 @@ a b
7070
2 1
7171
disconnect node_2a;
7272
drop table t1;
73+
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
74+
connection node_2a;
75+
CREATE TABLE t1 (i int primary key);
76+
SET DEBUG_SYNC = "before_wsrep_ordered_commit SIGNAL bwoc_reached WAIT_FOR bwoc_continue";
77+
INSERT INTO t1 VALUES (1);
78+
connection node_2;
79+
SET DEBUG_SYNC = "now WAIT_FOR bwoc_reached";
80+
SET DEBUG_SYNC = "now SIGNAL bwoc_continue";
81+
SET DEBUG_SYNC='RESET';
82+
connection node_2a;
83+
connection node_2;
84+
select * from t1;
85+
i
86+
1
87+
disconnect node_2a;
88+
connection node_2;
89+
drop table t1;

mysql-test/suite/galera/t/galera_bf_kill.test

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
--source include/galera_cluster.inc
2+
--source include/have_innodb.inc
3+
--source include/have_debug.inc
4+
--source include/have_debug_sync.inc
25

36
#
47
# Test case 1: Start a transaction on node_2a and kill it
@@ -140,4 +143,48 @@ select * from t1;
140143
drop table t1;
141144

142145

146+
#
147+
# Test case 7:
148+
# run a transaction in node 2, and set a sync point to pause the transaction
149+
# in commit phase.
150+
# Through another connection to node 2, kill the committing transaction by
151+
# KILL QUERY command
152+
#
153+
154+
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
155+
--connection node_2a
156+
--let $connection_id = `SELECT CONNECTION_ID()`
157+
158+
CREATE TABLE t1 (i int primary key);
159+
160+
# Set up sync point
161+
SET DEBUG_SYNC = "before_wsrep_ordered_commit SIGNAL bwoc_reached WAIT_FOR bwoc_continue";
162+
163+
# Send insert which will block in the sync point above
164+
--send INSERT INTO t1 VALUES (1)
165+
166+
--connection node_2
167+
SET DEBUG_SYNC = "now WAIT_FOR bwoc_reached";
168+
169+
--disable_query_log
170+
--disable_result_log
171+
# victim has passed the point of no return, kill is not possible anymore
172+
--eval KILL QUERY $connection_id
173+
--enable_result_log
174+
--enable_query_log
175+
176+
SET DEBUG_SYNC = "now SIGNAL bwoc_continue";
177+
SET DEBUG_SYNC='RESET';
178+
--connection node_2a
179+
--error 0,1213
180+
--reap
181+
182+
--connection node_2
183+
# victim was able to complete the INSERT
184+
select * from t1;
185+
186+
--disconnect node_2a
187+
188+
--connection node_2
189+
drop table t1;
143190

mysql-test/suite/galera/t/galera_bf_lock_wait.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
--source include/galera_cluster.inc
2+
--source include/have_innodb.inc
23
--source include/big_test.inc
34

45
--connection node_1

sql/service_wsrep.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ extern "C" void wsrep_commit_ordered(THD *thd)
299299
thd->wsrep_trx().state() == wsrep::transaction::s_committing &&
300300
!wsrep_commit_will_write_binlog(thd))
301301
{
302+
DEBUG_SYNC(thd, "before_wsrep_ordered_commit");
302303
thd->wsrep_cs().ordered_commit();
303304
}
304305
}

storage/innobase/trx/trx0trx.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,12 +1511,6 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr)
15111511
if (fts_trx)
15121512
trx_finalize_for_fts(this, undo_no != 0);
15131513

1514-
trx_mutex_enter(this);
1515-
dict_operation= TRX_DICT_OP_NONE;
1516-
1517-
DBUG_LOG("trx", "Commit in memory: " << this);
1518-
state= TRX_STATE_NOT_STARTED;
1519-
15201514
#ifdef WITH_WSREP
15211515
/* Serialization history has been written and the transaction is
15221516
committed in memory, which makes this commit ordered. Release commit
@@ -1528,6 +1522,11 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr)
15281522
}
15291523
lock.was_chosen_as_wsrep_victim= false;
15301524
#endif /* WITH_WSREP */
1525+
trx_mutex_enter(this);
1526+
dict_operation= TRX_DICT_OP_NONE;
1527+
1528+
DBUG_LOG("trx", "Commit in memory: " << this);
1529+
state= TRX_STATE_NOT_STARTED;
15311530

15321531
assert_freed();
15331532
trx_init(this);

0 commit comments

Comments
 (0)