lhotari commented on code in PR #25550:
URL: https://github.com/apache/pulsar/pull/25550#discussion_r3108939406
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/resources/TopicResources.java:
##########
@@ -90,14 +90,18 @@ public CompletableFuture<Boolean>
persistentTopicExists(TopicName topic) {
}
public CompletableFuture<Void> clearNamespacePersistence(NamespaceName ns)
{
- String path = MANAGED_LEDGER_PATH + "/" + ns;
- log.info().attr("namespace", ns).attr("path", path).log("Clearing
namespace persistence for namespace: , path");
- return store.deleteIfExists(path, Optional.empty());
+ return clearManagedLedgerPathIfExistsAsync(ns, MANAGED_LEDGER_PATH +
"/" + ns,
+ "Clearing namespace persistence for namespace: , path");
}
public CompletableFuture<Void> clearDomainPersistence(NamespaceName ns) {
- String path = MANAGED_LEDGER_PATH + "/" + ns + "/persistent";
- log.info().attr("namespace", ns).attr("path", path).log("Clearing
domain persistence for namespace: , path");
+ return clearManagedLedgerPathIfExistsAsync(ns, MANAGED_LEDGER_PATH +
"/" + ns + "/persistent",
+ "Clearing domain persistence for namespace: , path");
+ }
+
+ private CompletableFuture<Void> clearManagedLedgerPathIfExistsAsync(
+ NamespaceName ns, String path, String logMessage) {
+ log.info().attr("namespace", ns).attr("path", path).log(logMessage);
Review Comment:
This refactoring isn't that useful since the method name
`clearManagedLedgerPathIfExistsAsync` isn't accurate. The path is a
MetadataStore path, exactly what store.deleteIfExists already handles.
Eliminating duplication for the log message isn't useful since it just
results in harder readability.
--
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]