Savonitar opened a new pull request, #30190:
URL: https://github.com/apache/flink/pull/30190

   ## What is the purpose of the change
   
   RocksDB MapState uses an exclusive upper bound to keep a scan from visiting 
deletion markers belonging to the next map. Creating a native slice for that 
bound on every `isEmpty()` call, `clear()`, and iterator cache refill adds 
overhead even when the scan reads few entries. This change reuses the slice 
across successive scans. 
[FLINK-41519](https://issues.apache.org/jira/browse/FLINK-41519)
   
   ## Brief change log
   
   - Lazily allocate one upper-bound slice per backend and write the prefix 
successor directly into its buffer.
   - Reuse the slice once its iterator closes. Overlapping scans and bounds 
larger than 256 bytes get a private slice.
   - Copy the current RocksDB read options for each bounded iterator so it 
observes the snapshot and skip limit in effect when it opens.
   
   ## Verifying this change
   
   - `./mvnw clean verify` passed on JDK 17 across all 169 modules.
   - Added regression tests for overlapping scans, changes to snapshots and 
skip limits, and closing the factory while an iterator still owns its bound.
   - In two paired local JMH runs on macOS arm64 against parent `faf3dae8ec3`, 
populated RocksDB `MapState.isEmpty()` allocated about 56 fewer bytes per call. 
Throughput improved 6.8–13.4% on populated maps, 9.4–16.2% on cleared maps, and 
3.5–4.9% for `mapEntries`. Changelog throughput varied across runs. Each 
comparison used one fork per revision. [Benchmark 
sources](https://github.com/apache/flink-benchmarks/tree/438ff45f087cdfa70c9fab7d4b4dd5cd0385ead1)
   
   ## Does this pull request potentially affect one of the following parts?
   
   - Runtime per-record code paths — Yes, RocksDB MapState scans.
   - Dependencies, public API, serializers, deployment or recovery, and the S3 
filesystem connector — No.
   
   ## Documentation
   
   This is an internal performance improvement. It introduces no new feature or 
configuration option.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [x] Yes
   
   Generated-by: Claude Code (Fable 5.2)


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

Reply via email to