LeBW commented on a change in pull request #12215:
URL: https://github.com/apache/pulsar/pull/12215#discussion_r725727909
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
##########
@@ -982,6 +986,28 @@ public void deleteLedgerFailed(ManagedLedgerException
exception, Object ctx) {
return future;
}
+ public void deleteTopicAuthenticationWithRetry(String topic) {
+ pulsar.getPulsarResources().getNamespaceResources()
+ .setPoliciesAsync(TopicName.get(topic).getNamespaceObject(), p
-> {
+ p.auth_policies.getTopicAuthentication().remove(topic);
+ return p;
+ }).thenAccept(r2 -> {
+ log.info("Successfully delete authentication policies for
topic {}", topic);
+ }).exceptionally(ex1 -> {
+ if (ex1.getCause() instanceof
MetadataStoreException.BadVersionException) {
+ log.warn(
+ "Failed to delete authentication policies
because of bad version. "
+ + "Retry to delete authentication
policies for topic {}",
+ topic);
+ deleteTopicAuthenticationWithRetry(topic);
+ } else {
+ log.error("Failed to delete authentication policies
for topic {}", topic);
+ ex1.printStackTrace();
Review comment:
Fixed.
--
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]