Skip to content

Commit

Permalink
[fix][broker] Use user-specified bundle size on creating a namespace …
Browse files Browse the repository at this point in the history
…anti-affinity group with the default local policies (#20327)
  • Loading branch information
syk-coder authored May 18, 2023
1 parent 4678c36 commit 908d0b3
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1710,7 +1710,8 @@ protected String internalGetNamespaceAntiAffinityGroup() {
try {
return getLocalPolicies()
.getLocalPolicies(namespaceName)
.orElse(new LocalPolicies()).namespaceAntiAffinityGroup;
.orElseGet(() -> new LocalPolicies(getBundles(config().getDefaultNumberOfNamespaceBundles())
, null, null)).namespaceAntiAffinityGroup;
} catch (Exception e) {
log.error("[{}] Failed to get the antiAffinityGroup of namespace {}", clientAppId(), namespaceName, e);
throw new RestException(Status.NOT_FOUND, "Couldn't find namespace policies");
Expand Down Expand Up @@ -1760,7 +1761,9 @@ protected List<String> internalGetAntiAffinityNamespaces(String cluster, String
throw new RuntimeException(e);
}

String storedAntiAffinityGroup = policies.orElse(new LocalPolicies()).namespaceAntiAffinityGroup;
String storedAntiAffinityGroup = policies.orElseGet(() ->
new LocalPolicies(getBundles(config().getDefaultNumberOfNamespaceBundles()),
null, null)).namespaceAntiAffinityGroup;
return antiAffinityGroup.equalsIgnoreCase(storedAntiAffinityGroup);
}).collect(Collectors.toList());

Expand Down

0 comments on commit 908d0b3

Please sign in to comment.