Support mixed drivers in transactional work - #1365
Closed
bgentry wants to merge 1 commit into
Closed
Conversation
Worker contexts identify the client that is executing a job, but an application transaction may use a different database abstraction against the same database. Binding the context lookup to the transaction type prevents `JobCompleteTx` and the resumable step helpers from supporting that topology. Use the explicit driver type to unwrap each transaction while obtaining the pilot, schema, and clock from the worker client through a type-independent context view. This preserves the worker's completion semantics while allowing the transaction adapter to differ. Cover completion and resumable step persistence with transaction types that differ from the worker client's transaction type.
Contributor
Author
|
Closing this draft after further design review. Apologies, Codex got overeager and turned an incidental pre-Pilot behavior into proposed support for mixed transactional drivers. That doesn't fit River's client/driver/Pilot ownership model, and the pgx-backed listener approach in #1366 is the better solution to #1364. |
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.
Worker contexts currently bind transactional worker helpers to the worker
client's transaction type. Applications that execute jobs with one River
driver but use another driver for application transactions cannot complete a
job or persist a resumable step atomically through those transactions.
Use the explicit
TDriverparameter to adapt the supplied transaction whilecontinuing to take the pilot, schema, and clock from the worker client. This
keeps completion behavior associated with the worker that owns the job without
requiring the transaction and worker clients to expose the same Go transaction
type.
Apply the same separation to
JobCompleteTx,ResumableSetStepTx, andResumableSetStepCursorTx.River Pro compatibility is handled in
riverqueue/riverpro#360.
Fixes #1364.