mirror of
https://github.com/MariaDB/server.git
synced 2025-12-28 00:01:00 +00:00
MDEV-30764 : Assertion `transaction.is_streaming()' failed in void wsrep::transaction::adopt(const wsrep::transaction&)
This is very special case because test first sets read_only=ON disabling some of the writes. Based on documentation replication (slave) threads are not affected by this option. However, threads executing streaming replication recovery were effected by read_only setting. Fix is to set thd->security_ctx->skip_grants() for streaming replication threads so that they are not affected by read_only setting.
This commit is contained in:
parent
34a8209d66
commit
4918fc5780
66
mysql-test/suite/galera/r/MDEV-30764.result
Normal file
66
mysql-test/suite/galera/r/MDEV-30764.result
Normal file
@ -0,0 +1,66 @@
|
||||
connection node_2;
|
||||
connection node_1;
|
||||
connection node_1;
|
||||
connection node_2;
|
||||
connection node_1;
|
||||
SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true;pc.weight=2';
|
||||
connection node_2;
|
||||
SET GLOBAL read_only=1;
|
||||
SET SESSION wsrep_trx_fragment_size = 64;
|
||||
set default_storage_engine=SEQUENCE;
|
||||
SET AUTOCOMMIT = OFF;
|
||||
CREATE TABLE t1(c1 NUMERIC NOT NULL);
|
||||
ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by the engine")
|
||||
CREATE TABLE t1 (id INT PRIMARY KEY) engine=innodb;
|
||||
SET SESSION SQL_MODE='HIGH_NOT_PRECEDENCE';
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
SET GLOBAL SQL_MODE='NO_ENGINE_SUBSTITUTION';
|
||||
DROP TABLE dummy;
|
||||
ERROR 42S02: Unknown table 'test.dummy'
|
||||
INSERT INTO t1 VALUES('a');
|
||||
Warnings:
|
||||
Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`id` at row 1
|
||||
# In this point there should be one fragment
|
||||
select count(*) AS EXPECT_1 from mysql.wsrep_streaming_log;
|
||||
EXPECT_1
|
||||
1
|
||||
SET @@global.wsrep_cluster_address='gcomm://';
|
||||
SET SESSION SQL_MODE='TRADITIONAL ';
|
||||
# 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: BF applier thread");
|
||||
call mtr.add_suppression("WSREP: Event");
|
||||
call mtr.add_suppression("WSREP: SR trx recovery applying returned 1290");
|
||||
call mtr.add_suppression("WSREP: Adopting a transaction");
|
||||
call mtr.add_suppression("WSREP: Could not find applier context for");
|
||||
call mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster");
|
||||
call mtr.add_suppression("WSREP: Failed to vote on request for");
|
||||
select count(*) AS EXPECT_0 from mysql.wsrep_streaming_log;
|
||||
EXPECT_0
|
||||
0
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
connection node_1;
|
||||
select count(*) AS EXPECT_0 from mysql.wsrep_streaming_log;
|
||||
EXPECT_0
|
||||
0
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL wsrep_provider_options ='pc.ignore_sb=false;pc.weight=1';
|
||||
connection node_2;
|
||||
connection node_1;
|
||||
call mtr.add_suppression("WSREP: Event");
|
||||
call mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on");
|
||||
call mtr.add_suppression("WSREP: Failed to apply write set: gtid");
|
||||
call mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster");
|
||||
call mtr.add_suppression("WSREP: Could not find applier context for");
|
||||
call mtr.add_suppression("WSREP: Failed to vote on request for");
|
||||
disconnect node_2;
|
||||
disconnect node_1;
|
||||
100
mysql-test/suite/galera/t/MDEV-30764.test
Normal file
100
mysql-test/suite/galera/t/MDEV-30764.test
Normal file
@ -0,0 +1,100 @@
|
||||
--source include/galera_cluster.inc
|
||||
--source include/have_sequence.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
|
||||
SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true;pc.weight=2';
|
||||
|
||||
--connection node_2
|
||||
--let $wsrep_cluster_address_saved = `SELECT @@global.wsrep_cluster_address`
|
||||
SET GLOBAL read_only=1;
|
||||
SET SESSION wsrep_trx_fragment_size = 64;
|
||||
set default_storage_engine=SEQUENCE;
|
||||
SET AUTOCOMMIT = OFF;
|
||||
--error 1005
|
||||
CREATE TABLE t1(c1 NUMERIC NOT NULL);
|
||||
CREATE TABLE t1 (id INT PRIMARY KEY) engine=innodb;
|
||||
SET SESSION SQL_MODE='HIGH_NOT_PRECEDENCE';
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
SET GLOBAL SQL_MODE='NO_ENGINE_SUBSTITUTION';
|
||||
--error 1051
|
||||
DROP TABLE dummy;
|
||||
INSERT INTO t1 VALUES('a');
|
||||
--echo # In this point there should be one fragment
|
||||
select count(*) AS EXPECT_1 from mysql.wsrep_streaming_log;
|
||||
SET @@global.wsrep_cluster_address='gcomm://';
|
||||
SET SESSION SQL_MODE='TRADITIONAL ';
|
||||
|
||||
#
|
||||
# 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
|
||||
--source include/wait_until_ready.inc
|
||||
|
||||
--connection node_2
|
||||
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
|
||||
--let $start_mysqld_params =
|
||||
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
|
||||
--source include/start_mysqld.inc
|
||||
--source include/wait_until_ready.inc
|
||||
|
||||
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
|
||||
--source include/wait_condition.inc
|
||||
|
||||
call mtr.add_suppression("WSREP: BF applier thread");
|
||||
call mtr.add_suppression("WSREP: Event");
|
||||
call mtr.add_suppression("WSREP: SR trx recovery applying returned 1290");
|
||||
call mtr.add_suppression("WSREP: Adopting a transaction");
|
||||
call mtr.add_suppression("WSREP: Could not find applier context for");
|
||||
call mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster");
|
||||
call mtr.add_suppression("WSREP: Failed to vote on request for");
|
||||
|
||||
select count(*) AS EXPECT_0 from mysql.wsrep_streaming_log;
|
||||
|
||||
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
|
||||
--source include/wait_condition.inc
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
--connection node_1
|
||||
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
|
||||
--source include/wait_condition.inc
|
||||
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
|
||||
--source include/wait_condition.inc
|
||||
select count(*) AS EXPECT_0 from mysql.wsrep_streaming_log;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL wsrep_provider_options ='pc.ignore_sb=false;pc.weight=1';
|
||||
|
||||
--connection node_2
|
||||
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--connection node_1
|
||||
call mtr.add_suppression("WSREP: Event");
|
||||
call mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on");
|
||||
call mtr.add_suppression("WSREP: Failed to apply write set: gtid");
|
||||
call mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster");
|
||||
call mtr.add_suppression("WSREP: Could not find applier context for");
|
||||
call mtr.add_suppression("WSREP: Failed to vote on request for");
|
||||
|
||||
# Restore original auto_increment_offset values.
|
||||
--source include/auto_increment_offset_restore.inc
|
||||
|
||||
--source include/galera_end.inc
|
||||
@ -39,6 +39,7 @@ static void init_service_thd(THD* thd, void* thread_stack)
|
||||
thd->thread_stack= thread_stack;
|
||||
thd->real_id= pthread_self();
|
||||
thd->prior_thr_create_utime= thd->start_utime= microsecond_interval_timer();
|
||||
thd->security_ctx->skip_grants();
|
||||
thd->mark_connection_idle();
|
||||
thd->reset_for_next_command(true);
|
||||
server_threads.insert(thd); // as wsrep_innobase_kill_one_trx() uses find_thread_by_id()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user