fix(server): handle no-key-transactional commands in multi/exec (#2279)

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
This commit is contained in:
Vladislav 2023-12-12 19:34:02 +03:00 committed by GitHub
parent 7ca07a498f
commit e273f7a2b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -678,6 +678,12 @@ optional<Transaction::MultiMode> DeduceExecMode(ExecEvalState state,
for (const auto& scmd : exec_info.body) {
transactional |= scmd.Cid()->IsTransactional();
contains_global |= scmd.Cid()->opt_mask() & CO::GLOBAL_TRANS;
// We can't run no-key-transactional commands in lock-ahead mode currently,
// because it means we have to schedule on all shards
if (scmd.Cid()->opt_mask() & CO::NO_KEY_TRANSACTIONAL)
contains_global = true;
if (contains_global)
break;
}

View file

@ -920,6 +920,12 @@ TEST_F(MultiTest, EvalExpiration) {
EXPECT_LE(CheckedInt({"pttl", "x"}), 5000);
}
TEST_F(MultiTest, NoKeyTransactional) {
Run({"multi"});
Run({"ft._list"});
Run({"exec"});
}
class MultiEvalTest : public BaseFamilyTest {
protected:
MultiEvalTest() : BaseFamilyTest() {