merlimat opened a new pull request, #25987:
URL: https://github.com/apache/pulsar/pull/25987

   ### Motivation
   
   `RangeCacheEntryWrapper.recycle()` resets all wrapper fields except 
`messageMetadataInitialized`. Once a wrapper has served a cache hit (which sets 
the flag in `getValueInternal`), every entry later stored in that recycled 
wrapper instance inherits `messageMetadataInitialized=true`, so 
`getValueInternal()` skips the lazy 
`EntryImpl.initializeMessageMetadataIfNeeded()` call.
   
   After recycler warm-up, cache hits return entries whose message metadata was 
never parsed, and each dispatcher falls back to 
`Commands.peekAndCopyMessageMetadata` — a full metadata parse plus a 
`MessageMetadata` copy per entry per subscription. This silently defeats the 
parse-once-per-cached-entry optimization, with the cost multiplied by 
subscription fan-out.
   
   ### Modifications
   
   Reset `messageMetadataInitialized` in `recycle()`, matching the reset of the 
other wrapper fields. `recycle()` is the wrapper's only return-to-pool path, so 
this fully restores the intended lazy-init behavior.


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