More logging when cannot use transaction#2
Draft
jlrobins wants to merge 6 commits intov0.25.0-crdbfrom
Draft
Conversation
added 3 commits
July 28, 2022 13:31
…n the history of the connection use when we die of 'cannot use Connection.transaction() in a manually started transaction'
…n the history of the connection use when we die of 'cannot use Connection.transaction() in a manually started transaction'
…thub.com/noteable-io/asyncpg-crdb-noteable into more_logging_when_cannot_use_transaction
jlrobins
commented
Jul 28, 2022
asyncpg/prepared_stmt.py
Outdated
|
|
||
| async def __do_execute(self, executor): | ||
| protocol = self._connection._protocol | ||
| self._connection._recent_statements.append(self._query) |
Author
There was a problem hiding this comment.
Remeber statements being executed by PreparedStatement objects.
jlrobins
commented
Jul 28, 2022
|
|
||
| if con._top_xact is None: | ||
| if con._protocol.is_in_transaction(): | ||
| logger.error( |
Author
There was a problem hiding this comment.
Make structlog logging.error call with the connection's id and recent statements list before raising the transaction state-confused error.
jlrobins
commented
Jul 28, 2022
| else: | ||
| self._source_traceback = None | ||
|
|
||
| # circular buffer of most recent executed statements to assist in |
Author
There was a problem hiding this comment.
New circular buffer of recent statements here in a connection.
jlrobins
commented
Jul 28, 2022
| Added the *record_class* parameter. | ||
| """ | ||
| self._check_open() | ||
|
|
Author
There was a problem hiding this comment.
Record statements leading into a cursor factory. Unclear if sqla ends up using these.
jlrobins
commented
Jul 28, 2022
asyncpg/connection.py
Outdated
| """ | ||
| self._check_open() | ||
|
|
||
| # Append to circular buffer of most recent executed statements |
Author
There was a problem hiding this comment.
SQLA arg-free statements like BEGIN, COMMIT, etc. end up commit through execute() here and not through prepared statements.
added 3 commits
August 1, 2022 15:16
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.
This PR / branch isn't really for PRing, but rather to just show the diff between more_logging_when_cannot_use_transaction and v0.25.0-crdb. Unfortuately that diff is highly polluted by 'auto-black-on-save' in my editor, but the real payload here is:
This is not for merge, only for us to read.