Skip to content
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

Invalidate session&tx on YDB errors #16

Merged
merged 1 commit into from
Dec 19, 2024
Merged

Conversation

vgvoleg
Copy link
Collaborator

@vgvoleg vgvoleg commented Dec 19, 2024

No description provided.

@vgvoleg vgvoleg force-pushed the invalidate_session_and_tx branch 5 times, most recently from 1cc6e58 to 983a2fa Compare December 19, 2024 10:30
@vgvoleg vgvoleg force-pushed the invalidate_session_and_tx branch from 983a2fa to 47fe1f4 Compare December 19, 2024 10:48
@vgvoleg vgvoleg merged commit 6c4908d into main Dec 19, 2024
2 checks passed
@vgvoleg vgvoleg deleted the invalidate_session_and_tx branch December 19, 2024 13:51
@@ -188,6 +224,7 @@ def _get_request_settings(self) -> ydb.BaseRequestSettings:
return settings

@handle_ydb_errors
@invalidate_cursor_on_ydb_error

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: This method doesn't use session, it uses pool. So if the error occur here, this decorator will delete session and transaction, but shouldn't. Example:

with connection.begin():
  connection.execute(DML)
  try:
    connection.execute(DDL) <--- exception occur and session invalidated
  except:
    pass
  connection.execute(DML) <--- fail, because session is lost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants