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

raft: open db on service.Open instead on apply #4878

Merged
merged 4 commits into from
May 10, 2024

Conversation

moogacs
Copy link
Contributor

@moogacs moogacs commented May 8, 2024

What's being changed:

this PR avoid reopening the db with every apply and instead does it at the beginning when we start newRaft

this pr is part of series of PRs
#4876
#4878

Why: we ended up in situation we made assumption that the database has to be updated before schema and that caused some confusion.

How:
Old approach:
open database at the beginning only if the node was fresh
open the db again on apply command
separate between commands to be applied on db or schema only based on newAppliedIndex <= initialLastAppliedIndex

New approach:
always open database at the beginning of raft init if there is something to catch up on
always updating both database and schema at the same time by applying schema 1st then the database, so that schema has the validation logic to protect any updates from going to the database

chaos pipeline

Review checklist

  • Documentation has been updated, if necessary. Link to changed documentation:
  • Chaos pipeline run or not necessary. Link to pipeline:
  • All new code is covered by tests where it is reasonable.
  • Performance tests have been run or not necessary.

@moogacs moogacs force-pushed the refactor-db-open-3 branch 2 times, most recently from b48601c to 8a6c7b2 Compare May 8, 2024 16:51
@moogacs moogacs changed the title raft: open db on service.Open raft: open db on service.Open instead on apply May 8, 2024
Copy link

sonarcloud bot commented May 8, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@moogacs moogacs marked this pull request as ready for review May 8, 2024 21:36
Base automatically changed from refactor-db-open-2 to stable/v1.25 May 10, 2024 09:29
@reyreaud-l reyreaud-l merged commit 9a018c7 into stable/v1.25 May 10, 2024
42 checks passed
@reyreaud-l reyreaud-l deleted the refactor-db-open-3 branch May 10, 2024 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants