You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/03/27 08:20:39 UTC

[GitHub] [pulsar] codelipenghui commented on a change in pull request #6592: [Issue 6437][broker] Prevent marker messages from accumulating in backlog of replicated subscription

codelipenghui commented on a change in pull request #6592: [Issue 6437][broker] Prevent marker messages from accumulating in backlog of replicated subscription
URL: https://github.com/apache/pulsar/pull/6592#discussion_r399098767
 
 

 ##########
 File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/ReplicatedSubscriptionsSnapshotBuilder.java
 ##########
 @@ -122,9 +123,18 @@ synchronized void receivedSnapshotResponse(Position position, ReplicatedSubscrip
         }
         // Snapshot is now complete, store it in the local topic
         PositionImpl p = (PositionImpl) position;
-        controller.writeMarker(
-                Markers.newReplicatedSubscriptionsSnapshot(snapshotId, controller.localCluster(),
-                        p.getLedgerId(), p.getEntryId(), responses));
+        try {
+            ReplicatedSubscriptionsSnapshot snapshot = Markers.instantiateReplicatedSubscriptionsSnapshot(snapshotId,
+                    controller.localCluster(), p.getLedgerId(), p.getEntryId(), responses);
+            controller.topic().getSubscriptions().forEach((subName, sub) -> {
+                if (sub != null) {
+                    sub.processReplicatedSubscriptionSnapshot(snapshot);
+                }
+            });
+        } catch (Throwable t) {
+            log.warn("[{}] Failed to process replicated subscription snapshot {} -- {}", controller.topic().getName(),
+                    snapshotId, t.getMessage());
+        }
 
 Review comment:
   I don’t understand a bit here. If we don't store snapshots into the topic, how can we recover snapshots after broker restarts?
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services