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: Request delete_reason if effective machine version >= 2 only #309

Merged

Conversation

dumbbell
Copy link
Member

@dumbbell dumbbell commented Dec 12, 2024

Why

The delete_reason property to return was introduced with machine version 2. Older versions have two issues:

  • They don't know this property
  • They crash on unknown properties

How

We request this new property only if the effective machine version is greater or equal to 2 to avoid the issues listed above.

Future unknown properties are ignored since commit 257cf32 merged in the previous pull request #308.

@dumbbell dumbbell added the enhancement New feature or request label Dec 12, 2024
@dumbbell dumbbell added this to the v0.17.0 milestone Dec 12, 2024
@dumbbell dumbbell self-assigned this Dec 12, 2024
Copy link

codecov bot commented Dec 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.83%. Comparing base (0db160f) to head (e3d959c).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #309      +/-   ##
==========================================
+ Coverage   89.58%   89.83%   +0.25%     
==========================================
  Files          22       22              
  Lines        3263     3277      +14     
==========================================
+ Hits         2923     2944      +21     
+ Misses        340      333       -7     
Flag Coverage Δ
erlang-25 89.07% <100.00%> (+0.41%) ⬆️
erlang-26 89.68% <100.00%> (+0.44%) ⬆️
erlang-27 89.47% <100.00%> (+0.10%) ⬆️
os-ubuntu-latest 89.80% <100.00%> (+0.31%) ⬆️
os-windows-latest 89.65% <100.00%> (+0.32%) ⬆️

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.

@dumbbell
Copy link
Member Author

@the-mikedavis: As briefly stated in the commit message and a comment in the code, getting the effective machine version when handling transactions is a bit tricky. The code runs inside the Ra server process. It doesn’t have the store ID because we don’t keep it in the machine state, even though we get it in the init arguments…

For now, I just query the registered name of the process, but, yeah, not ideal… Ideally, I would modify the state to add the store ID. We already bump the machine version anyway. I was lazy for this first iteration :-)

So, I will prepare a new patch to modify that state, and I also need to document that the delete_reason was added as part of version 2.

Regardless, what do you think of the patch so far?

@dumbbell
Copy link
Member Author

I’m wrong: we have the store ID in the machine configuration!

@dumbbell dumbbell force-pushed the set-default-props_to_return-based-on-effective-machine-version branch 3 times, most recently from 8f5b966 to 6dc1be2 Compare December 12, 2024 16:30
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.

I found a few typos but otherwise I think this looks great!

src/khepri_machine.erl Outdated Show resolved Hide resolved
src/khepri_machine.erl Outdated Show resolved Hide resolved
…>= 2 only

[Why]
The `delete_reason` property to return was introduced with machine
version 2. Older versions have two issues:
* They don't know this property
* They crash on unknown properties

[How]
We request this new property only if the effective machine version is
greater or equal to 2 to avoid the issues listed above.

Future unknown properties are ignored since commit
257cf32 merged in the previous pull
request #308.
@dumbbell dumbbell force-pushed the set-default-props_to_return-based-on-effective-machine-version branch from 6dc1be2 to e3d959c Compare December 16, 2024 10:46
@dumbbell dumbbell marked this pull request as ready for review December 16, 2024 10:53
@dumbbell
Copy link
Member Author

@the-mikedavis: Did you check if mixed-version testing in RabbitMQ was fixed with this change?

@the-mikedavis
Copy link
Member

I didn't test this patch in the server but I was testing ba1bf14 before which should have roughly the same effect. We still need to handle the case of "paused" cluster members on the older version but that change did remove errors from delete_reason not being recognized on older members. I'll update rabbitmq/rabbitmq-server#12753 to test this branch instead

@the-mikedavis
Copy link
Member

I updated the draft PR in the server repo to use this change (and #312) and I don't see any error logs about delete_reason in the failed test logs 👍

@dumbbell
Copy link
Member Author

I updated the draft PR in the server repo to use this change (and #312) and I don't see any error logs about delete_reason in the failed test logs 👍

Thank you! I couldn’t reproduce any errors related to this locally either.

@dumbbell dumbbell merged commit 8e5703e into main Dec 17, 2024
26 checks passed
@dumbbell dumbbell deleted the set-default-props_to_return-based-on-effective-machine-version branch December 17, 2024 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants