@InterfaceAudience.Private public class HFileCleaner extends CleanerChore<BaseHFileCleanerDelegate>
Modifier and Type | Class and Description |
---|---|
private static class |
HFileCleaner.HFileDeleteTask |
CHORE_POOL_SIZE, cleanersChain, fs, params
Constructor and Description |
---|
HFileCleaner(int period,
Stoppable stopper,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path directory) |
HFileCleaner(int period,
Stoppable stopper,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path directory,
Map<String,Object> params) |
Modifier and Type | Method and Description |
---|---|
void |
cancel(boolean mayInterruptIfRunning) |
private boolean |
checkAndUpdateConfigurations(org.apache.hadoop.conf.Configuration conf)
Check new configuration and update settings if value changed
|
void |
cleanup()
Override to run cleanup tasks when the Chore encounters an error and must stop running
|
protected void |
consumerLoop(BlockingQueue<HFileCleaner.HFileDeleteTask> queue) |
private void |
countDeletedFiles(boolean isLargeFile,
boolean fromLargeQueue) |
private HFileCleaner.HFileDeleteTask |
deleteFile(org.apache.hadoop.fs.FileStatus file)
Construct an
HFileCleaner.HFileDeleteTask for each file to delete and add into the correct queue |
int |
deleteFiles(Iterable<org.apache.hadoop.fs.FileStatus> filesToDelete)
Delete the given files
|
private boolean |
dispatch(HFileCleaner.HFileDeleteTask task) |
(package private) long |
getCleanerThreadCheckIntervalMsec() |
List<Thread> |
getCleanerThreads() |
(package private) long |
getCleanerThreadTimeoutMsec() |
List<BaseHFileCleanerDelegate> |
getDelegatesForTesting()
Exposed for TESTING!
|
long |
getLargeQueueInitSize() |
long |
getNumOfDeletedLargeFiles() |
long |
getNumOfDeletedSmallFiles() |
long |
getSmallQueueInitSize() |
long |
getThrottlePoint() |
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. |
private void |
startHFileDeleteThreads()
Start threads for hfile deletion
|
private void |
stopHFileDeleteThreads()
Stop threads for hfile deletion
|
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
public static final String MASTER_HFILE_CLEANER_PLUGINS
public static final String HFILE_DELETE_THROTTLE_THRESHOLD
public static final int DEFAULT_HFILE_DELETE_THROTTLE_THRESHOLD
public static final String LARGE_HFILE_QUEUE_INIT_SIZE
public static final int DEFAULT_LARGE_HFILE_QUEUE_INIT_SIZE
public static final String SMALL_HFILE_QUEUE_INIT_SIZE
public static final int DEFAULT_SMALL_HFILE_QUEUE_INIT_SIZE
public static final String LARGE_HFILE_DELETE_THREAD_NUMBER
public static final int DEFAULT_LARGE_HFILE_DELETE_THREAD_NUMBER
public static final String SMALL_HFILE_DELETE_THREAD_NUMBER
public static final int DEFAULT_SMALL_HFILE_DELETE_THREAD_NUMBER
public static final String HFILE_DELETE_THREAD_TIMEOUT_MSEC
static final long DEFAULT_HFILE_DELETE_THREAD_TIMEOUT_MSEC
public static final String HFILE_DELETE_THREAD_CHECK_INTERVAL_MSEC
static final long DEFAULT_HFILE_DELETE_THREAD_CHECK_INTERVAL_MSEC
private static final org.slf4j.Logger LOG
StealJobQueue<HFileCleaner.HFileDeleteTask> largeFileQueue
BlockingQueue<HFileCleaner.HFileDeleteTask> smallFileQueue
private int throttlePoint
private int largeQueueInitSize
private int smallQueueInitSize
private int largeFileDeleteThreadNumber
private int smallFileDeleteThreadNumber
private long cleanerThreadTimeoutMsec
private long cleanerThreadCheckIntervalMsec
private boolean running
private AtomicLong deletedLargeFiles
private AtomicLong deletedSmallFiles
private static final Comparator<HFileCleaner.HFileDeleteTask> COMPARATOR
public HFileCleaner(int period, Stoppable stopper, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path directory)
public HFileCleaner(int period, Stoppable stopper, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path directory, Map<String,Object> params)
period
- the period of time to sleep between each runstopper
- the stopperconf
- configuration to usefs
- handle to the FSdirectory
- directory to be cleanedparams
- params could be used in subclass of BaseHFileCleanerDelegateprotected boolean validate(org.apache.hadoop.fs.Path file)
CleanerChore
validate
in class CleanerChore<BaseHFileCleanerDelegate>
file
- full Path
of the file to be checkedpublic List<BaseHFileCleanerDelegate> getDelegatesForTesting()
public int deleteFiles(Iterable<org.apache.hadoop.fs.FileStatus> filesToDelete)
CleanerChore
deleteFiles
in class CleanerChore<BaseHFileCleanerDelegate>
filesToDelete
- files to deleteprivate HFileCleaner.HFileDeleteTask deleteFile(org.apache.hadoop.fs.FileStatus file)
HFileCleaner.HFileDeleteTask
for each file to delete and add into the correct queuefile
- the file to deleteprivate boolean dispatch(HFileCleaner.HFileDeleteTask task)
public void cleanup()
ScheduledChore
cleanup
in class CleanerChore<BaseHFileCleanerDelegate>
private void startHFileDeleteThreads()
protected void consumerLoop(BlockingQueue<HFileCleaner.HFileDeleteTask> queue)
private void countDeletedFiles(boolean isLargeFile, boolean fromLargeQueue)
private void stopHFileDeleteThreads()
public List<Thread> getCleanerThreads()
public long getNumOfDeletedLargeFiles()
public long getNumOfDeletedSmallFiles()
public long getLargeQueueInitSize()
public long getSmallQueueInitSize()
public long getThrottlePoint()
long getCleanerThreadTimeoutMsec()
long getCleanerThreadCheckIntervalMsec()
public 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<BaseHFileCleanerDelegate>
private boolean checkAndUpdateConfigurations(org.apache.hadoop.conf.Configuration conf)
conf
- The new configurationpublic void cancel(boolean mayInterruptIfRunning)
cancel
in class ScheduledChore
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.