hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [07/52] [partial] hbase-site git commit: Published site at 950d547dae684155020edb879a343bee1bf18e97.
Date Mon, 29 Aug 2016 15:32:57 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/45a663dd/devapidocs/src-html/org/apache/hadoop/hbase/master/snapshot/SnapshotHFileCleaner.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/master/snapshot/SnapshotHFileCleaner.html
b/devapidocs/src-html/org/apache/hadoop/hbase/master/snapshot/SnapshotHFileCleaner.html
index ba72892..4c78c07 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/master/snapshot/SnapshotHFileCleaner.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/master/snapshot/SnapshotHFileCleaner.html
@@ -28,97 +28,110 @@
 <span class="sourceLineNo">020</span>import java.io.IOException;<a name="line.20"></a>
 <span class="sourceLineNo">021</span>import java.util.Collection;<a name="line.21"></a>
 <span class="sourceLineNo">022</span>import java.util.Collections;<a name="line.22"></a>
-<span class="sourceLineNo">023</span><a name="line.23"></a>
-<span class="sourceLineNo">024</span>import org.apache.commons.logging.Log;<a
name="line.24"></a>
-<span class="sourceLineNo">025</span>import org.apache.commons.logging.LogFactory;<a
name="line.25"></a>
-<span class="sourceLineNo">026</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a
name="line.26"></a>
-<span class="sourceLineNo">027</span>import org.apache.hadoop.hbase.classification.InterfaceStability;<a
name="line.27"></a>
-<span class="sourceLineNo">028</span>import org.apache.hadoop.conf.Configuration;<a
name="line.28"></a>
-<span class="sourceLineNo">029</span>import org.apache.hadoop.fs.FileStatus;<a
name="line.29"></a>
-<span class="sourceLineNo">030</span>import org.apache.hadoop.fs.FileSystem;<a
name="line.30"></a>
-<span class="sourceLineNo">031</span>import org.apache.hadoop.fs.Path;<a name="line.31"></a>
-<span class="sourceLineNo">032</span>import org.apache.hadoop.hbase.HBaseInterfaceAudience;<a
name="line.32"></a>
-<span class="sourceLineNo">033</span>import org.apache.hadoop.hbase.master.cleaner.BaseHFileCleanerDelegate;<a
name="line.33"></a>
-<span class="sourceLineNo">034</span>import org.apache.hadoop.hbase.snapshot.CorruptedSnapshotException;<a
name="line.34"></a>
-<span class="sourceLineNo">035</span>import org.apache.hadoop.hbase.snapshot.SnapshotReferenceUtil;<a
name="line.35"></a>
-<span class="sourceLineNo">036</span>import org.apache.hadoop.hbase.util.FSUtils;<a
name="line.36"></a>
-<span class="sourceLineNo">037</span><a name="line.37"></a>
-<span class="sourceLineNo">038</span>/**<a name="line.38"></a>
-<span class="sourceLineNo">039</span> * Implementation of a file cleaner that
checks if a hfile is still used by snapshots of HBase<a name="line.39"></a>
-<span class="sourceLineNo">040</span> * tables.<a name="line.40"></a>
-<span class="sourceLineNo">041</span> */<a name="line.41"></a>
-<span class="sourceLineNo">042</span>@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)<a
name="line.42"></a>
-<span class="sourceLineNo">043</span>@InterfaceStability.Evolving<a name="line.43"></a>
-<span class="sourceLineNo">044</span>public class SnapshotHFileCleaner extends
BaseHFileCleanerDelegate {<a name="line.44"></a>
-<span class="sourceLineNo">045</span>  private static final Log LOG = LogFactory.getLog(SnapshotHFileCleaner.class);<a
name="line.45"></a>
-<span class="sourceLineNo">046</span><a name="line.46"></a>
-<span class="sourceLineNo">047</span>  /**<a name="line.47"></a>
-<span class="sourceLineNo">048</span>   * Conf key for the frequency to attempt
to refresh the cache of hfiles currently used in<a name="line.48"></a>
-<span class="sourceLineNo">049</span>   * snapshots (ms)<a name="line.49"></a>
-<span class="sourceLineNo">050</span>   */<a name="line.50"></a>
-<span class="sourceLineNo">051</span>  public static final String HFILE_CACHE_REFRESH_PERIOD_CONF_KEY
=<a name="line.51"></a>
-<span class="sourceLineNo">052</span>      "hbase.master.hfilecleaner.plugins.snapshot.period";<a
name="line.52"></a>
-<span class="sourceLineNo">053</span><a name="line.53"></a>
-<span class="sourceLineNo">054</span>  /** Refresh cache, by default, every 5
minutes */<a name="line.54"></a>
-<span class="sourceLineNo">055</span>  private static final long DEFAULT_HFILE_CACHE_REFRESH_PERIOD
= 300000;<a name="line.55"></a>
+<span class="sourceLineNo">023</span>import java.util.Map;<a name="line.23"></a>
+<span class="sourceLineNo">024</span><a name="line.24"></a>
+<span class="sourceLineNo">025</span>import org.apache.commons.logging.Log;<a
name="line.25"></a>
+<span class="sourceLineNo">026</span>import org.apache.commons.logging.LogFactory;<a
name="line.26"></a>
+<span class="sourceLineNo">027</span>import org.apache.hadoop.hbase.classification.InterfaceAudience;<a
name="line.27"></a>
+<span class="sourceLineNo">028</span>import org.apache.hadoop.hbase.classification.InterfaceStability;<a
name="line.28"></a>
+<span class="sourceLineNo">029</span>import org.apache.hadoop.conf.Configuration;<a
name="line.29"></a>
+<span class="sourceLineNo">030</span>import org.apache.hadoop.fs.FileStatus;<a
name="line.30"></a>
+<span class="sourceLineNo">031</span>import org.apache.hadoop.fs.FileSystem;<a
name="line.31"></a>
+<span class="sourceLineNo">032</span>import org.apache.hadoop.fs.Path;<a name="line.32"></a>
+<span class="sourceLineNo">033</span>import org.apache.hadoop.hbase.HBaseInterfaceAudience;<a
name="line.33"></a>
+<span class="sourceLineNo">034</span>import org.apache.hadoop.hbase.master.HMaster;<a
name="line.34"></a>
+<span class="sourceLineNo">035</span>import org.apache.hadoop.hbase.master.MasterServices;<a
name="line.35"></a>
+<span class="sourceLineNo">036</span>import org.apache.hadoop.hbase.master.cleaner.BaseHFileCleanerDelegate;<a
name="line.36"></a>
+<span class="sourceLineNo">037</span>import org.apache.hadoop.hbase.snapshot.CorruptedSnapshotException;<a
name="line.37"></a>
+<span class="sourceLineNo">038</span>import org.apache.hadoop.hbase.snapshot.SnapshotReferenceUtil;<a
name="line.38"></a>
+<span class="sourceLineNo">039</span>import org.apache.hadoop.hbase.util.FSUtils;<a
name="line.39"></a>
+<span class="sourceLineNo">040</span><a name="line.40"></a>
+<span class="sourceLineNo">041</span>/**<a name="line.41"></a>
+<span class="sourceLineNo">042</span> * Implementation of a file cleaner that
checks if a hfile is still used by snapshots of HBase<a name="line.42"></a>
+<span class="sourceLineNo">043</span> * tables.<a name="line.43"></a>
+<span class="sourceLineNo">044</span> */<a name="line.44"></a>
+<span class="sourceLineNo">045</span>@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)<a
name="line.45"></a>
+<span class="sourceLineNo">046</span>@InterfaceStability.Evolving<a name="line.46"></a>
+<span class="sourceLineNo">047</span>public class SnapshotHFileCleaner extends
BaseHFileCleanerDelegate {<a name="line.47"></a>
+<span class="sourceLineNo">048</span>  private static final Log LOG = LogFactory.getLog(SnapshotHFileCleaner.class);<a
name="line.48"></a>
+<span class="sourceLineNo">049</span><a name="line.49"></a>
+<span class="sourceLineNo">050</span>  /**<a name="line.50"></a>
+<span class="sourceLineNo">051</span>   * Conf key for the frequency to attempt
to refresh the cache of hfiles currently used in<a name="line.51"></a>
+<span class="sourceLineNo">052</span>   * snapshots (ms)<a name="line.52"></a>
+<span class="sourceLineNo">053</span>   */<a name="line.53"></a>
+<span class="sourceLineNo">054</span>  public static final String HFILE_CACHE_REFRESH_PERIOD_CONF_KEY
=<a name="line.54"></a>
+<span class="sourceLineNo">055</span>      "hbase.master.hfilecleaner.plugins.snapshot.period";<a
name="line.55"></a>
 <span class="sourceLineNo">056</span><a name="line.56"></a>
-<span class="sourceLineNo">057</span>  /** File cache for HFiles in the completed
and currently running snapshots */<a name="line.57"></a>
-<span class="sourceLineNo">058</span>  private SnapshotFileCache cache;<a
name="line.58"></a>
+<span class="sourceLineNo">057</span>  /** Refresh cache, by default, every 5
minutes */<a name="line.57"></a>
+<span class="sourceLineNo">058</span>  private static final long DEFAULT_HFILE_CACHE_REFRESH_PERIOD
= 300000;<a name="line.58"></a>
 <span class="sourceLineNo">059</span><a name="line.59"></a>
-<span class="sourceLineNo">060</span>  @Override<a name="line.60"></a>
-<span class="sourceLineNo">061</span>  public synchronized Iterable&lt;FileStatus&gt;
getDeletableFiles(Iterable&lt;FileStatus&gt; files) {<a name="line.61"></a>
-<span class="sourceLineNo">062</span>    try {<a name="line.62"></a>
-<span class="sourceLineNo">063</span>      return cache.getUnreferencedFiles(files);<a
name="line.63"></a>
-<span class="sourceLineNo">064</span>    } catch (CorruptedSnapshotException
cse) {<a name="line.64"></a>
-<span class="sourceLineNo">065</span>      LOG.debug("Corrupted in-progress snapshot
file exception, ignored ", cse);<a name="line.65"></a>
-<span class="sourceLineNo">066</span>    } catch (IOException e) {<a name="line.66"></a>
-<span class="sourceLineNo">067</span>      LOG.error("Exception while checking
if files were valid, keeping them just in case.", e);<a name="line.67"></a>
-<span class="sourceLineNo">068</span>    }<a name="line.68"></a>
-<span class="sourceLineNo">069</span>    return Collections.emptyList();<a
name="line.69"></a>
-<span class="sourceLineNo">070</span>  }<a name="line.70"></a>
-<span class="sourceLineNo">071</span><a name="line.71"></a>
-<span class="sourceLineNo">072</span>  @Override<a name="line.72"></a>
-<span class="sourceLineNo">073</span>  protected boolean isFileDeletable(FileStatus
fStat) {<a name="line.73"></a>
-<span class="sourceLineNo">074</span>    return false;<a name="line.74"></a>
+<span class="sourceLineNo">060</span>  /** File cache for HFiles in the completed
and currently running snapshots */<a name="line.60"></a>
+<span class="sourceLineNo">061</span>  private SnapshotFileCache cache;<a
name="line.61"></a>
+<span class="sourceLineNo">062</span><a name="line.62"></a>
+<span class="sourceLineNo">063</span>  private MasterServices master;<a name="line.63"></a>
+<span class="sourceLineNo">064</span><a name="line.64"></a>
+<span class="sourceLineNo">065</span>  @Override<a name="line.65"></a>
+<span class="sourceLineNo">066</span>  public synchronized Iterable&lt;FileStatus&gt;
getDeletableFiles(Iterable&lt;FileStatus&gt; files) {<a name="line.66"></a>
+<span class="sourceLineNo">067</span>    try {<a name="line.67"></a>
+<span class="sourceLineNo">068</span>      return cache.getUnreferencedFiles(files,
master.getSnapshotManager());<a name="line.68"></a>
+<span class="sourceLineNo">069</span>    } catch (CorruptedSnapshotException
cse) {<a name="line.69"></a>
+<span class="sourceLineNo">070</span>      LOG.debug("Corrupted in-progress snapshot
file exception, ignored ", cse);<a name="line.70"></a>
+<span class="sourceLineNo">071</span>    } catch (IOException e) {<a name="line.71"></a>
+<span class="sourceLineNo">072</span>      LOG.error("Exception while checking
if files were valid, keeping them just in case.", e);<a name="line.72"></a>
+<span class="sourceLineNo">073</span>    }<a name="line.73"></a>
+<span class="sourceLineNo">074</span>    return Collections.emptyList();<a
name="line.74"></a>
 <span class="sourceLineNo">075</span>  }<a name="line.75"></a>
 <span class="sourceLineNo">076</span><a name="line.76"></a>
-<span class="sourceLineNo">077</span>  public void setConf(final Configuration
conf) {<a name="line.77"></a>
-<span class="sourceLineNo">078</span>    super.setConf(conf);<a name="line.78"></a>
-<span class="sourceLineNo">079</span>    try {<a name="line.79"></a>
-<span class="sourceLineNo">080</span>      long cacheRefreshPeriod = conf.getLong(HFILE_CACHE_REFRESH_PERIOD_CONF_KEY,<a
name="line.80"></a>
-<span class="sourceLineNo">081</span>        DEFAULT_HFILE_CACHE_REFRESH_PERIOD);<a
name="line.81"></a>
-<span class="sourceLineNo">082</span>      final FileSystem fs = FSUtils.getCurrentFileSystem(conf);<a
name="line.82"></a>
-<span class="sourceLineNo">083</span>      Path rootDir = FSUtils.getRootDir(conf);<a
name="line.83"></a>
-<span class="sourceLineNo">084</span>      cache = new SnapshotFileCache(fs,
rootDir, cacheRefreshPeriod, cacheRefreshPeriod,<a name="line.84"></a>
-<span class="sourceLineNo">085</span>          "snapshot-hfile-cleaner-cache-refresher",
new SnapshotFileCache.SnapshotFileInspector() {<a name="line.85"></a>
-<span class="sourceLineNo">086</span>            public Collection&lt;String&gt;
filesUnderSnapshot(final Path snapshotDir)<a name="line.86"></a>
-<span class="sourceLineNo">087</span>                throws IOException {<a
name="line.87"></a>
-<span class="sourceLineNo">088</span>              return SnapshotReferenceUtil.getHFileNames(conf,
fs, snapshotDir);<a name="line.88"></a>
-<span class="sourceLineNo">089</span>            }<a name="line.89"></a>
-<span class="sourceLineNo">090</span>          });<a name="line.90"></a>
-<span class="sourceLineNo">091</span>    } catch (IOException e) {<a name="line.91"></a>
-<span class="sourceLineNo">092</span>      LOG.error("Failed to create cleaner
util", e);<a name="line.92"></a>
-<span class="sourceLineNo">093</span>    }<a name="line.93"></a>
-<span class="sourceLineNo">094</span>  }<a name="line.94"></a>
-<span class="sourceLineNo">095</span><a name="line.95"></a>
-<span class="sourceLineNo">096</span>  @Override<a name="line.96"></a>
-<span class="sourceLineNo">097</span>  public void stop(String why) {<a name="line.97"></a>
-<span class="sourceLineNo">098</span>    this.cache.stop(why);<a name="line.98"></a>
-<span class="sourceLineNo">099</span>  }<a name="line.99"></a>
-<span class="sourceLineNo">100</span><a name="line.100"></a>
-<span class="sourceLineNo">101</span>  @Override<a name="line.101"></a>
-<span class="sourceLineNo">102</span>  public boolean isStopped() {<a name="line.102"></a>
-<span class="sourceLineNo">103</span>    return this.cache.isStopped();<a
name="line.103"></a>
-<span class="sourceLineNo">104</span>  }<a name="line.104"></a>
-<span class="sourceLineNo">105</span><a name="line.105"></a>
-<span class="sourceLineNo">106</span>  /**<a name="line.106"></a>
-<span class="sourceLineNo">107</span>   * Exposed for Testing!<a name="line.107"></a>
-<span class="sourceLineNo">108</span>   * @return the cache of all hfiles<a
name="line.108"></a>
-<span class="sourceLineNo">109</span>   */<a name="line.109"></a>
-<span class="sourceLineNo">110</span>  public SnapshotFileCache getFileCacheForTesting()
{<a name="line.110"></a>
-<span class="sourceLineNo">111</span>    return this.cache;<a name="line.111"></a>
+<span class="sourceLineNo">077</span>  @Override<a name="line.77"></a>
+<span class="sourceLineNo">078</span>  public void init(Map&lt;String, Object&gt;
params) {<a name="line.78"></a>
+<span class="sourceLineNo">079</span>    if (params.containsKey(HMaster.MASTER))
{<a name="line.79"></a>
+<span class="sourceLineNo">080</span>      this.master = (MasterServices) params.get(HMaster.MASTER);<a
name="line.80"></a>
+<span class="sourceLineNo">081</span>    }<a name="line.81"></a>
+<span class="sourceLineNo">082</span>  }<a name="line.82"></a>
+<span class="sourceLineNo">083</span><a name="line.83"></a>
+<span class="sourceLineNo">084</span>  @Override<a name="line.84"></a>
+<span class="sourceLineNo">085</span>  protected boolean isFileDeletable(FileStatus
fStat) {<a name="line.85"></a>
+<span class="sourceLineNo">086</span>    return false;<a name="line.86"></a>
+<span class="sourceLineNo">087</span>  }<a name="line.87"></a>
+<span class="sourceLineNo">088</span><a name="line.88"></a>
+<span class="sourceLineNo">089</span>  public void setConf(final Configuration
conf) {<a name="line.89"></a>
+<span class="sourceLineNo">090</span>    super.setConf(conf);<a name="line.90"></a>
+<span class="sourceLineNo">091</span>    try {<a name="line.91"></a>
+<span class="sourceLineNo">092</span>      long cacheRefreshPeriod = conf.getLong(HFILE_CACHE_REFRESH_PERIOD_CONF_KEY,<a
name="line.92"></a>
+<span class="sourceLineNo">093</span>        DEFAULT_HFILE_CACHE_REFRESH_PERIOD);<a
name="line.93"></a>
+<span class="sourceLineNo">094</span>      final FileSystem fs = FSUtils.getCurrentFileSystem(conf);<a
name="line.94"></a>
+<span class="sourceLineNo">095</span>      Path rootDir = FSUtils.getRootDir(conf);<a
name="line.95"></a>
+<span class="sourceLineNo">096</span>      cache = new SnapshotFileCache(fs,
rootDir, cacheRefreshPeriod, cacheRefreshPeriod,<a name="line.96"></a>
+<span class="sourceLineNo">097</span>          "snapshot-hfile-cleaner-cache-refresher",
new SnapshotFileCache.SnapshotFileInspector() {<a name="line.97"></a>
+<span class="sourceLineNo">098</span>            public Collection&lt;String&gt;
filesUnderSnapshot(final Path snapshotDir)<a name="line.98"></a>
+<span class="sourceLineNo">099</span>                throws IOException {<a
name="line.99"></a>
+<span class="sourceLineNo">100</span>              return SnapshotReferenceUtil.getHFileNames(conf,
fs, snapshotDir);<a name="line.100"></a>
+<span class="sourceLineNo">101</span>            }<a name="line.101"></a>
+<span class="sourceLineNo">102</span>          });<a name="line.102"></a>
+<span class="sourceLineNo">103</span>    } catch (IOException e) {<a name="line.103"></a>
+<span class="sourceLineNo">104</span>      LOG.error("Failed to create cleaner
util", e);<a name="line.104"></a>
+<span class="sourceLineNo">105</span>    }<a name="line.105"></a>
+<span class="sourceLineNo">106</span>  }<a name="line.106"></a>
+<span class="sourceLineNo">107</span><a name="line.107"></a>
+<span class="sourceLineNo">108</span><a name="line.108"></a>
+<span class="sourceLineNo">109</span>  @Override<a name="line.109"></a>
+<span class="sourceLineNo">110</span>  public void stop(String why) {<a name="line.110"></a>
+<span class="sourceLineNo">111</span>    this.cache.stop(why);<a name="line.111"></a>
 <span class="sourceLineNo">112</span>  }<a name="line.112"></a>
-<span class="sourceLineNo">113</span>}<a name="line.113"></a>
+<span class="sourceLineNo">113</span><a name="line.113"></a>
+<span class="sourceLineNo">114</span>  @Override<a name="line.114"></a>
+<span class="sourceLineNo">115</span>  public boolean isStopped() {<a name="line.115"></a>
+<span class="sourceLineNo">116</span>    return this.cache.isStopped();<a
name="line.116"></a>
+<span class="sourceLineNo">117</span>  }<a name="line.117"></a>
+<span class="sourceLineNo">118</span><a name="line.118"></a>
+<span class="sourceLineNo">119</span>  /**<a name="line.119"></a>
+<span class="sourceLineNo">120</span>   * Exposed for Testing!<a name="line.120"></a>
+<span class="sourceLineNo">121</span>   * @return the cache of all hfiles<a
name="line.121"></a>
+<span class="sourceLineNo">122</span>   */<a name="line.122"></a>
+<span class="sourceLineNo">123</span>  public SnapshotFileCache getFileCacheForTesting()
{<a name="line.123"></a>
+<span class="sourceLineNo">124</span>    return this.cache;<a name="line.124"></a>
+<span class="sourceLineNo">125</span>  }<a name="line.125"></a>
+<span class="sourceLineNo">126</span>}<a name="line.126"></a>
 
 
 


Mime
View raw message