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

Automatically clean the list of running stores if a Ra server has stopped behind the scene #275

Merged
merged 3 commits into from
Jul 22, 2024

Conversation

dumbbell
Copy link
Member

@dumbbell dumbbell commented Jul 22, 2024

Why

If a Ra server has stopped behind the back of Khepri, the is_store_running/1 and get_store_ids/0 function will return incorrect data or even hit an assertion.

How

With these commits, the list is automatically cleaned up if one of the functions detects that a stopped Ra server is still listed.

Fixes #271.

dumbbell added 2 commits July 22, 2024 19:40
[Why]
If a Ra server has stopped behind the back of Khepri, we want to delete
it from the list of running stores.

[How]
Instead of having an assertion to ensure that the presence or absence of
a store in the list of running stores matches the result of
`is_store_running/1`, we clean up the list if needed as part of that
function.
[Why]
If a Ra server has stopped behind the back of Khepri, the cached list of
running stores might not reflect the reality.

[How]
We filter the cached list using `is_store_running/1`. This function will
clean up the list as a side effect too.
@dumbbell dumbbell added the bug Something isn't working label Jul 22, 2024
@dumbbell dumbbell added this to the v0.15.0 milestone Jul 22, 2024
@dumbbell dumbbell self-assigned this Jul 22, 2024
Copy link

codecov bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.39%. Comparing base (c6647cf) to head (aabaa5a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #275      +/-   ##
==========================================
+ Coverage   89.37%   89.39%   +0.02%     
==========================================
  Files          21       21              
  Lines        3078     3084       +6     
==========================================
+ Hits         2751     2757       +6     
  Misses        327      327              
Flag Coverage Δ
erlang-25 88.55% <100.00%> (-0.02%) ⬇️
erlang-26 89.29% <100.00%> (+0.02%) ⬆️
erlang-27 89.29% <100.00%> (-0.02%) ⬇️
os-ubuntu-latest 89.39% <100.00%> (+0.08%) ⬆️
os-windows-latest 89.33% <100.00%> (+0.02%) ⬆️

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 dumbbell force-pushed the auto-cleanup-store-ids-list branch from f165e51 to aabaa5a Compare July 22, 2024 17:56
…crashed Ra servers

[Why]
These functions didn't use to handle a Ra server that has stopped behing
the back of Khepri correctly. This is fixed by the two previous commits.
@dumbbell dumbbell marked this pull request as ready for review July 22, 2024 18:06
@dumbbell dumbbell merged commit 467b4b6 into main Jul 22, 2024
12 checks passed
@dumbbell dumbbell deleted the auto-cleanup-store-ids-list branch July 22, 2024 18:07
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.

Store left in the list of running stores after a crash of the Ra server
1 participant