summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2022-10-03 10:30:34 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2022-10-09 10:09:47 +0300
commit7be82a1fec92a582a4933f6ee186ea08350d154f (patch)
treec384e9843f917946820eeaacf300395df9e8c1a0
parent5f26f50020e9a41f644893088e94de74de55f95d (diff)
downloadmariadb-git-7be82a1fec92a582a4933f6ee186ea08350d154f.tar.gz
MDEV-29142 : Assertion `!_current_thd()' failed in void destroy_background_thd(THD*)
In test user has set WSREP_ON=OFF this causes streaming replication recovery to fail and this caused call to unireg_abort(). However, this call is not necessary and we can let transaction to fail. Naturally, if real user does this he needs to bootstrap his cluster.
-rw-r--r--mysql-test/suite/galera/r/MDEV-29142.result43
-rw-r--r--mysql-test/suite/galera/t/MDEV-29142.test71
-rw-r--r--sql/wsrep_mysqld.cc13
3 files changed, 121 insertions, 6 deletions
diff --git a/mysql-test/suite/galera/r/MDEV-29142.result b/mysql-test/suite/galera/r/MDEV-29142.result
new file mode 100644
index 00000000000..3816ca19867
--- /dev/null
+++ b/mysql-test/suite/galera/r/MDEV-29142.result
@@ -0,0 +1,43 @@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
+connection node_1;
+call mtr.add_suppression("WSREP: Event .* Write_rows_v1 apply failed:.*");
+call mtr.add_suppression("WSREP: Failed to apply write set:.*");
+connection node_2;
+call mtr.add_suppression("WSREP: Failed to open table mysql.wsrep_streaming_log for writing");
+call mtr.add_suppression("WSREP: Failed to open SR table for write");
+call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0");
+SET @@global.tx_read_only = ON;
+SET default_storage_engine = SEQUENCE;
+create table t1 (c1 int);
+ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by the engine")
+CREATE TABLE t1(c1 VARCHAR(20)) engine=innodb;
+INSERT INTO t1 VALUES(0xA9B8);
+create TABLE t1 (c1 int) engine=innodb;
+ERROR 42S01: Table 't1' already exists
+create TABLE t1 (c1 int) engine=innodb;
+ERROR 42S01: Table 't1' already exists
+SET GLOBAL wsrep_on=OFF;
+SET GLOBAL wsrep_cluster_address='gcomm://';
+INSERT INTO t1 VALUES (1);
+SELECT 1;
+1
+1
+SELECT 1;
+1
+1
+COMMIT;
+# Killing cluster because we have messed with wsrep_cluster_address
+connection node_2;
+SET SESSION wsrep_sync_wait = 0;
+Killing server ...
+connection node_1;
+SET SESSION wsrep_sync_wait = 0;
+Killing server ...
+connection node_2;
+call mtr.add_suppression("WSREP: Failed to open table mysql.wsrep_streaming_log for writing");
+call mtr.add_suppression("WSREP: Failed to open SR table for write");
+call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0");
+DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/galera/t/MDEV-29142.test b/mysql-test/suite/galera/t/MDEV-29142.test
new file mode 100644
index 00000000000..7f68e91859c
--- /dev/null
+++ b/mysql-test/suite/galera/t/MDEV-29142.test
@@ -0,0 +1,71 @@
+--source include/galera_cluster.inc
+--source include/have_sequence.inc
+--source include/force_restart.inc
+
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--source include/auto_increment_offset_save.inc
+
+--connection node_1
+call mtr.add_suppression("WSREP: Event .* Write_rows_v1 apply failed:.*");
+call mtr.add_suppression("WSREP: Failed to apply write set:.*");
+
+--connection node_2
+call mtr.add_suppression("WSREP: Failed to open table mysql.wsrep_streaming_log for writing");
+call mtr.add_suppression("WSREP: Failed to open SR table for write");
+call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0");
+
+SET @@global.tx_read_only = ON;
+--error 0,1286
+SET default_storage_engine = SEQUENCE;
+--error 1005
+create table t1 (c1 int);
+CREATE TABLE t1(c1 VARCHAR(20)) engine=innodb;
+INSERT INTO t1 VALUES(0xA9B8);
+--error 1050
+create TABLE t1 (c1 int) engine=innodb;
+--error 1050
+create TABLE t1 (c1 int) engine=innodb;
+--let $wsrep_cluster_address_saved = `SELECT @@global.wsrep_cluster_address`
+SET GLOBAL wsrep_on=OFF;
+SET GLOBAL wsrep_cluster_address='gcomm://';
+INSERT INTO t1 VALUES (1);
+SELECT 1;
+SELECT 1;
+COMMIT;
+
+#
+# Kill the entire cluster and restart
+#
+--echo # Killing cluster because we have messed with wsrep_cluster_address
+--connection node_2
+SET SESSION wsrep_sync_wait = 0;
+--source include/kill_galera.inc
+
+--connection node_1
+SET SESSION wsrep_sync_wait = 0;
+--source include/kill_galera.inc
+
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
+--let $start_mysqld_params = "--wsrep-new-cluster"
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--source include/start_mysqld.inc
+
+--connection node_2
+--let $start_mysqld_params = ""
+--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+--source include/start_mysqld.inc
+
+call mtr.add_suppression("WSREP: Failed to open table mysql.wsrep_streaming_log for writing");
+call mtr.add_suppression("WSREP: Failed to open SR table for write");
+call mtr.add_suppression("WSREP: Failed to recover SR transactions from schema: wsrep_on : 0");
+
+#
+# Cleanup
+#
+--source ../../galera/include/auto_increment_offset_restore.inc
+# We killed cluster, it might mean that table does not exists
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 743837f4ee1..ccf191b2e21 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -414,19 +414,20 @@ void wsrep_recover_sr_from_storage(THD *orig_thd)
if (!wsrep_schema)
{
WSREP_ERROR("Wsrep schema not initialized when trying to recover "
- "streaming transactions");
- unireg_abort(1);
+ "streaming transactions: wsrep_on %d", WSREP_ON);
+ trans_commit(orig_thd);
}
if (wsrep_schema->recover_sr_transactions(orig_thd))
{
- WSREP_ERROR("Failed to recover SR transactions from schema");
- unireg_abort(1);
+ WSREP_ERROR("Failed to recover SR transactions from schema: wsrep_on : %d", WSREP_ON);
+ trans_commit(orig_thd);
}
break;
default:
/* */
- WSREP_ERROR("Unsupported wsrep SR store type: %lu", wsrep_SR_store_type);
- unireg_abort(1);
+ WSREP_ERROR("Unsupported wsrep SR store type: %lu wsrep_on: %d",
+ wsrep_SR_store_type, WSREP_ON);
+ trans_commit(orig_thd);
break;
}
}