Add a fault-tolerant commitlog replay mode for use in debugging#3887
Merged
Add a fault-tolerant commitlog replay mode for use in debugging#3887
Conversation
When debugging broken commitlogs, we want to inspect the whole commitlog, including the part after the first error. This is in contrast with the way we want to replay in prod, where we'd rather get a hard error than an incorrect state. This commit adds a new flag to commitlog replay, `ErrorBehavior`. The `core` crate passes `ErrorBehavior::FailFast` when replaying commitlogs to reconstruct databases. Internal tooling (not in this repository) uses `ErrorBehavior::Warn` to print the entirety of a broken commitlog.
Contributor
|
1 task
kim
approved these changes
Dec 16, 2025
Centril
approved these changes
Dec 16, 2025
github-merge-queue bot
pushed a commit
that referenced
this pull request
Dec 17, 2025
# Description of Changes Based on #3887 . Review starting from commit 233b48c. We've encountered a commitlog which includes inserts into `st_table`, `st_column`, &c of the rows which describe `st_view`, `st_view_param`, &c. This caused replay to fail, as those rows were already inserted during bootstrapping, so we got set-semantic duplicate errors. With this commit, we ignore set-semantic duplicate errors when replaying a commitlog specifically for rows in system tables which describe system tables. We also have to do an additional fixup for sequences. This is described in-depth in comments added at the relevant locations. # API and ABI breaking changes N/a # Expected complexity level and risk 1 - I was careful not to swallow any errors which aren't obviously safe. # Testing - [x] Manually replayed commitlog which includes the above mentioned inserts, got error prior to this commit, no error with this commit.
aasoni
pushed a commit
that referenced
this pull request
Feb 5, 2026
Based on #3887 . Review starting from commit 233b48c. We've encountered a commitlog which includes inserts into `st_table`, `st_column`, &c of the rows which describe `st_view`, `st_view_param`, &c. This caused replay to fail, as those rows were already inserted during bootstrapping, so we got set-semantic duplicate errors. With this commit, we ignore set-semantic duplicate errors when replaying a commitlog specifically for rows in system tables which describe system tables. We also have to do an additional fixup for sequences. This is described in-depth in comments added at the relevant locations. N/a 1 - I was careful not to swallow any errors which aren't obviously safe. - [x] Manually replayed commitlog which includes the above mentioned inserts, got error prior to this commit, no error with this commit.
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.
Description of Changes
When debugging broken commitlogs, we want to inspect the whole commitlog, including the part after the first error.
This is in contrast with the way we want to replay in prod, where we'd rather get a hard error than an incorrect state.
This commit adds a new flag to commitlog replay,
ErrorBehavior. Thecorecrate passesErrorBehavior::FailFastwhen replaying commitlogs to reconstruct databases. Internal tooling (not in this repository) uses
ErrorBehavior::Warnto print the entirety of a broken commitlog.API and ABI breaking changes
Changes internal APIs only.
Expected complexity level and risk
1 - no change to behavior of SpacetimeDB.
Testing
None.