Skip to content

Commit

Permalink
do not assert lsn condition in On_commit during log replay in restart
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravi Nagarjun Akella authored and Ravi Nagarjun Akella committed Aug 5, 2024
1 parent fbcfd7a commit ca6efec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/lib/replication/repl_dev/raft_repl_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ void RaftReplDev::handle_fetch_data_response(sisl::GenericClientResponse respons
RD_DBG_ASSERT_EQ(total_size, 0, "Total size mismatch, some data is not consumed");
}

void RaftReplDev::handle_commit(repl_req_ptr_t rreq) {
void RaftReplDev::handle_commit(repl_req_ptr_t rreq, bool recovery) {
if (rreq->local_blkid().is_valid()) {
if (data_service().commit_blk(rreq->local_blkid()) != BlkAllocStatus::SUCCESS) {
if (hs()->device_mgr()->is_boot_in_degraded_mode() && m_log_store_replay_done)
Expand All @@ -771,8 +771,10 @@ void RaftReplDev::handle_commit(repl_req_ptr_t rreq) {
m_listener->on_commit(rreq->lsn(), rreq->header(), rreq->key(), rreq->local_blkid(), rreq);
}

auto prev_lsn = m_commit_upto_lsn.exchange(rreq->lsn());
RD_DBG_ASSERT_GT(rreq->lsn(), prev_lsn, "Out of order commit of lsns, it is not expected in RaftReplDev");
if (!recovery) {
auto prev_lsn = m_commit_upto_lsn.exchange(rreq->lsn());
RD_DBG_ASSERT_GT(rreq->lsn(), prev_lsn, "Out of order commit of lsns, it is not expected in RaftReplDev");
}

if (!rreq->is_proposer()) { rreq->clear(); }
}
Expand Down Expand Up @@ -1168,7 +1170,7 @@ void RaftReplDev::on_log_found(logstore_seq_num_t lsn, log_buffer buf, void* ctx
m_listener->on_pre_commit(lsn, entry_to_hdr(jentry), entry_to_key(jentry), nullptr);

// 3. Commit the log entry
handle_commit(rreq);
handle_commit(rreq, true /* recovery */);
}

} // namespace homestore
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 @@ -181,7 +181,7 @@ class RaftReplDev : public ReplDev,

//////////////// Methods needed for other Raft classes to access /////////////////
void use_config(json_superblk raft_config_sb);
void handle_commit(repl_req_ptr_t rreq);
void handle_commit(repl_req_ptr_t rreq, bool recovery = false);
repl_req_ptr_t repl_key_to_req(repl_key const& rkey) const;
repl_req_ptr_t applier_create_req(repl_key const& rkey, journal_type_t code, sisl::blob const& user_header,
sisl::blob const& key, uint32_t data_size, bool is_data_channel);
Expand Down

0 comments on commit ca6efec

Please sign in to comment.