-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Watch response revision can be lower than the required starting revision #19487
Comments
Don't think we provide any guarantees about RV in watch response, as long as it's not a progress notification. They are just local etcd RV when the response was created. As responses are queued up to 100, they can be arbitrarily stale. I don't think the current semantic of RV in watch response is useful, and fixing the issue you described would not make it any more useful. |
Hi @serathius! Thank you for response. What we are observing is that the watch request does not respect the given start revision, as it returns responses that have lower revision than the start revision. I think this watch start revision semantic is clearly defined in the API documentation
and the robustness model: etcd/tests/robustness/model/replay.go Lines 56 to 57 in 6ecb6fb
I am not sure if this is related to staleness (or maybe I miss something). |
@serathius Below are the steps to reproduce. In summary, we need to first send a watch request with a future starting revision to a follower, then trigger the leader to send a snapshot to this node, finally run some puts.
Hope it helps. |
Bug report criteria
What happened?
Hi developers! When testing etcd, we found a bug that can cause a watch response revision to be less than the required starting revision (e.g., watch key --rev 4 returns a response with revision=3).
What did you expect to happen?
The watch response revision should not be less than the starting revision.
How can we reproduce it (as minimally and precisely as possible)?
The following steps are required to trigger this bug on a follower node:
(s *watchableStore) Restore(b backend.Backend)
is called), e.g., after a network partition; at this point, the watch revision is still greater than the current revisionsyncWatchers()
is calledIt seems that when restoring the snapshot, the node will move the synced watchers to the unsynced group:
etcd/server/mvcc/watchable_store.go
Lines 204 to 207 in 5bca08e
Later, when syncWatchers() is called, it decreases the watcher's
minRev
tocurRev + 1
, and then moves the watcher back to synced group; then the future put()s will be notified even if their revisions are less than the original watch revision:etcd/server/mvcc/watchable_store.go
Lines 368 to 382 in 5bca08e
Hope this could be helpful.
Anything else we need to know?
No response
Etcd version (please run commands below)
3.5.18
Etcd configuration (command line flags or environment variables)
No response
Etcd debug information (please run commands below, feel free to obfuscate the IP address or FQDN in the output)
No response
Relevant log output
The text was updated successfully, but these errors were encountered: