org.apache.hadoop.hbase.master.snapshot
Class SnapshotHFileCleaner

java.lang.Object
  extended by org.apache.hadoop.hbase.BaseConfigurable
      extended by org.apache.hadoop.hbase.master.cleaner.BaseFileCleanerDelegate
          extended by org.apache.hadoop.hbase.master.cleaner.BaseHFileCleanerDelegate
              extended by org.apache.hadoop.hbase.master.snapshot.SnapshotHFileCleaner
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable, FileCleanerDelegate, Stoppable

@InterfaceAudience.LimitedPrivate(value="Configuration")
@InterfaceStability.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
static String HFILE_CACHE_REFRESH_PERIOD_CONF_KEY
          Conf key for the frequency to attempt to refresh the cache of hfiles currently used in snapshots (ms)
 
Constructor Summary
SnapshotHFileCleaner()
           
 
Method Summary
 Iterable<org.apache.hadoop.fs.FileStatus> getDeletableFiles(Iterable<org.apache.hadoop.fs.FileStatus> files)
          Determines which of the given files are safe to delete
 SnapshotFileCache getFileCacheForTesting()
          Exposed for Testing!
protected  boolean isFileDeletable(org.apache.hadoop.fs.FileStatus fStat)
          Should the master delete the file or keep it?
 boolean isStopped()
           
 void setConf(org.apache.hadoop.conf.Configuration conf)
           
 void stop(String why)
          Stop this service.
 
Methods inherited from class org.apache.hadoop.hbase.BaseConfigurable
getConf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.conf.Configurable
getConf
 

Field Detail

HFILE_CACHE_REFRESH_PERIOD_CONF_KEY

public static final String 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:
Constant Field Values
Constructor Detail

SnapshotHFileCleaner

public SnapshotHFileCleaner()
Method Detail

getDeletableFiles

public Iterable<org.apache.hadoop.fs.FileStatus> getDeletableFiles(Iterable<org.apache.hadoop.fs.FileStatus> files)
Description copied from interface: FileCleanerDelegate
Determines which of the given files are safe to delete

Specified by:
getDeletableFiles in interface FileCleanerDelegate
Overrides:
getDeletableFiles in class BaseFileCleanerDelegate
Parameters:
files - files to check for deletion
Returns:
files that are ok to delete according to this cleaner

isFileDeletable

protected boolean isFileDeletable(org.apache.hadoop.fs.FileStatus fStat)
Description copied from class: BaseFileCleanerDelegate
Should the master delete the file or keep it?

Specified by:
isFileDeletable in class BaseFileCleanerDelegate
Parameters:
fStat - file status of the file to check
Returns:
true if the file is deletable, false if not

setConf

public void setConf(org.apache.hadoop.conf.Configuration conf)
Specified by:
setConf in interface org.apache.hadoop.conf.Configurable
Overrides:
setConf in class BaseConfigurable

stop

public void stop(String why)
Description copied from interface: Stoppable
Stop this service.

Specified by:
stop in interface Stoppable
Overrides:
stop in class BaseHFileCleanerDelegate
Parameters:
why - Why we're stopping.

isStopped

public boolean isStopped()
Specified by:
isStopped in interface Stoppable
Overrides:
isStopped in class BaseHFileCleanerDelegate
Returns:
True if Stoppable.stop(String) has been closed.

getFileCacheForTesting

public SnapshotFileCache getFileCacheForTesting()
Exposed for Testing!

Returns:
the cache of all hfiles


Copyright © 2015 The Apache Software Foundation. All rights reserved.