Skip to content

Follower 节点日志和快照被清空后,仅接收心跳不会触发 snapshot 拉取 #494

@houlin2016

Description

@houlin2016

你好,我在使用 Braft 时遇到了一个问题,情况如下:

我们有一个三节点集群,节点 A、B、C。其中,B 节点的 raftlog 和 snapshot 数据被清空后重启。重启后,B 成功加入集群,成为 follower,并能收到 leader 的心跳。但在不写入新日志的情况下(即日志没有新增 index),B 节点不会触发 snapshot 拉取,始终卡在 (index=0, term=45),状态如下所示:

B 节点状态(被清空后重启):

state: FOLLOWER
readonly: 0
term: 45
conf_index: 0
last_msg_to_now: 95
election_timer: timeout(1000ms) SCHEDULING(in 214ms)
vote_timer: timeout(2000ms) STOPPED
stepdown_timer: timeout(1000ms) STOPPED
snapshot_timer: timeout(3600000ms) SCHEDULING(in 2161540ms)
storage: [1, 0]
disk_index: 0
known_applied_index: 0
last_log_id: (index=0,term=0)
state_machine: Idle
last_committed_index: 0
last_snapshot_index: 0
last_snapshot_term: 0
snapshot_status: IDLE

Leader 节点状态:

state: LEADER
readonly: 0
term: 45
conf_index: 1338
changing_conf: NO    stage: STAGE_NONE
election_timer: timeout(1000ms) STOPPED
vote_timer: timeout(2000ms) STOPPED
stepdown_timer: timeout(1000ms) SCHEDULING(in 37ms)
snapshot_timer: timeout(3600000ms) SCHEDULING(in 574758ms)
storage: [1348, 1347]
disk_index: 1347
known_applied_index: 1347
last_log_id: (index=1347,term=45)
state_machine: Idle
last_committed_index: 1347
last_snapshot_index: 1347
last_snapshot_term: 45
snapshot_status: IDLE
replicator_12408160521560@A: next_index=1348  flying_append_entries_size=0 idle hc=5804502 ac=19 ic=0
replicator_42408507084623@B: next_index=1348  flying_append_entries_size=0 idle hc=5804995 ac=1085 ic=1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions