Skip to content

Commit

Permalink
Rename apply_snp_resync_data to save_snp_resync_data
Browse files Browse the repository at this point in the history
- apply_snp_resync_data is similar to apply_snapshot in raft
  • Loading branch information
yuwmao committed Jan 23, 2025
1 parent 45b3643 commit ec39fde
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/lib/replication/log_store/home_raft_log_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,13 @@ bool HomeRaftLogStore::compact(ulong compact_lsn) {
// we directly compact and truncate up to compact_lsn assuming there are dummy logs.
REPL_STORE_LOG(DEBUG, "Compact with log holes from {} to={}", cur_max_lsn + 1, to_store_lsn(compact_lsn));
}
#ifdef _PRERELEASE
auto delay = iomgr_flip::instance()->get_test_flip< long >("simulate_log_compact_delay");
if (delay) {
REPL_STORE_LOG(DEBUG, "Simulating log compaction with delay, delay:{}", delay.get());
std::this_thread::sleep_for(std::chrono::milliseconds(delay.get()));
}
#endif
m_log_store->truncate(to_store_lsn(compact_lsn));
m_log_store->flush_meta(to_store_lsn(compact_lsn) + 1);
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/replication/repl_dev/raft_repl_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,7 @@ void RaftReplDev::create_snp_resync_data(raft_buf_ptr_t& data_out) {
std::memcpy(data_out->data_begin(), &msg, msg_size);
}

bool RaftReplDev::apply_snp_resync_data(nuraft::buffer& data) {
bool RaftReplDev::save_snp_resync_data(nuraft::buffer& data) {
auto msg = r_cast< snp_repl_dev_data* >(data.data_begin());
if (msg->magic_num != HOMESTORE_RESYNC_DATA_MAGIC ||
msg->protocol_version != HOMESTORE_RESYNC_DATA_PROTOCOL_VERSION_V1) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/replication/repl_dev/raft_repl_dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class RaftReplDev : public ReplDev,
void replace_member(repl_req_ptr_t rreq);
void reset_quorum_size(uint32_t commit_quorum);
void create_snp_resync_data(raft_buf_ptr_t& data_out);
bool apply_snp_resync_data(nuraft::buffer& data);
bool save_snp_resync_data(nuraft::buffer& data);
};

} // namespace homestore
4 changes: 2 additions & 2 deletions src/lib/replication/repl_dev/raft_state_machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,9 @@ void RaftStateMachine::save_logical_snp_obj(nuraft::snapshot& s, ulong& obj_id,
bool is_last_obj) {
if (is_hs_snp_obj(obj_id)) {
// Homestore preserved msg
if (m_rd.apply_snp_resync_data(data)) {
if (m_rd.save_snp_resync_data(data)) {
obj_id = snp_obj_id_type_app;
LOGDEBUG("apply_snp_resync_data success, next obj_id={}", obj_id);
LOGDEBUG("save_snp_resync_data success, next obj_id={}", obj_id);
}
return;
}
Expand Down

0 comments on commit ec39fde

Please sign in to comment.