vyalamar opened a new pull request, #12154:
URL: https://github.com/apache/ozone/pull/12154

   ## What changes were proposed in this pull request?
   
   Introduce a snapshot-consistent, lock-free parallel table scan primitive 
(`Table#parallelScan`) in `hdds-framework` for full-table and prefix-scoped 
RocksDB scans:
   
   - **`ManagedSnapshot`** (`hdds-managed-rocksdb`): Takes one shared RocksDB 
snapshot per scan, holds the `RocksDatabase` reference count until all split 
iterators close, and registers with `ManagedRocksObjectUtils.track` for leak 
detection.
   - **`RDBTableSplitter`**: Partitions the scan `[start, end)` range up front 
from `LiveFileMetaData` using the level with the largest overlapping byte size 
(ties broken by deeper level), splitting on interior `smallestKey`s (falling 
back to `largestKey`s for overlapping L0 files) to produce balanced, 
SST-aligned ranges without empty or single-key gap splits.
   - **`RDBSplitIterator`**: Scans each disjoint `KeyRange` independently with 
native `iterate_lower_bound` / `iterate_upper_bound` (`ManagedReadOptions`), 
`fillCache=false`, `totalOrderSeek=true`, `IteratorType` (`KEY_ONLY`, 
`VALUE_ONLY`, `KEY_AND_VALUE`) support, and `iterator.status()` verification.
   - **`RDBParallelScanner`**: Executes splits on a bounded thread pool 
(`min(requested, splits, maxThreads)`), propagates failures with fail-fast 
abort, drains all split tasks before releasing the snapshot, and falls back to 
single-threaded execution on the calling thread when disabled or when only 1 
split exists.
   - **`ParallelScanConfig` & `ozone-default.xml`**: Controlled by 
`ozone.metadata.db.parallel.scan.enabled` (default `false`) and 
`ozone.metadata.db.parallel.scan.max.threads` (default `4`). 
`Table#parallelScan` provides a sequential default fallback for non-RocksDB 
implementations (e.g. `InMemoryTestTable`).
   
   > **Note:** This draft branch currently builds on top of the `HDDS-14242` 
(#10227) native prefix bounds commits (`ManagedReadOptions` bounds + `seek` 
clamping below prefix) and will be rebased cleanly once native bounds (#10227 / 
#12109) land.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-12779
   
   ## How was this patch tested?
   
   - Added unit tests in `TestRDBTableSplitter` and `TestRDBParallelScanner` 
covering:
     - Parallel vs. sequential equivalence across 1/2/4/8 threads, prefix 
scans, empty tables, and boundary endpoints.
     - Snapshot isolation under concurrent writes, flushes, and `compactRange`.
     - `IteratorType.KEY_ONLY` and `VALUE_ONLY` (verifying unused codecs are 
not invoked and `valueByteSize` is preserved).
     - Fail-fast abort on worker failure, prefix-extractor column families, and 
`InMemoryTestTable` default fallback.
     - Byte-weighted SST level selection and overlapping L0 fallback in 
`RDBTableSplitter`.
   - Verified `TestIOUtils`, `TestRDBStoreAbstractIterator`, 
`TestRDBStoreByteArrayIterator`, `TestRDBStoreCodecBufferIterator`, 
`TestRDBTableStore`, `TestRDBTableSplitter`, `TestRDBParallelScanner`, 
Checkstyle, and Apache RAT.
   
   ### Local Microbenchmark (1M keys, 24B keys, 512B compressible values, 
`DBProfile.SSD`, 10 SSTs)
   
   | Mode | Splits | Threads | Median | Throughput | Speedup |
   | :--- | :---: | :---: | :---: | :---: | :---: |
   | `TypedTable` Sequential (`iterator()`) | 1 | 1 | 609 ms | 1.64M keys/s | 
1.00x |
   | `TypedTable` `parallelScan(1)` | 1 | 1 | 569 ms | 1.76M keys/s | 1.07x |
   | `TypedTable` `parallelScan(2)` | 8 | 2 | 362 ms | 2.76M keys/s | 1.68x |
   | `TypedTable` `parallelScan(4)` | 10 | 4 | 200 ms | 5.00M keys/s | 3.05x |
   | `TypedTable` `parallelScan(8)` | 10 | 8 | 142 ms | 7.04M keys/s | 4.29x |
   | `KEY_ONLY` Sequential (`keyIterator()`) | 1 | 1 | 428 ms | 2.34M keys/s | 
1.00x |
   | `KEY_ONLY` `parallelScan(4)` | 10 | 4 | 149 ms | 6.71M keys/s | 2.87x |
   | `KEY_ONLY` `parallelScan(8)` | 10 | 8 | 107 ms | 9.35M keys/s | 4.00x |


-- 
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