bobhan1 opened a new pull request, #70890:
URL: https://github.com/apache/doris/pull/70890

   ### Background
   
   Compaction records source-to-destination row locations for delete-bitmap 
conversion and inverted-index merging. #70350 added compressed row-id storage 
with a 500 MiB selection threshold. CLucene index compaction still consumes a 
dense matrix, so its presence prevents compressed selection.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #70350 (compressed storage), #69313 (norms compatibility), 
apache/doris-thirdparty#438 (borrowed mapping API)
   PR Type: Performance
   
   Problem Summary:
   
   Large compactions with CLucene indexes retain dense row-id arrays even when 
compression is enabled. Upgrade CLucene to its merged lookup API and connect it 
to both RowIdConversion representations without expanding a segment. Most 
additions are tests. Eligible compactions now follow the existing compression 
threshold; configuration defaults and successful index results remain unchanged.
   
   ### Details
   
   - **Change map:** 131 production lines (102 for the borrowed adapter, 29 for 
selection/integration), 280 test lines, two CMake removals and a two-line 
gitlink change. The dependency moves `f2864e07f08` to `bb3b6ef0c32`: 
apache/doris-thirdparty#438 adds lookup support, apache/doris-thirdparty#421 
replaces TurboPFor, apache/doris-thirdparty#426 fixes macOS CI, and 
apache/doris-thirdparty#420's existing token-count fix is preserved. Its 
65-file diff is +1,819/-26,647 lines, dominated by removing the old codec.
   - **Why it was slow:** CLucene forces the eight-byte-per-source-row dense 
representation, then copies the entire matrix into IndexWriter. The compressed 
representation cannot reduce either allocation on this path.
   - **Optimization:** Borrow source views through a CLucene adapter, cache at 
most one decoded block per source and share a decode workspace. Reuse #70350's 
codec. Mapping failures propagate as CLuceneError instead of becoming deleted 
postings; dense callers also avoid the writer copy.
   - **Results:** Calculated mapping payload for one billion physical source 
rows, with decimal GB; excludes unrelated compaction allocations:
   
     | Representation | Before | After |
     |---|---|---|
     | Dense | 8.00 GB map + 8.00 GB writer copy | 8.00 GB map |
     | Eligible compressed | Forced dense: 16.00 GB | Encoded map + at most 32 
KiB decoded values per source + shared workspace |
   
     The encoded map includes its block metadata; its size depends on the data. 
These are storage calculations, not measured RSS. No new whole-compaction 
timing or compression-ratio benchmark is claimed.
   - **Applicability and cost:** `enable_compressed_rowid_conversion` remains 
enabled by default. Compression requires estimated dense memory to exceed 
`compressed_rowid_conversion_threshold_bytes` (500 MiB); debug dumps, cluster 
keys and sequence maps retain their exclusions. Each lookup adds virtual 
dispatch. Sparse postings and term rewinds can decode a 4096-row block 
repeatedly. SNII selection and budgets are unchanged.
   
   ### Testing
   
   Local Clang 20.1.8 ASAN, with the official merged dependency:
   
   ```sh
   bash run-be-ut.sh --run 
--filter='CluceneRowIdMappingTest.*:*TestRowIdConversion*:CompressedRowIdMapTest.*:IndexCompactionTest.*:IndexCompactionWriteIndexTest.*:SniiRowIdConversionTest.*'
 -j100
   ```
   
   78/78 tests passed across seven suites; none skipped.
   
   Coverage includes source/block rewinds, non-contiguous physical segment IDs, 
missing/invalid rows, lookup errors, legacy dense callers, and 
postings/positions/norms/token/null equivalence. Duplicate Key and MoW 
compaction cases assert COMPRESSED mode and compare with raw index rebuilds. 
The #69313 fallback regression remains intact.
   
   Independent CLucene ASAN/LSAN tests passed 31/31, including PFOR 
golden-data/legacy-file compatibility. The merged dependency has exactly the 
tested source tree. No live-cluster or Release performance run was added.
   
   ### Notes for Reviewers
   
   The old and upstream apache/doris-thirdparty#420 implementations and 
regression tests match despite their different commit history. Two obsolete 
`ic` references are removed because apache/doris-thirdparty#421 removed that 
build target. The test helper now follows production mapping 
selection/finalization.
   
   ### Release note
   
   Eligible compactions with CLucene indexes can use the configured compressed 
row-id mapping instead of always allocating a dense map.
   
   ### Check List (For Author)
   
   - Behavior changed: No
   - Does this need documentation: No
   - Pre-submission status: Ready
   
   ### AI Disclosure
   
   - Tool: OpenAI Codex (GPT-6)
   - Generated: implementation, tests and description
   - Human review: not stated
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to