lhotari commented on code in PR #22890:
URL: https://github.com/apache/pulsar/pull/22890#discussion_r1634858511
##########
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? Please add a unique log message for
this case which explains the situation.
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -439,13 +439,6 @@ public CompletableFuture<Void> initialize() {
this.createPersistentSubscriptions();
}));
- for (ManagedCursor cursor : ledger.getCursors()) {
- if (cursor.getName().startsWith(replicatorPrefix)) {
- String localCluster =
brokerService.pulsar().getConfiguration().getClusterName();
- String remoteCluster =
PersistentReplicator.getRemoteCluster(cursor.getName());
- futures.add(addReplicationCluster(remoteCluster, cursor,
localCluster));
- }
- }
Review Comment:
Why is adding removed? Does `addReplicationCluster` remove replication
cursors?
--
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]