BewareMyPower commented on code in PR #19972:
URL: https://github.com/apache/pulsar/pull/19972#discussion_r1154067698
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -338,7 +338,38 @@ public CompletableFuture<Void> initialize() {
if (cursor.getName().startsWith(replicatorPrefix)) {
String localCluster =
brokerService.pulsar().getConfiguration().getClusterName();
String remoteCluster =
PersistentReplicator.getRemoteCluster(cursor.getName());
- futures.add(addReplicationCluster(remoteCluster, cursor,
localCluster));
+ final CompletableFuture<Void> future = new
CompletableFuture<>();
+ addReplicationCluster(remoteCluster, cursor,
localCluster).whenComplete((__, e) -> {
+ if (e == null) {
+ future.complete(null);
+ } else {
+ Throwable throwable = e;
+ while (throwable.getCause() != null) {
+ throwable = throwable.getCause();
+ }
+ if (throwable instanceof
MetadataStoreException.NotFoundException
+ &&
throwable.getMessage().equals(remoteCluster)) {
+ log.warn("[{}] Remote cluster '{}' is not found
while there is a replicator cursor,"
+ + " remove cursor '{}'", topic,
remoteCluster, cursor.getName());
+ ledger.asyncDeleteCursor(cursor.getName(), new
DeleteCursorCallback() {
Review Comment:
Only when `BrokerService#getReplication` accepts an empty `clusterDataOp`
will we remove the cursor. The data is retrieved from:
```java
brokerService.pulsar().getPulsarResources().getClusterResources()
.getClusterAsync(remoteCluster)
```
ZK is always CP, so I think it won't be temporariy unobtainable like the
network loss.
--
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]