codelipenghui commented on a change in pull request #8101:
URL: https://github.com/apache/pulsar/pull/8101#discussion_r492527221
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/NamespaceService.java
##########
@@ -400,6 +400,11 @@ public boolean registerNamespace(String namespace, boolean
ensureOwned) throws P
private void searchForCandidateBroker(NamespaceBundle bundle,
CompletableFuture<Optional<LookupResult>> lookupFuture,
LookupOptions options) {
+ if( null == pulsar.getLeaderElectionService() || !
pulsar.getLeaderElectionService().isElected()) {
+ LOG.warn("The leader election has not yet been completed!
NamespaceBundle[{}]", bundle);
+ lookupFuture.completeExceptionally(new IllegalStateException("The
leader election has not yet been completed!"));
Review comment:
Thanks for the great contribution, I think it's better to return a
retryable exception to the client? So that the client can reconnect later. Does
this make sense?
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/NamespaceService.java
##########
@@ -400,6 +400,11 @@ public boolean registerNamespace(String namespace, boolean
ensureOwned) throws P
private void searchForCandidateBroker(NamespaceBundle bundle,
CompletableFuture<Optional<LookupResult>> lookupFuture,
LookupOptions options) {
+ if( null == pulsar.getLeaderElectionService() || !
pulsar.getLeaderElectionService().isElected()) {
+ LOG.warn("The leader election has not yet been completed!
NamespaceBundle[{}]", bundle);
+ lookupFuture.completeExceptionally(new IllegalStateException("The
leader election has not yet been completed!"));
Review comment:
As discussed with @4onni, this will resultin a client lookup timeout,
and the client will relookup later, so it's not a problem here.
----------------------------------------------------------------
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]