merlimat commented on a change in pull request #14118:
URL: https://github.com/apache/pulsar/pull/14118#discussion_r799883400
##########
File path:
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarLedgerIdGenerator.java
##########
@@ -80,8 +80,19 @@ public void
generateLedgerId(BookkeeperInternalCallbacks.GenericCallback<Long> g
// Proceed
return internalGenerateShortLedgerId();
} else {
- return store.put(shortIdGenPath, new byte[0],
Optional.empty())
- .thenCompose(__ ->
internalGenerateShortLedgerId());
+ CompletableFuture<Void> future = new
CompletableFuture<>();
+ store.put(shortIdGenPath, new byte[0],
Optional.of(-1L))
+ .whenComplete((stat, throwable) -> {
+ Throwable cause =
FutureUtil.unwrapCompletionException(throwable);
+ if (cause == null
+ || cause instanceof
MetadataStoreException.BadVersionException) {
+ // creat shortIdGenPath success or it
already created by others.
+ future.complete(null);
Review comment:
I think it's ok, there's just the "create if missing" of the base path,
though we can move on if the it's already existing.
--
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]