Skip to content

Conversation

@vgvoleg
Copy link
Collaborator

@vgvoleg vgvoleg commented Jan 23, 2026

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Other information

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors the session lifecycle management in the YDB Query Service implementation, removing the complex state machine pattern in favor of simpler flag-based state tracking.

Changes:

  • Removed QuerySessionState, QuerySessionStateEnum, and IQuerySessionState interface, moving session state directly into BaseQuerySession as simple attributes
  • Added session invalidation on DeadlineExceed errors through a new error callback mechanism in response iterators
  • Changed DeadlineExceed exception to inherit from Error instead of ConnectionError

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
ydb/query/session.py Removed state machine classes, added _invalidate() method and error handling, simplified session lifecycle
ydb/query/transaction.py Updated to use session directly instead of session_state, added TYPE_CHECKING imports, updated error handlers
ydb/query/base.py Removed IQuerySessionState interface, added on_error callback to response iterators, updated handler signatures
ydb/query/pool.py Updated to use session.session_id and session.is_active instead of state object
ydb/issues.py Changed DeadlineExceed to inherit from Error instead of ConnectionError
ydb/aio/query/session.py Mirror of sync changes for async implementation
ydb/aio/query/transaction.py Mirror of sync changes for async implementation
ydb/aio/query/base.py Added async version of error handling in response iterator
ydb/aio/query/pool.py Updated to use session properties instead of state object
tests/query/test_query_session.py Updated tests to reflect new state management and behavior changes
tests/query/test_query_session_pool.py Updated tests to use session properties
tests/aio/query/test_query_session.py Updated async tests to reflect new state management
tests/aio/query/test_query_session_pool.py Updated async pool tests to use session properties

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



class DeadlineExceed(ConnectionError):
class DeadlineExceed(Error):
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

Changing DeadlineExceed from inheriting ConnectionError to Error is a breaking change. Code that catches ConnectionError specifically will no longer catch DeadlineExceed exceptions. Consider whether this change aligns with the PR's stated type as "Bugfix" - breaking changes typically warrant a feature or refactoring PR. If this is intentional, ensure all callers that catch ConnectionError are updated to handle DeadlineExceed appropriately, or document this as a breaking change.

Suggested change
class DeadlineExceed(Error):
class DeadlineExceed(ConnectionError):

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ну дружище, это бага была. люди таймауты ставили и уходили в цикл ретраев.

@vgvoleg vgvoleg force-pushed the fix_timeout_session_rotation branch from dc71bb6 to 2689c47 Compare January 23, 2026 17:16
@vgvoleg vgvoleg added the SLO label Jan 23, 2026
@github-actions
Copy link

github-actions bot commented Jan 23, 2026

🌋 SLO Test Results

Status: 🔴 2 workloads tested • 2 workloads failed

Workload Metrics Regressions Improvements Links
🔴 ydb-python-sync-table 8 2 0 ReportCheck
🔴 ydb-python-sync-query 8 2 0 ReportCheck

Generated by ydb-slo-action

@github-actions github-actions bot removed the SLO label Jan 23, 2026
@vgvoleg vgvoleg force-pushed the fix_timeout_session_rotation branch from 2689c47 to 74fc728 Compare January 23, 2026 17:52
@vgvoleg vgvoleg added the SLO label Jan 23, 2026
@github-actions github-actions bot removed the SLO label Jan 23, 2026
@vgvoleg vgvoleg merged commit 326bcf8 into main Jan 23, 2026
25 checks passed
@vgvoleg vgvoleg deleted the fix_timeout_session_rotation branch January 23, 2026 18:20
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