Skip to content

Commit

Permalink
Merge branch 'bb-10.4-release' into bb-10.5-release
Browse files Browse the repository at this point in the history
  • Loading branch information
sanja-byelkin committed May 2, 2023
2 parents 495f1ec + 1d15300 commit 10e135b
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 7 deletions.
12 changes: 11 additions & 1 deletion mysql-test/suite/galera/r/galera_var_retry_autocommit.result
Expand Up @@ -20,17 +20,25 @@ DROP TABLE t1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
SET SESSION wsrep_retry_autocommit = 1;
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue';
INSERT INTO t1 (f1) VALUES (3);
connection node_1a;
SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
connection node_2;
TRUNCATE TABLE t1;
connection node_1;
connection node_1a;
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
SELECT COUNT(*) FROM t1;
COUNT(*)
0
SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
1
SET DEBUG_SYNC = 'RESET';
SET GLOBAL debug_dbug = NULL;
DROP TABLE t1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
Expand Down Expand Up @@ -64,6 +72,8 @@ SET SESSION wsrep_retry_autocommit = 64;
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 64';
INSERT INTO t1 VALUES (5);
connection node_2;
connection node_1;
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
Expand Down
19 changes: 18 additions & 1 deletion mysql-test/suite/galera/t/galera_var_retry_autocommit.test
Expand Up @@ -25,6 +25,8 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
SET DEBUG_SYNC = 'now WAIT_FOR before_cert';

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

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

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

--connection node_1a
SET DEBUG_SYNC = 'now WAIT_FOR before_cert';

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

--connection node_1a
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
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;

SET DEBUG_SYNC = 'RESET';
SET GLOBAL debug_dbug = NULL;
DROP TABLE t1;


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

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

--connection node_1a
Expand Down Expand Up @@ -114,6 +126,11 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu

--send INSERT INTO t1 VALUES (5)

--connection node_2
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
--source include/wait_condition.inc

--connection node_1
--disable_query_log
--disable_result_log
--let $count = 64
Expand Down
15 changes: 15 additions & 0 deletions mysql-test/suite/galera_sr/r/MDEV-30838.result
@@ -0,0 +1,15 @@
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
SET SESSION wsrep_trx_fragment_size=1;
START TRANSACTION;
INSERT INTO t1 VALUES(1);
SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
INSERT INTO t1 VALUES(2);
ERROR HY000: Error while appending streaming replication fragment
COMMIT;
SELECT * FROM t1;
f1
SET debug_dbug='-d,ib_create_table_fail_too_many_trx';
DROP TABLE t1;
CALL mtr.add_suppression("Error writing into mysql.wsrep_streaming_log: 177");
18 changes: 18 additions & 0 deletions mysql-test/suite/galera_sr/t/MDEV-30838.test
@@ -0,0 +1,18 @@
#
# MDEV-30838 - Assertion `m_thd == _current_thd()' failed in
# virtual int Wsrep_client_service::bf_rollback()
#
--source include/galera_cluster.inc
--source include/have_debug_sync.inc
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
SET SESSION wsrep_trx_fragment_size=1;
START TRANSACTION;
INSERT INTO t1 VALUES(1);
SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
--error ER_ERROR_DURING_COMMIT
INSERT INTO t1 VALUES(2);
COMMIT;
SELECT * FROM t1;
SET debug_dbug='-d,ib_create_table_fail_too_many_trx';
DROP TABLE t1;
CALL mtr.add_suppression("Error writing into mysql.wsrep_streaming_log: 177");
5 changes: 2 additions & 3 deletions sql/wsrep_schema.cc
Expand Up @@ -1016,10 +1016,9 @@ int Wsrep_schema::append_fragment(THD* thd,
Wsrep_schema_impl::store(frag_table, 3, flags);
Wsrep_schema_impl::store(frag_table, 4, data.data(), data.size());

int error;
if ((error= Wsrep_schema_impl::insert(frag_table))) {
WSREP_ERROR("Failed to write to frag table: %d", error);
if (Wsrep_schema_impl::insert(frag_table)) {
trans_rollback_stmt(thd);
close_thread_tables(thd);
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
DBUG_RETURN(1);
}
Expand Down
9 changes: 8 additions & 1 deletion sql/wsrep_thd.h
Expand Up @@ -228,7 +228,14 @@ static inline void wsrep_override_error(THD* thd,
break;
case wsrep::e_append_fragment_error:
/* TODO: Figure out better error number */
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, 0, status);
if (status)
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT,
"Error while appending streaming replication fragment"
"(provider status: %s)",
wsrep::provider::to_string(status).c_str());
else
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT,
"Error while appending streaming replication fragment");
break;
case wsrep::e_not_supported_error:
wsrep_override_error(thd, ER_NOT_SUPPORTED_YET);
Expand Down

0 comments on commit 10e135b

Please sign in to comment.