summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2023-05-02 15:45:35 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2023-05-02 15:45:35 +0200
commit1d15300b301c3026216c3d52fa6bad737d734673 (patch)
tree6b8fac7968b519f79b8e96976b98a549b27a96fd
parentedd0b03e60f4cc666fbdf16e7b01b97188f2f887 (diff)
parentc6ef9b1c1a59dd5dae81888d47f1749e1a433b96 (diff)
downloadmariadb-git-1d15300b301c3026216c3d52fa6bad737d734673.tar.gz
Merge branch '10.4' into bb-10.4-release
-rw-r--r--mysql-test/suite/galera/r/galera_var_retry_autocommit.result12
-rw-r--r--mysql-test/suite/galera/t/galera_var_retry_autocommit.test19
-rw-r--r--mysql-test/suite/galera_sr/r/MDEV-30838.result15
-rw-r--r--mysql-test/suite/galera_sr/t/MDEV-30838.test18
-rw-r--r--sql/wsrep_schema.cc5
-rw-r--r--sql/wsrep_thd.h9
m---------wsrep-lib0
7 files changed, 72 insertions, 6 deletions
diff --git a/mysql-test/suite/galera/r/galera_var_retry_autocommit.result b/mysql-test/suite/galera/r/galera_var_retry_autocommit.result
index 56c2c995402..50667b0a4fa 100644
--- a/mysql-test/suite/galera/r/galera_var_retry_autocommit.result
+++ b/mysql-test/suite/galera/r/galera_var_retry_autocommit.result
@@ -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;
@@ -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(*)
diff --git a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
index bd10e448e06..c58eba1410e 100644
--- a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
+++ b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test
@@ -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
@@ -44,6 +46,7 @@ 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)
@@ -51,14 +54,21 @@ 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
+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;
@@ -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
@@ -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
diff --git a/mysql-test/suite/galera_sr/r/MDEV-30838.result b/mysql-test/suite/galera_sr/r/MDEV-30838.result
new file mode 100644
index 00000000000..6997b9c4d5d
--- /dev/null
+++ b/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");
diff --git a/mysql-test/suite/galera_sr/t/MDEV-30838.test b/mysql-test/suite/galera_sr/t/MDEV-30838.test
new file mode 100644
index 00000000000..39ca7d2a375
--- /dev/null
+++ b/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");
diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc
index 40cdd6496b2..1bc8dd5c98f 100644
--- a/sql/wsrep_schema.cc
+++ b/sql/wsrep_schema.cc
@@ -991,10 +991,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);
}
diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h
index cf8528c3165..a17de084c93 100644
--- a/sql/wsrep_thd.h
+++ b/sql/wsrep_thd.h
@@ -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);
diff --git a/wsrep-lib b/wsrep-lib
-Subproject 275a0af8c5b92f0ee33cfe9e23f3db5f59b56e9
+Subproject 4951c38357737d568b554402bc5b6abe88a38fe