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

Return the actually committed index if it's greater than the official committed index for ReadIndex #105

Closed
wants to merge 1 commit into from

Conversation

ahrtr
Copy link
Member

@ahrtr ahrtr commented Sep 30, 2023

When etcd receives committed Entries, it does the following three things concurrently,

  • apply the entries and respond to client
  • persist the hard state
  • persist the applied data to bboltDB

It's possible that it has successfully responded to the client, but fails to persist the hardstate and data to bboltDB, such as crashes right before persisting the hardstate(including committed index) and the applied data to bboltDB.

After etcd starts again,

  • The initial committed index of the raft is an out of date value;
  • When a client sends a linearizable request, it gets the readIndex firstly, and get the old value; accordingly won't wait for the new entries being applied, and respond the client with an stale data.
    • Note that etcd replays WAL entries on bootstrap, but this step may be executed before the replaying finishes.

raft.go Outdated Show resolved Hide resolved
raft.go Outdated Show resolved Hide resolved
@serathius
Copy link
Member

serathius commented Sep 30, 2023

Not yet convinced that the problem is with readIndex. I would be interested more into persistence of HardState.
HardState should be also persisted to WAL, isn't it guaranteed to be written?

… committed index for ReadIndex

Signed-off-by: Benjamin Wang <[email protected]>
@ahrtr
Copy link
Member Author

ahrtr commented Sep 30, 2023

See etcd-io/etcd#16675.

This PR is a standalone change for raft.

@ahrtr
Copy link
Member Author

ahrtr commented Oct 5, 2023

Won't continue to work on this.

etcd-io/etcd#16666 (comment)

@ahrtr ahrtr closed this Oct 5, 2023
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