BewareMyPower opened a new pull request #10330: URL: https://github.com/apache/pulsar/pull/10330
### Motivation When I tested pulsar with `AppendIndexMetadataInterceptor` configured, i.e. ```properties brokerEntryMetadataInterceptors=org.apache.pulsar.common.intercept.AppendIndexMetadataInterceptor ``` I found the heap memory increased very fast so that GC happened frequently. After the analysis from the dump info, I found many messages, which have `BrokerEntryMetadata` in the head, are stored in heap memory instead of direct memory. When I removed the above configuration, the heap memory became slow to increase. ### Modifications - Copy two buffers into a single buffer instead of using `CompositeByteBuf`. It's hard to explain, however, the heap memory increasing problem was solved after that. - Remove the unused return value from `ManagedLedgerInterceptor#beforeAddEntry` interface. - And the reference count check to ensure that after the change, the input and output buffers of `addBrokerEntryMetadata` will be released finally after the output buffer is released. ### Verifying this change - [ ] Make sure that the change passes the CI checks. *(Please pick either of the following options)* This change is a trivial rework / code cleanup without any test coverage. -- 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. For queries about this service, please contact Infrastructure at: [email protected]
