Class LogCleaner
java.lang.Object
org.apache.hadoop.hbase.ScheduledChore
org.apache.hadoop.hbase.master.cleaner.CleanerChore<BaseLogCleanerDelegate>
org.apache.hadoop.hbase.master.cleaner.LogCleaner
- All Implemented Interfaces:
Runnable,ConfigurationObserver
@Private
public class LogCleaner
extends CleanerChore<BaseLogCleanerDelegate>
implements ConfigurationObserver
This Chore, every time it runs, will attempt to delete the WALs and Procedure WALs in the old
logs folder. The WAL is only deleted if none of the cleaner delegates says otherwise.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longstatic final int(package private) static final longprivate static final org.slf4j.Loggerstatic final Stringstatic final Stringprivate final LinkedBlockingQueue<LogCleaner.CleanerContext>Fields inherited from class org.apache.hadoop.hbase.master.cleaner.CleanerChore
CHORE_POOL_SIZE, cleanersChain, DEFAULT_CHORE_POOL_SIZE, DEFAULT_LOG_CLEANER_CHORE_DIRECTORY_SORTING, DEFAULT_LOG_CLEANER_CHORE_POOL_SIZE, excludeDirs, fs, LOG_CLEANER_CHORE_DIRECTORY_SORTING, LOG_CLEANER_CHORE_SIZE, params -
Constructor Summary
ConstructorsConstructorDescriptionLogCleaner(int period, Stoppable stopper, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path oldLogDir, DirScanPool pool, Map<String, Object> params) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel(boolean mayInterruptIfRunning) voidcleanup()Override to run cleanup tasks when the Chore encounters an error and must stop runningcreateOldWalsCleaner(int size) private voidprotected intdeleteFiles(Iterable<org.apache.hadoop.fs.FileStatus> filesToDelete) Delete the given files(package private) long(package private) intprivate voidvoidonConfigurationChange(org.apache.hadoop.conf.Configuration conf) This method would be called by theConfigurationManagerobject when theConfigurationobject is reloaded from disk.protected booleanvalidate(org.apache.hadoop.fs.Path file) Validate the file to see if it even belongs in the directory.Methods inherited from class org.apache.hadoop.hbase.master.cleaner.CleanerChore
calculatePoolSize, chore, getChorePoolSize, getEnabled, initialChore, setEnabled, triggerCleanerNowMethods inherited from class org.apache.hadoop.hbase.ScheduledChore
cancel, choreForTesting, getInitialDelay, getName, getPeriod, getStopper, getTimeUnit, isInitialChoreComplete, isScheduled, run, shutdown, shutdown, toString, triggerNow
-
Field Details
-
LOG
-
OLD_WALS_CLEANER_THREAD_SIZE
- See Also:
-
DEFAULT_OLD_WALS_CLEANER_THREAD_SIZE
- See Also:
-
OLD_WALS_CLEANER_THREAD_TIMEOUT_MSEC
- See Also:
-
DEFAULT_OLD_WALS_CLEANER_THREAD_TIMEOUT_MSEC
- See Also:
-
pendingDelete
-
oldWALsCleaner
-
cleanerThreadTimeoutMsec
-
-
Constructor Details
-
LogCleaner
public LogCleaner(int period, Stoppable stopper, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path oldLogDir, DirScanPool pool, Map<String, Object> params) - Parameters:
period- the period of time to sleep between each runstopper- the stopperconf- configuration to usefs- handle to the FSoldLogDir- the path to the archived logspool- the thread pool used to scan directories
-
-
Method Details
-
validate
Description copied from class:CleanerChoreValidate the file to see if it even belongs in the directory. If it is valid, then the file will go through the cleaner delegates, but otherwise the file is just deleted.- Specified by:
validatein classCleanerChore<BaseLogCleanerDelegate>- Parameters:
file- fullPathof the file to be checked- Returns:
- true if the file is valid, false otherwise
-
onConfigurationChange
Description copied from interface:ConfigurationObserverThis method would be called by theConfigurationManagerobject when theConfigurationobject is reloaded from disk.- Specified by:
onConfigurationChangein interfaceConfigurationObserver
-
deleteFiles
Description copied from class:CleanerChoreDelete the given files- Overrides:
deleteFilesin classCleanerChore<BaseLogCleanerDelegate>- Parameters:
filesToDelete- files to delete- Returns:
- number of deleted files
-
cleanup
Description copied from class:ScheduledChoreOverride to run cleanup tasks when the Chore encounters an error and must stop running- Overrides:
cleanupin classCleanerChore<BaseLogCleanerDelegate>
-
getSizeOfCleaners
int getSizeOfCleaners() -
getCleanerThreadTimeoutMsec
long getCleanerThreadTimeoutMsec() -
createOldWalsCleaner
-
interruptOldWALsCleaner
-
deleteFile
-
cancel
- Overrides:
cancelin classScheduledChore
-