mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
bug(replication): BLPOP fix write to shard journal of popped key (#761)
Signed-off-by: adi_holden <adi@dragonflydb.io>
This commit is contained in:
parent
69bca570f0
commit
cc74594c2f
2 changed files with 8 additions and 8 deletions
|
@ -290,11 +290,6 @@ OpStatus BPopper::Run(Transaction* t, unsigned msec) {
|
|||
|
||||
auto cb = [this](Transaction* t, EngineShard* shard) {
|
||||
Pop(t, shard);
|
||||
OpArgs op_args = t->GetOpArgs(shard);
|
||||
if (op_args.shard->journal()) {
|
||||
string command = dir_ == ListDir::LEFT ? "LPOP" : "RPOP";
|
||||
RecordJournal(op_args, command, ArgSlice{key_}, 1);
|
||||
}
|
||||
return OpStatus::OK;
|
||||
};
|
||||
t->Execute(std::move(cb), true);
|
||||
|
@ -317,6 +312,11 @@ void BPopper::Pop(Transaction* t, EngineShard* shard) {
|
|||
if (quicklistCount(ql) == 0) {
|
||||
CHECK(shard->db_slice().Del(t->GetDbIndex(), it));
|
||||
}
|
||||
OpArgs op_args = t->GetOpArgs(shard);
|
||||
if (op_args.shard->journal()) {
|
||||
string command = dir_ == ListDir::LEFT ? "LPOP" : "RPOP";
|
||||
RecordJournal(op_args, command, ArgSlice{key_}, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -520,10 +520,10 @@ async def test_rewrites(df_local_factory):
|
|||
|
||||
# Check there is no rewrite for RPOPLPUSH on single shard
|
||||
await check("RPOPLPUSH list list", r"RPOPLPUSH list list")
|
||||
# Check BRPOPLPUSH on single shard turns into RPOPLPUSH
|
||||
await check("BRPOPLPUSH list list 0", r"RPOPLPUSH list list")
|
||||
# Check BRPOPLPUSH on single shard turns into LMOVE
|
||||
await check("BRPOPLPUSH list list 0", r"LMOVE list list RIGHT LEFT")
|
||||
# Check BLPOP turns into LPOP
|
||||
await check("BLPOP list 0", r"LPOP list")
|
||||
await check("BLPOP list list1 0", r"LPOP list")
|
||||
# Check BRPOP turns into RPOP
|
||||
await check("BRPOP list 0", r"RPOP list")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue