feat(transaction): Idempotent callbacks (immediate runs) (#2453)

This commit generalizes the machanism of running transaction callbacks during scheduling, removing the need for specialized ScheduleUniqueShard/RunQuickie. Instead, transactions can be run now during ScheduleInShard - called "immediate" runs - if the transaction is concluding and either only a single shard is active or the operation can be safely repeated if scheduling failed (idempotent commands, like MGET).

Updates transaction stats to mirror the new changes more closely.

---------

Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
This commit is contained in:
Vladislav 2024-04-03 23:06:57 +03:00 committed by GitHub
parent 84d451fbed
commit fbc55bb82d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 150 additions and 285 deletions

View file

@ -671,7 +671,7 @@ TEST_F(MultiTest, ExecGlobalFallback) {
Run({"set", "a", "1"}); // won't run ooo, because it became part of global
Run({"move", "a", "1"});
Run({"exec"});
EXPECT_EQ(1, GetMetrics().coordinator_stats.tx_type_cnt[ServerState::GLOBAL]);
EXPECT_EQ(1, GetMetrics().coordinator_stats.tx_global_cnt);
ClearMetrics();
@ -683,7 +683,7 @@ TEST_F(MultiTest, ExecGlobalFallback) {
Run({"exec"});
auto stats = GetMetrics().coordinator_stats;
EXPECT_EQ(1, stats.tx_type_cnt[ServerState::QUICK] + stats.tx_type_cnt[ServerState::INLINE]);
EXPECT_EQ(1, stats.tx_normal_cnt); // move is global
}
TEST_F(MultiTest, ScriptFlagsCommand) {