Pre init recover index bug fix#629
Merged
Merged
Conversation
Updates `ra_log:pre_init` to accept and pass the machine configuration to `ra_snapshot:init`,
ensuring proper recovery even when the snapshot `indexes` file is empty.
Additionally, fixes `ra_log_pre_init` to properly handle both `{module, ...}` and `{simple, ...}`
machine configuration formats, and includes a regression test.
There was a problem hiding this comment.
Pull request overview
Fixes snapshot recovery when the snapshot indexes file is present but empty/corrupt by ensuring pre-init snapshot discovery has enough machine context to rebuild live indexes, and adds a regression test to prevent recurrence.
Changes:
- Change
ra_log:pre_initto accept a machine instance and pass it through tora_snapshot:init/…sorecover_indexes/…can rebuild indexes when needed. - Update
ra_log_pre_initto read persistedmachineconfig and normalize{module,…}/{simple,…}formats into the{machine, Mod, Args}form used byra_snapshot. - Add a Common Test regression covering restart + snapshot install with an emptied
snapshots/.../indexesfile; minor logging format tweak inra_server_proc.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
test/ra_log_2_SUITE.erl |
Adds regression test for recovery when snapshot indexes file is empty. |
src/ra_server_proc.erl |
Adjusts error logging formatting to use depth-limited term formatting. |
src/ra_log.erl |
Updates pre_init API to accept/pass machine into snapshot initialization. |
src/ra_log_pre_init.erl |
Extracts and normalizes machine config from on-disk config before calling ra_log:pre_init/2. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix snapshot recovery with empty indexes file
Updates
ra_log:pre_initto accept and pass the machine configuration tora_snapshot:init,ensuring proper recovery even when the snapshot
indexesfile is empty.Additionally, fixes
ra_log_pre_initto properly handle both{module, ...}and{simple, ...}machine configuration formats, and includes a regression test.