Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(transaction): Fix auto journaling in transaction #4737

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/server/transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_) {
Expand Down
19 changes: 19 additions & 0 deletions tests/dragonfly/replication_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,10 @@ async def is_match_rsp(rx):
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)
Expand Down Expand Up @@ -731,6 +735,21 @@ async def check_expire(key):
)
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.
Expand Down
Loading