1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00

fix(server): Use custom journal for multi-key PFMERGE cmd (#2437)

While at it, also fix `PFCOUNT` to say that it's a readonly cmd.

Fixed #2421
This commit is contained in:
Shahar Mike 2024-01-18 12:30:21 +02:00 committed by GitHub
parent 2f0287429d
commit 5586798e90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -265,6 +265,11 @@ OpResult<int> PFMergeInternal(CmdArgList args, ConnectionContext* cntx) {
return OpStatus::OUT_OF_MEMORY;
}
res.it->second.SetString(hll);
if (op_args.shard->journal()) {
RecordJournal(op_args, "SET", ArgSlice{key, hll});
}
return OpStatus::OK;
};
trans->Execute(std::move(set_cb), true);
@ -297,8 +302,9 @@ void HllFamily::Register(CommandRegistry* registry) {
using CI = CommandId;
registry->StartFamily();
*registry << CI{"PFADD", CO::WRITE, -3, 1, 1, acl::kPFAdd}.SetHandler(PFAdd)
<< CI{"PFCOUNT", CO::WRITE, -2, 1, -1, acl::kPFCount}.SetHandler(PFCount)
<< CI{"PFMERGE", CO::WRITE, -2, 1, -1, acl::kPFMerge}.SetHandler(PFMerge);
<< CI{"PFCOUNT", CO::READONLY, -2, 1, -1, acl::kPFCount}.SetHandler(PFCount)
<< CI{"PFMERGE", CO::WRITE | CO::NO_AUTOJOURNAL, -2, 1, -1, acl::kPFMerge}.SetHandler(
PFMerge);
}
const char HllFamily::kInvalidHllErr[] = "Key is not a valid HyperLogLog string value.";