[to dev/1.3] Optimize memtable scan#16643
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev/1.3 #16643 +/- ##
===========================================
Coverage 40.98% 40.99%
Complexity 198 198
===========================================
Files 3581 3585 +4
Lines 234341 234715 +374
Branches 28211 28300 +89
===========================================
+ Hits 96050 96225 +175
- Misses 138291 138490 +199 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes memtable scan performance by implementing several efficiency improvements: early exits based on time range filters, push-down of offset/limit operations, binary search for timestamp navigation, and lazy bitmap construction to reduce memory overhead.
Key changes:
- Implements binary search methods in TVList to efficiently skip timestamps outside query ranges
- Pushes down offset and limit operations to the nextBatch method for non-aligned series
- Introduces LazyBitMap to avoid constructing large bitmaps unnecessarily for aligned series
- Adds early exit logic in unpackOneFakeMemChunkMetaData when timestamps exceed filter ranges
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pom.xml | Updates tsfile dependency version to include optimization changes |
| NonAlignedTVListIteratorTest.java | Adds test coverage for time range skipping functionality |
| AlignedTVListIteratorTest.java | Adds test coverage for time range skipping in aligned series |
| TVList.java | Implements binary search methods and offset/limit push-down in nextBatch |
| OrderedMultiTVListIterator.java | Adds skipToCurrentTimeRangeStartPosition method for multi-iterator handling |
| OrderedMultiAlignedTVListIterator.java | Adds skipToCurrentTimeRangeStartPosition for aligned multi-iterators |
| MergeSortMultiTVListIterator.java | Implements time range skipping for merge-sort iterators |
| MergeSortMultiAlignedTVListIterator.java | Implements time range skipping for aligned merge-sort iterators |
| MemPointIterator.java | Adds abstract method for time range start position skipping |
| LazyBitMap.java | New class implementing lazy bitmap construction to reduce memory usage |
| AlignedTVList.java | Replaces BitMap with LazyBitMap and refactors rebuild logic with filter/pagination |
| NoDataPointReader.java | New singleton class for representing empty point readers |
| SeriesScanUtil.java | Adds early exit optimization and satisfied time range tracking |
| FragmentInstanceContext.java | Adds cached global time filter time ranges accessor |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.



Description
Optimize memtable scan #16576