Skip to content

cache: implement MVP watch demux#20160

Merged
serathius merged 1 commit intoetcd-io:mainfrom
apullo777:cache-mvp
Jul 3, 2025
Merged

cache: implement MVP watch demux#20160
serathius merged 1 commit intoetcd-io:mainfrom
apullo777:cache-mvp

Conversation

@apullo777
Copy link
Copy Markdown
Contributor

This is a WIP draft PR created to start the code review process. Feedback welcome!

What’s in this PR

  • implements the MVP Watch demultiplexer only, per earlier discussion with mentors
  • defers the storage & indexing layer to next stage, so we can focus on correctness and robustness of the core demux

What's next

  • continue writing unit tests for all demux/watch behaviors (catch-up, backoff, drop threshold, etc.)

Tagging mentors for code review:
@serathius
@MadhavJivrajani

@k8s-ci-robot
Copy link
Copy Markdown

Hi @apullo777. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

Comment thread cache/eventsource.go Outdated
Comment thread cache/eventsource.go Outdated
Comment thread cache/cache.go Outdated
Comment thread cache/cache.go Outdated
Comment thread cache/cache.go Outdated
Comment thread cache/config.go Outdated
Comment thread cache/predicate.go Outdated
Comment thread cache/cache.go Outdated
Comment thread cache/demux.go Outdated
Comment thread cache/eventsource.go Outdated
Copy link
Copy Markdown
Contributor

@MadhavJivrajani MadhavJivrajani left a comment

Choose a reason for hiding this comment

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

Great progress! 🎉

Leaving a few comments for us to work on next week.

Comment thread cache/cache.go Outdated
Comment thread cache/cache.go Outdated
Comment thread cache/cache.go Outdated
Comment thread cache/cache.go Outdated
Comment thread cache/catchup.go Outdated
Comment thread cache/demux.go Outdated
Comment thread cache/eventsource.go Outdated
Comment thread cache/cache.go
Comment thread cache/cache.go Outdated
Comment thread cache/cache.go Outdated
Comment thread cache/cache.go Outdated
Comment thread cache/cache.go Outdated
Comment thread cache/cache.go Outdated
Comment thread cache/cache.go
Comment thread cache/cache.go Outdated
Comment thread cache/cache.go Outdated
Comment thread cache/cache.go Outdated
Comment thread cache/cache.go Outdated
Comment thread cache/config.go Outdated
Comment thread cache/config.go Outdated
Comment thread cache/config.go Outdated
Comment thread cache/demux.go Outdated
Comment thread cache/demux.go Outdated
Comment thread cache/demux.go Outdated
Comment thread cache/demux.go Outdated
Comment thread cache/demux.go Outdated
@ivanvc
Copy link
Copy Markdown
Member

ivanvc commented Jul 3, 2025

-release

@serathius, I had a hard time finding this message in this pull request; it has a lot of activity. I see that you suggested a change that will fix the release tests, but they are still failing. Before I investigate, is this still an issue? Please feel free to contact me on Slack.

@apullo777
Copy link
Copy Markdown
Contributor Author

@serathius Sorry, I couldn't solve the rebase issue, and it now turns into a weird situation. I tried to do git rebase origin/main but it hit a strange issue: even with a clean working tree (both git status and git stash report no local edits), my git rebase aborts with merge conflicts with go.mod/sum files. The weird part is that Git seems to think those files are already up-to-date, so I cannot resolve the "invisible" conflict.

Stuck with this issue, I tried to force pushed a brand new branch onto the old PR branch name. That fixed the CI-side rebase error, but in doing so it also pulled in the root repo’s latest bump-Go commit (and its file changes) into my cache-mvp feature branch. So now those upstream modifications are being pushed as part of the commit, while they do not appear on my local, so I cannot remove them to update the PR commit.

At this point I can’t seem to remove them or get a clean history. Should I start over a new PR with a new branch?

@apullo777
Copy link
Copy Markdown
Contributor Author

-release

@serathius, I had a hard time finding this message in this pull request; it has a lot of activity. I see that you suggested a change that will fix the release tests, but they are still failing. Before I investigate, is this still an issue? Please feel free to contact me on Slack.

@ivanvc Thanks for taking a look! It appears the release test is now passing, so that part is resolved. But now my feature work are polluted I will try to figure out how to solve it. Sorry for the confusion...

@serathius
Copy link
Copy Markdown
Member

Should I start over a new PR with a new branch?

No

Comment thread cache/cache.go Outdated
Comment thread cache/demux.go Outdated
Comment thread cache/demux.go Outdated
@serathius
Copy link
Copy Markdown
Member

serathius commented Jul 3, 2025

@serathius Sorry, I couldn't solve the rebase issue, and it now turns into a weird situation. I tried to do git rebase origin/main but it hit a strange issue: even with a clean working tree (both git status and git stash report no local edits), my git rebase aborts with merge conflicts with go.mod/sum files. The weird part is that Git seems to think those files are already up-to-date, so I cannot resolve the "invisible" conflict.

Yea, you broke git history. Somehow you changed the commit type to merge commit. I fixed it and pushed to your fork.
Before making any more changes please fetch the branch locally.

@serathius serathius force-pushed the cache-mvp branch 4 times, most recently from 2e233fb to 5e51bab Compare July 3, 2025 09:22
@k8s-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: apullo777, serathius

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

The pull request process is described here

Details 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

@serathius serathius force-pushed the cache-mvp branch 3 times, most recently from 49ba5c0 to 626569c Compare July 3, 2025 11:02
Signed-off-by: Peter Chang <peter.yaochen.chang@gmail.com>
@serathius
Copy link
Copy Markdown
Member

serathius commented Jul 3, 2025

There are still a lot of things we can improve, but this looks like a good start. The most important thing next is fixing the Atomic watch property. The current implementation assumes that revision is a unique number, this is not true.

TXN can have multiple operations (Put/Delete) that are executed within one transactions, all this operations will share revision. Atomic watch guarantee ensures that events that share revisions will always be send in single watch response and not broken up. https://etcd.io/docs/v3.5/learning/api_guarantees/#watch-apis

Prepared PR to show what I mean #20272

@serathius serathius merged commit 866bc07 into etcd-io:main Jul 3, 2025
29 of 31 checks passed
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.

5 participants