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

tests/robustness: add in compaction checks for prevKV #18158

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MadhavJivrajani
Copy link
Contributor

@MadhavJivrajani MadhavJivrajani commented Jun 11, 2024

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

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 <[email protected]>
@MadhavJivrajani
Copy link
Contributor Author

oh wait I see my error - will fix in a little bit.

@serathius
Copy link
Member

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]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:
Copy link
Member

@serathius serathius Jun 15, 2024

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.

@k8s-ci-robot
Copy link

@MadhavJivrajani: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-etcd-unit-test-arm64 ef61fb6 link true /test pull-etcd-unit-test-arm64

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants