public class GarbageCollectWriteAheadLogs extends Object
| Modifier and Type | Method and Description |
|---|---|
void |
collect(GCStatus status)
Removes all the WAL files that are no longer used.
|
protected Iterable<Map.Entry<Key,Value>> |
getReplicationStatusForFile(Connector conn,
String wal) |
protected boolean |
neededByReplication(Connector conn,
String wal)
Determine if the given WAL is needed for replication
|
protected int |
removeReplicationEntries(Map<String,org.apache.hadoop.fs.Path> nameToFileMap,
Map<String,org.apache.hadoop.fs.Path> sortedWALogs,
GCStatus status) |
protected boolean |
timeToDelete(com.google.common.net.HostAndPort address,
long wait)
Determine if TServer has been dead long enough to remove associated WALs.
|
public void collect(GCStatus status)
This method is not Threadsafe. SimpleGarbageCollector#run does not invoke collect in a concurrent manner.
status - GCStatus objectprotected int removeReplicationEntries(Map<String,org.apache.hadoop.fs.Path> nameToFileMap, Map<String,org.apache.hadoop.fs.Path> sortedWALogs, GCStatus status) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
IOExceptionorg.apache.zookeeper.KeeperExceptionInterruptedExceptionprotected boolean neededByReplication(Connector conn, String wal)
wal - The full path (URI)protected Iterable<Map.Entry<Key,Value>> getReplicationStatusForFile(Connector conn, String wal)
protected boolean timeToDelete(com.google.common.net.HostAndPort address,
long wait)
Uses a map where the key is the address and the value is the time first seen dead. If the address is not in the map, it is added with the current system nanoTime. When the passed in wait time has elapsed, this method returns true and removes the key and value from the map.
address - HostAndPort of dead tserverwait - long value of elapsed millis to waitCopyright © 2011–2017 The Apache Software Foundation. All rights reserved.