gaoran10 commented on a change in pull request #10520:
URL: https://github.com/apache/pulsar/pull/10520#discussion_r629009888



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -893,24 +898,29 @@ public void openCursorFailed(ManagedLedgerException 
exception, Object ctx) {
             }
 
             if (startMessageRollbackDurationSec > 0) {
-                long timestamp = System.currentTimeMillis()
-                        - 
TimeUnit.SECONDS.toMillis(startMessageRollbackDurationSec);
-                final Subscription finalSubscription = subscription;
-                subscription.resetCursor(timestamp).handle((s, ex) -> {
-                    if (ex != null) {
-                        log.warn("[{}] Failed to reset cursor {} position at 
timestamp {}", topic, subscriptionName,
-                                startMessageRollbackDurationSec);
-                    }
-                    subscriptionFuture.complete(finalSubscription);
-                    return null;
-                });
+                resetSubscriptionCursor(subscription, subscriptionFuture, 
startMessageRollbackDurationSec);
                 return subscriptionFuture;
             } else {
                 return CompletableFuture.completedFuture(subscription);
             }
         }
     }
 
+    private void resetSubscriptionCursor(Subscription subscription, 
CompletableFuture<Subscription> subscriptionFuture,
+                                         long startMessageRollbackDurationSec) 
{
+        long timestamp = System.currentTimeMillis()
+                - TimeUnit.SECONDS.toMillis(startMessageRollbackDurationSec);
+        final Subscription finalSubscription = subscription;
+        subscription.resetCursor(timestamp).handle((s, ex) -> {
+            if (ex != null) {

Review comment:
       If the reset cursor operation is failed, the subscription still could be 
generated successfully, it seems that the configuration 
startMessageRollbackDurationSec is invalid, this has no effect on the users, 
right?
   
   Maybe we could print a simple error message in the warning log.




-- 
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:
[email protected]


Reply via email to