Ensure broker is fully boostrapped before load manager register itself#2935
Merged
sijie merged 3 commits intoapache:masterfrom Nov 20, 2018
Merged
Ensure broker is fully boostrapped before load manager register itself#2935sijie merged 3 commits intoapache:masterfrom
sijie merged 3 commits intoapache:masterfrom
Conversation
sijie
approved these changes
Nov 6, 2018
Contributor
Author
|
run integration tests |
2 similar comments
Contributor
Author
|
run integration tests |
Contributor
Author
|
run integration tests |
ivankelly
previously requested changes
Nov 6, 2018
Contributor
ivankelly
left a comment
There was a problem hiding this comment.
looks good. Minor comments.
Probably out of scope for this patch, but perhaps we should run a healthcheck before advertising?
Contributor
Author
|
run cpp tests |
Contributor
Author
|
run integration tests |
4 similar comments
Contributor
Author
|
run integration tests |
Contributor
Author
|
run integration tests |
Contributor
Author
|
run integration tests |
Member
|
run integration tests |
Member
|
@ivankelly can you review this, since @merlimat already addressed your comments? |
merlimat
added a commit
that referenced
this pull request
Dec 13, 2018
#2935) ### Motivation In some cases the broker can immediately gets assigned traffic before it's fully boostrapped. This happens because the load manager is registering the broker in ZK before some of the initialization steps are completed. This results in NPE, like : ``` Caused by: java.lang.NullPointerException at org.apache.pulsar.broker.service.persistent.PersistentTopic.hasSchema(PersistentTopic.java:1815) ~[org.apache.pulsar-pulsar-broker-2.2.0-streamlio-22.jar:2.2.0-streamlio-22] at org.apache.pulsar.broker.service.ServerCnx.lambda$25(ServerCnx.java:836) ~[org.apache.pulsar-pulsar-broker-2.2.0-streamlio-22.jar:2.2.0-streamlio-22] at java.util.concurrent.CompletableFuture.uniAccept(CompletableFuture.java:656) ~[?:1.8.0_181] ``` ### Modifications * Register the broker in ZK only after the full start sequence has been done. This will ensure other brokers will not discover this broker before it's ready. * Expose the "is ready" state in the VipStatus -- This will be used to make sure the load balancer will not direct any lookup request to the broker before it's ready.
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.
Motivation
In some cases the broker can immediately gets assigned traffic before it's fully boostrapped.
This happens because the load manager is registering the broker in ZK before some of the initialization steps are completed.
This results in NPE, like :
Modifications