Repository navigation
feat(storage): add RunInSerializableTransaction for component catalog writes - #1416
Merged
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for serializable transaction isolation in PostgreSQL to protect multi-row invariants in the component catalog, aligning its behavior with Spanner. It also refactors component snapshot decoding and payload unmarshaling into a shared internal/storage/data package. The review feedback focuses on improving robustness by adding defensive nil checks to prevent potential runtime panics in IsSerializableTransaction, DecodeComponentPayloads, FinalizeComponentRecord, and the transaction runner's clock function.
andrzejfudro
added a commit
that referenced
this pull request
Oct 29, 2026
…e contract Document RunInTransactionWithCommitTime, ComponentRepository.WithReadOnlySnapshot, and MockStorage.CommitTime in internal/storage/README.md, clarify the storage.Storage requirements on NewSpannerStore, and align the PostgreSQL RunInTransactionWithCommitTime stub comment with #1416. TAG=agy CONV=5d43b8db-2f9c-4908-a311-376a2b7dfdf0
andrzejfudro
force-pushed
the
feat/cms-storage-serializable-tx
branch
from
October 29, 2026 15:49
0f1336f to
2f8165a
Compare
Base automatically changed from
test/cms-dbstore-backend-neutral-tests
to
main
October 30, 2026 06:44
andrzejfudro
force-pushed
the
feat/cms-storage-serializable-tx
branch
from
October 30, 2026 06:44
5823a27 to
c8516ca
Compare
Replace TransactionRunner.RunInTransactionWithCommitTime with RunInSerializableTransaction so multi-row component catalog invariants run at SERIALIZABLE isolation while default RunInTransaction stays at READ COMMITTED on PostgreSQL. Add pgdb.RunInSerializableTx, implement postgres.Storage.RunInSerializableTransaction returning SELECT now() in UTC, and route dbstore.Store writes through RunInSerializableTransaction. TAG=agy CONV=5d43b8db-2f9c-4908-a311-376a2b7dfdf0
andrzejfudro
force-pushed
the
feat/cms-storage-serializable-tx
branch
from
October 30, 2026 09:14
39b662d to
f434063
Compare
andrzejfudro
marked this pull request as ready for review
October 30, 2026 09:15
janzak-dev
approved these changes
Oct 30, 2026
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.
Summary
TransactionRunner.RunInTransactionWithCommitTimewithRunInSerializableTransaction, running multi-row invariant transactions atSERIALIZABLEisolation and returning the commit timestamp written to commit-time columns.pgdb.RunInSerializableTx(internal/storage/postgres/pgdb/tx.go) usingpgx.TxOptions{IsoLevel: pgx.Serializable}while keepingpgdb.RunInTxat defaultREAD COMMITTED, implementpostgres.Storage.RunInSerializableTransaction(internal/storage/postgres/storage.go) returning the transaction'sSELECT now()timestamp in UTC, and route alldbstore.Storewrites throughRunInSerializableTransaction.Assumptions
None — requirements were fully specified.
Testing
bazel test //internal/storage:storage_test //internal/storage/postgres:postgres_test //internal/storage/postgres/pgdb:pgdb_test //internal/storage/spanner:spanner_test //pkg/components/store/dbstore:dbstore_testTAG=agy
CONV=5d43b8db-2f9c-4908-a311-376a2b7dfdf0