Repository navigation
Conversation
126 adds workflow_status.suspend_key, the topic a SUSPENDED recv waits on. 127 indexes SUSPENDED rows by delay_until_epoch_ms. 128 adds idx_workflow_status_deadline_v2, whose predicate also covers SUSPENDED, and 129 drops the v1 deadline index it supersedes. 130 makes send_message wake a SUSPENDED destination waiting on the message's topic. Migration 130 drops send_message before creating it. Java's migration 14 named the fourth parameter idempotency_key while every other SDK names it message_id, and CREATE OR REPLACE cannot rename an input parameter. Dropping first lets 130 run on a system database created by any SDK and leaves the parameter named message_id everywhere. The DROP, CREATE and search_path ALTER run in one transaction. The required schema version rises to 130.
kraftp
approved these changes
Nov 14, 2026
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Dropping and recreating the shared send_message function affects ownership, grants, and dependencies, requiring human validation of production privileges and the Java-first cross-SDK upgrade path.
No open issues 🎉
What changed in this PR
Adds shared system database migrations 126–130 to prepare Java’s database schema for suspend mode, aligning migration indexes with the other SDKs.
Changes:
- Adds
suspend_keyand suspended-workflow indexes, replacing the previous deadline index. - Recreates
send_messageto wake matching suspended receivers and standardize its fourth parameter asmessage_id. - Extends migration tests for upgrades, fresh databases, repeat execution, and message wake-up behavior.
| File | Description |
|---|---|
transact/src/test/java/dev/dbos/transact/migrations/MigrationManagerTest.java |
Tests schema upgrades through 130 and suspended-receiver wake-up behavior. |
transact/src/main/java/dev/dbos/transact/migrations/MigrationManager.java |
Adds migrations 126–130, including online index changes and the updated messaging function. |
transact/src/main/java/dev/dbos/transact/database/dao/WorkflowDAO.java |
Updates a comment to name the replacement deadline index; no runtime change. |
Review effort: Balanced
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.
Adds system database migrations 126–130, the shared migrations Python 3.5.0 and TypeScript v5.5 added for suspend mode. They run at the same indexes as in every other SDK, and the DDL is Python's final form (after py#948). Java's required schema version rises to 130.
workflow_status.suspend_key TEXT, the topic a suspendedrecvwaits onidx_workflow_status_suspendedondelay_until_epoch_mswherestatus = 'SUSPENDED'(online)idx_workflow_status_deadline_v2onworkflow_deadline_epoch_ms, whose predicate also coversSUSPENDED(online)idx_workflow_status_deadline, superseded by 128 (online)send_messagewakes aSUSPENDEDdestination waiting on the message's topic127–129 run
CONCURRENTLYin autocommit on PostgreSQL and transactionally on CockroachDB, as 122–125 do. All five are additive, so 1.3 executors keep working on a migrated database.Migration 130 drops
send_messagebefore creating itJava's migration 14 named the function's fourth parameter
idempotency_key; every other SDK names itmessage_id. PostgreSQL cannot rename an input parameter withCREATE OR REPLACE("cannot change name of input parameter"), so Python's and TypeScript's form of 130 fails on a Java-created database. Java's 130 instead runs, in one transaction:DROP FUNCTION IF EXISTS send_message(TEXT, JSON, TEXT, TEXT),CREATE FUNCTIONwith Python's body and the parameter namedmessage_id, and (PostgreSQL only)ALTER FUNCTION ... SET search_path = pg_catalog, pg_temp. Every database Java migrates ends up withmessage_id, whichever SDK created it.Tests
MigrationManagerTest:idempotency_key, andmessage_idrecreated the Python way); checks the column, both new indexes, the v1 deadline index gone, the fourth parametermessage_id, andsearch_pathon PostgreSQL; re-running the DDL and the runner is harmless.send_messagewakes aSUSPENDEDrow with a matchingsuspend_key(including the null topic) and leaves a different key, aPENDINGrow, an unaddressed row and a null key alone; a send to a missing workflow still fails.Ran on PostgreSQL (
MigrationManagerTest,PgSqlClientTest,WorkflowTimeoutSweepTest) and the new tests once on CockroachDB.Release notes
DROP FUNCTION "<schema>".send_message(text, json, text, text);and relaunch.send_message, so it is then owned by the role that ran the migration; re-grant anyEXECUTEyou restricted to specific roles.send_messagewith the named argumentidempotency_key => ...must usemessage_id. Positional calls are unaffected.DROPhas noCASCADE: an object PostgreSQL records as depending onsend_message(such as aBEGIN ATOMICSQL function) blocks the migration until it is dropped.🤖 Generated with Claude Code