Skip to content

Commit

Permalink
fix: master has db data, but no binlog. a new slave has replication_i…
Browse files Browse the repository at this point in the history
…d in its config. this must execute full sync(OpenAtomFoundation#2436) (OpenAtomFoundation#2444)

Co-authored-by: liuchengyu <[email protected]>
  • Loading branch information
chengyu-l and liuchengyu authored Mar 6, 2024
1 parent 24a8ddd commit f3f646b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/pika_repl_server_conn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ bool PikaReplServerConn::TrySyncOffsetCheck(const std::shared_ptr<SyncMasterDB>&
return false;
}

if (boffset.filenum == slave_boffset.filenum() && slave_boffset.filenum() == 0 &&
boffset.offset == slave_boffset.offset() && slave_boffset.offset() == 0) {
LOG(INFO) << "maybe a new master and slave, there is no binlog, but has db data, this need full sync";
try_sync_response->set_reply_code(InnerMessage::InnerResponse::TrySync::kSyncPointBePurged);
return false;
}

PikaBinlogReader reader;
reader.Seek(db->Logger(), slave_boffset.filenum(), slave_boffset.offset());
BinlogOffset seeked_offset;
Expand Down

0 comments on commit f3f646b

Please sign in to comment.