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

Add verification to ensure the watch events are in the expected range #18980

Closed
wants to merge 1 commit into from

Conversation

ahrtr
Copy link
Member

@ahrtr ahrtr commented Dec 2, 2024

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahrtr

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

Attention: Patch coverage is 57.14286% with 3 lines in your changes missing coverage. Please review.

Project coverage is 68.76%. Comparing base (78885f6) to head (7d5180a).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
server/storage/mvcc/watchable_store.go 57.14% 2 Missing and 1 partial ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
server/storage/mvcc/watchable_store.go 92.64% <57.14%> (-0.86%) ⬇️

... and 18 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #18980      +/-   ##
==========================================
- Coverage   68.80%   68.76%   -0.04%     
==========================================
  Files         420      420              
  Lines       35599    35606       +7     
==========================================
- Hits        24494    24485       -9     
- Misses       9675     9692      +17     
+ Partials     1430     1429       -1     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78885f6...7d5180a. Read the comment docs.

@@ -372,6 +374,17 @@ func (s *watchableStore) syncWatchers() int {
// Otherwise we will trigger SIGSEGV during boltdb re-mmap.
tx.RUnlock()

verify.Verify(func() {
Copy link
Member

@serathius serathius Dec 2, 2024

Choose a reason for hiding this comment

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

This just tests the results of range over revisions, this kind of things should be validated in tests, not during e2e tests.
I think the discussion in #17563 (comment) was about curRev decreasing

Copy link
Member Author

Choose a reason for hiding this comment

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

We already have a couple of verifications to ensure the revision will never decrease.

This verification is only to ensure the watch events are in the expected range.

Copy link
Member

Choose a reason for hiding this comment

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

We introduce verification for non-trivial properties that are based on state that is changed in so many places that it's impossible to test them in isolated way. In this case you are just validating range that is defined via minBytes and maxBytes variable 10 lines above. Would a unit test be a better match?

Copy link
Member

Choose a reason for hiding this comment

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

For example b52ee3b

Copy link
Member

Choose a reason for hiding this comment

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

We can merge #18981

Copy link
Member Author

Choose a reason for hiding this comment

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

It mainly verifies the keys(revisions) read from bbolt are in the expected range. We might should do it in bbolt instead of etcd.

@ahrtr ahrtr closed this Dec 3, 2024
@ahrtr ahrtr deleted the verify_watch_syncer_20241202 branch December 4, 2024 16:42
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.

3 participants