[Messenger] Don't lock tables or start transactions #40376
Merged
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.
I was so sure my PR #40336 fixed the doctrine-messenger issue once and for all. But it had a very silent bug..
This has been tricky to debug and find because the
PDO
behaves differently in PHP 7.4 compared to PHP 8.PostgreSqlConnection::getTriggerSql()
messenger:setup-transports
setup()
doctrine:schema:create
getExtraSetupSqlForTable()
doctrine:migration:diff
getExtraSetupSqlForTable()
PR #40055 fixed scenario C on PHP 8, but that also broke scenario B on PHP 7.4 and PHP 8.
In PR #40336 I was wrong claiming:
The result was the we removed all the errors messages from the 3 scenarios. But scenario B will produce some SQL that is actually never committed. IE it will silently fail.
I've been trying to figure out a good solution to how or when to start a transaction. I tried out @fbourigault suggestion but that would be the same fix as #40055.
We need a transaction because the SQL includes a
LOCK TABLE
, however, I cannot see a strict need for it. This PR removesLOCK TABLE
and all transaction juggling. It all seams to work.I would be happy to get thorough feedback on this PR so we can end the chapter of constantly adding bugs to this part of the component.
@dunglas, you added
LOCK TABLE
in your initial version of this class in #35485, could you share some knowledge if this is a good or bad idea?