mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
fix(transaction): Fix auto journaling in transaction (#4737)
* fix(transaction): Fix auto journaling in transaction Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io> * refactor: address comments Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io> --------- Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>
This commit is contained in:
parent
2ff8603492
commit
4f70d1bdbc
2 changed files with 20 additions and 0 deletions
|
@ -499,6 +499,7 @@ void Transaction::MultiSwitchCmd(const CommandId* cid) {
|
|||
kv_fp_.clear();
|
||||
|
||||
cid_ = cid;
|
||||
re_enabled_auto_journal_ = false;
|
||||
cb_ptr_ = nullptr;
|
||||
|
||||
for (auto& sd : shard_data_) {
|
||||
|
|
|
@ -589,6 +589,10 @@ async def test_rewrites(df_factory):
|
|||
async def skip_cmd():
|
||||
await is_match_rsp(r".*")
|
||||
|
||||
async def skip_cmds(n):
|
||||
for _ in range(n):
|
||||
await skip_cmd()
|
||||
|
||||
async def check(cmd, rx):
|
||||
await c_master.execute_command(cmd)
|
||||
match = await is_match_rsp(rx)
|
||||
|
@ -731,6 +735,21 @@ async def test_rewrites(df_factory):
|
|||
)
|
||||
await check_expire("renamekey")
|
||||
|
||||
# Test autojournaling in the multi-mode
|
||||
await c_master.execute_command("XADD k-stream * field value")
|
||||
await c_master.execute_command("SADD k-one-element-set value1 value2")
|
||||
sha = await c_master.script_load(
|
||||
"redis.call('XTRIM', KEYS[1], 'MINID', '0'); return redis.call('SPOP', KEYS[2]);"
|
||||
)
|
||||
await skip_cmds(3)
|
||||
# The first call to XTRIM triggers autojournaling.
|
||||
# The SPOP command is executed with CO::NO_AUTOJOURNALING.
|
||||
# This test ensures that the SPOP command is still properly replicated
|
||||
await check_list_ooo(
|
||||
f"EVALSHA {sha} 2 k-stream k-one-element-set",
|
||||
[r"XTRIM k-stream MINID 0", r"SREM k-one-element-set value[12]"],
|
||||
)
|
||||
|
||||
|
||||
"""
|
||||
Test automatic replication of expiry.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue