-
Notifications
You must be signed in to change notification settings - Fork 9.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
raft: send empty appends when replication is paused #14633
Conversation
|
9386713
to
1233147
Compare
Codecov Report
@@ Coverage Diff @@
## main #14633 +/- ##
==========================================
- Coverage 75.81% 75.53% -0.29%
==========================================
Files 457 457
Lines 37292 37298 +6
==========================================
- Hits 28274 28174 -100
- Misses 7271 7348 +77
- Partials 1747 1776 +29
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
8bf78f9
to
e00dba8
Compare
@tbg This is now ready for review. |
83559d3
to
330bcb2
Compare
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.
Looks good! I'd mainly try to rearrange code and add more comments so that the intricacies of this dance are bit easier to grasp for future readers. See inline comments.
I also think it is worthwhile to add a TestInteraction
test for this.
7680b2a
to
cae22cd
Compare
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.
@tbg Addressed most comments, notably added the data-driven test.
1928d4d
to
9d81638
Compare
@ahrtr Please review or redirect to someone in etcd/raft folks. Commit-by-commit review is recommended. Only the 5-th commit Overall commits structure:
|
Probably flaky. The last run is good. |
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.
Addressed comments form @ahrtr
5817a3f
to
b525d02
Compare
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.
Overall looks good to me.
Thank you @pavelkalinnikov
We recently added some mix-versions test, and also removed some dependencies, so please rebase this PR. Once all pipelines are green, then it's OK to merge this PR. |
This commit adds a data-driven test which simulates conditions under which Raft messages flow to a particular node is throttled while in StateReplicate. The test demonstrates that MsgApp messages with non-empty Entries may "leak" to a paused stream every time there is successful heartbeat exchange. Signed-off-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
Signed-off-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
- avoid large indented blocks, leave the main block unindented - declare pb.Message inlined in the sending call Signed-off-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
Previously, Progress update on MsgApp send was scattered across raft.go and tracker/progress.go. This commit better encapsulates this logic in the Progress type. Signed-off-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
When Inflights to a particular node is full, i.e. MaxInflightMsgs for the append messages flow is saturated, it is still necessary to continue sending MsgApp to ensure progress. Currently this is achieved by "forgetting" the first in-flight message in the window, which frees up quota for one new MsgApp. This new message is constructed in such a way that it potentially has multiple entries, or a large entry. The effect of this is that the in-flight limitations can be exceeded arbitrarily, for as long as the flow to this node continues being saturated. In particular, if a follower is stuck, the leader will keep sending entries to it. This commit makes the MsgApp empty when Inflights is saturated, and prevents the described leakage of Entries to slow followers. Signed-off-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
Signed-off-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
Make the field name and comment clearer on the fact that it's used both in StateProbe and StateReplicate. The old name ProbeSent was slightly confusing, and also triggered thinking that it's used only in StateProbe. Signed-off-by: Pavel Kalinnikov <pavel@cockroachlabs.com>
b525d02
to
1ea1349
Compare
@ahrtr Rebased. Could you trigger CI once again and/or merge? |
Done. |
When Inflights to a particular node is full, i.e. MaxInflightMsgs for the append messages flow is saturated, it is still necessary to continue sending MsgApp to ensure progress. Currently this is achieved by "forgetting" the first in-flight message in the window, which frees up quota for one new MsgApp.
This new message is constructed in such a way that it potentially has multiple entries, or a large entry. The effect of this is that the in-flight limitations can be exceeded arbitrarily, for as long as the flow to this node continues being saturated. In particular, if a follower is stuck, the leader will keep sending entries to it.
This commit makes the MsgApp empty when Inflights is saturated, and prevents the described leakage of Entries to slow followers.
Signed-off-by: Pavel Kalinnikov pavel@cockroachlabs.com