Conversation
Preserve explicit allocator overrides and cover shared batch buffer release. Fix mock batch size splitting after an empty entry and cover the BookKeeper batch-read kill switch. Assisted-by: Codex
lhotari
commented
Sep 16, 2026
Comment on lines
+143
to
+145
| if (pooled != null) { | ||
| return "true".equalsIgnoreCase(pooled) ? AllocatorType.POOLED : AllocatorType.UNPOOLED; | ||
| } |
Owner
Author
There was a problem hiding this comment.
this should be only the default for the "default" allocator
Owner
Author
There was a problem hiding this comment.
Implemented. The built-in pooled fallback is now explicit for the default allocator; when no global or legacy type is configured, ml-cache continues to select adaptive. Explicit named, global, and legacy overrides retain their precedence. Targeted allocator tests and quickCheck pass.
Keep the pooled fallback explicit for the default allocator while using adaptive for ml-cache when no allocator type is configured. Assisted-by: Codex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Follow up on apache#25280 and apache#26597. Batch reads are now enabled by default, and their entries must be copied into cache-owned buffers even when
managedLedgerCacheCopyEntries=false: retaining one entry must not retain the entire BookKeeper response frame. This makes theml-cacheallocator relevant to the default storage-read path.Use Netty's adaptive allocator as the built-in default for these copies. The expected workload is many small entries with similar sizes. The rationale is reduced fragmentation waste under that assumption:
This is a workload-based default choice, not a measured performance claim. Size-class rounding, partially occupied chunks, and allocator caches still consume memory; adaptive does not guarantee lower RSS for every size distribution or eviction pattern. No benchmarks were run.
managedLedgerCacheCopyEntries=falseretains the incoming buffer; it does not imply unpooled allocation. The previous cache-copy allocator was pooled. This change preserves APIs, data formats, and explicit allocator settings, while deliberately changing allocation and memory-retention behavior when no allocator type is configured. Operators can retain the previous policy with-Dpulsar.allocator.ml-cache.type=pooled.Modifications
ml-cacheallocator toadaptive. General and other named allocators remainpooled. Preserve named overrides, global type fallback, and legacypulsar.allocator.pooledsettings.pulsar_env.sh.[0, 2048]with a 1024-byte limit is split into separate rounds.The merged batch-read change already corrected mandatory cache copying, unsupported-bookie fallback documentation, and ensemble/quorum configuration names. Its protocol guard now checks the actual BookKeeper client configuration; this follow-up retains that design.
Verifying this change
./gradlew quickCheck(license headers and main/test checkstyle).PulsarByteBufAllocatorTest,PulsarByteBufAllocatorTypeTest,ManagedLedgerBatchReadTest,RangeEntryCacheImplTest, andManagedLedgerTest.testBatchReadRequiresClientSupport, with retries disabled.Does this pull request potentially affect one of the following parts:
The built-in managed-ledger cache allocator changes from pooled to adaptive. Explicit allocator settings retain their precedence.