Class SnapshotHFileCleaner
java.lang.Object
org.apache.hadoop.hbase.BaseConfigurable
org.apache.hadoop.hbase.master.cleaner.BaseFileCleanerDelegate
org.apache.hadoop.hbase.master.cleaner.BaseHFileCleanerDelegate
org.apache.hadoop.hbase.master.snapshot.SnapshotHFileCleaner
- All Implemented Interfaces:
org.apache.hadoop.conf.Configurable,FileCleanerDelegate,Stoppable
@LimitedPrivate("Configuration")
@Evolving
public class SnapshotHFileCleaner
extends BaseHFileCleanerDelegate
Implementation of a file cleaner that checks if a hfile is still used by snapshots of HBase
tables.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SnapshotFileCacheFile cache for HFiles in the completed and currently running snapshotsprivate static final longRefresh cache, by default, every 5 minutesstatic final StringConf key for the frequency to attempt to refresh the cache of hfiles currently used in snapshots (ms)private static final org.slf4j.Loggerprivate MasterServices -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionIterable<org.apache.hadoop.fs.FileStatus>getDeletableFiles(Iterable<org.apache.hadoop.fs.FileStatus> files) Determines which of the given files are safe to deleteExposed for Testing!voidthis method is used to pass some instance into subclassprotected booleanisFileDeletable(org.apache.hadoop.fs.FileStatus fStat) Should the master delete the file or keep it?booleanReturns True ifStoppable.stop(String)has been closed.voidsetConf(org.apache.hadoop.conf.Configuration conf) voidStop this service.Methods inherited from class org.apache.hadoop.hbase.BaseConfigurable
getConfMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.conf.Configurable
getConfMethods inherited from interface org.apache.hadoop.hbase.master.cleaner.FileCleanerDelegate
isEmptyDirDeletable, postClean, preClean
-
Field Details
-
LOG
-
HFILE_CACHE_REFRESH_PERIOD_CONF_KEY
Conf key for the frequency to attempt to refresh the cache of hfiles currently used in snapshots (ms)- See Also:
-
DEFAULT_HFILE_CACHE_REFRESH_PERIOD
Refresh cache, by default, every 5 minutes- See Also:
-
cache
File cache for HFiles in the completed and currently running snapshots -
master
-
-
Constructor Details
-
SnapshotHFileCleaner
public SnapshotHFileCleaner()
-
-
Method Details
-
getDeletableFiles
public Iterable<org.apache.hadoop.fs.FileStatus> getDeletableFiles(Iterable<org.apache.hadoop.fs.FileStatus> files) Description copied from interface:FileCleanerDelegateDetermines which of the given files are safe to delete- Specified by:
getDeletableFilesin interfaceFileCleanerDelegate- Overrides:
getDeletableFilesin classBaseFileCleanerDelegate- Parameters:
files- files to check for deletion- Returns:
- files that are ok to delete according to this cleaner
-
init
Description copied from interface:FileCleanerDelegatethis method is used to pass some instance into subclass- Specified by:
initin interfaceFileCleanerDelegate- Overrides:
initin classBaseFileCleanerDelegate
-
isFileDeletable
Description copied from class:BaseFileCleanerDelegateShould the master delete the file or keep it?- Specified by:
isFileDeletablein classBaseFileCleanerDelegate- Parameters:
fStat- file status of the file to check- Returns:
- true if the file is deletable, false if not
-
setConf
- Specified by:
setConfin interfaceorg.apache.hadoop.conf.Configurable- Overrides:
setConfin classBaseConfigurable
-
stop
Description copied from interface:StoppableStop this service. Implementers should favor logging errors over throwing RuntimeExceptions.- Specified by:
stopin interfaceStoppable- Overrides:
stopin classBaseHFileCleanerDelegate- Parameters:
why- Why we're stopping.
-
isStopped
Description copied from interface:StoppableReturns True ifStoppable.stop(String)has been closed.- Specified by:
isStoppedin interfaceStoppable- Overrides:
isStoppedin classBaseHFileCleanerDelegate
-
getFileCacheForTesting
Exposed for Testing!- Returns:
- the cache of all hfiles
-