Skip to content

Commit

Permalink
Fix cant full sync bug (#759)
Browse files Browse the repository at this point in the history
  • Loading branch information
whoiami committed Sep 23, 2019
1 parent eec731b commit c4bce79
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/pika_repl_server_conn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ void PikaReplServerConn::HandleTrySyncRequest(void* arg) {
<< ", pro_offset_: " << slave_boffset.offset();
pre_success = false;
}
if (pre_success) {
std::string confile = NewFileName(partition->logger()->filename, slave_boffset.filenum());
if (!slash::FileExists(confile)) {
LOG(INFO) << "Partition: " << partition_name << " binlog has been purged, may need full sync";
try_sync_response->set_reply_code(InnerMessage::InnerResponse::TrySync::kSyncPointBePurged);
pre_success = false;
}
}
if (pre_success) {
PikaBinlogReader reader;
reader.Seek(partition->logger(), slave_boffset.filenum(), slave_boffset.offset());
Expand All @@ -147,15 +155,6 @@ void PikaReplServerConn::HandleTrySyncRequest(void* arg) {
}
}

if (pre_success) {
std::string confile = NewFileName(partition->logger()->filename, slave_boffset.filenum());
if (!slash::FileExists(confile)) {
LOG(INFO) << "Partition: " << partition_name << " binlog has been purged, may need full sync";
try_sync_response->set_reply_code(InnerMessage::InnerResponse::TrySync::kSyncPointBePurged);
pre_success = false;
}
}

if (pre_success) {
if (!g_pika_rm->CheckPartitionSlaveExist(RmNode(node.ip(), node.port(), table_name, partition_id))) {
int32_t session_id = g_pika_rm->GenPartitionSessionId(table_name, partition_id);
Expand Down

0 comments on commit c4bce79

Please sign in to comment.