mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
bug(server): set connection flags block/pause flag on all blocking commands (#2816)
* bug((server)): set connecttion blocking and puash flags on all blocking commands Signed-off-by: adi_holden <adi@dragonflydb.io>
This commit is contained in:
parent
23106d4be5
commit
b1e688b33f
10 changed files with 54 additions and 37 deletions
|
@ -1190,7 +1190,7 @@ size_t Transaction::ReverseArgIndex(ShardId shard_id, size_t arg_index) const {
|
|||
}
|
||||
|
||||
OpStatus Transaction::WaitOnWatch(const time_point& tp, WaitKeysProvider wkeys_provider,
|
||||
KeyReadyChecker krc) {
|
||||
KeyReadyChecker krc, bool* block_flag, bool* pause_flag) {
|
||||
DCHECK(!blocking_barrier_.IsClaimed()); // Blocking barrier can't be re-used
|
||||
|
||||
// Register keys on active shards blocking controllers and mark shard state as suspended.
|
||||
|
@ -1206,16 +1206,19 @@ OpStatus Transaction::WaitOnWatch(const time_point& tp, WaitKeysProvider wkeys_p
|
|||
auto* stats = ServerState::tl_connection_stats();
|
||||
++stats->num_blocked_clients;
|
||||
DVLOG(1) << "WaitOnWatch wait for " << tp << " " << DebugId();
|
||||
// TBD set connection blocking state
|
||||
|
||||
// Wait for the blocking barrier to be closed.
|
||||
// Note: It might return immediately if another thread already notified us.
|
||||
*block_flag = true;
|
||||
cv_status status = blocking_barrier_.Wait(tp);
|
||||
*block_flag = false;
|
||||
|
||||
DVLOG(1) << "WaitOnWatch done " << int(status) << " " << DebugId();
|
||||
--stats->num_blocked_clients;
|
||||
|
||||
// TBD set connection pause state
|
||||
*pause_flag = true;
|
||||
ServerState::tlocal()->AwaitPauseState(true); // blocking are always write commands
|
||||
*pause_flag = false;
|
||||
|
||||
OpStatus result = OpStatus::OK;
|
||||
if (status == cv_status::timeout) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue