Skip to content

Commit

Permalink
set slaveNode to DBSync status before commit bgsave task
Browse files Browse the repository at this point in the history
  • Loading branch information
cheniujh committed Jul 11, 2024
1 parent 1de6598 commit 720224f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pika_repl_server_conn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,13 @@ void PikaReplServerConn::HandleDBSyncRequest(void* arg) {
}
}

g_pika_server->TryDBSync(node.ip(), node.port() + kPortShiftRSync, db_name,
static_cast<int32_t>(slave_boffset.filenum()));
// Change slave node's state to kSlaveDbSync so that the binlog will perserved.
// See details in SyncMasterSlot::BinlogCloudPurge.
master_db->ActivateSlaveDbSync(node.ip(), node.port());

g_pika_server->TryDBSync(node.ip(), node.port() + kPortShiftRSync, db_name,
static_cast<int32_t>(slave_boffset.filenum()));

std::string reply_str;
if (!response.SerializeToString(&reply_str) || (conn->WriteResp(reply_str) != 0)) {
LOG(WARNING) << "Handle DBSync Failed";
Expand Down

0 comments on commit 720224f

Please sign in to comment.