mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
fix: fix multi mget exec error message (#3662)
This commit is contained in:
parent
2cc2a23247
commit
894bf4735b
2 changed files with 6 additions and 5 deletions
|
@ -2187,6 +2187,10 @@ void Service::Exec(CmdArgList args, ConnectionContext* cntx) {
|
|||
// Clean the context no matter the outcome
|
||||
absl::Cleanup exec_clear = [&cntx] { MultiCleanup(cntx); };
|
||||
|
||||
if (exec_info.state == ConnectionState::ExecInfo::EXEC_ERROR) {
|
||||
return cntx->SendError("-EXECABORT Transaction discarded because of previous errors");
|
||||
}
|
||||
|
||||
// Check basic invariants
|
||||
if (!exec_info.IsCollecting()) {
|
||||
return cntx->SendError("EXEC without MULTI");
|
||||
|
@ -2196,10 +2200,6 @@ void Service::Exec(CmdArgList args, ConnectionContext* cntx) {
|
|||
return cntx->SendError("Dragonfly does not allow WATCH and EXEC on different databases");
|
||||
}
|
||||
|
||||
if (exec_info.state == ConnectionState::ExecInfo::EXEC_ERROR) {
|
||||
return cntx->SendError("-EXECABORT Transaction discarded because of previous errors");
|
||||
}
|
||||
|
||||
if (exec_info.watched_dirty.load(memory_order_relaxed)) {
|
||||
return rb->SendNull();
|
||||
}
|
||||
|
|
|
@ -72,10 +72,11 @@ TEST_F(MultiTest, MultiAndFlush) {
|
|||
}
|
||||
|
||||
TEST_F(MultiTest, MultiWithError) {
|
||||
EXPECT_THAT(Run({"exec"}), ErrArg("EXEC without MULTI"));
|
||||
EXPECT_THAT(Run({"multi"}), "OK");
|
||||
EXPECT_THAT(Run({"set", "x", "y"}), "QUEUED");
|
||||
EXPECT_THAT(Run({"set", "x"}), ErrArg("wrong number of arguments for 'set' command"));
|
||||
EXPECT_THAT(Run({"exec"}), ErrArg("EXEC without MULTI"));
|
||||
EXPECT_THAT(Run({"exec"}), ErrArg("EXECABORT Transaction discarded because of previous errors"));
|
||||
|
||||
EXPECT_THAT(Run({"multi"}), "OK");
|
||||
EXPECT_THAT(Run({"set", "z", "y"}), "QUEUED");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue