Skip to content

Commit 10e135b

Browse files
committed
Merge branch 'bb-10.4-release' into bb-10.5-release
2 parents 495f1ec + 1d15300 commit 10e135b

File tree

7 files changed

+73
-7
lines changed

7 files changed

+73
-7
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,25 @@ DROP TABLE t1;
2020
connection node_1;
2121
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
2222
SET SESSION wsrep_retry_autocommit = 1;
23+
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
2324
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue';
2425
INSERT INTO t1 (f1) VALUES (3);
2526
connection node_1a;
2627
SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
2728
connection node_2;
2829
TRUNCATE TABLE t1;
29-
connection node_1;
30+
connection node_1a;
31+
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
3032
SELECT COUNT(*) FROM t1;
3133
COUNT(*)
3234
0
35+
SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';
36+
connection node_1;
37+
SELECT COUNT(*) FROM t1;
38+
COUNT(*)
39+
1
3340
SET DEBUG_SYNC = 'RESET';
41+
SET GLOBAL debug_dbug = NULL;
3442
DROP TABLE t1;
3543
connection node_1;
3644
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
@@ -64,6 +72,8 @@ SET SESSION wsrep_retry_autocommit = 64;
6472
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
6573
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 64';
6674
INSERT INTO t1 VALUES (5);
75+
connection node_2;
76+
connection node_1;
6777
connection node_1;
6878
SELECT COUNT(*) FROM t1;
6979
COUNT(*)

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
2525
SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
2626

2727
--connection node_2
28+
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
29+
--source include/wait_condition.inc
2830
TRUNCATE TABLE t1;
2931

3032
--connection node_1
@@ -44,21 +46,29 @@ DROP TABLE t1;
4446
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
4547

4648
SET SESSION wsrep_retry_autocommit = 1;
49+
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
4750
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue';
4851
--send INSERT INTO t1 (f1) VALUES (3)
4952

5053
--connection node_1a
5154
SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
5255

5356
--connection node_2
57+
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
58+
--source include/wait_condition.inc
5459
TRUNCATE TABLE t1;
5560

61+
--connection node_1a
62+
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
63+
SELECT COUNT(*) FROM t1;
64+
SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';
65+
5666
--connection node_1
57-
--error 0,ER_LOCK_DEADLOCK
5867
--reap
5968
SELECT COUNT(*) FROM t1;
6069

6170
SET DEBUG_SYNC = 'RESET';
71+
SET GLOBAL debug_dbug = NULL;
6272
DROP TABLE t1;
6373

6474

@@ -79,6 +89,8 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
7989
SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
8090

8191
--connection node_2
92+
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
93+
--source include/wait_condition.inc
8294
TRUNCATE TABLE t1;
8395

8496
--connection node_1a
@@ -114,6 +126,11 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
114126

115127
--send INSERT INTO t1 VALUES (5)
116128

129+
--connection node_2
130+
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
131+
--source include/wait_condition.inc
132+
133+
--connection node_1
117134
--disable_query_log
118135
--disable_result_log
119136
--let $count = 64
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
connection node_2;
2+
connection node_1;
3+
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
4+
SET SESSION wsrep_trx_fragment_size=1;
5+
START TRANSACTION;
6+
INSERT INTO t1 VALUES(1);
7+
SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
8+
INSERT INTO t1 VALUES(2);
9+
ERROR HY000: Error while appending streaming replication fragment
10+
COMMIT;
11+
SELECT * FROM t1;
12+
f1
13+
SET debug_dbug='-d,ib_create_table_fail_too_many_trx';
14+
DROP TABLE t1;
15+
CALL mtr.add_suppression("Error writing into mysql.wsrep_streaming_log: 177");
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#
2+
# MDEV-30838 - Assertion `m_thd == _current_thd()' failed in
3+
# virtual int Wsrep_client_service::bf_rollback()
4+
#
5+
--source include/galera_cluster.inc
6+
--source include/have_debug_sync.inc
7+
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
8+
SET SESSION wsrep_trx_fragment_size=1;
9+
START TRANSACTION;
10+
INSERT INTO t1 VALUES(1);
11+
SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
12+
--error ER_ERROR_DURING_COMMIT
13+
INSERT INTO t1 VALUES(2);
14+
COMMIT;
15+
SELECT * FROM t1;
16+
SET debug_dbug='-d,ib_create_table_fail_too_many_trx';
17+
DROP TABLE t1;
18+
CALL mtr.add_suppression("Error writing into mysql.wsrep_streaming_log: 177");

sql/wsrep_schema.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,10 +1016,9 @@ int Wsrep_schema::append_fragment(THD* thd,
10161016
Wsrep_schema_impl::store(frag_table, 3, flags);
10171017
Wsrep_schema_impl::store(frag_table, 4, data.data(), data.size());
10181018

1019-
int error;
1020-
if ((error= Wsrep_schema_impl::insert(frag_table))) {
1021-
WSREP_ERROR("Failed to write to frag table: %d", error);
1019+
if (Wsrep_schema_impl::insert(frag_table)) {
10221020
trans_rollback_stmt(thd);
1021+
close_thread_tables(thd);
10231022
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
10241023
DBUG_RETURN(1);
10251024
}

sql/wsrep_thd.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,14 @@ static inline void wsrep_override_error(THD* thd,
228228
break;
229229
case wsrep::e_append_fragment_error:
230230
/* TODO: Figure out better error number */
231-
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, 0, status);
231+
if (status)
232+
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT,
233+
"Error while appending streaming replication fragment"
234+
"(provider status: %s)",
235+
wsrep::provider::to_string(status).c_str());
236+
else
237+
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT,
238+
"Error while appending streaming replication fragment");
232239
break;
233240
case wsrep::e_not_supported_error:
234241
wsrep_override_error(thd, ER_NOT_SUPPORTED_YET);

0 commit comments

Comments
 (0)