mirror of
https://github.com/dragonflydb/dragonfly
synced 2024-11-22 15:44:13 +00:00
fix: disable inline transactions when db_slice has registered callbacks (#3391)
Inline transactions do not acquire any locks and therefore they should not preempt. This is no longer true when db_slice has registered callbacks. * disable inline transactions when db_slice has registered callbacks --------- Signed-off-by: kostas <kostas@dragonflydb.io>
This commit is contained in:
parent
a95cf2e857
commit
79d7f57b67
@ -423,6 +423,10 @@ class DbSlice {
|
||||
//! at a time of the call.
|
||||
uint64_t RegisterOnChange(ChangeCallback cb);
|
||||
|
||||
bool HasRegisteredCallbacks() const {
|
||||
return !change_cb_.empty();
|
||||
}
|
||||
|
||||
// Call registered callbacks with version less than upper_bound.
|
||||
void FlushChangeToEarlierCallbacks(DbIndex db_ind, Iterator it, uint64_t upper_bound);
|
||||
|
||||
|
@ -1420,8 +1420,9 @@ void Transaction::CancelBlocking(std::function<OpStatus(ArgSlice)> status_cb) {
|
||||
|
||||
bool Transaction::CanRunInlined() const {
|
||||
auto* ss = ServerState::tlocal();
|
||||
auto* es = EngineShard::tlocal();
|
||||
if (unique_shard_cnt_ == 1 && unique_shard_id_ == ss->thread_index() &&
|
||||
ss->AllowInlineScheduling()) {
|
||||
ss->AllowInlineScheduling() && !GetDbSlice(es->shard_id()).HasRegisteredCallbacks()) {
|
||||
ss->stats.tx_inline_runs++;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user