Skip to content

Conversation

@marta-lokhova
Copy link
Contributor

@marta-lokhova marta-lokhova commented Jan 7, 2026

Small follow up to #5081 to better handle some edge cases

  • Move the exception about potentially corrupt checkpoints further down the recovery function to capture all possible recovery failures.
  • Handle cases where publishing was enabled mid-checkpoint: skip publishing of the incomplete file, start publishing on the next checkpoint.

Copilot AI review requested due to automatic review settings January 7, 2026 19:41
Copy link

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

This PR improves checkpoint publishing robustness by handling edge cases where publishing is enabled mid-checkpoint. The changes refactor how incomplete checkpoints are detected and skipped, and relocate the corruption check to after the truncation process completes.

Key changes:

  • Introduced mPublishWasDisabled flag to track when publishing was previously disabled and skip incomplete checkpoints
  • Moved checkpoint file corruption detection to after truncation completes, avoiding false positives
  • Changed corruption check from != to < to accommodate truncation scenarios
  • Enhanced error messages when checkpoint files are partially missing

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/history/CheckpointBuilder.h Added publishWasDisabled() getter method and changed ensureOpen() return type from bool to void
src/history/CheckpointBuilder.cpp Refactored file recovery logic in cleanup(), moved corruption check after truncation, updated appendTransactionSet() and appendLedgerHeader() to check publish status, and added validation for partial checkpoint file existence
src/history/HistoryManagerImpl.cpp Added check to skip queueing incomplete checkpoints when publishing was previously disabled

Copy link

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 3 out of 3 changed files in this pull request and generated 2 comments.

@marta-lokhova marta-lokhova force-pushed the publishHardeningJan2026 branch 3 times, most recently from 15acb83 to 7f2f4ff Compare January 7, 2026 23:00
@graydon
Copy link
Contributor

graydon commented Jan 8, 2026

I'm happy to see this getting more edge cases filed off, but I find it a little hard to follow I think mainly because of .. naming? Like it's a bit double-negative heavy: we have a flag tracking if the publication is disabled and then it's set to false once we start filling in a file. I think it might read better if we changed the variable to tracking whether we are currently open-and-appending, and then we return early if we're not at a checkpoint boundary and that's false. WDYT?

@marta-lokhova marta-lokhova force-pushed the publishHardeningJan2026 branch from 7f2f4ff to da637c3 Compare January 8, 2026 17:29
@marta-lokhova marta-lokhova force-pushed the publishHardeningJan2026 branch from da637c3 to dcfbcd2 Compare January 8, 2026 17:30
@marta-lokhova marta-lokhova added this pull request to the merge queue Jan 8, 2026
Merged via the queue into stellar:master with commit 2c70b12 Jan 8, 2026
43 checks passed
@marta-lokhova marta-lokhova deleted the publishHardeningJan2026 branch January 8, 2026 19: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.

2 participants