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 2022/07/09 16:31:40 UTC

[GitHub] [pulsar] Demogorgon314 commented on a diff in pull request #16491: [fix][broker] Retry when DistributedIdGenerator has BadVersion error

Demogorgon314 commented on code in PR #16491:
URL: https://github.com/apache/pulsar/pull/16491#discussion_r917285152


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/api/coordination/CoordinationService.java:
##########
@@ -56,4 +56,21 @@ <T> LeaderElection<T> getLeaderElection(Class<T> clazz, String path,
      *             if there's a failure in incrementing the counter
      */
     CompletableFuture<Long> getNextCounterValue(String path);
+
+    /**
+     * Increment a counter identified by the specified path and return the current value.
+     * The counter value will be guaranteed to be unique within the context of the path.
+     * It will retry when {@link org.apache.pulsar.metadata.api.MetadataStoreException} happened.
+     *
+     * If the maximum number of retries is reached and still failed,
+     * the feature will complete with exception {@link org.apache.pulsar.metadata.api.MetadataStoreException}.
+     *
+     * @param path
+     *            The path that identifies a particular counter
+     * @param count
+     *            The retry count.
+     * @return
+     *            A future that will track the completion of the operation
+     */
+    CompletableFuture<Long> getNextCounterValueWithRetry(String path, int count);

Review Comment:
   @merlimat Do you suggest using a fixed retry count in `CoordinationServiceImpl#getNextCounterValue` method, if I understand correctly?



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org