This is an automated email from the ASF dual-hosted git repository.

ayegorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 743def3  Explicit error message if an exception other than 
BKNoSuchLedgerExistsOnMetadataServerException occurs in over-replicated ledger 
GC
743def3 is described below

commit 743def3634cc95e651faa0ca1a6d3c50483f2d37
Author: shustsud <[email protected]>
AuthorDate: Tue Feb 15 04:20:49 2022 +0900

    Explicit error message if an exception other than 
BKNoSuchLedgerExistsOnMetadataServerException occurs in over-replicated ledger 
GC
    
    ### Motivation
    - Even if an exception other than 
BKNoSuchLedgerExistsOnMetadataServerException occurs of readLedgerMetadata in 
over-replicated ledger GC, nothing will be output to the log.
    (https://github.com/apache/bookkeeper/pull/2844#discussion_r735219876)
    
    ### Changes
    - If an exception other than BKNoSuchLedgerExistsOnMetadataServerException 
occurs in readLedgerMetadata, output information to the log.
    
    
    Reviewers: Andrey Yegorov <None>, Nicolò Boschi <[email protected]>
    
    This closes #2873 from shustsud/improved_error_handling
---
 .../apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java  | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java
index 93bf47c..b3c724b 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java
@@ -243,6 +243,10 @@ public class ScanAndCompareGarbageCollector implements 
GarbageCollector {
                     continue;
                 }
             } catch (Throwable t) {
+                if (!(t.getCause() instanceof 
BKException.BKNoSuchLedgerExistsOnMetadataServerException)) {
+                    LOG.warn("Failed to get metadata for ledger {}. {}: {}",
+                            ledgerId, t.getClass().getName(), t.getMessage());
+                }
                 latch.countDown();
                 continue;
             }
@@ -268,6 +272,10 @@ public class ScanAndCompareGarbageCollector implements 
GarbageCollector {
                                         overReplicatedLedgers.add(ledgerId);
                                         garbageCleaner.clean(ledgerId);
                                     }
+                                } else if (!(exception
+                                        instanceof 
BKException.BKNoSuchLedgerExistsOnMetadataServerException)) {
+                                    LOG.warn("Failed to get metadata for 
ledger {}. {}: {}",
+                                            ledgerId, 
exception.getClass().getName(), exception.getMessage());
                                 }
                             } finally {
                                 semaphore.release();

Reply via email to