Skip to content

Re-initialise aux state when recovering from a recovery checkpoint - #645

Merged
kjnilsson merged 1 commit into
mainfrom
aux-init-bug
Jul 22, 2026
Merged

Re-initialise aux state when recovering from a recovery checkpoint#645
kjnilsson merged 1 commit into
mainfrom
aux-init-bug

Conversation

@kjnilsson

Copy link
Copy Markdown
Contributor

aux_state is transient and is only ever set once, by ra_server:init/2, before recovery checkpoint recovery runs. Since a recovery checkpoint can skip log replay across machine version upgrades, the previously initialised aux state could be silently carried over and handed to a handle_aux/5 it was never created for.

aux_state is transient and is only ever set once, by ra_server:init/2,
before recovery checkpoint recovery runs. Since a recovery checkpoint
can skip log replay across machine version upgrades, the previously
initialised aux state could be silently carried over and handed to a
handle_aux/5 it was never created for.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a recovery-edge-case where aux_state (a transient, non-snapshotted value) could be silently carried across a recovery-checkpoint jump to a different effective machine module/version, potentially passing incompatible aux state into the machine’s aux handling.

Changes:

  • Re-initialise aux_state when recovering from a recovery checkpoint (even if the checkpoint’s machine version matches the current effective version).
  • Add new CT coverage ensuring aux_state is re-initialised both across machine-version changes and in same-version recovery-checkpoint recovery.

Reviewed changes

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

File Description
src/ra_server.erl Re-initialises aux_state during recovery-checkpoint recovery based on the effective machine module.
test/ra_server_SUITE.erl Adds tests asserting aux_state is re-initialised when using recovery checkpoints (upgrade + same-version cases).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ra_server.erl
@kjnilsson
kjnilsson marked this pull request as ready for review July 22, 2026 07:52
@mergify

mergify Bot commented Jul 22, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@kjnilsson
kjnilsson merged commit 843cd4b into main Jul 22, 2026
9 checks passed
@kjnilsson
kjnilsson deleted the aux-init-bug branch July 22, 2026 07:55
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.

2 participants