Skip to content

Make /readyz catch up to latest consensus commit - #5405

Merged
timvisee merged 2 commits into
devfrom
readyz-fully-catch-up
Nov 18, 2024
Merged

timvisee merged 2 commits into
devfrom
readyz-fully-catch-up

Conversation

@timvisee

@timvisee timvisee commented Nov 8, 2024 •

Copy link
Copy Markdown
Member

Make /readyz a more strict and let it catch up to the latest current consensus commit, instead of just the latest commit at the time the peer started.

In other words, it now constantly polls the latest commit and tries to catch up to that, instead of just trying to catch up to the latest commit we saw at the time of starting the peer.

This is important because if a replica is marked as dead and is then recovered, the active state of that replica might blink on the restarted peer while it is already accepting updates. That could result in missing updates.

Some potential negative side effects of this change are:

  • it might take longer to be ready
  • if there is a constant stream of new consensus operations we may never catch up
  • we have more calls across the cluster to synchronize /readyz

But, ensuring data consistency is more important than the above three points.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --all --all-features command?

Don't just catch up to the cluster commit at the start of the node, but
keep polling the latest commit and what for it instead.
Comment thread src/common/health.rs
// Get *cluster* commit index, or check if this is the only node in the cluster
let Some(cluster_commit_index) = self.cluster_commit_index().await else {
// Get estimate of current cluster commit so we can wait for it
let Some(mut cluster_commit_index) = self.cluster_commit_index(true).await else {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor change: the first consensus commit we wait on is just requested from a single node, which may not necessarily be the latest. It is fine because we'll always do another set of requests to all nodes later.

In an ideal situation this reduces requests to other nodes by (50% - 1).

@timvisee
timvisee marked this pull request as ready for review November 18, 2024 11:52
@timvisee
timvisee requested a review from generall November 18, 2024 11:52
@timvisee
timvisee merged commit 711034d into dev Nov 18, 2024
@timvisee
timvisee deleted the readyz-fully-catch-up branch November 18, 2024 15:37
timvisee added a commit that referenced this pull request Dec 9, 2024
* Make /readyz fully catch up to current latest cluster commit

Don't just catch up to the cluster commit at the start of the node, but
keep polling the latest commit and what for it instead.

* On first consensus commit request, just rely on the commit of one node
@timvisee timvisee mentioned this pull request Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants