-
Notifications
You must be signed in to change notification settings - Fork 173
feat(c/driver/postgresql): avoid commit/rollback when idle #2685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This avoids spamming the server-side log with "WARNING: there is no transaction in progress" messages. Fixes apache#2673.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.
Files not reviewed (2)
- c/driver/postgresql/connection.cc: Language not supported
- c/driver/postgresql/postgresql_test.cc: Language not supported
Comments suppressed due to low confidence (1)
python/adbc_driver_postgresql/tests/test_dbapi.py:454
- [nitpick] Consider renaming the local function 'status' to a more descriptive name like 'get_transaction_status' to improve clarity.
def status() -> str:
paleolimbot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
| adbc_validation::StreamReader reader; | ||
| ASSERT_THAT(AdbcStatementSetSqlQuery(&statement, "SELECT 1", &error), | ||
| IsOkStatus(&error)); | ||
| ASSERT_THAT(AdbcStatementExecuteQuery(&statement, &reader.stream.value, | ||
| &reader.rows_affected, &error), | ||
| IsOkStatus(&error)); | ||
| ASSERT_NO_FATAL_FAILURE(reader.GetSchema()); | ||
|
|
||
| ASSERT_EQ("active", ConnectionGetOption(&connection, txn_status, &error)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this repeat of the above block needed to capture the issue? (If so, maybe briefly explain why somewhere?)
| ASSERT_EQ("active", ConnectionGetOption(&connection, txn_status, &error)); | ||
|
|
||
| // Note that despite the status being "active", this commit still | ||
| // generates a warning on the server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // generates a warning on the server. | |
| // generates a warning on the server because no changes were made to the database during the transaction. |
(or the actual reason if I guessed wrong 🙂 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that's it, I just don't get why ROLLBACK doesn't trigger the same thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah...I figured it out. We need to explicitly start a new transaction after a ROLLBACK.
This avoids spamming the server-side log with "WARNING: there is no transaction in progress" messages. Also, fix ConnectionRollback not properly starting a new transaction afterwards. Fixes apache#2673.
This avoids spamming the server-side log with "WARNING: there is no transaction in progress" messages.
Also, fix ConnectionRollback not properly starting a new transaction afterwards.
Fixes #2673.