eolivelli commented on code in PR #17512:
URL: https://github.com/apache/pulsar/pull/17512#discussion_r964757669


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -3006,6 +3006,13 @@ private void offloadLoop(CompletableFuture<PositionImpl> 
promise, Queue<LedgerIn
                                     if (exception != null) {
                                         log.error("[{}] Failed to offload data 
for the ledgerId {}",
                                                 name, ledgerId, exception);
+                                        if (exception instanceof 
MetaStoreException) {
+                                            // When a MetaStore exception 
happens, we can not make sure the metadata
+                                            // update is failed or not. 
Because we have a retry on the connection loss,
+                                            // it is possible to get a 
BadVersion or other exception after retrying.
+                                            // So we don't clean up the data 
if it has metadata operation exception.

Review Comment:
   we must log a (ERROR) message that explains, this way we can see this case 
in the logs
   ```
   if (exception instanceof MetaStoreException) {
   log.error("[{}] Failed to update offloaded  metadata for the ledgerId {}",
                                                   name, ledgerId, exception);
    } else {
    log.error("[{}] Failed to offload data for the ledgerId {}",
                                                   name, ledgerId, exception);
   }
   ```



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