shibd commented on code in PR #23204:
URL: https://github.com/apache/pulsar/pull/23204#discussion_r1904149209
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -777,19 +747,7 @@ public void asyncAddEntry(final byte[] data, int
numberOfMessages, int offset, i
@Override
public void asyncAddEntry(ByteBuf buffer, AddEntryCallback callback,
Object ctx) {
- if (log.isDebugEnabled()) {
- log.debug("[{}] asyncAddEntry size={} state={}", name,
buffer.readableBytes(), state);
- }
-
- // retain buffer in this thread
- buffer.retain();
-
- // Jump to specific thread to avoid contention from writers writing
from different threads
- executor.execute(() -> {
- OpAddEntry addOperation = OpAddEntry.createNoRetainBuffer(this,
buffer, callback, ctx,
- currentLedgerTimeoutTriggered);
- internalAsyncAddEntry(addOperation);
- });
+ asyncAddEntry(buffer, 1, callback, ctx);
Review Comment:
Can we use -1 to keep original behaviour?
If this is set to 1, then the content originally written via this interface
will go through the `broker metadata interceptor`.
For example, `commitTxn` or `abortTxn`, which will cause the index
maintained in `AppendIndexMetadataInterceptor` to increment `incorrectly`.
Maybe the implicit behavior of this method(`asyncAddEntry(ByteBuf buffer,
AddEntryCallback callback, Object ctx)`) is that calling this interface does
not tuch the `broker metadata interceptor`.
Then, modifying the append of a normal transaction message should call the
interface that passes in numberOfMessage.
--
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]