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/29 16:44:52 UTC

[GitHub] [pulsar] dlg99 commented on a diff in pull request #16857: [fix][broker] PulsarLedgerManager to pass correct error code to BK client

dlg99 commented on code in PR #16857:
URL: https://github.com/apache/pulsar/pull/16857#discussion_r933449616


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarLedgerManager.java:
##########
@@ -89,6 +89,20 @@ public LedgerMetadata deserialize(String path, byte[] content, Stat stat) throws
         store.registerListener(this::handleDataNotification);
     }
 
+    private static Throwable mapToBkException(Throwable ex) {
+        if (ex instanceof MetadataStoreException.NotFoundException) {
+            return BKException.create(BKException.Code.NoSuchLedgerExistsOnMetadataServerException);

Review Comment:
   fixed



##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarLedgerManager.java:
##########
@@ -106,14 +120,21 @@ public CompletableFuture<Versioned<LedgerMetadata>> createLedgerMetadata(long le
             return FutureUtil.failedFuture(new BKException.BKMetadataSerializationException(ioe));
         }
 
+        CompletableFuture<Versioned<LedgerMetadata>> promise = new CompletableFuture<>();
+
         CompletableFuture<Versioned<LedgerMetadata>> future = store.put(getLedgerPath(ledgerId), data, Optional.of(-1L))
-                .thenApply(stat -> new Versioned(metadata, new LongVersion(stat.getVersion())));
+                .thenApply(stat -> {

Review Comment:
   fixed



-- 
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