assertion failed: meta.index > applied', when applying snapshot
- https://git.picodata.io/picodata/picodata/picodata/-/jobs/103194
- https://git.picodata.io/picodata/picodata/picodata/-/jobs/106240
- https://git.picodata.io/picodata/picodata/picodata/-/jobs/183782
i3 | 2023-12-01 16:54:36.256 [86383] main/110/.proc_raft_interact I> log [committed=74, persisted=74, applied=74, unstable.offset=75, unstable.entries.len()=0] starts to restore snapshot [index: 74, term: 2], snapshot_term: 2, snapshot_index: 74, log: committed=74, persisted=74, applied=74, unstable.offset=75, unstable.entries.len()=0, raft_id: 2
i3 | 2023-12-01 16:54:36.256 [86383] main/110/.proc_raft_interact I> switched to configuration, config: Configuration { voters: Configuration { incoming: Configuration { voters: {1, 2, 3} }, outgoing: Configuration { voters: {} } }, learners: {}, learners_next: {}, auto_leave: false }, raft_id: 2
i3 | 2023-12-01 16:54:36.256 [86383] main/110/.proc_raft_interact I> restored snapshot, snapshot_term: 2, snapshot_index: 74, last_term: 2, last_index: 74, commit: 74, raft_id: 2
i3 | 2023-12-01 16:54:36.256 [86383] main/110/.proc_raft_interact I> [commit: 74, term: 2] restored snapshot [index: 74, term: 2], snapshot_term: 2, snapshot_index: 74, commit: 74, term: 2, raft_id: 2
i3 | 2023-12-01 16:54:36.256 [86383] main/110/.proc_raft_interact V> Sending from 2 to 1, msg: msg_type: MsgAppendResponse to: 1 index: 74, to: 1, from: 2, raft_id: 2
i3 | 2023-12-01 16:54:36.257 [86383] main/111/raft_main_loop V> main_loop_status = 'applying snapshot'
i3 | thread 'main' panicked at 'assertion failed: meta.index > applied', src/traft/raft_storage.rs:433:9
Looks like the snapshot's index is the same as local applied index, which break our assertion. But perhaps our assertion should be that meta.index >= applied. Although why do we receive the snapshot then? I though the snapshot only comes when we send a message append reject...
Update
Вот логи с безуспешного запуска: job-247057.txt
Наблюдаемая ситуация не объясняется недетерминированностью сетевого взаимодействия, т.к. сообщения идут по порядку. При этом рафт лидер не меняется. Ситуация примерно такая:
- Фоловер обнаруживая у себя дыру в логе отправляет лидеру reject в ответ на msg append
- Лидер отправляет фоловеру снапшот
- Фоловер применяет снапшот, отправляет append response
- Лидер шлёт следующий append
- Фоловер внезапно шлёт reject с reject_hint_term = 0
- Лидер шлёт снапшот
- Фоловер применяет снапшот, паника, потому что snapshot_index = applied_index
С какого перепуга там reject_hint_term = 0, я понять пока не смог. Локально это не воспроизводится. Похоже где-то какая-то странная гонка..
Edited by Georgy Moshkin