-
Notifications
You must be signed in to change notification settings - Fork 68
Refactor session lifecycle #754
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
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.
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, andIQuerySessionStateinterface, moving session state directly intoBaseQuerySessionas simple attributes - Added session invalidation on
DeadlineExceederrors through a new error callback mechanism in response iterators - Changed
DeadlineExceedexception to inherit fromErrorinstead ofConnectionError
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): |
Copilot
AI
Jan 23, 2026
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.
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.
| class DeadlineExceed(Error): | |
| class DeadlineExceed(ConnectionError): |
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.
ну дружище, это бага была. люди таймауты ставили и уходили в цикл ретраев.
dc71bb6 to
2689c47
Compare
🌋 SLO Test ResultsStatus: 🔴 2 workloads tested • 2 workloads failed
Generated by ydb-slo-action |
2689c47 to
74fc728
Compare
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Other information