Skip to content

Commit

Permalink
draft fix of bgsave's inconsistent problem (#2818)
Browse files Browse the repository at this point in the history
Co-authored-by: cheniujh <[email protected]>
  • Loading branch information
2 people authored and brother-jin committed Aug 1, 2024
1 parent 273ea3d commit 9c58cf5
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/pika_command.cc
Original file line number Diff line number Diff line change
Expand Up @@ -875,27 +875,26 @@ void Cmd::InternalProcessCommand(const HintKeys& hint_keys) {
if (g_pika_conf->slowlog_slower_than() >= 0) {
start_us = pstd::NowMicros();
}

if (!IsSuspend()) {
db_->DBLockShared();
}

DoCommand(hint_keys);
if (g_pika_conf->slowlog_slower_than() >= 0) {
do_duration_ += pstd::NowMicros() - start_us;
}

DoBinlog();

if (!IsSuspend()) {
db_->DBUnlockShared();
}
if (is_write()) {
record_lock.Unlock(current_key());
}
}

void Cmd::DoCommand(const HintKeys& hint_keys) {
if (!IsSuspend()) {
db_->DBLockShared();
}
DEFER {
if (!IsSuspend()) {
db_->DBUnlockShared();
}
};
if (IsNeedCacheDo()
&& PIKA_CACHE_NONE != g_pika_conf->cache_mode()
&& db_->cache()->CacheStatus() == PIKA_CACHE_STATUS_OK) {
Expand Down

0 comments on commit 9c58cf5

Please sign in to comment.