Review Board 1.7.22


BOOKKEEPER-160: bookie server needs to do compaction over entry log files to reclaim disk space

Review Request #3874 - Created Feb. 12, 2012 and updated

Sijie Guo
BOOKKEEPER-160
Reviewers
bookkeeper
bookkeeper-git
bookie server aggregates entries into entry log file. suppose there is lots of ledgers, each ledger has little messages. so a entry log file would contains messages from lots of different ledgers. if there is only one ledger not be deleted, the entry log file would not be removed, whose occupied disk space could not be reclaimed.

 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
Revision 57a6c29 New Change
[20] 927 lines
[+20] [+] public void writeComplete(int rc, long ledgerId,
928
            l.setMasterKeyPersisted();
928
            l.setMasterKeyPersisted();
929
        }
929
        }
930
        return l;
930
        return l;
931
    }
931
    }
932

    
   
932

   

    
   
933
    protected void addEntryByLedgerId(long ledgerId, ByteBuffer entry)

    
   
934
        throws IOException, BookieException {

    
   
935
        LedgerDescriptor handle = getHandle(ledgerId);

    
   
936
        try {

    
   
937
            handle.addEntry(entry);

    
   
938
        } finally {

    
   
939
            putHandle(handle); 

    
   
940
        }

    
   
941
    }

    
   
942

   
933
    /**
943
    /**
934
     * Add an entry to a ledger as specified by handle. 
944
     * Add an entry to a ledger as specified by handle. 
935
     */
945
     */
936
    private void addEntryInternal(LedgerDescriptor handle, ByteBuffer entry, WriteCallback cb, Object ctx)
946
    private void addEntryInternal(LedgerDescriptor handle, ByteBuffer entry, WriteCallback cb, Object ctx)
937
            throws IOException, BookieException {
947
            throws IOException, BookieException {
[+20] [20] 121 lines
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
Revision 42f54d2 New Change
 
bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java
Revision 0c83977 New Change
 
bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CompactionTest.java
New File
 
bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/EntryLogTest.java
Revision 2e5d784 New Change
 
  1. bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java: Loading...
  2. bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java: Loading...
  3. bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java: Loading...
  4. bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CompactionTest.java: Loading...
  5. bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/EntryLogTest.java: Loading...