Denovo1998 commented on code in PR #18010:
URL: https://github.com/apache/pulsar/pull/18010#discussion_r1140357628


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/BookkeeperSchemaStorage.java:
##########
@@ -691,7 +691,8 @@ public static Exception bkException(String operation, int 
rc, long ledgerId, lon
             message += " - entry=" + entryId;
         }
         boolean recoverable = rc != 
BKException.Code.NoSuchLedgerExistsException
-                && rc != BKException.Code.NoSuchEntryException;
+                && rc != BKException.Code.NoSuchEntryException
+                && rc != 
BKException.Code.NoSuchLedgerExistsOnMetadataServerException;

Review Comment:
   @poorbarcode Maybe we should modify 
here(`BookkeeperSchemaStorage.bkException`), if `autoSkipNonRecoverableData` is 
false, then `NoSuchLedgerExistsOnMetadataServerException` should not be 
recoverable. What do you think about this?
   ```java
       private final boolean autoSkipNonRecoverableData;
   
       BookkeeperSchemaStorage(PulsarService pulsar) {
           ......
           this.autoSkipNonRecoverableData = 
pulsar.getConfiguration().isAutoSkipNonRecoverableData();
       }
   
       private CompletableFuture<Long> addEntry(LedgerHandle ledgerHandle, 
SchemaStorageFormat.SchemaEntry entry) {
           ......
           future.completeExceptionally(bkException("Failed to add entry", rc, 
ledgerHandle.getId(), -1, autoSkipNonRecoverableData));
           ......
       }
   
       private CompletableFuture<LedgerHandle> createLedger(String schemaId) {
           ......
           future.completeExceptionally(bkException("Failed to create ledger", 
rc, -1, -1, autoSkipNonRecoverableData));
           ......
       }
   
       private CompletableFuture<LedgerHandle> openLedger(Long ledgerId) {
           ......
           future.completeExceptionally(bkException("Failed to open ledger", 
rc, ledgerId, -1, autoSkipNonRecoverableData));
           ......
       }
   
       private CompletableFuture<Void> closeLedger(LedgerHandle ledgerHandle) {
           ......
           future.completeExceptionally(bkException("Failed to close ledger", 
rc, ledgerHandle.getId(), -1, autoSkipNonRecoverableData));
           ......
       }
   
       interface Functions {
           // remove getLedgerEntry
       }
   
       // move to here
       private CompletableFuture<LedgerEntry> getLedgerEntry(LedgerHandle 
ledger, long entry) {
           ......
           future.completeExceptionally(bkException("Failed to read entry", rc, 
ledger.getId(), entry,
                   autoSkipNonRecoverableData));
           ......
       }
   
       @NotNull
       private CompletableFuture<SchemaStorageFormat.SchemaEntry> 
readSchemaEntry(SchemaStorageFormat.PositionInfo position) {
           ......
           // Functions.getLedgerEntry(ledger, position.getEntryId())
           getLedgerEntry(ledger, position.getEntryId())
           ......
       }
   
       public static Exception bkException(String operation, int rc, long 
ledgerId, long entryId, boolean autoSkipNonRecoverableData) {
           String message = 
org.apache.bookkeeper.client.api.BKException.getMessage(rc)
                   + " -  ledger=" + ledgerId + " - operation=" + operation;
   
           if (entryId != -1) {
               message += " - entry=" + entryId;
           }
   
           boolean recoverable = rc != 
BKException.Code.NoSuchLedgerExistsException
                   && rc != BKException.Code.NoSuchEntryException;
           return !autoSkipNonRecoverableData ? new 
SchemaException(recoverable, message)
                   : new SchemaException(recoverable && rc != 
BKException.Code.NoSuchLedgerExistsOnMetadataServerException, message);
       }
   ```



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

Reply via email to