-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
tests/robustness: add in compaction checks for prevKV #18158
base: main
Are you sure you want to change the base?
tests/robustness: add in compaction checks for prevKV #18158
Conversation
Kubernetes issues watch to etcd using PrevKV() and with that, it relies on the property that create events always have prevKV=nil. This commit incorporates that explicit check in the robustness tests. Further, etcd also can have prevKV=nil for any event type in the case of compaction taking place. This commit also adds in that check to ensure we are not changing these invariants. Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
oh wait I see my error - will fix in a little bit. |
Please ping me when it's ready for review. |
// check that without knowing if compaction has run. | ||
// i.e. for create events, prevKV is nil. | ||
if event.IsCreate && event.PrevValue != nil { | ||
lg.Error("prevValue field shold be nil in create event", zap.Int("client", report.ClientID), zap.Any("event", event), zap.Any("previousValue", prevState.KeyValues[event.Key])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lg.Error("prevValue field shold be nil in create event", zap.Int("client", report.ClientID), zap.Any("event", event), zap.Any("previousValue", prevState.KeyValues[event.Key])) | |
lg.Error("prevValue field should be nil in create event", zap.Int("client", report.ClientID), zap.Any("event", event), zap.Any("previousValue", prevState.KeyValues[event.Key])) |
err = errBrokePrevKV | ||
} | ||
|
||
// If compaction took place in the previous state, prevKV should be nil for all types of events in the current state: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct. Event generation and compaction are independent processes. They are not serialized by WAL.
Idea that nil prevKV is caused by compaction is correct, but it cannot be validated this way. Hit me up if you want to discuss it.
Kubernetes issues watch to etcd using PrevKV() and with that, it relies on the property that create events always have prevKV=nil. This commit incorporates that explicit check in the robustness tests.
Further, etcd also can have prevKV=nil for any event type in the case of compaction taking place. This commit also adds in that check to ensure we are not changing these invariants.
We can make this change now because compaction support exists in robustness tests: #17833
Towards: #15820
/assign @serathius @siyuanfoundation