Skip to content

Commit

Permalink
set slaveNode to DBSync status before commit bgsave task (#2798)
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 e641950 commit ef31b03
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 @@ -280,12 +280,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 ef31b03

Please sign in to comment.