From 9fc0ed9f229a1ee7e9c6bde445060f20df680448 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 234ebe4f5..088270de0 100644 --- a/src/lib/replication/repl_dev/raft_repl_dev.cpp +++ b/src/lib/replication/repl_dev/raft_repl_dev.cpp @@ -1317,6 +1317,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) {