@InterfaceAudience.Private public class LogCleaner extends CleanerChore<BaseLogCleanerDelegate>
BaseLogCleanerDelegate
Modifier and Type | Class and Description |
---|---|
private static class |
LogCleaner.CleanerContext |
Modifier and Type | Field and Description |
---|---|
private long |
cleanerThreadCheckIntervalMsec |
private long |
cleanerThreadTimeoutMsec |
(package private) static long |
DEFAULT_OLD_WALS_CLEANER_THREAD_CHECK_INTERVAL_MSEC |
static int |
DEFAULT_OLD_WALS_CLEANER_THREAD_SIZE |
(package private) static long |
DEFAULT_OLD_WALS_CLEANER_THREAD_TIMEOUT_MSEC |
private static org.slf4j.Logger |
LOG |
static String |
OLD_WALS_CLEANER_THREAD_CHECK_INTERVAL_MSEC |
static String |
OLD_WALS_CLEANER_THREAD_SIZE |
static String |
OLD_WALS_CLEANER_THREAD_TIMEOUT_MSEC |
private List<Thread> |
oldWALsCleaner |
private LinkedBlockingQueue<LogCleaner.CleanerContext> |
pendingDelete |
CHORE_POOL_SIZE, cleanersChain, fs, params
Constructor and Description |
---|
LogCleaner(int period,
Stoppable stopper,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path oldLogDir) |
Modifier and Type | Method and Description |
---|---|
void |
cancel(boolean mayInterruptIfRunning) |
void |
cleanup()
Override to run cleanup tasks when the Chore encounters an error and must stop running
|
private List<Thread> |
createOldWalsCleaner(int size) |
private void |
deleteFile() |
protected int |
deleteFiles(Iterable<org.apache.hadoop.fs.FileStatus> filesToDelete)
Delete the given files
|
(package private) long |
getCleanerThreadCheckIntervalMsec() |
(package private) long |
getCleanerThreadTimeoutMsec() |
(package private) int |
getSizeOfCleaners() |
private void |
interruptOldWALsCleaner() |
void |
onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
This method would be called by the
ConfigurationManager
object when the Configuration object is reloaded from disk. |
protected boolean |
validate(org.apache.hadoop.fs.Path file)
Validate the file to see if it even belongs in the directory.
|
calculatePoolSize, chore, getChorePoolSize, getEnabled, runCleaner, setEnabled
cancel, choreForTesting, getInitialDelay, getName, getPeriod, getStopper, getTimeUnit, initialChore, isInitialChoreComplete, isScheduled, run, toString, triggerNow
private static final org.slf4j.Logger LOG
public static final String OLD_WALS_CLEANER_THREAD_SIZE
public static final int DEFAULT_OLD_WALS_CLEANER_THREAD_SIZE
public static final String OLD_WALS_CLEANER_THREAD_TIMEOUT_MSEC
static final long DEFAULT_OLD_WALS_CLEANER_THREAD_TIMEOUT_MSEC
public static final String OLD_WALS_CLEANER_THREAD_CHECK_INTERVAL_MSEC
static final long DEFAULT_OLD_WALS_CLEANER_THREAD_CHECK_INTERVAL_MSEC
private final LinkedBlockingQueue<LogCleaner.CleanerContext> pendingDelete
private List<Thread> oldWALsCleaner
private long cleanerThreadTimeoutMsec
private long cleanerThreadCheckIntervalMsec
public LogCleaner(int period, Stoppable stopper, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path oldLogDir)
period
- the period of time to sleep between each runstopper
- the stopperconf
- configuration to usefs
- handle to the FSoldLogDir
- the path to the archived logsprotected boolean validate(org.apache.hadoop.fs.Path file)
CleanerChore
validate
in class CleanerChore<BaseLogCleanerDelegate>
file
- full Path
of the file to be checkedpublic void onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
ConfigurationObserver
ConfigurationManager
object when the Configuration
object is reloaded from disk.onConfigurationChange
in interface ConfigurationObserver
onConfigurationChange
in class CleanerChore<BaseLogCleanerDelegate>
protected int deleteFiles(Iterable<org.apache.hadoop.fs.FileStatus> filesToDelete)
CleanerChore
deleteFiles
in class CleanerChore<BaseLogCleanerDelegate>
filesToDelete
- files to deletepublic void cleanup()
ScheduledChore
cleanup
in class CleanerChore<BaseLogCleanerDelegate>
int getSizeOfCleaners()
long getCleanerThreadTimeoutMsec()
long getCleanerThreadCheckIntervalMsec()
private List<Thread> createOldWalsCleaner(int size)
private void interruptOldWALsCleaner()
private void deleteFile()
public void cancel(boolean mayInterruptIfRunning)
cancel
in class ScheduledChore
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.