Repository navigation
perf: share vector decodes across fused INCLUDE reads - #28442
Conversation
Allow one explicitly selected vector column to reuse the bounded scoped decoded-read registry within a multi-entry FileService request. Preserve the combined filter/vector/projection read and leave all sibling columns unmarked. Add a position-validated ObjectIO read helper, mark the requested column before physical-entry compaction, and opt in only the fused INCLUDE Top-K consumer. Preserve the existing single-column API and custom-factory behavior. Skip satisfied targets, restore the original converter on the current entry, and transfer its lease through existing success and error cleanup. Cover partial cache hits, helper entry replacement, sibling and cache-update failures, Close, synthetic relocation, and independent fused-reader results. Add a matched LZ4 benchmark with overlapping, single-reader, hot-cache, and unmarked controls.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review completed against exact head e72bdef6b6bce761f4f7b8bfd445009dc1a89db2 (base 9f87b6249889107c3c108c133a4c3c8f3bc273ee). No confirmed blocking regression found.
Reviewed all eight changed files and the surrounding ownership, conversion, cache, and TopN call paths. In particular:
- The fused loader selects the vector by its requested-column position. ObjectIO marks the corresponding normal physical entry before missing-column compaction; reconstruction copies the complete entry, retaining its decode ticket. Missing/special/scalar targets and custom constructors do not opt in. Ordinary readers retain their previous behavior.
- Sharing remains keyed by physical file/extent, decoded size, policy, and conversion descriptor, not sibling positions or query inputs. The standard constructor validates the stored representation; existing whole-column chunk reconstruction retains row/type checks. NULL handling and row selection remain in the per-call TopN consumer, whose query, distance heap, selections, and owned projections are not shared.
- The selected converter is restored on the final entry after helper reads. Its read guard covers sibling conversions and deferred cache updates; caller-held tickets cover the later borrowed TopN scope. Error cleanup, selector/materialization failures, memory-hit bypass, independent follower cancellation, timeout fallback, and Close retirement have consistent ownership. Registry locking does not enclose conversion or cache work, and the existing byte/generation/participant limits remain unchanged.
- The added tests exercise first/middle/last target placement across range/stream/individual reads, mixed cache hits, sibling failures, Close during a blocked sibling, synthetic-column relocation, and overlapping fused queries with different selections/bounds. The performance change is one bounded descriptor scan plus constant selected-entry state; storage read shape is unchanged. The microbenchmark demonstrates overlapping decoded-lifetime reuse, not an end-to-end SQL throughput guarantee.
Evidence: CI run 34261285041 reports success for this exact head, including UT, SCA, and BVT jobs. I downloaded its UT coverage artifact and checked coverage in the three changed production files, and inspected the pessimistic BVT log. The PR's focused race/repetition and benchmark results are author-provided evidence; I did not independently rerun those commands or the full test suites locally. Coverage counts and green CI are supporting evidence, not substitutes for the source-level checks above.
Review used the MatrixOne self-review and unhappy-path audit framework for ownership, termination, and bounded-resource closure. No source changes made.
Merge Queue Status
This pull request spent 8 minutes 6 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #28442 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to #24097; this does not close the umbrella performance issue. Follows #28434 and #28442. ## What this PR does / why we need it: Compute fused INCLUDE vector Top-K directly over persisted chunks instead of reconstructing and serializing a whole vector column. Keep filter, vector, and projection columns in one storage request on cache misses, then decode only vector chunks containing residual-filter survivors. Reuse decoded whole-column cache hits or a fully cached set of chunks before reading compressed input. Introduce scoped block-read ownership and single-entry conversion from supplied bytes so chunks use existing cache admission and bounded decode sharing without additional storage reads. Keep compressed sources out of decoded-column cache keys and release raw buffers and temporary chunk ownership deterministically. Share chunk validation and ranking with the single-column reader, preserving physical row coordinates, selection order, ties, thresholds, and reader-wide heap state. Retain legacy and unsupported-operation behavior, and reconstruct unsorted selections only from already-held sources. Projection decoding, storage encoding, parallelism, and buffer recycling are unchanged. ## Design and validation The design was approved before implementation and recorded in commit 43fd4ee. The design document is included in this implementation PR; no separate documentation PR is required. - Owning packages and block-reader consumer pass: `pkg/fileservice`, `pkg/objectio`, `pkg/objectio/ioutil`, and `pkg/vm/engine/tae/blockio`. - Owning FileService/ObjectIO packages pass under the race detector. Individually selected lifecycle, sharing, chunk-reader, and fused-consumer tests pass 100 race repetitions. - Tests cover sparse/dense/empty/unsorted selections, cache warming and partial hits, ordinary-reader interoperability, immutable encoded data, FileService decorators, malformed input, cancellation, Close, and selector/materialization cleanup. - The real fused consumer exercises both legacy data and chunked output from the production writer. Miniature persisted fixtures cover chunk boundaries without large datasets. - Existing IVF INCLUDE `pre_post_modes`, `mode_paths`, and `end_to_end` SQL cases pass twice in normal comparison mode, with teardown verified after each run. - Full repository SCA passes. ### Performance evidence Five alternating main/candidate samples of `BenchmarkFusedTopN` against main `f0c31cd4b8`, using the unchanged public fused loader, production-written 4096×768 vectors, Go 1.26.4 production SIMD mode, eight CPUs, and identical cache pressure and requests. Medians: | Workload | Main elapsed | PR elapsed | Main CPU | PR CPU | |---|---:|---:|---:|---:| | Dense, chunked miss | 5.702 ms | 0.700 ms | 11.189 ms | 0.738 ms | | Sparse, chunked miss | 5.334 ms | 0.249 ms | 10.738 ms | 0.280 ms | | Eight overlapping readers | 6.773 ms | 1.923 ms | 16.451 ms | 5.539 ms | | Legacy column | 0.690 ms | 0.684 ms | 0.730 ms | 0.718 ms | | Existing whole-column cache hit | 0.241 ms | 0.245 ms | 0.247 ms | 0.250 ms | | Cache warmed by each implementation | 0.241 ms | 0.249 ms | 0.243 ms | 0.253 ms | Cold storage reads and requested bytes are unchanged: one read/122,221 bytes for dense or sparse, eight reads/977,768 bytes for the overlapping cohort. Both warm paths perform zero storage reads. The largest decoded allocation falls from 16 MiB to 8 MiB. Dense Go allocation falls from approximately 65.2 MiB to 332 KiB per operation; total decoded backing allocation remains 16 MiB for dense reads and falls to 8 MiB for sparse reads. Warm-cache bookkeeping adds up to 3.4% elapsed time / 4.0% CPU in these samples, below the 5% control gate. These are fused-loader benchmarks, not SQL or Wiki-10M latency claims. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…8442) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#24097. This does not close the umbrella performance issue. ## What this PR does / why we need it: Extend scoped decoded-column sharing to the selected vector entry in fused INCLUDE reads. Overlapping readers of the same vector extent can reuse one immutable decoded result while filter, vector, and projected columns remain in the same I/O request. Add a position-validated ObjectIO opt-in and mark only the Top-K column before physical-entry compaction. Keep sibling columns, including other vector columns, unmarked. Preserve ordinary reads, custom constructors, the existing single-column option, and chunk-native Top-K behavior. Retain the existing registry limits and query-scoped ownership. Skip already-satisfied targets, restore the original converter on the final entry, and carry its sharing lease through entry replacement, synthetic-column expansion, and normal success/error cleanup. Filtering, ranking, thresholds, and projected results remain independent per query. ## Validation - All three owning packages pass in normal and race modes: `pkg/fileservice`, `pkg/objectio`, and `pkg/objectio/ioutil`. - Affected sharing/lifecycle tests pass 100 individually selected race repetitions, including Close during sibling conversion and independent fused consumers. - Regression coverage includes first/middle/last target positions, partial memory hits in both directions, multiple-marker bypass, custom constructors, synthetic relocation, range/stream/per-entry reads, converter restoration, sibling/cache-update failures, and selector/materialization cleanup. - Existing IVF INCLUDE `pre_post_modes`, `mode_paths`, and `end_to_end` SQL cases pass twice in normal comparison mode; database teardown is verified after each run. - Full repository SCA passes. ### Matched performance evidence Five alternating main/candidate samples of `BenchmarkSelectedDecode`, using identical three-entry requests and a 1 MiB LZ4 payload, Go 1.26.4 production SIMD mode, and eight CPUs. Overlap means eight live consumer scopes; this is a focused decode-sharing benchmark, not a SQL or Wiki-10M benchmark. | Eight overlapping reads | Main | This PR | |---|---:|---:| | Median CPU time | 4.210 ms | 0.415 ms | | Median elapsed time | 4.195 ms | 0.396 ms | | Vector conversions | 8 | 1 | | Decoded allocation | 8 MiB | 1 MiB | | Storage reads / bytes | 8 / 58,936 | 8 / 58,936 | Median CPU changes for controls: single-reader +0.68%, hot-cache +0.17%, unmarked approximately unchanged. Sharing adds a small Go bookkeeping cost: 449 to 496 allocations across eight requests. No buffer recycling, additional decoded cache, request splitting, new parallelism, or storage-format change is included. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#24097; this does not close the umbrella performance issue. Follows matrixorigin#28434 and matrixorigin#28442. ## What this PR does / why we need it: Compute fused INCLUDE vector Top-K directly over persisted chunks instead of reconstructing and serializing a whole vector column. Keep filter, vector, and projection columns in one storage request on cache misses, then decode only vector chunks containing residual-filter survivors. Reuse decoded whole-column cache hits or a fully cached set of chunks before reading compressed input. Introduce scoped block-read ownership and single-entry conversion from supplied bytes so chunks use existing cache admission and bounded decode sharing without additional storage reads. Keep compressed sources out of decoded-column cache keys and release raw buffers and temporary chunk ownership deterministically. Share chunk validation and ranking with the single-column reader, preserving physical row coordinates, selection order, ties, thresholds, and reader-wide heap state. Retain legacy and unsupported-operation behavior, and reconstruct unsorted selections only from already-held sources. Projection decoding, storage encoding, parallelism, and buffer recycling are unchanged. ## Design and validation The design was approved before implementation and recorded in commit 43fd4ee. The design document is included in this implementation PR; no separate documentation PR is required. - Owning packages and block-reader consumer pass: `pkg/fileservice`, `pkg/objectio`, `pkg/objectio/ioutil`, and `pkg/vm/engine/tae/blockio`. - Owning FileService/ObjectIO packages pass under the race detector. Individually selected lifecycle, sharing, chunk-reader, and fused-consumer tests pass 100 race repetitions. - Tests cover sparse/dense/empty/unsorted selections, cache warming and partial hits, ordinary-reader interoperability, immutable encoded data, FileService decorators, malformed input, cancellation, Close, and selector/materialization cleanup. - The real fused consumer exercises both legacy data and chunked output from the production writer. Miniature persisted fixtures cover chunk boundaries without large datasets. - Existing IVF INCLUDE `pre_post_modes`, `mode_paths`, and `end_to_end` SQL cases pass twice in normal comparison mode, with teardown verified after each run. - Full repository SCA passes. ### Performance evidence Five alternating main/candidate samples of `BenchmarkFusedTopN` against main `f0c31cd4b8`, using the unchanged public fused loader, production-written 4096×768 vectors, Go 1.26.4 production SIMD mode, eight CPUs, and identical cache pressure and requests. Medians: | Workload | Main elapsed | PR elapsed | Main CPU | PR CPU | |---|---:|---:|---:|---:| | Dense, chunked miss | 5.702 ms | 0.700 ms | 11.189 ms | 0.738 ms | | Sparse, chunked miss | 5.334 ms | 0.249 ms | 10.738 ms | 0.280 ms | | Eight overlapping readers | 6.773 ms | 1.923 ms | 16.451 ms | 5.539 ms | | Legacy column | 0.690 ms | 0.684 ms | 0.730 ms | 0.718 ms | | Existing whole-column cache hit | 0.241 ms | 0.245 ms | 0.247 ms | 0.250 ms | | Cache warmed by each implementation | 0.241 ms | 0.249 ms | 0.243 ms | 0.253 ms | Cold storage reads and requested bytes are unchanged: one read/122,221 bytes for dense or sparse, eight reads/977,768 bytes for the overlapping cohort. Both warm paths perform zero storage reads. The largest decoded allocation falls from 16 MiB to 8 MiB. Dense Go allocation falls from approximately 65.2 MiB to 332 KiB per operation; total decoded backing allocation remains 16 MiB for dense reads and falls to 8 MiB for sparse reads. Warm-cache bookkeeping adds up to 3.4% elapsed time / 4.0% CPU in these samples, below the 5% control gate. These are fused-loader benchmarks, not SQL or Wiki-10M latency claims. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…8442) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#24097. This does not close the umbrella performance issue. ## What this PR does / why we need it: Extend scoped decoded-column sharing to the selected vector entry in fused INCLUDE reads. Overlapping readers of the same vector extent can reuse one immutable decoded result while filter, vector, and projected columns remain in the same I/O request. Add a position-validated ObjectIO opt-in and mark only the Top-K column before physical-entry compaction. Keep sibling columns, including other vector columns, unmarked. Preserve ordinary reads, custom constructors, the existing single-column option, and chunk-native Top-K behavior. Retain the existing registry limits and query-scoped ownership. Skip already-satisfied targets, restore the original converter on the final entry, and carry its sharing lease through entry replacement, synthetic-column expansion, and normal success/error cleanup. Filtering, ranking, thresholds, and projected results remain independent per query. ## Validation - All three owning packages pass in normal and race modes: `pkg/fileservice`, `pkg/objectio`, and `pkg/objectio/ioutil`. - Affected sharing/lifecycle tests pass 100 individually selected race repetitions, including Close during sibling conversion and independent fused consumers. - Regression coverage includes first/middle/last target positions, partial memory hits in both directions, multiple-marker bypass, custom constructors, synthetic relocation, range/stream/per-entry reads, converter restoration, sibling/cache-update failures, and selector/materialization cleanup. - Existing IVF INCLUDE `pre_post_modes`, `mode_paths`, and `end_to_end` SQL cases pass twice in normal comparison mode; database teardown is verified after each run. - Full repository SCA passes. ### Matched performance evidence Five alternating main/candidate samples of `BenchmarkSelectedDecode`, using identical three-entry requests and a 1 MiB LZ4 payload, Go 1.26.4 production SIMD mode, and eight CPUs. Overlap means eight live consumer scopes; this is a focused decode-sharing benchmark, not a SQL or Wiki-10M benchmark. | Eight overlapping reads | Main | This PR | |---|---:|---:| | Median CPU time | 4.210 ms | 0.415 ms | | Median elapsed time | 4.195 ms | 0.396 ms | | Vector conversions | 8 | 1 | | Decoded allocation | 8 MiB | 1 MiB | | Storage reads / bytes | 8 / 58,936 | 8 / 58,936 | Median CPU changes for controls: single-reader +0.68%, hot-cache +0.17%, unmarked approximately unchanged. Sharing adds a small Go bookkeeping cost: 449 to 496 allocations across eight requests. No buffer recycling, additional decoded cache, request splitting, new parallelism, or storage-format change is included. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#24097; this does not close the umbrella performance issue. Follows matrixorigin#28434 and matrixorigin#28442. ## What this PR does / why we need it: Compute fused INCLUDE vector Top-K directly over persisted chunks instead of reconstructing and serializing a whole vector column. Keep filter, vector, and projection columns in one storage request on cache misses, then decode only vector chunks containing residual-filter survivors. Reuse decoded whole-column cache hits or a fully cached set of chunks before reading compressed input. Introduce scoped block-read ownership and single-entry conversion from supplied bytes so chunks use existing cache admission and bounded decode sharing without additional storage reads. Keep compressed sources out of decoded-column cache keys and release raw buffers and temporary chunk ownership deterministically. Share chunk validation and ranking with the single-column reader, preserving physical row coordinates, selection order, ties, thresholds, and reader-wide heap state. Retain legacy and unsupported-operation behavior, and reconstruct unsorted selections only from already-held sources. Projection decoding, storage encoding, parallelism, and buffer recycling are unchanged. ## Design and validation The design was approved before implementation and recorded in commit 43fd4ee. The design document is included in this implementation PR; no separate documentation PR is required. - Owning packages and block-reader consumer pass: `pkg/fileservice`, `pkg/objectio`, `pkg/objectio/ioutil`, and `pkg/vm/engine/tae/blockio`. - Owning FileService/ObjectIO packages pass under the race detector. Individually selected lifecycle, sharing, chunk-reader, and fused-consumer tests pass 100 race repetitions. - Tests cover sparse/dense/empty/unsorted selections, cache warming and partial hits, ordinary-reader interoperability, immutable encoded data, FileService decorators, malformed input, cancellation, Close, and selector/materialization cleanup. - The real fused consumer exercises both legacy data and chunked output from the production writer. Miniature persisted fixtures cover chunk boundaries without large datasets. - Existing IVF INCLUDE `pre_post_modes`, `mode_paths`, and `end_to_end` SQL cases pass twice in normal comparison mode, with teardown verified after each run. - Full repository SCA passes. ### Performance evidence Five alternating main/candidate samples of `BenchmarkFusedTopN` against main `f0c31cd4b8`, using the unchanged public fused loader, production-written 4096×768 vectors, Go 1.26.4 production SIMD mode, eight CPUs, and identical cache pressure and requests. Medians: | Workload | Main elapsed | PR elapsed | Main CPU | PR CPU | |---|---:|---:|---:|---:| | Dense, chunked miss | 5.702 ms | 0.700 ms | 11.189 ms | 0.738 ms | | Sparse, chunked miss | 5.334 ms | 0.249 ms | 10.738 ms | 0.280 ms | | Eight overlapping readers | 6.773 ms | 1.923 ms | 16.451 ms | 5.539 ms | | Legacy column | 0.690 ms | 0.684 ms | 0.730 ms | 0.718 ms | | Existing whole-column cache hit | 0.241 ms | 0.245 ms | 0.247 ms | 0.250 ms | | Cache warmed by each implementation | 0.241 ms | 0.249 ms | 0.243 ms | 0.253 ms | Cold storage reads and requested bytes are unchanged: one read/122,221 bytes for dense or sparse, eight reads/977,768 bytes for the overlapping cohort. Both warm paths perform zero storage reads. The largest decoded allocation falls from 16 MiB to 8 MiB. Dense Go allocation falls from approximately 65.2 MiB to 332 KiB per operation; total decoded backing allocation remains 16 MiB for dense reads and falls to 8 MiB for sparse reads. Warm-cache bookkeeping adds up to 3.4% elapsed time / 4.0% CPU in these samples, below the 5% control gate. These are fused-loader benchmarks, not SQL or Wiki-10M latency claims. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…8442) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#24097. This does not close the umbrella performance issue. ## What this PR does / why we need it: Extend scoped decoded-column sharing to the selected vector entry in fused INCLUDE reads. Overlapping readers of the same vector extent can reuse one immutable decoded result while filter, vector, and projected columns remain in the same I/O request. Add a position-validated ObjectIO opt-in and mark only the Top-K column before physical-entry compaction. Keep sibling columns, including other vector columns, unmarked. Preserve ordinary reads, custom constructors, the existing single-column option, and chunk-native Top-K behavior. Retain the existing registry limits and query-scoped ownership. Skip already-satisfied targets, restore the original converter on the final entry, and carry its sharing lease through entry replacement, synthetic-column expansion, and normal success/error cleanup. Filtering, ranking, thresholds, and projected results remain independent per query. ## Validation - All three owning packages pass in normal and race modes: `pkg/fileservice`, `pkg/objectio`, and `pkg/objectio/ioutil`. - Affected sharing/lifecycle tests pass 100 individually selected race repetitions, including Close during sibling conversion and independent fused consumers. - Regression coverage includes first/middle/last target positions, partial memory hits in both directions, multiple-marker bypass, custom constructors, synthetic relocation, range/stream/per-entry reads, converter restoration, sibling/cache-update failures, and selector/materialization cleanup. - Existing IVF INCLUDE `pre_post_modes`, `mode_paths`, and `end_to_end` SQL cases pass twice in normal comparison mode; database teardown is verified after each run. - Full repository SCA passes. ### Matched performance evidence Five alternating main/candidate samples of `BenchmarkSelectedDecode`, using identical three-entry requests and a 1 MiB LZ4 payload, Go 1.26.4 production SIMD mode, and eight CPUs. Overlap means eight live consumer scopes; this is a focused decode-sharing benchmark, not a SQL or Wiki-10M benchmark. | Eight overlapping reads | Main | This PR | |---|---:|---:| | Median CPU time | 4.210 ms | 0.415 ms | | Median elapsed time | 4.195 ms | 0.396 ms | | Vector conversions | 8 | 1 | | Decoded allocation | 8 MiB | 1 MiB | | Storage reads / bytes | 8 / 58,936 | 8 / 58,936 | Median CPU changes for controls: single-reader +0.68%, hot-cache +0.17%, unmarked approximately unchanged. Sharing adds a small Go bookkeeping cost: 449 to 496 allocations across eight requests. No buffer recycling, additional decoded cache, request splitting, new parallelism, or storage-format change is included. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
) ## What type of PR is this? - [ ] API-change - [ ] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#24097; this does not close the umbrella performance issue. Follows matrixorigin#28434 and matrixorigin#28442. ## What this PR does / why we need it: Compute fused INCLUDE vector Top-K directly over persisted chunks instead of reconstructing and serializing a whole vector column. Keep filter, vector, and projection columns in one storage request on cache misses, then decode only vector chunks containing residual-filter survivors. Reuse decoded whole-column cache hits or a fully cached set of chunks before reading compressed input. Introduce scoped block-read ownership and single-entry conversion from supplied bytes so chunks use existing cache admission and bounded decode sharing without additional storage reads. Keep compressed sources out of decoded-column cache keys and release raw buffers and temporary chunk ownership deterministically. Share chunk validation and ranking with the single-column reader, preserving physical row coordinates, selection order, ties, thresholds, and reader-wide heap state. Retain legacy and unsupported-operation behavior, and reconstruct unsorted selections only from already-held sources. Projection decoding, storage encoding, parallelism, and buffer recycling are unchanged. ## Design and validation The design was approved before implementation and recorded in commit 43fd4ee. The design document is included in this implementation PR; no separate documentation PR is required. - Owning packages and block-reader consumer pass: `pkg/fileservice`, `pkg/objectio`, `pkg/objectio/ioutil`, and `pkg/vm/engine/tae/blockio`. - Owning FileService/ObjectIO packages pass under the race detector. Individually selected lifecycle, sharing, chunk-reader, and fused-consumer tests pass 100 race repetitions. - Tests cover sparse/dense/empty/unsorted selections, cache warming and partial hits, ordinary-reader interoperability, immutable encoded data, FileService decorators, malformed input, cancellation, Close, and selector/materialization cleanup. - The real fused consumer exercises both legacy data and chunked output from the production writer. Miniature persisted fixtures cover chunk boundaries without large datasets. - Existing IVF INCLUDE `pre_post_modes`, `mode_paths`, and `end_to_end` SQL cases pass twice in normal comparison mode, with teardown verified after each run. - Full repository SCA passes. ### Performance evidence Five alternating main/candidate samples of `BenchmarkFusedTopN` against main `f0c31cd4b8`, using the unchanged public fused loader, production-written 4096×768 vectors, Go 1.26.4 production SIMD mode, eight CPUs, and identical cache pressure and requests. Medians: | Workload | Main elapsed | PR elapsed | Main CPU | PR CPU | |---|---:|---:|---:|---:| | Dense, chunked miss | 5.702 ms | 0.700 ms | 11.189 ms | 0.738 ms | | Sparse, chunked miss | 5.334 ms | 0.249 ms | 10.738 ms | 0.280 ms | | Eight overlapping readers | 6.773 ms | 1.923 ms | 16.451 ms | 5.539 ms | | Legacy column | 0.690 ms | 0.684 ms | 0.730 ms | 0.718 ms | | Existing whole-column cache hit | 0.241 ms | 0.245 ms | 0.247 ms | 0.250 ms | | Cache warmed by each implementation | 0.241 ms | 0.249 ms | 0.243 ms | 0.253 ms | Cold storage reads and requested bytes are unchanged: one read/122,221 bytes for dense or sparse, eight reads/977,768 bytes for the overlapping cohort. Both warm paths perform zero storage reads. The largest decoded allocation falls from 16 MiB to 8 MiB. Dense Go allocation falls from approximately 65.2 MiB to 332 KiB per operation; total decoded backing allocation remains 16 MiB for dense reads and falls to 8 MiB for sparse reads. Warm-cache bookkeeping adds up to 3.4% elapsed time / 4.0% CPU in these samples, below the 5% control gate. These are fused-loader benchmarks, not SQL or Wiki-10M latency claims. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Related to #24097. This does not close the umbrella performance issue.
What this PR does / why we need it:
Extend scoped decoded-column sharing to the selected vector entry in fused INCLUDE reads. Overlapping readers of the same vector extent can reuse one immutable decoded result while filter, vector, and projected columns remain in the same I/O request.
Add a position-validated ObjectIO opt-in and mark only the Top-K column before physical-entry compaction. Keep sibling columns, including other vector columns, unmarked. Preserve ordinary reads, custom constructors, the existing single-column option, and chunk-native Top-K behavior.
Retain the existing registry limits and query-scoped ownership. Skip already-satisfied targets, restore the original converter on the final entry, and carry its sharing lease through entry replacement, synthetic-column expansion, and normal success/error cleanup. Filtering, ranking, thresholds, and projected results remain independent per query.
Validation
pkg/fileservice,pkg/objectio, andpkg/objectio/ioutil.pre_post_modes,mode_paths, andend_to_endSQL cases pass twice in normal comparison mode; database teardown is verified after each run.Matched performance evidence
Five alternating main/candidate samples of
BenchmarkSelectedDecode, using identical three-entry requests and a 1 MiB LZ4 payload, Go 1.26.4 production SIMD mode, and eight CPUs. Overlap means eight live consumer scopes; this is a focused decode-sharing benchmark, not a SQL or Wiki-10M benchmark.Median CPU changes for controls: single-reader +0.68%, hot-cache +0.17%, unmarked approximately unchanged. Sharing adds a small Go bookkeeping cost: 449 to 496 allocations across eight requests. No buffer recycling, additional decoded cache, request splitting, new parallelism, or storage-format change is included.