[MDEV-25305] MyRocks: Killing server during RESET MASTER can lose last transactions Created: 2021-03-30  Updated: 2021-04-06  Resolved: 2021-03-31

Status: Closed
Project: MariaDB Server
Component/s: Replication, Storage Engine - RocksDB
Affects Version/s: 10.3, 10.4, 10.5, 10.6
Fix Version/s: 10.5.10, 10.6.0

Type: Bug Priority: Major
Reporter: Sergei Petrunia Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-25304 Atomic ALTER TABLE: MyRocks support Closed

 Description   

Hit this when working on MDEV-25304:

Apply this patch:

diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 084259d863d..fbc1e637abc 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -3966,6 +3966,8 @@ int reset_master(THD* thd, rpl_gtid *init_state, uint32 init_state_len,
   ret= mysql_bin_log.reset_logs(thd, 1, init_state, init_state_len,
                                 next_log_number);
   repl_semisync_master.after_reset_master();
+  DBUG_EXECUTE_IF("reset_master_done", DBUG_SUICIDE(););
+
   return ret;
 }
 

then run this testcase (put in storage/rocksdb/mysql-test/rocksdb/t/binlog_rotate.test ):

--source include/have_rocksdb.inc
--source include/have_log_bin.inc
 
set global rocksdb_flush_log_at_trx_commit=1;
 
create table t1 (a int, b int, key(a)) engine=rocksdb;
insert into t1 values (1,1),(2,2);
select * from t1;
flush tables;
 
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart
EOF
 
set @@debug_dbug="+d,reset_master_done";
 
--disable_reconnect
--error 0,2013
RESET MASTER;
--enable_reconnect
--source include/wait_until_connected_again.inc
select * from t1;
 
drop table t1;

and observe:

...
set global rocksdb_flush_log_at_trx_commit=1;
create table t1 (a int, b int, key(a)) engine=rocksdb;
insert into t1 values (1,1),(2,2);
select * from t1;
a       b
1       1
2       2
flush tables;
set @@debug_dbug="+d,reset_master_done";
RESET MASTER;
select * from t1;
a       b
drop table t1;

The INSERTs are lost.


Generated at Thu Feb 08 09:36:41 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.