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

[query]How etcd-raft gurantee the correctness of leased read #99

Open
kikimo opened this issue Sep 13, 2023 · 2 comments
Open

[query]How etcd-raft gurantee the correctness of leased read #99

kikimo opened this issue Sep 13, 2023 · 2 comments

Comments

@kikimo
Copy link
Contributor

kikimo commented Sep 13, 2023

Hi, I read the leader lease part of etcd-raft and it seems that the Leader was not expiring its leader lease when it was required to transfer its leadership. A transferer might just step back to leader(it has now a new leader lease of an election timeout long) and serve read-only reuqests after election timeout if now message from new leader was recieved. Suppose the transferee was elected leader just right after the transferer step back leader again, at this time both leader might be able to server read-only request and I think the old leader might return stale read-only results to clients.

@kikimo kikimo changed the title How etcd-raft gurantee the correctness of leased read How etcd-raft gurantee the correctness of leased read[query] Sep 13, 2023
@kikimo kikimo changed the title How etcd-raft gurantee the correctness of leased read[query] [query]How etcd-raft gurantee the correctness of leased read Sep 13, 2023
@joshuazh-x
Copy link
Contributor

raft guarantees at most one leader in each term. And in serving read-only query, leader will first check if it is the latest leader by casting heartbeat to all peers. Only the leader with newer term will be able to get quorum heartbeat responses and serve read-only query.

Following is quoted from Diego Ongaro's dissertation.

The leader needs to make sure it hasn’t been superseded by a newer leader of which it is
unaware. It issues a new round of heartbeats and waits for their acknowledgments from a
majority of the cluster.

@kikimo
Copy link
Contributor Author

kikimo commented Sep 28, 2023

raft guarantees at most one leader in each term. And in serving read-only query, leader will first check if it is the latest leader by casting heartbeat to all peers. Only the leader with newer term will be able to get quorum heartbeat responses and serve read-only query.

Following is quoted from Diego Ongaro's dissertation.

The leader needs to make sure it hasn’t been superseded by a newer leader of which it is
unaware. It issues a new round of heartbeats and waits for their acknowledgments from a
majority of the cluster.

That's indexed read, but I'm talking about leased read.

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

No branches or pull requests

2 participants