Repository navigation
Async the method onManagedLedgerLastLedgerInitialize for ManagedLedgerInterceptor - #10706
Merged
Merged
Conversation
codelipenghui
requested review from
315157973,
BewareMyPower,
congbobo184,
eolivelli,
gaoran10,
hangc0276,
merlimat,
sijie and
zymap
May 26, 2021 01:19
merlimat
reviewed
May 26, 2021
| if (ledgerEntry != null) { | ||
| for (BrokerEntryMetadataInterceptor interceptor : brokerEntryMetadataInterceptors) { | ||
| if (interceptor instanceof AppendIndexMetadataInterceptor) { | ||
| BrokerEntryMetadata brokerEntryMetadata = |
Contributor
There was a problem hiding this comment.
We can probably just do the parsing once
merlimat
reviewed
May 26, 2021
Comment on lines
+359
to
+365
| .whenComplete((__, ex) -> { | ||
| if (ex != null) { | ||
| callback.initializeFailed(new ManagedLedgerInterceptException(ex)); | ||
| } else { | ||
| initializeBookKeeper(callback); | ||
| } | ||
| }); |
Contributor
There was a problem hiding this comment.
In general it's preferable to do:
Suggested change
| .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.
BewareMyPower
approved these changes
May 26, 2021
315157973
approved these changes
May 26, 2021
merlimat
approved these changes
May 26, 2021
BewareMyPower
pushed a commit
to streamnative/kop
that referenced
this pull request
May 31, 2021
### 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
yangl
pushed a commit
to yangl/pulsar
that referenced
this pull request
Jun 23, 2021
…rInterceptor (apache#10706) * Async the method onManagedLedgerLastLedgerInitialize for ManagedLedgerInterceptor * Addressed comment.
bharanic-dev
pushed a commit
to bharanic-dev/pulsar
that referenced
this pull request
Mar 18, 2022
…rInterceptor (apache#10706) * Async the method onManagedLedgerLastLedgerInitialize for ManagedLedgerInterceptor * Addressed comment.
This was referenced Sep 8, 2026
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.
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
yeswas chosen, please highlight the changesDocumentation