Skip to content

Conversation

@kim
Copy link
Contributor

@kim kim commented May 14, 2025

Snapshots may be corrupted on disk or incomplete where the lock file is gone,
but the snapshot file was not written (it is written last after all objects).

This patch handles both cases by ignoring snapshots without a snapshot file when
listing the available snapshots, and trying older snapshots if the latest one
cannot be restored from (for any reason).

It also takes into account that the prefix of the local commitlog could have
been archived.

API and ABI breaking changes

No

Expected complexity level and risk

2

Testing

  • added

kim added 4 commits May 14, 2025 14:26
It is possible that a snapshot is incomplete, even though its lock file
was removed. When listing available snapshots, ignore those without a
metadata file.
Mirroring `max_committed_offset`.
Similar to `Iterator::size_hint`, `History` gains `tx_range_hint` that
returns both a lower and (optional) upper bound.
There is always a possibility that a snapshot is somehow invalid or
corrupted. When starting up a `RelationalDB`, don't fail immediately if
that is the case, but instead try older snapshots if the available
commitlog permits replaying.
@kim kim changed the title Handle snapshot restore more robustly] Handle snapshot restore more robustly May 14, 2025
Co-authored-by: Shubham Mishra <shubham@clockworklabs.io>
Signed-off-by: Kim Altintop <kim@eagain.io>
Signed-off-by: Shubham Mishra <shivam828787@gmail.com>
Copy link
Contributor

@Shubham8287 Shubham8287 left a comment

Choose a reason for hiding this comment

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

Thanks!

@kim kim enabled auto-merge May 15, 2025 14:15
@kim kim added this pull request to the merge queue May 15, 2025
Merged via the queue into master with commit 3d1a91c May 15, 2025
20 checks passed
@kim kim deleted the kim/snapshot/incomplete branch May 15, 2025 15: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.

3 participants