Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kvserver: fix 'observed raft log position' assertion #107412

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/kv/kvserver/replica_proposal_buf.go
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,16 @@ func maybeDeductFlowTokens(
if admitHandle.handle == nil {
continue // nothing to do
}
if ents[i].Term == 0 && ents[i].Index == 0 {
// It's possible to have lost raft leadership right before stepping
// proposals through raft. They'll get forwarded to the new raft
// leader, and for flow token purposes, there's no tracking
// necessary. The token deductions below asserts on monotonic
// observations of log positions, which this empty position would
// otherwise violate. There's integration code elsewhere that will
// free up all tracked tokens as a result of this leadership change.
return
}
log.VInfof(ctx, 1, "bound index/log terms for proposal entry: %s",
raft.DescribeEntry(ents[i], func(bytes []byte) string {
return "<omitted>"
Expand Down