Repository navigation
Rollback safe system table additions - #6004
Merged
Merged
Conversation
joshua-spacetime
approved these changes
Oct 6, 2026
Co-authored-by: Jeffrey Dallatezza <jeffreydallatezza@gmail.com>
joshua-spacetime
force-pushed
the
jsdt/safe-system-table-additions
branch
from
October 8, 2026 17:22
ac0efba to
1ff854b
Compare
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
TLDR: Write system table schema info to the commit log immediately for new databases.
Currently if we add new system tables, there is a specific case where trying to open a database with a previous version of spacetimedb can fail: if we create a new database with the added system table (and write something to that system table), we won't be able to replay the history for that database without a snapshot. In practice, this is an unlikely error case, since we always try to write a snapshot for a new database. Databases with a snapshot don't have a problem (because the new system table schema info is in the snapshot), and existing databases don't have a problem (because we create the new system tables in a transaction).
With this change, when we open a new database, we write all of the system table schema information to the commit log as the first transaction, so older versions will still be able to parse rows for those tables.
This also makes system-sequence initialization during migration match bootstrap initialization, and shifts the automatic snapshot trigger by one transaction to account for the new first transaction.
Expected complexity level and risk
Anything with system tables carries higher risk, but this has pretty good test coverage.
Testing
This updates some existing tests to make sure that the schema information is written to the commit log, and it adds a few additional tests in relational_db. The most important one is probably replay_from_commitlog_preserves_unknown_future_system_table, which simulates a replay with an unknown system table.
Rollback safety impact
n/a