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
-
Field Summary
Modifier and TypeFieldDescriptionprivate long
static final int
(package private) static final long
private static final org.slf4j.Logger
static final String
static final String
private 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
ConstructorDescriptionLogCleaner
(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 TypeMethodDescriptionvoid
cancel
(boolean mayInterruptIfRunning) void
cleanup()
Override to run cleanup tasks when the Chore encounters an error and must stop runningcreateOldWalsCleaner
(int size) private void
protected int
deleteFiles
(Iterable<org.apache.hadoop.fs.FileStatus> filesToDelete) Delete the given files(package private) long
(package private) int
private void
void
onConfigurationChange
(org.apache.hadoop.conf.Configuration conf) This method would be called by theConfigurationManager
object when theConfiguration
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.Methods inherited from class org.apache.hadoop.hbase.master.cleaner.CleanerChore
calculatePoolSize, chore, getChorePoolSize, getEnabled, initialChore, setEnabled, triggerCleanerNow
Methods 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:CleanerChore
Validate 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:
validate
in classCleanerChore<BaseLogCleanerDelegate>
- Parameters:
file
- fullPath
of the file to be checked- Returns:
- true if the file is valid, false otherwise
-
onConfigurationChange
Description copied from interface:ConfigurationObserver
This method would be called by theConfigurationManager
object when theConfiguration
object is reloaded from disk.- Specified by:
onConfigurationChange
in interfaceConfigurationObserver
-
deleteFiles
Description copied from class:CleanerChore
Delete the given files- Overrides:
deleteFiles
in classCleanerChore<BaseLogCleanerDelegate>
- Parameters:
filesToDelete
- files to delete- Returns:
- number of deleted files
-
cleanup
Description copied from class:ScheduledChore
Override to run cleanup tasks when the Chore encounters an error and must stop running- Overrides:
cleanup
in classCleanerChore<BaseLogCleanerDelegate>
-
getSizeOfCleaners
int getSizeOfCleaners() -
getCleanerThreadTimeoutMsec
long getCleanerThreadTimeoutMsec() -
createOldWalsCleaner
-
interruptOldWALsCleaner
-
deleteFile
-
cancel
- Overrides:
cancel
in classScheduledChore
-