Skip to content

Pre init recover index bug fix#629

Merged
kjnilsson merged 3 commits into
mainfrom
pre-init-recover-index-bug-fix
May 11, 2026
Merged

Pre init recover index bug fix#629
kjnilsson merged 3 commits into
mainfrom
pre-init-recover-index-bug-fix

Conversation

@kjnilsson
Copy link
Copy Markdown
Contributor

Fix snapshot recovery with empty indexes file

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.

kjnilsson added 2 commits May 8, 2026 10:49
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.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_init to accept a machine instance and pass it through to ra_snapshot:init/… so recover_indexes/… can rebuild indexes when needed.
  • Update ra_log_pre_init to read persisted machine config and normalize {module,…} / {simple,…} formats into the {machine, Mod, Args} form used by ra_snapshot.
  • Add a Common Test regression covering restart + snapshot install with an emptied snapshots/.../indexes file; minor logging format tweak in ra_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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread src/ra_log_pre_init.erl
@kjnilsson kjnilsson marked this pull request as ready for review May 11, 2026 07:18
@kjnilsson kjnilsson merged commit 83c10db into main May 11, 2026
12 checks passed
@kjnilsson kjnilsson deleted the pre-init-recover-index-bug-fix branch May 11, 2026 07:19
@michaelklishin michaelklishin added this to the 3.1.7 milestone May 28, 2026
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.

3 participants