Skip to content

Commit

Permalink
add is_write_db
Browse files Browse the repository at this point in the history
  • Loading branch information
buzhimingyonghu committed Dec 15, 2024
1 parent 951dc63 commit 917050d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pika_repl_bgworker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void PikaReplBgWorker::HandleBGWorkerWriteBinlog(void* arg) {
LOG(WARNING) << "Slave DB " << db_name << " Not Found";
return;
}

bool is_write_db=true;
for (int i : *index) {
const InnerMessage::InnerResponse::BinlogSync& binlog_res = res->binlog_sync(i);
// if pika are not current a slave or DB not in
Expand Down Expand Up @@ -139,12 +139,14 @@ void PikaReplBgWorker::HandleBGWorkerWriteBinlog(void* arg) {
slave_db->SetReplState(ReplState::kTryConnect);
return;
}


if(!is_write_db){
std::shared_ptr<SyncMasterDB> db = g_pika_rm->GetSyncMasterDBByName(DBInfo(db_name));
LogOffset cur_logoffset;
ParseBinlogOffset(binlog_res.binlog_offset(),&cur_logoffset);
db->PutCoordinatorOffsetIndex(cur_logoffset,worker->binlog_item_.offset());

}

const char* redis_parser_start = binlog_res.binlog().data() + BINLOG_ENCODE_LEN;
int redis_parser_len = static_cast<int>(binlog_res.binlog().size()) - BINLOG_ENCODE_LEN;
int processed_len = 0;
Expand Down

0 comments on commit 917050d

Please sign in to comment.