Skip to content

Sealed segment without IndexStart #31

@rledisez

Description

@rledisez
[INFO]  raft: initial configuration: index=7 servers="[{Suffrage:Voter ID:00000001-0001-0001-0001-000000000001 Address:192.168.121.27:4419} {Suffrage:Voter ID:00000003-0003-0003-0003-000000000003 Address:192.168.121.217:4419} {Suffrage:Voter ID:00000002-0002-0002-0002-000000000002 Address:192.168.121.112:4419}]"
[INFO]  raft: entering follower state: follower="Node at 00000001-0001-0001-0001-000000000001 [Follower]" leader-address= leader-id=
[WARN]  raft: heartbeat timeout reached, not part of a stable configuration or a non-voter or not allowed to candidate, not triggering a leader election
[DEBUG] raft: lost leadership because received a requestVote with a newer term
[WARN]  raft: rejecting vote request since our last index is greater: candidate=00000003-0003-0003-0003-000000000003 last-index=424 last-candidate-index=423
[WARN]  raft: clearing log suffix: from=424 to=424

# Process is restarted

[ERROR] raft: failed to get log: index=1 error="sealed segment has no index block"
panic: sealed segment has no index block
goroutine 1 [running]:
github.com/hashicorp/raft.NewRaft(0xc0003423c0, {0x32b3ec0?, 0xc000355f50}, {0x32b7b90?, 0xc000342460}, {0x32b5b48?, 0xc000342460}, {0x32b3470?, 0xc000355ec0}, {0x32bb698, ...})
[...]

In this trace, raft is clearing the last index from the WAL (424). It calls (w *WAL) DeleteRange() which calls (w *WAL) truncateTailLocked().

truncateTailLocked() seals the segment but does not set the IndexStart, which is wrong from my understanding. So at the next start, the segment is sealed without any IndexStart set, which triggers the panic from (r *Reader) findFrameOffset.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions