fix: pin connection for advisory lock lifecycle#1168
Open
thetutlage wants to merge 2 commits into22.xfrom
Open
fix: pin connection for advisory lock lifecycle#1168thetutlage wants to merge 2 commits into22.xfrom
thetutlage wants to merge 2 commits into22.xfrom
Conversation
Allow overwriting existing files during stub generation by passing --force to any make:* command. The make:model command forwards the flag to sub-commands (migration, controller, transformer, factory).
…ELEASE_LOCK Advisory locks (PG_TRY_ADVISORY_LOCK/PG_ADVISORY_UNLOCK in PostgreSQL, GET_LOCK/RELEASE_LOCK in MySQL) are session-scoped — they are bound to the specific database connection that acquired them. Previously, both acquire and release used rawQuery which picks a random connection from the pool each time, causing the release to fail when it lands on a different connection. When the pool has more than one connection, the migration runner now pins a dedicated connection and passes it through to the dialect's lock methods. With a single-connection pool, pinning is skipped since it would starve other queries and isn't needed (only one connection exists). Closes #1153
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
rawQuerypicks a random connection from the pool each time. This causesreleaseAdvisoryLockto fail withE_UNABLE_RELEASE_LOCKwhen it lands on a different connection thangetAdvisoryLock.getAdvisoryLockandreleaseAdvisoryLockaccept an optionalconnectionparameter to use a specific connection instead of acquiring one from the pool.Closes #1153
Test plan