Skip to content

Commit 908d0b3

Browse files
authored
[fix][broker] Use user-specified bundle size on creating a namespace anti-affinity group with the default local policies (apache#20327)
1 parent 4678c36 commit 908d0b3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,8 @@ protected String internalGetNamespaceAntiAffinityGroup() {
17101710
try {
17111711
return getLocalPolicies()
17121712
.getLocalPolicies(namespaceName)
1713-
.orElse(new LocalPolicies()).namespaceAntiAffinityGroup;
1713+
.orElseGet(() -> new LocalPolicies(getBundles(config().getDefaultNumberOfNamespaceBundles())
1714+
, null, null)).namespaceAntiAffinityGroup;
17141715
} catch (Exception e) {
17151716
log.error("[{}] Failed to get the antiAffinityGroup of namespace {}", clientAppId(), namespaceName, e);
17161717
throw new RestException(Status.NOT_FOUND, "Couldn't find namespace policies");
@@ -1760,7 +1761,9 @@ protected List<String> internalGetAntiAffinityNamespaces(String cluster, String
17601761
throw new RuntimeException(e);
17611762
}
17621763

1763-
String storedAntiAffinityGroup = policies.orElse(new LocalPolicies()).namespaceAntiAffinityGroup;
1764+
String storedAntiAffinityGroup = policies.orElseGet(() ->
1765+
new LocalPolicies(getBundles(config().getDefaultNumberOfNamespaceBundles()),
1766+
null, null)).namespaceAntiAffinityGroup;
17641767
return antiAffinityGroup.equalsIgnoreCase(storedAntiAffinityGroup);
17651768
}).collect(Collectors.toList());
17661769

0 commit comments

Comments
 (0)