horizonzy commented on code in PR #21096:
URL: https://github.com/apache/pulsar/pull/21096#discussion_r1314422374
##########
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:
Not, we already caught this exception at line_284
--
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]