Skip to content

Commit

Permalink
fix possible conflix between BGSave and DBSync
Browse files Browse the repository at this point in the history
  • Loading branch information
CatKang committed Oct 17, 2017
1 parent e18d821 commit 0714609
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/pika_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,13 @@ bool PikaServer::InitBgsaveEngine() {
}

bool PikaServer::RunBgsaveEngine(const std::string path) {
// Prepare for Bgsaving
if (!InitBgsaveEnv() || !InitBgsaveEngine()) {
ClearBgsave();
return false;
}
LOG(INFO) << "after prepare bgsave";

// Backup to tmp dir
nemo::Status nemo_s = bgsave_engine_->CreateNewBackup(path);
LOG(INFO) << "Create new backup finished.";
Expand All @@ -865,13 +872,6 @@ void PikaServer::Bgsave() {
bgsave_info_.bgsaving = true;
}

// Prepare for Bgsaving
if (!InitBgsaveEnv() || !InitBgsaveEngine()) {
ClearBgsave();
return;
}
LOG(INFO) << "after prepare bgsave";

// Start new thread if needed
bgsave_thread_.StartThread();
bgsave_thread_.Schedule(&DoBgsave, static_cast<void*>(this));
Expand Down

0 comments on commit 0714609

Please sign in to comment.