-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
storage: fill the reservation before sending the snapshot response #10440
storage: fill the reservation before sending the snapshot response #10440
Conversation
s.bookie.Fill(ctx, header.RangeDescriptor.RangeID) | ||
} | ||
} | ||
defer fillReservation() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ugly. I'm open to suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could a sync.Once
do the trick?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, though the synchronization sync.Once
provides isn't necessary.
df6a951
to
ecab915
Compare
If we send the response before filling the reservation the RPC can be sent over the network waking up the goroutine which initiated the preemptive snapshot and allowing it to perform another one before the reservation is filled. This second preemptive snapshot would get rejected and cause full replication to take much longer to achieve resulting in test flakiness.
ecab915
to
d9e812a
Compare
Reworked this PR to have the snapshot sender wait for the stream EOF. PTAL. |
Reviewed 2 of 2 files at r2. pkg/storage/raft_transport.go, line 605 at r2 (raw file):
please add a comment! Comments from Reviewable |
Review status: all files reviewed at latest revision, 2 unresolved discussions, all commit checks successful. pkg/storage/raft_transport.go, line 605 at r2 (raw file):
|
// NB: wait for EOF which ensures that all processing on the server side has | ||
// completed (such as defers that might be run after the previous message was | ||
// received). | ||
if _, err := stream.Recv(); err != io.EOF { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is rather odd for two reasons 1. the resp is ignored, and 2. I imagine it would be part of a receiver loop
Review status: all files reviewed at latest revision, 3 unresolved discussions, all commit checks successful. pkg/storage/raft_transport.go, line 605 at r2 (raw file):
|
If we send the response before filling the reservation the RPC can be
sent over the network waking up the goroutine which initiated the
preemptive snapshot and allowing it to perform another one before the
reservation is filled. This second preemptive snapshot would get
rejected and cause full replication to take much longer to achieve
resulting in test flakiness.
This change is