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

khepri_machine: Restore #unregister_projection{} for backward-compatibility #286

Merged
merged 2 commits into from
Aug 16, 2024

Conversation

dumbbell
Copy link
Member

Why

Even though this version of Khepri never emits #unregister_projection{}, existing WAL files may still contain that command.

How

To not break these existing deployment, apply/3 accepts #unregister_projection{} again. It converts it to the new #unregister_projections{} command and recurses.

@dumbbell dumbbell added the bug Something isn't working label Aug 16, 2024
@dumbbell dumbbell added this to the v0.15.0 milestone Aug 16, 2024
@dumbbell dumbbell self-assigned this Aug 16, 2024
Copy link

codecov bot commented Aug 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.66%. Comparing base (94e673c) to head (e45323e).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #286      +/-   ##
==========================================
+ Coverage   89.55%   89.66%   +0.10%     
==========================================
  Files          21       21              
  Lines        3122     3124       +2     
==========================================
+ Hits         2796     2801       +5     
+ Misses        326      323       -3     
Flag Coverage Δ
erlang-25 88.89% <100.00%> (+0.10%) ⬆️
erlang-26 89.50% <100.00%> (+0.13%) ⬆️
erlang-27 89.56% <100.00%> (+0.07%) ⬆️
os-ubuntu-latest 89.66% <100.00%> (+0.10%) ⬆️
os-windows-latest 89.62% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

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

Codewise 👍

For the commit description and the comment in apply/3 though I think it's more general to say that the command might be "in existing Raft logs". The WAL is a temporary place to store commands as a performance optimization and the command might also be in segment files. But both are part of the Raft log.

@dumbbell dumbbell force-pushed the restore-unregister_projection-for-backward-compat branch from bf2bfc3 to a068e78 Compare August 16, 2024 13:49
@dumbbell
Copy link
Member Author

Good point @the-mikedavis, I improved the wording.

…tibility

[Why]
Even though this version of Khepri never emits
`#unregister_projection{}`, existing Ra log files may still contain that
command. Therefore, it may still be applied after an upgrade of Khepri.

[How]
To not break these existing deployment, `apply/3` accepts
`#unregister_projection{}` again. It converts it to the new
`#unregister_projections{}` command and recurses.
@dumbbell dumbbell force-pushed the restore-unregister_projection-for-backward-compat branch from a068e78 to e45323e Compare August 16, 2024 13:56
@dumbbell
Copy link
Member Author

I added a test case that just makes sure the machine code won't crash. It doesn't verify if the projections are actually unregistered.

@dumbbell dumbbell marked this pull request as ready for review August 16, 2024 14:30
@dumbbell dumbbell merged commit 1bc7edb into main Aug 16, 2024
12 checks passed
@dumbbell dumbbell deleted the restore-unregister_projection-for-backward-compat branch August 16, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants