-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async the method onManagedLedgerLastLedgerInitialize for ManagedLedgerInterceptor #10706
Conversation
if (ledgerEntry != null) { | ||
for (BrokerEntryMetadataInterceptor interceptor : brokerEntryMetadataInterceptors) { | ||
if (interceptor instanceof AppendIndexMetadataInterceptor) { | ||
BrokerEntryMetadata brokerEntryMetadata = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably just do the parsing once
.whenComplete((__, ex) -> { | ||
if (ex != null) { | ||
callback.initializeFailed(new ManagedLedgerInterceptException(ex)); | ||
} else { | ||
initializeBookKeeper(callback); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general it's preferable to do:
.whenComplete((__, ex) -> { | |
if (ex != null) { | |
callback.initializeFailed(new ManagedLedgerInterceptException(ex)); | |
} else { | |
initializeBookKeeper(callback); | |
} | |
}); | |
.thenRun(() -> initializeBookKeeper(callback)) | |
.exceptionally(ex -> { | |
callback.initializeFailed(new ManagedLedgerInterceptException(ex)); | |
return null; | |
}); |
The reason is that if there is any unexpected exception thrown when calling initializeBookKeeper()
, the exceptionally part will be invoked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good Job!
...ar-broker/src/main/java/org/apache/pulsar/broker/intercept/ManagedLedgerInterceptorImpl.java
Show resolved
Hide resolved
### Modification 1. upgrade pulsar dependency to include the following bug fix - apache/pulsar#10706 : fix load __consumer_offset topic timeout on bundle onLoad stage - apache/pulsar#10341 : fix create reader failed on bundle onLoad stage
…rInterceptor (apache#10706) * Async the method onManagedLedgerLastLedgerInitialize for ManagedLedgerInterceptor * Addressed comment.
…rInterceptor (apache#10706) * Async the method onManagedLedgerLastLedgerInitialize for ManagedLedgerInterceptor * Addressed comment.
Fixes #10703
Motivation
Async the method onManagedLedgerLastLedgerInitialize for ManagedLedgerInterceptor. The root cause for issue #10703 is the ManagedLedger Interceptor is making a block read call from within a thread used for async operations. The interceptor shouldn’t be making any blocking calls. Thanks for @merlimat's help.
Here is the detailed stacktrace:
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation