mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
bug(transaction): local result needs to be reset on InitByArgs Fixes … (#762)
* bug(transaction): local result needs to be reset on InitByArgs Fixes #752 Signed-off-by: adi_holden <adi@dragonflydb.io> * add unit test Signed-off-by: adi_holden <adi@dragonflydb.io> --------- Signed-off-by: adi_holden <adi@dragonflydb.io>
This commit is contained in:
parent
448508a23a
commit
4a826fdb7b
2 changed files with 14 additions and 0 deletions
|
@ -971,6 +971,19 @@ TEST_F(DefragDflyEngineTest, TestDefragOption) {
|
|||
});
|
||||
}
|
||||
|
||||
TEST_F(DflyEngineTest, Issue752) {
|
||||
// https://github.com/dragonflydb/dragonfly/issues/752
|
||||
// local_result_ member was not reset between commands
|
||||
Run({"multi"});
|
||||
auto resp = Run({"llen", kKey1});
|
||||
ASSERT_EQ(resp, "QUEUED");
|
||||
resp = Run({"del", kKey1, kKey2});
|
||||
ASSERT_EQ(resp, "QUEUED");
|
||||
resp = Run({"exec"});
|
||||
ASSERT_THAT(resp, ArrLen(2));
|
||||
ASSERT_THAT(resp.GetVec(), ElementsAre(IntArg(0), IntArg(0)));
|
||||
}
|
||||
|
||||
// TODO: to test transactions with a single shard since then all transactions become local.
|
||||
// To consider having a parameter in dragonfly engine controlling number of shards
|
||||
// unconditionally from number of cpus. TO TEST BLPOP under multi for single/multi argument case.
|
||||
|
|
|
@ -82,6 +82,7 @@ Transaction::~Transaction() {
|
|||
OpStatus Transaction::InitByArgs(DbIndex index, CmdArgList args) {
|
||||
db_index_ = index;
|
||||
cmd_with_full_args_ = args;
|
||||
local_result_ = OpStatus::OK;
|
||||
|
||||
if (IsGlobal()) {
|
||||
unique_shard_cnt_ = shard_set->size();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue