-
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
prevKV not being returned if the previous KV was compacted is suprising behavior #10681
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions. |
Do watches ever end with a compacted error today? |
It should return errCompacted. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions. |
Would like to revisit this as part of Kubernetes-etcd contract. |
See kubernetes/kubernetes#76624
For delete watch event, in particular, I'm guessing the conditions for this to happen would be something like:
1: put "/x" -> "value" (revision=1)
2. create watch "/x"
3. delete "/x" (revision=2)
4. compaction
5. "/x deleted" watch event sent
Because if the compaction happened before (3) or after (5), the prevKV would be included in the "/x deleted" watch event (revision 1 of "/x" can't be compacted until after the delete). I'm concerned this is a rare enough situation that clients that make use of prevKV are unlikely to see it in development and even more unlikely to write code to defend against it until it breaks in production.
One option would be to terminate the watch with
ErrCompacted
rather than returning a watch event with a missingprevKV
. Clients would need to re-establish the watch if they get theErrCompacted
error, but they need to be written to be able to do that already. Only watches withWithPrevKV()
enabled would be impacted.Another would be to modify compaction to retain both the latest and the previous of each KV. This would 2x minimum disk space in the worst case.
The text was updated successfully, but these errors were encountered: