Check execution conditions during updates - #11714
Open
ali-khokhar-nvidia wants to merge 2 commits into
Open
Conversation
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.
Fixes #11711.
What changed?
SQL execution updates now use an optional SQL-plugin capability to include the expected prior record version or next event ID in the
UPDATEpredicate. A successful update on PostgreSQL, MySQL, or SQLite therefore acquires the row lock and validates the condition in one statement. When the conditional update affects zero rows, the existing lock/read path still resolves the precise condition error.The existing
HistoryExecution.UpdateExecutionscontract remains unchanged. SQL plugins that do not implement the optional conditional updater continue to use the existing lock/check followed by update path.Why?
Successful workflow mutations currently execute
SELECT ... FOR UPDATEand then an unconditionalUPDATEof the same execution row. Folding the existing condition into the update removes one persistence statement from every successful mutation on plugins that support it, without weakening optimistic concurrency or changing conflict details.How did you test it?
The added SQL-plugin cases cover both legacy next-event-ID conditions and record-version conditions, including mismatches that leave the stored row unchanged. A downstream compatibility probe also verifies that an implementation of the existing
HistoryExecution.UpdateExecutionssignature still satisfies the interface.Potential risks
The optimized built-in path no longer performs the preliminary lock query. Its conditional update holds the same row lock through the transaction, while conflicts retain the existing typed condition errors through the fallback read. Plugins without the optional capability preserve the previous lock-then-update behavior.