mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
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:
parent
84d451fbed
commit
fbc55bb82d
12 changed files with 150 additions and 285 deletions
|
@ -24,19 +24,18 @@ namespace dfly {
|
|||
__thread ServerState* ServerState::state_ = nullptr;
|
||||
|
||||
ServerState::Stats::Stats(unsigned num_shards) : tx_width_freq_arr(num_shards) {
|
||||
tx_type_cnt.fill(0);
|
||||
}
|
||||
|
||||
ServerState::Stats& ServerState::Stats::Add(const ServerState::Stats& other) {
|
||||
static_assert(sizeof(Stats) == 17 * 8, "Stats size mismatch");
|
||||
|
||||
for (int i = 0; i < NUM_TX_TYPES; ++i) {
|
||||
this->tx_type_cnt[i] += other.tx_type_cnt[i];
|
||||
}
|
||||
static_assert(sizeof(Stats) == 16 * 8, "Stats size mismatch");
|
||||
|
||||
this->eval_io_coordination_cnt += other.eval_io_coordination_cnt;
|
||||
this->eval_shardlocal_coordination_cnt += other.eval_shardlocal_coordination_cnt;
|
||||
this->eval_squashed_flushes += other.eval_squashed_flushes;
|
||||
|
||||
this->tx_global_cnt += other.tx_global_cnt;
|
||||
this->tx_normal_cnt += other.tx_normal_cnt;
|
||||
this->tx_inline_runs += other.tx_inline_runs;
|
||||
this->tx_schedule_cancel_cnt += other.tx_schedule_cancel_cnt;
|
||||
|
||||
this->multi_squash_executions += other.multi_squash_executions;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue