From db70292b810248e7e6faec52b29cd71d5b8ead36 Mon Sep 17 00:00:00 2001 From: Xiaoxi Chen Date: Mon, 23 Sep 2024 16:17:02 +0800 Subject: [PATCH] Add proper state into rreq when replaying. Signed-off-by: Xiaoxi Chen --- src/lib/replication/repl_dev/raft_repl_dev.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/replication/repl_dev/raft_repl_dev.cpp b/src/lib/replication/repl_dev/raft_repl_dev.cpp index 4c4a6d396..df12481f2 100644 --- a/src/lib/replication/repl_dev/raft_repl_dev.cpp +++ b/src/lib/replication/repl_dev/raft_repl_dev.cpp @@ -1220,6 +1220,12 @@ void RaftReplDev::on_log_found(logstore_seq_num_t lsn, log_buffer buf, void* ctx // keep lentry in scope for the lyfe cycle of the rreq rreq->set_lentry(lentry); rreq->init(rkey, jentry->code, false /* is_proposer */, entry_to_hdr(jentry), entry_to_key(jentry), data_size); + // we load the log from log device, implies log flushed. We only flush log after data is written to data device. + rreq->add_state(repl_req_state_t::BLK_ALLOCATED); + rreq->add_state(repl_req_state_t::DATA_RECEIVED); + rreq->add_state(repl_req_state_t::DATA_WRITTEN); + rreq->add_state(repl_req_state_t::LOG_RECEIVED); + rreq->add_state(repl_req_state_t::LOG_FLUSHED); RD_LOGD("Replay log on restart, rreq=[{}]", rreq->to_string()); if (repl_lsn > m_rd_sb->durable_commit_lsn) {