Skip to content

Commit

Permalink
cleanup unused sync method in NamespacesBase (#17778)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnonHxy authored Sep 26, 2022
1 parent 5e6b344 commit 691e468
Showing 1 changed file with 0 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1147,25 +1147,6 @@ protected CompletableFuture<PublishRate> internalGetPublishRateAsync() {
policies.publishMaxMessageRate.get(pulsar().getConfiguration().getClusterName()));
}

@SuppressWarnings("deprecation")
protected void internalSetTopicDispatchRate(DispatchRateImpl dispatchRate) {
validateSuperUserAccess();
log.info("[{}] Set namespace dispatch-rate {}/{}", clientAppId(), namespaceName, dispatchRate);
try {
updatePolicies(namespaceName, policies -> {
policies.topicDispatchRate.put(pulsar().getConfiguration().getClusterName(), dispatchRate);
policies.clusterDispatchRate.put(pulsar().getConfiguration().getClusterName(), dispatchRate);
return policies;
});
log.info("[{}] Successfully updated the dispatchRate for cluster on namespace {}", clientAppId(),
namespaceName);
} catch (Exception e) {
log.error("[{}] Failed to update the dispatchRate for cluster on namespace {}", clientAppId(),
namespaceName, e);
throw new RestException(e);
}
}

@SuppressWarnings("deprecation")
protected CompletableFuture<Void> internalSetTopicDispatchRateAsync(DispatchRateImpl dispatchRate) {
log.info("[{}] Set namespace dispatch-rate {}/{}", clientAppId(), namespaceName, dispatchRate);
Expand Down Expand Up @@ -1821,39 +1802,6 @@ protected BundlesData validateBundlesData(BundlesData initialBundles) {
.build();
}

private void validatePolicies(NamespaceName ns, Policies policies) {
if (ns.isV2() && policies.replication_clusters.isEmpty()) {
// Default to local cluster
policies.replication_clusters = Collections.singleton(config().getClusterName());
}

// Validate cluster names and permissions
policies.replication_clusters.forEach(cluster -> validateClusterForTenant(ns.getTenant(), cluster));

if (policies.message_ttl_in_seconds != null && policies.message_ttl_in_seconds < 0) {
throw new RestException(Status.PRECONDITION_FAILED, "Invalid value for message TTL");
}

if (policies.bundles != null && policies.bundles.getNumBundles() > 0) {
if (policies.bundles.getBoundaries() == null || policies.bundles.getBoundaries().size() == 0) {
policies.bundles = getBundles(policies.bundles.getNumBundles());
} else {
policies.bundles = validateBundlesData(policies.bundles);
}
} else {
int defaultNumberOfBundles = config().getDefaultNumberOfNamespaceBundles();
policies.bundles = getBundles(defaultNumberOfBundles);
}

if (policies.persistence != null) {
validatePersistencePolicies(policies.persistence);
}

if (policies.retention_policies != null) {
validateRetentionPolicies(policies.retention_policies);
}
}

private CompletableFuture<Void> validatePoliciesAsync(NamespaceName ns, Policies policies) {
if (ns.isV2() && policies.replication_clusters.isEmpty()) {
// Default to local cluster
Expand Down

0 comments on commit 691e468

Please sign in to comment.