Commit bf310b4c authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-25305: MyRocks: Killing server during RESET MASTER can lose last transactions

rocksdb_checkpoint_request() should call FlushWAL(sync=true) (which does
write-out and sync), not just SyncWAL()  (which just syncs without writing
out)
Followup: the test requires debug sync facility

(This is a backport to 10.5)
parent 5b678d9e
...@@ -3966,6 +3966,8 @@ int reset_master(THD* thd, rpl_gtid *init_state, uint32 init_state_len, ...@@ -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, ret= mysql_bin_log.reset_logs(thd, 1, init_state, init_state_len,
next_log_number); next_log_number);
repl_semisync_master.after_reset_master(); repl_semisync_master.after_reset_master();
DBUG_EXECUTE_IF("crash_after_reset_master", DBUG_SUICIDE(););
return ret; return ret;
} }
......
...@@ -4113,7 +4113,7 @@ static int rocksdb_recover(handlerton* hton, XID* xid_list, uint len) ...@@ -4113,7 +4113,7 @@ static int rocksdb_recover(handlerton* hton, XID* xid_list, uint len)
static void rocksdb_checkpoint_request(void *cookie) static void rocksdb_checkpoint_request(void *cookie)
{ {
const rocksdb::Status s= rdb->SyncWAL(); const rocksdb::Status s= rdb->FlushWAL(true);
//TODO: what to do on error? //TODO: what to do on error?
if (s.ok()) if (s.ok())
{ {
......
#
# MDEV-25305: MyRocks: Killing server during RESET MASTER can lose last transactions
#
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,crash_after_reset_master";
RESET MASTER;
# Must show the inserted rows:
select * from t1;
a b
1 1
2 2
drop table t1;
--source include/have_rocksdb.inc
--source include/have_log_bin.inc
--source include/have_debug_sync.inc
--echo #
--echo # MDEV-25305: MyRocks: Killing server during RESET MASTER can lose last transactions
--echo #
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,crash_after_reset_master";
--disable_reconnect
--error 0,2013
RESET MASTER;
--enable_reconnect
--source include/wait_until_connected_again.inc
--echo # Must show the inserted rows:
select * from t1;
drop table t1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment