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

@ -205,13 +205,14 @@ EngineShardSet* shard_set = nullptr;
uint64_t TEST_current_time_ms = 0;
EngineShard::Stats& EngineShard::Stats::operator+=(const EngineShard::Stats& o) {
static_assert(sizeof(Stats) == 40);
static_assert(sizeof(Stats) == 48);
defrag_attempt_total += o.defrag_attempt_total;
defrag_realloc_total += o.defrag_realloc_total;
defrag_task_invocation_total += o.defrag_task_invocation_total;
poll_execution_total += o.poll_execution_total;
tx_ooo_total += o.tx_ooo_total;
tx_immediate_total += o.tx_immediate_total;
return *this;
}