You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by rd...@apache.org on 2020/07/24 02:54:10 UTC

[bookkeeper] branch master updated: Issue 2264: Bookie cannot perform Garbage Collection in case of corrupted EntryLogger file

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

rdhabalia 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 4376410  Issue 2264: Bookie cannot perform Garbage Collection in case of corrupted EntryLogger file
4376410 is described below

commit 4376410a9299191388662b1131ad7452be47ee84
Author: Enrico Olivelli <eo...@gmail.com>
AuthorDate: Fri Jul 24 04:53:56 2020 +0200

    Issue 2264: Bookie cannot perform Garbage Collection in case of corrupted EntryLogger file
    
    - in case of corrupted entry log file the bookie cannot perform GC
    - handle the case of an unexpected negative entrysize
    
    ### Changes
    
    Stop scanning the file
    
    Master Issue: #2264
    
    
    Reviewers: Jia Zhai <zh...@apache.org>, Rajan Dhabalia <rd...@apache.org>
    
    This closes #2373 from eolivelli/fix/issue2264-corruptedfile
---
 .../src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java      | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
index 0d7c861..bc16a19 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
@@ -1011,6 +1011,11 @@ public class EntryLogger {
                 // read the entry
 
                 data.clear();
+                if (entrySize < 0) {
+                    LOG.warn("bad read for ledger entry from entryLog {}@{} (entry size {})",
+                            entryLogId, pos, entrySize);
+                    return;
+                }
                 data.capacity(entrySize);
                 int rc = readFromLogChannel(entryLogId, bc, data, pos);
                 if (rc != entrySize) {