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

   ### Background
   
   Extended DESCRIBE discovers physically materialized Variant paths and types 
on sampled tablets. The BE builds the schema from the segment metadata of each 
visible rowset, including external column metadata in V3.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #70825 (earlier inline-summary approach)
   PR Type: Performance
   
   Problem Summary:
   
   Tablets with many small rowsets can have the same Variant layout in most of 
them. A compact rowset fingerprint lets extended DESCRIBE read one complete 
representative per layout. In a Cloud run of `DESC` on a tablet with 1,000 V3 
rowsets and two layouts, the reader skipped 998 rowsets and returned the same 
schema as baseline.
   
   ### Details
   
   - **Change map:** 450 production lines added and 82 removed, with 164 test 
lines added. Variant owns canonical fingerprints and representative selection. 
Shared writers carry the digest and bind it to final physical segment IDs. 
Cloud PB conversion carries one optional rowset field.
   - **Why it was slow:** Each rowset repeated segment opens, metadata decoding 
and schema merging even when its layout had already been observed.
   - **Optimization:** Hash a sorted projection of physical Variant columns and 
aggregate the distinct segment hashes. Validate physical coverage before 
grouping and skip a matching rowset only after a complete representative read. 
Missing or stale fingerprints use the legacy reader.
   - **Results:** RELEASE on dev-x with the same files per comparison, one 
tablet, 24 common paths and auto-compaction disabled. Each run restarted the BE 
and primed the RPC route with a separate table. The Cloud fixture used MemKV 
and MinIO with an empty BE file cache each run.
   
     | Case | Samples per binary | Baseline median | Candidate median |
     |---|---:|---:|---:|
     | Cloud V3, 1,000 rowsets, two layouts | 5 | 1429.622 ms | 29.212 ms |
     | Cloud V3, 128 distinct layouts | 5 | 171.655 ms | 170.860 ms |
     | Shared-nothing V3, 1,000 rowsets, two layouts | 3 | 217.281 ms | 20.317 
ms |
   
   - **Applicability and cost:** The optional field adds 138 serialized bytes 
to a version-1 rowset. Different segment-layout sets can produce different 
fingerprints even with the same union of paths.
   - **Behavior change:** Static review found that the extra bytes can cause a 
formerly valid Cloud rowset close to the 100,000-byte FoundationDB value limit 
to fail metadata submission. The BE-side size guard is still open.
   
   ### Testing
   
   - Passed 17 BE ASAN tests covering reordered fields and segments, physical 
segment ID coverage, stale and missing fingerprints, and Cloud PB round trips.
   - Passed `regression_test_variant_desc`, `test_variant_bool_path`, 
`test_compaction_nokey_variant` and `test_variant_external_meta_integration` on 
dev-x.
   - On dev-x Cloud, the candidate fetched rowsets from the same Meta Service 
after each restart and read two of the 1,000 data rowsets. Direct `get_rowset` 
readback confirmed 999+1 fingerprint groups and exactly one fingerprint on the 
three-rowset mixed-version tablet. The mixed tablet retained columns from both 
legacy and current writes.
   
   ### Release note
   
   Extended DESCRIBE can reuse identical Variant layouts within a tablet.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: No
   - Pre-submission status: Not ready: the near-limit FoundationDB rowset size 
risk identified in static review is open and has not been exercised against 
FoundationDB.
   
   ### AI Disclosure
   
   - Tool: Codex
   - Generated: Implementation, tests, benchmark harness, static review 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