codelipenghui commented on code in PR #21096:
URL: https://github.com/apache/pulsar/pull/21096#discussion_r1314414613


##########
pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/IsolatedBookieEnsemblePlacementPolicy.java:
##########
@@ -179,25 +185,34 @@ private static Pair<Set<String>, Set<String>> 
getIsolationGroup(
         return pair;
     }
 
-    private Set<BookieId> getExcludedBookiesWithIsolationGroups(int 
ensembleSize,
+    @VisibleForTesting
+    Set<BookieId> getExcludedBookiesWithIsolationGroups(int ensembleSize,
         Pair<Set<String>, Set<String>> isolationGroups) {
         Set<BookieId> excludedBookies = new HashSet<>();
-        if (isolationGroups != null && 
isolationGroups.getLeft().contains(PULSAR_SYSTEM_TOPIC_ISOLATION_GROUP))  {
+        if (isolationGroups != null && 
isolationGroups.getLeft().contains(PULSAR_SYSTEM_TOPIC_ISOLATION_GROUP)) {
             return excludedBookies;
         }
         try {
             if (bookieMappingCache != null) {
                 CompletableFuture<Optional<BookiesRackConfiguration>> future =
                         
bookieMappingCache.get(BookieRackAffinityMapping.BOOKIE_INFO_ROOT_PATH);
 
+                BookiesRackConfiguration allGroupsBookieMapping;
                 Optional<BookiesRackConfiguration> optRes = (future.isDone() 
&& !future.isCompletedExceptionally())
                         ? future.join() : Optional.empty();
 
-                if (optRes.isEmpty()) {
-                    return excludedBookies;
+                if (!optRes.isPresent()) {
+                    if (cachedRackConfiguration != null) {
+                        log.debug("The newest rack config is not available 
now, use the cached rack config : {}",
+                                cachedRackConfiguration);
+                        allGroupsBookieMapping = cachedRackConfiguration;
+                    } else {
+                        throw new 
KeeperException.NoNodeException(ZkBookieRackAffinityMapping.BOOKIE_INFO_ROOT_PATH);

Review Comment:
   How bookie client will handle this exception, and what is the expected 
behavior from the producer/consumer's perspective? Will the producer/consumer 
be closed by this exception?



-- 
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]

Reply via email to