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)
This commit is contained in:
parent
5b678d9ea4
commit
bf310b4cfb
@ -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("crash_after_reset_master", DBUG_SUICIDE(););
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -4113,7 +4113,7 @@ static int rocksdb_recover(handlerton* hton, XID* xid_list, uint len)
|
||||
|
||||
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?
|
||||
if (s.ok())
|
||||
{
|
||||
|
@ -0,0 +1,19 @@
|
||||
#
|
||||
# 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;
|
@ -0,0 +1,31 @@
|
||||
--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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user