diff --git a/src/tests/test_raft_repl_dev.cpp b/src/tests/test_raft_repl_dev.cpp index 7cd79eedb..062e4906c 100644 --- a/src/tests/test_raft_repl_dev.cpp +++ b/src/tests/test_raft_repl_dev.cpp @@ -210,7 +210,7 @@ class TestReplicatedDB : public homestore::ReplDevListener { sisl::io_blob_safe blob{static_cast< uint32_t >(kv_snapshot_data_size)}; std::memcpy(blob.bytes(), kv_snapshot_data.data(), kv_snapshot_data_size); snp_data->blob = std::move(blob); - snp_data->is_last_obj = false; + snp_data->is_last_obj = true; LOGINFOMOD(replication, "[Replica={}] Read logical snapshot callback obj_id={} term={} idx={} num_items={}", g_helper->replica_num(), snp_data->offset, s->get_last_log_term(), s->get_last_log_idx(), kv_snapshot_data.size()); @@ -230,9 +230,10 @@ class TestReplicatedDB : public homestore::ReplDevListener { void write_snapshot_data(shared< snapshot_context > context, shared< snapshot_data > snp_data) override { auto s = std::dynamic_pointer_cast< nuraft_snapshot_context >(context)->nuraft_snapshot(); - auto raft_server = std::dynamic_pointer_cast< RaftReplDev >(repl_dev())->raft_server(); + auto last_committed_idx = + std::dynamic_pointer_cast< RaftReplDev >(repl_dev())->raft_server()->get_committed_log_idx(); if (snp_data->offset == 0) { - snp_data->offset = raft_server->get_committed_log_idx(); + snp_data->offset = last_committed_idx + 1; LOGINFOMOD(replication, "[Replica={}] Save logical snapshot callback return obj_id={}", g_helper->replica_num(), snp_data->offset); return; @@ -265,7 +266,7 @@ class TestReplicatedDB : public homestore::ReplDevListener { "[Replica={}] Save logical snapshot callback obj_id={} term={} idx={} is_last={} num_items={}", g_helper->replica_num(), snp_data->offset, s->get_last_log_term(), s->get_last_log_idx(), snp_data->is_last_obj, num_items); - snp_data->offset = raft_server->get_committed_log_idx() + 1; + snp_data->offset = last_committed_idx + 1; } bool apply_snapshot(shared< snapshot_context > context) override {