Skip to content

Commit 46bba39

Browse files
rock-gityuhaijun999
authored andcommitted
[fix][store] Fixup load snapshot issues when reboot.
1 parent 7a4ec07 commit 46bba39

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

src/handler/raft_snapshot_handler.cc

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -231,29 +231,6 @@ butil::Status RaftSnapshot::HandleRaftSnapshotRegionMeta(braft::SnapshotReader*
231231
}
232232
}
233233

234-
// update store_state_machine's applied_index from snapshot meta.
235-
auto raft_store_engine = Server::GetInstance().GetRaftStoreEngine();
236-
if (raft_store_engine == nullptr) {
237-
DINGO_LOG(ERROR) << fmt::format("[raft.snapshot][region({})] raft store engine is null", region->Id());
238-
return butil::Status(pb::error::EINTERNAL, "raft store engine is null");
239-
}
240-
auto raft_node = raft_store_engine->GetNode(region->Id());
241-
if (raft_node == nullptr) {
242-
DINGO_LOG(ERROR) << fmt::format("[raft.snapshot][region({})] raft node is null", region->Id());
243-
return butil::Status(pb::error::EINTERNAL, "raft node is null");
244-
}
245-
auto fsm = raft_node->GetStateMachine();
246-
if (fsm == nullptr) {
247-
DINGO_LOG(ERROR) << fmt::format("[raft.snapshot][region({})] raft node's fsm is null", region->Id());
248-
return butil::Status(pb::error::EINTERNAL, "raft node's fsm is null");
249-
}
250-
auto store_state_machine = std::dynamic_pointer_cast<StoreStateMachine>(fsm);
251-
auto old_index = store_state_machine->GetAppliedIndex();
252-
store_state_machine->UpdateAppliedIndex(meta.log_index());
253-
254-
DINGO_LOG(INFO) << fmt::format("[raft.snapshot][region({})] update applied index from snapshot meta, from: {} to: {}",
255-
region->Id(), old_index, meta.log_index());
256-
257234
return butil::Status();
258235
}
259236

0 commit comments

Comments
 (0)