Repository navigation
Allow manual confirmation of topic reader partition sessions - #951
Merged
vgvoleg merged 3 commits intoDec 3, 2026
Merged
Conversation
Add EventHandler.on_partition_session_start with OnPartitionSessionStart.confirm(read_offset, commit_offset), similar to Confirm in the C++ SDK, and EventHandler.on_partition_session_stop notification. The default handler keeps confirming automatically with on_partition_get_start_offset. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #951 +/- ##
==========================================
+ Coverage 84.53% 84.66% +0.12%
==========================================
Files 102 102
Lines 14137 14200 +63
Branches 1489 1499 +10
==========================================
+ Hits 11951 12022 +71
+ Misses 1739 1731 -8
Partials 447 447
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
nshestakov
marked this pull request as ready for review
December 3, 2026 12:42
🌋 SLO Test Results🟡 6 workload(s) tested — 1 workload(s) exceeded warning thresholds
Threshold violations: async-query:
Generated by ydb-slo-action |
vgvoleg
approved these changes
Dec 3, 2026
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.
Pull request type
What is the current behavior?
The topic reader answers every
StartPartitionSessionRequestby itself. An application can only pass a start offset fromon_partition_get_start_offset, and the whole read loop waits while that hook runs. There is no way to setcommit_offset, to delay the confirmation, or to learn that a partition was stopped.The C++ SDK lets the application call
TStartPartitionSessionEvent::Confirm(readOffset, commitOffset)when it is ready. Clients migrating from the legacy PersQueue SDK rely on this to start reading from offsets stored in their own database.Issue Number: N/A
What is the new behavior?
EventHandler.on_partition_session_start(event)receivesOnPartitionSessionStartwithtopic,partition_id,committed_offset,read_offsetandend_offset. No data is read from the partition untilevent.confirm(read_offset=None, commit_offset=None)is called. The call may happen after the handler returns and from any thread.confirm()raisesValueError. A confirm for a partition session that was already stopped, or for a closed stream, is ignored.EventHandler.on_partition_session_stop(event)receivesOnPartitionSessionStopwithtopic,partition_id,committed_offsetandgraceful. It is a notification: the reader still answers the server itself.on_partition_session_startcallson_partition_get_start_offsetand confirms with its result, so existing handlers keep working.Other information
ydb/_topic_reader/topic_reader_asyncio_test.pycover the default confirm, the legacy start-offset hook, manual confirm, confirm from another thread, and confirm after stop.black,style,mypyand unit tests pass locally. Integration tests were not run.