lhotari commented on a change in pull request #14118:
URL: https://github.com/apache/pulsar/pull/14118#discussion_r799419222
##########
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:
Will this suppress a possible exception? could that lead to lost updates
and inconsistent state?
--
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]