Repository navigation
Use INT4 for tx_step_outputs.step_id, so it is 4 bytes on CockroachDB too - #611
Merged
devhawk merged 1 commit intoOct 8, 2026
Conversation
This was referenced Oct 8, 2026
devhawk
approved these changes
Oct 8, 2026
Collaborator
|
Thanks @marc-merino! |
Contributor
Author
|
You're welcome, @devhawk :) I DM'd you on Discord about these PR's, would really appreciate it if you had a look. Cheers |
maxdml
pushed a commit
to dbos-inc/dbos-transact-golang
that referenced
this pull request
Oct 8, 2026
…on CockroachDB too (#499) <!-- BEGIN KNIT BUNDLE --> ## Knit Bundle [View bundle](https://svartal.com/app/bundles/7cae31dc-1e9d-47d8-aaec-6df2ed7e80d0) This PR is part of Knit bundle `use-int4-for-step-id-columns-on-cockroachdb`. See the other review objects in this bundle: - `py`: dbos-inc/dbos-transact-py#884 - `ts`: dbos-inc/dbos-transact-ts#1403 - `golang`: #499 (this PR) - `java`: dbos-inc/dbos-transact-java#611 Bundle id: `use-int4-for-step-id-columns-on-cockroachdb` Bundle title: Use INT4 for step-ID columns on CockroachDB <!-- END KNIT BUNDLE --> Closes #497 `notifications.consumed_by_function_id` was created as `INTEGER`, which is 4 bytes on Postgres but 8 bytes (`INT8`) on CockroachDB. Every other step-ID column is `INT4`, and since the system database is shared across SDKs, a reader that decodes the column as a 32-bit integer fails on CockroachDB. The Postgres migration 121 now creates it as `INT4`. That is a no-op on Postgres, and existing CockroachDB tables keep `INT8` because the statement uses `ADD COLUMN IF NOT EXISTS`. The same fix is proposed for the other DBOS SDKs. ## Testing - Ran the statement on CockroachDB: the column is now `INT4` (it was `INT8`). - The migration, recv and rewind tests pass on Postgres and on CockroachDB.
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.
Knit Bundle
View bundle
This PR is part of Knit bundle
use-int4-for-step-id-columns-on-cockroachdb.See the other review objects in this bundle:
py: Use INT4 for datasource_outputs.step_id, so it is 4 bytes on CockroachDB too dbos-transact-py#884ts: Use INT4 for transaction_completion.function_num, so it is 4 bytes on CockroachDB too dbos-transact-ts#1403golang: Use INT4 for notifications.consumed_by_function_id, so it is 4 bytes on CockroachDB too dbos-transact-golang#499java: Use INT4 for tx_step_outputs.step_id, so it is 4 bytes on CockroachDB too #611 (this PR)Bundle id:
use-int4-for-step-id-columns-on-cockroachdbBundle title: Use INT4 for step-ID columns on CockroachDB
Closes #609
tx_step_outputs.step_idwas created asINT, which is 4 bytes on Postgres but 8 bytes (INT8) on CockroachDB. Every other step-ID column isINT4, and since the system database is shared across SDKs, a reader that decodes the column as a 32-bit integer fails on CockroachDB.The
TxStepSchema.createTablenow creates it asINT4. That is a no-op on Postgres, and existing CockroachDB tables keepINT8because the statement usesCREATE TABLE IF NOT EXISTS.The same fix is proposed for the other DBOS SDKs.
Testing
INT4(it wasINT8).txsteptests pass.