Package org.apache.bookkeeper.bookie
Class ScanAndCompareGarbageCollector
- java.lang.Object
-
- org.apache.bookkeeper.bookie.ScanAndCompareGarbageCollector
-
- All Implemented Interfaces:
GarbageCollector
public class ScanAndCompareGarbageCollector extends java.lang.Object implements GarbageCollector
Garbage collector implementation using scan and compare.Garbage collection is processed as below:
- fetch all existing ledgers from zookeeper or metastore according to the LedgerManager, called globalActiveLedgers
- fetch all active ledgers from bookie server, said bkActiveLedgers
- loop over bkActiveLedgers to find those ledgers that are not in globalActiveLedgers, do garbage collection on them.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.bookkeeper.bookie.GarbageCollector
GarbageCollector.GarbageCleaner
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static org.slf4j.Logger
LOG
-
Constructor Summary
Constructors Constructor Description ScanAndCompareGarbageCollector(LedgerManager ledgerManager, CompactableLedgerStorage ledgerStorage, ServerConfiguration conf, StatsLogger statsLogger)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
gc(GarbageCollector.GarbageCleaner garbageCleaner)
Do the garbage collector work.int
getNumActiveLedgers()
-
-
-
Constructor Detail
-
ScanAndCompareGarbageCollector
public ScanAndCompareGarbageCollector(LedgerManager ledgerManager, CompactableLedgerStorage ledgerStorage, ServerConfiguration conf, StatsLogger statsLogger) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getNumActiveLedgers
public int getNumActiveLedgers()
-
gc
public void gc(GarbageCollector.GarbageCleaner garbageCleaner)
Description copied from interface:GarbageCollector
Do the garbage collector work.- Specified by:
gc
in interfaceGarbageCollector
- Parameters:
garbageCleaner
- cleaner used to clean selected garbages
-
-