Use pandasSQL transactions in sql test suite to avoid engine deadlocks #55129
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.
When trying to integrate the engine fixtures into these tests I have been running into a lot of deadlocking issues. From some research it looks like SQLAlchemy strongly discourages running doing Connectionless Execution
Note the comment:
We probably need an overhaul of the sql module to more natively account for this, but I think it makes sense to unlock our test suite first so that getting better coverage via fixtures in #55074 would help us more confidently refactor
Here's an MRE to reproduce this deadlock locally:
If you wrap the read_query call in a transaction there is no deadlock
(tip: if you ran the above locally you will probably want to kill the thread so it doesn't lock up your database. run
show engine innodb status;
inside the db, look for the hanging thread id and runKILL <thread_id>
)