poorbarcode commented on code in PR #22890:
URL: https://github.com/apache/pulsar/pull/22890#discussion_r1635080504


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -553,6 +547,26 @@ private void createPersistentSubscriptions() {
         checkReplicatedSubscriptionControllerState();
     }
 
+    private CompletableFuture<Void> removeOrphanReplicationCursors() {
+        List<CompletableFuture<Void>> futures = new ArrayList<>();
+        String localCluster = 
brokerService.pulsar().getConfiguration().getClusterName();
+        List<String> replicationClusters = 
topicPolicies.getReplicationClusters().get();
+        for (ManagedCursor cursor : ledger.getCursors()) {
+            if (cursor.getName().startsWith(replicatorPrefix)) {
+                String remoteCluster = 
PersistentReplicator.getRemoteCluster(cursor.getName());
+                if (!replicationClusters.contains(remoteCluster)) {
+                    log.warn("Remove the replicator because the cluster '{}' 
does not exist", remoteCluster);
+                    futures.add(removeReplicator(remoteCluster));
+                    continue;
+                }
+                if (localCluster.equals(remoteCluster)) {
+                    log.warn("Remove the replicator because the cluster '{}' 
does not exist", remoteCluster);
+                }

Review Comment:
   > Does something get removed in this case? 
   
   No, removed



-- 
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]

Reply via email to