-
Notifications
You must be signed in to change notification settings - Fork 727
Let the scan see stable state of portions during the whole scan in Column Shards #26863
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
Let the scan see stable state of portions during the whole scan in Column Shards #26863
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 PR implements a mechanism to provide a stable view of portion states during the entire scan operation in Column Shards. The changes replace the previous EPortionCommitStatus
enum-based approach with a new TPortionStateAtScanStart
struct that captures portion state at scan initiation time, preventing anomalies caused by portions changing state during scan execution.
- Replaced
EPortionCommitStatus
enum withTPortionStateAtScanStart
struct containing committed, conflicting, and snapshot information - Updated logic in both simple and plain readers to use the new stable state mechanism
- Refactored conflict detection and duplicate filtering to work with the new state representation
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
ydb/core/tx/columnshard/engines/reader/simple_reader/iterator/source.cpp | Updated portion state checking and conflict detection logic |
ydb/core/tx/columnshard/engines/reader/simple_reader/iterator/context.cpp | Modified fetching plan logic and duplicate filtering to use new state |
ydb/core/tx/columnshard/engines/reader/simple_reader/iterator/collections/constructors.h | Changed SourceId type and reformatted constructor |
ydb/core/tx/columnshard/engines/reader/plain_reader/iterator/source.cpp | Updated portion state checking and conflict detection logic |
ydb/core/tx/columnshard/engines/reader/common_reader/iterator/context.h | Replaced enum with new struct and added state determination logic |
ydb/core/tx/columnshard/engines/reader/common_reader/iterator/context.cpp | Implemented comprehensive portion state determination logic |
ydb/core/tx/columnshard/engines/reader/common_reader/constructor/read_metadata.h | Added new method and removed old one |
ydb/core/tx/columnshard/engines/reader/common_reader/constructor/read_metadata.cpp | Updated initialization logic and removed old method |
ydb/core/tx/columnshard/engines/portions/written.h | Reorganized method placement in class |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
ydb/core/tx/columnshard/engines/reader/simple_reader/iterator/collections/constructors.h
Show resolved
Hide resolved
ydb/core/tx/columnshard/engines/reader/common_reader/constructor/read_metadata.cpp
Show resolved
Hide resolved
ydb/core/tx/columnshard/engines/reader/common_reader/iterator/context.cpp
Show resolved
Hide resolved
⚪
🟢
*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation |
⚪ ⚪ Ya make output | Test bloat | Test bloat
🟢
*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation |
private: | ||
TCompareKeyForScanSequence Start; | ||
YDB_READONLY(ui32, SourceId, 0); | ||
YDB_READONLY(ui64, SourceId, 0); |
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.
хм, а portion id получается ui64?
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.
Получается так. Прямо в этом классе есть метод ui64 DoGetEntityId()
который возвращает SourceId. Плюс конструктор выставляет это поле вот так SourceId(portion->GetPortionId())
, portion->GetPortionId() тоже возвращает ui64.
fixes #26726
Here we reuse the existing way of understanding if a portion is conflicting with the current tx, and build the stable meaningful state that the scan logic uses.
Also noticed that TSourceConstructor.SourceId field is ui32, but we pass there ui64 value (portionId). So I fixed that as well.