Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: TiKV raft engine日志丢失Tikv恢复失败

To improve efficiency, please provide the following information. A clear problem description will help resolve the issue faster:
Overview: When attempting to test the recovery of a single-node TiKV, the recovery-mode
configuration item of raft-engine was modified to “tolerate-any-corruption” and the raft log file was manually deleted, resulting in TiKV failing to recover.
Application Framework and Business Logic Adaptation: Testing TiKV’s recovery in cases of file loss or corruption due to power outages or other anomalies.
Background:
- Modified the
recovery-mode
configuration item of raft-engine to “tolerate-any-corruption”. - Restarted TiKV.
- Inserted data into TiKV from the application layer.
- Manually deleted the tail log file of raft-engine.
- Stopped data insertion.
- Restarted TiKV, and TiKV failed to start.
Phenomenon: TiKV failed to start and reported the error “[FATAL] [server.rs:950] [“failed to start node: Engine(Other("[components/raftstore/src/store/fsm/store.rs:1115]: \"[components/raftstore/src/store/peer_storage.rs:769]: [region 2] 3 validate state fail: Other(\\\"[components/raftstore/src/store/peer_storage.rs:595]: log at recorded commit index [8] 262607 doesn’t exist, may lose data, region 2, raft state hard_state { term: 8 vote: 3 commit: 103492 } last_index: 103494, apply state applied_index: 262607 commit_index: 262607 commit_term: 8 truncated_state { index: 262600 term: 8 }\\\")\""))”]”
Problem: TiKV cannot recover.
Business Impact:
TiDB Version:
tikv:v6.1.0
Attachments: