mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
fix: potential crash with multi-sharded pfmerge
Fixes #5004 Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
d5c375235f
commit
86bbe3d4f7
2 changed files with 7 additions and 6 deletions
|
@ -255,14 +255,14 @@ OpResult<int> PFMergeInternal(CmdArgList args, Transaction* tx, SinkReplyBuilder
|
|||
if (result.ok()) {
|
||||
hlls[sid] = std::move(result.value());
|
||||
} else {
|
||||
success = false;
|
||||
success.store(false, memory_order_relaxed);
|
||||
}
|
||||
return result.status();
|
||||
return OpStatus::OK;
|
||||
};
|
||||
|
||||
tx->Execute(std::move(cb), false);
|
||||
|
||||
if (!success) {
|
||||
if (!success.load(memory_order_relaxed)) {
|
||||
tx->Conclude();
|
||||
return OpStatus::INVALID_VALUE;
|
||||
}
|
||||
|
|
|
@ -194,11 +194,12 @@ TEST_F(HllFamilyTest, MergeOverlapping) {
|
|||
}
|
||||
|
||||
TEST_F(HllFamilyTest, MergeInvalid) {
|
||||
GTEST_SKIP() << "TBD: MergeInvalid test fails with multi-shard runs, see #5004";
|
||||
Run({"exists", "key1", "key4"});
|
||||
ASSERT_EQ(GetDebugInfo().shards_count, 2); // ensure 2 shards
|
||||
|
||||
EXPECT_EQ(CheckedInt({"pfadd", "key1", "1", "2", "3"}), 1);
|
||||
EXPECT_EQ(Run({"set", "key2", "..."}), "OK");
|
||||
EXPECT_THAT(Run({"pfmerge", "key1", "key2"}), ErrArg(HllFamily::kInvalidHllErr));
|
||||
EXPECT_EQ(Run({"set", "key4", "..."}), "OK");
|
||||
EXPECT_THAT(Run({"pfmerge", "key1", "key4"}), ErrArg(HllFamily::kInvalidHllErr));
|
||||
EXPECT_EQ(CheckedInt({"pfcount", "key1"}), 3);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue