hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [06/51] [partial] hbase-site git commit: Published site at cb17c7a97a1e2eb0ebd532f614191e4edbb9e49b.
Date Fri, 15 Jan 2016 17:04:11 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/50917b1d/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/MasterProcedureEnv.MasterProcedureStoreListener.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/MasterProcedureEnv.MasterProcedureStoreListener.html b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/MasterProcedureEnv.MasterProcedureStoreListener.html
index 1610d02..5cdd36e 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/MasterProcedureEnv.MasterProcedureStoreListener.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/MasterProcedureEnv.MasterProcedureStoreListener.html
@@ -39,101 +39,127 @@
 <span class="sourceLineNo">031</span>import org.apache.hadoop.hbase.master.HMaster;<a name="line.31"></a>
 <span class="sourceLineNo">032</span>import org.apache.hadoop.hbase.master.MasterCoprocessorHost;<a name="line.32"></a>
 <span class="sourceLineNo">033</span>import org.apache.hadoop.hbase.master.MasterServices;<a name="line.33"></a>
-<span class="sourceLineNo">034</span>import org.apache.hadoop.hbase.procedure2.store.ProcedureStore;<a name="line.34"></a>
-<span class="sourceLineNo">035</span>import org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore;<a name="line.35"></a>
-<span class="sourceLineNo">036</span>import org.apache.hadoop.hbase.security.User;<a name="line.36"></a>
-<span class="sourceLineNo">037</span>import org.apache.hadoop.hbase.security.UserProvider;<a name="line.37"></a>
-<span class="sourceLineNo">038</span>import org.apache.hadoop.hbase.util.CancelableProgressable;<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>@InterfaceAudience.Private<a name="line.41"></a>
-<span class="sourceLineNo">042</span>@InterfaceStability.Evolving<a name="line.42"></a>
-<span class="sourceLineNo">043</span>public class MasterProcedureEnv {<a name="line.43"></a>
-<span class="sourceLineNo">044</span>  private static final Log LOG = LogFactory.getLog(MasterProcedureEnv.class);<a name="line.44"></a>
-<span class="sourceLineNo">045</span><a name="line.45"></a>
-<span class="sourceLineNo">046</span>  @InterfaceAudience.Private<a name="line.46"></a>
-<span class="sourceLineNo">047</span>  public static class WALStoreLeaseRecovery implements WALProcedureStore.LeaseRecovery {<a name="line.47"></a>
-<span class="sourceLineNo">048</span>    private final HMaster master;<a name="line.48"></a>
-<span class="sourceLineNo">049</span><a name="line.49"></a>
-<span class="sourceLineNo">050</span>    public WALStoreLeaseRecovery(final HMaster master) {<a name="line.50"></a>
-<span class="sourceLineNo">051</span>      this.master = master;<a name="line.51"></a>
-<span class="sourceLineNo">052</span>    }<a name="line.52"></a>
-<span class="sourceLineNo">053</span><a name="line.53"></a>
-<span class="sourceLineNo">054</span>    @Override<a name="line.54"></a>
-<span class="sourceLineNo">055</span>    public void recoverFileLease(final FileSystem fs, final Path path) throws IOException {<a name="line.55"></a>
-<span class="sourceLineNo">056</span>      final Configuration conf = master.getConfiguration();<a name="line.56"></a>
-<span class="sourceLineNo">057</span>      final FSUtils fsUtils = FSUtils.getInstance(fs, conf);<a name="line.57"></a>
-<span class="sourceLineNo">058</span>      fsUtils.recoverFileLease(fs, path, conf, new CancelableProgressable() {<a name="line.58"></a>
-<span class="sourceLineNo">059</span>        @Override<a name="line.59"></a>
-<span class="sourceLineNo">060</span>        public boolean progress() {<a name="line.60"></a>
-<span class="sourceLineNo">061</span>          LOG.debug("Recover Procedure Store log lease: " + path);<a name="line.61"></a>
-<span class="sourceLineNo">062</span>          return master.isActiveMaster();<a name="line.62"></a>
-<span class="sourceLineNo">063</span>        }<a name="line.63"></a>
-<span class="sourceLineNo">064</span>      });<a name="line.64"></a>
-<span class="sourceLineNo">065</span>    }<a name="line.65"></a>
-<span class="sourceLineNo">066</span>  }<a name="line.66"></a>
-<span class="sourceLineNo">067</span><a name="line.67"></a>
-<span class="sourceLineNo">068</span>  @InterfaceAudience.Private<a name="line.68"></a>
-<span class="sourceLineNo">069</span>  public static class MasterProcedureStoreListener<a name="line.69"></a>
-<span class="sourceLineNo">070</span>      implements ProcedureStore.ProcedureStoreListener {<a name="line.70"></a>
-<span class="sourceLineNo">071</span>    private final HMaster master;<a name="line.71"></a>
-<span class="sourceLineNo">072</span><a name="line.72"></a>
-<span class="sourceLineNo">073</span>    public MasterProcedureStoreListener(final HMaster master) {<a name="line.73"></a>
-<span class="sourceLineNo">074</span>      this.master = master;<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>    @Override<a name="line.77"></a>
-<span class="sourceLineNo">078</span>    public void postSync() {<a name="line.78"></a>
-<span class="sourceLineNo">079</span>      // no-op<a name="line.79"></a>
-<span class="sourceLineNo">080</span>    }<a name="line.80"></a>
-<span class="sourceLineNo">081</span><a name="line.81"></a>
-<span class="sourceLineNo">082</span>    @Override<a name="line.82"></a>
-<span class="sourceLineNo">083</span>    public void abortProcess() {<a name="line.83"></a>
-<span class="sourceLineNo">084</span>      master.abort("The Procedure Store lost the lease");<a name="line.84"></a>
-<span class="sourceLineNo">085</span>    }<a name="line.85"></a>
-<span class="sourceLineNo">086</span>  }<a name="line.86"></a>
-<span class="sourceLineNo">087</span><a name="line.87"></a>
-<span class="sourceLineNo">088</span>  private final MasterProcedureQueue procQueue;<a name="line.88"></a>
-<span class="sourceLineNo">089</span>  private final MasterServices master;<a name="line.89"></a>
-<span class="sourceLineNo">090</span><a name="line.90"></a>
-<span class="sourceLineNo">091</span>  public MasterProcedureEnv(final MasterServices master) {<a name="line.91"></a>
-<span class="sourceLineNo">092</span>    this.master = master;<a name="line.92"></a>
-<span class="sourceLineNo">093</span>    this.procQueue = new MasterProcedureQueue(master.getConfiguration(),<a name="line.93"></a>
-<span class="sourceLineNo">094</span>      master.getTableLockManager());<a name="line.94"></a>
-<span class="sourceLineNo">095</span>  }<a name="line.95"></a>
-<span class="sourceLineNo">096</span><a name="line.96"></a>
-<span class="sourceLineNo">097</span>  public User getRequestUser() throws IOException {<a name="line.97"></a>
-<span class="sourceLineNo">098</span>    User user = RpcServer.getRequestUser();<a name="line.98"></a>
-<span class="sourceLineNo">099</span>    if (user == null) {<a name="line.99"></a>
-<span class="sourceLineNo">100</span>      user = UserProvider.instantiate(getMasterConfiguration()).getCurrent();<a name="line.100"></a>
-<span class="sourceLineNo">101</span>    }<a name="line.101"></a>
-<span class="sourceLineNo">102</span>    return user;<a name="line.102"></a>
-<span class="sourceLineNo">103</span>  }<a name="line.103"></a>
-<span class="sourceLineNo">104</span><a name="line.104"></a>
-<span class="sourceLineNo">105</span>  public MasterServices getMasterServices() {<a name="line.105"></a>
-<span class="sourceLineNo">106</span>    return master;<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>  public Configuration getMasterConfiguration() {<a name="line.109"></a>
-<span class="sourceLineNo">110</span>    return master.getConfiguration();<a name="line.110"></a>
-<span class="sourceLineNo">111</span>  }<a name="line.111"></a>
-<span class="sourceLineNo">112</span><a name="line.112"></a>
-<span class="sourceLineNo">113</span>  public MasterCoprocessorHost getMasterCoprocessorHost() {<a name="line.113"></a>
-<span class="sourceLineNo">114</span>    return master.getMasterCoprocessorHost();<a name="line.114"></a>
-<span class="sourceLineNo">115</span>  }<a name="line.115"></a>
-<span class="sourceLineNo">116</span><a name="line.116"></a>
-<span class="sourceLineNo">117</span>  public MasterProcedureQueue getProcedureQueue() {<a name="line.117"></a>
-<span class="sourceLineNo">118</span>    return procQueue;<a name="line.118"></a>
-<span class="sourceLineNo">119</span>  }<a name="line.119"></a>
-<span class="sourceLineNo">120</span><a name="line.120"></a>
-<span class="sourceLineNo">121</span>  public boolean isRunning() {<a name="line.121"></a>
-<span class="sourceLineNo">122</span>    return master.getMasterProcedureExecutor().isRunning();<a name="line.122"></a>
-<span class="sourceLineNo">123</span>  }<a name="line.123"></a>
-<span class="sourceLineNo">124</span><a name="line.124"></a>
-<span class="sourceLineNo">125</span>  public boolean isInitialized() {<a name="line.125"></a>
-<span class="sourceLineNo">126</span>    return master.isInitialized();<a name="line.126"></a>
-<span class="sourceLineNo">127</span>  }<a name="line.127"></a>
-<span class="sourceLineNo">128</span>}<a name="line.128"></a>
+<span class="sourceLineNo">034</span>import org.apache.hadoop.hbase.master.procedure.MasterProcedureScheduler.ProcedureEvent;<a name="line.34"></a>
+<span class="sourceLineNo">035</span>import org.apache.hadoop.hbase.procedure2.Procedure;<a name="line.35"></a>
+<span class="sourceLineNo">036</span>import org.apache.hadoop.hbase.procedure2.store.ProcedureStore;<a name="line.36"></a>
+<span class="sourceLineNo">037</span>import org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore;<a name="line.37"></a>
+<span class="sourceLineNo">038</span>import org.apache.hadoop.hbase.security.User;<a name="line.38"></a>
+<span class="sourceLineNo">039</span>import org.apache.hadoop.hbase.security.UserProvider;<a name="line.39"></a>
+<span class="sourceLineNo">040</span>import org.apache.hadoop.hbase.util.CancelableProgressable;<a name="line.40"></a>
+<span class="sourceLineNo">041</span>import org.apache.hadoop.hbase.util.FSUtils;<a name="line.41"></a>
+<span class="sourceLineNo">042</span><a name="line.42"></a>
+<span class="sourceLineNo">043</span>@InterfaceAudience.Private<a name="line.43"></a>
+<span class="sourceLineNo">044</span>@InterfaceStability.Evolving<a name="line.44"></a>
+<span class="sourceLineNo">045</span>public class MasterProcedureEnv {<a name="line.45"></a>
+<span class="sourceLineNo">046</span>  private static final Log LOG = LogFactory.getLog(MasterProcedureEnv.class);<a name="line.46"></a>
+<span class="sourceLineNo">047</span><a name="line.47"></a>
+<span class="sourceLineNo">048</span>  @InterfaceAudience.Private<a name="line.48"></a>
+<span class="sourceLineNo">049</span>  public static class WALStoreLeaseRecovery implements WALProcedureStore.LeaseRecovery {<a name="line.49"></a>
+<span class="sourceLineNo">050</span>    private final HMaster master;<a name="line.50"></a>
+<span class="sourceLineNo">051</span><a name="line.51"></a>
+<span class="sourceLineNo">052</span>    public WALStoreLeaseRecovery(final HMaster master) {<a name="line.52"></a>
+<span class="sourceLineNo">053</span>      this.master = master;<a name="line.53"></a>
+<span class="sourceLineNo">054</span>    }<a name="line.54"></a>
+<span class="sourceLineNo">055</span><a name="line.55"></a>
+<span class="sourceLineNo">056</span>    @Override<a name="line.56"></a>
+<span class="sourceLineNo">057</span>    public void recoverFileLease(final FileSystem fs, final Path path) throws IOException {<a name="line.57"></a>
+<span class="sourceLineNo">058</span>      final Configuration conf = master.getConfiguration();<a name="line.58"></a>
+<span class="sourceLineNo">059</span>      final FSUtils fsUtils = FSUtils.getInstance(fs, conf);<a name="line.59"></a>
+<span class="sourceLineNo">060</span>      fsUtils.recoverFileLease(fs, path, conf, new CancelableProgressable() {<a name="line.60"></a>
+<span class="sourceLineNo">061</span>        @Override<a name="line.61"></a>
+<span class="sourceLineNo">062</span>        public boolean progress() {<a name="line.62"></a>
+<span class="sourceLineNo">063</span>          LOG.debug("Recover Procedure Store log lease: " + path);<a name="line.63"></a>
+<span class="sourceLineNo">064</span>          return master.isActiveMaster();<a name="line.64"></a>
+<span class="sourceLineNo">065</span>        }<a name="line.65"></a>
+<span class="sourceLineNo">066</span>      });<a name="line.66"></a>
+<span class="sourceLineNo">067</span>    }<a name="line.67"></a>
+<span class="sourceLineNo">068</span>  }<a name="line.68"></a>
+<span class="sourceLineNo">069</span><a name="line.69"></a>
+<span class="sourceLineNo">070</span>  @InterfaceAudience.Private<a name="line.70"></a>
+<span class="sourceLineNo">071</span>  public static class MasterProcedureStoreListener<a name="line.71"></a>
+<span class="sourceLineNo">072</span>      implements ProcedureStore.ProcedureStoreListener {<a name="line.72"></a>
+<span class="sourceLineNo">073</span>    private final HMaster master;<a name="line.73"></a>
+<span class="sourceLineNo">074</span><a name="line.74"></a>
+<span class="sourceLineNo">075</span>    public MasterProcedureStoreListener(final HMaster master) {<a name="line.75"></a>
+<span class="sourceLineNo">076</span>      this.master = master;<a name="line.76"></a>
+<span class="sourceLineNo">077</span>    }<a name="line.77"></a>
+<span class="sourceLineNo">078</span><a name="line.78"></a>
+<span class="sourceLineNo">079</span>    @Override<a name="line.79"></a>
+<span class="sourceLineNo">080</span>    public void postSync() {<a name="line.80"></a>
+<span class="sourceLineNo">081</span>      // no-op<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>    public void abortProcess() {<a name="line.85"></a>
+<span class="sourceLineNo">086</span>      master.abort("The Procedure Store lost the lease");<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><a name="line.89"></a>
+<span class="sourceLineNo">090</span>  private final MasterProcedureScheduler procSched;<a name="line.90"></a>
+<span class="sourceLineNo">091</span>  private final MasterServices master;<a name="line.91"></a>
+<span class="sourceLineNo">092</span><a name="line.92"></a>
+<span class="sourceLineNo">093</span>  public MasterProcedureEnv(final MasterServices master) {<a name="line.93"></a>
+<span class="sourceLineNo">094</span>    this.master = master;<a name="line.94"></a>
+<span class="sourceLineNo">095</span>    this.procSched = new MasterProcedureScheduler(master.getConfiguration(),<a name="line.95"></a>
+<span class="sourceLineNo">096</span>      master.getTableLockManager());<a name="line.96"></a>
+<span class="sourceLineNo">097</span>  }<a name="line.97"></a>
+<span class="sourceLineNo">098</span><a name="line.98"></a>
+<span class="sourceLineNo">099</span>  public User getRequestUser() throws IOException {<a name="line.99"></a>
+<span class="sourceLineNo">100</span>    User user = RpcServer.getRequestUser();<a name="line.100"></a>
+<span class="sourceLineNo">101</span>    if (user == null) {<a name="line.101"></a>
+<span class="sourceLineNo">102</span>      user = UserProvider.instantiate(getMasterConfiguration()).getCurrent();<a name="line.102"></a>
+<span class="sourceLineNo">103</span>    }<a name="line.103"></a>
+<span class="sourceLineNo">104</span>    return user;<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>  public MasterServices getMasterServices() {<a name="line.107"></a>
+<span class="sourceLineNo">108</span>    return master;<a name="line.108"></a>
+<span class="sourceLineNo">109</span>  }<a name="line.109"></a>
+<span class="sourceLineNo">110</span><a name="line.110"></a>
+<span class="sourceLineNo">111</span>  public Configuration getMasterConfiguration() {<a name="line.111"></a>
+<span class="sourceLineNo">112</span>    return master.getConfiguration();<a name="line.112"></a>
+<span class="sourceLineNo">113</span>  }<a name="line.113"></a>
+<span class="sourceLineNo">114</span><a name="line.114"></a>
+<span class="sourceLineNo">115</span>  public MasterCoprocessorHost getMasterCoprocessorHost() {<a name="line.115"></a>
+<span class="sourceLineNo">116</span>    return master.getMasterCoprocessorHost();<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>  public MasterProcedureScheduler getProcedureQueue() {<a name="line.119"></a>
+<span class="sourceLineNo">120</span>    return procSched;<a name="line.120"></a>
+<span class="sourceLineNo">121</span>  }<a name="line.121"></a>
+<span class="sourceLineNo">122</span><a name="line.122"></a>
+<span class="sourceLineNo">123</span>  public boolean isRunning() {<a name="line.123"></a>
+<span class="sourceLineNo">124</span>    return master.getMasterProcedureExecutor().isRunning();<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>
+<span class="sourceLineNo">127</span>  public boolean isInitialized() {<a name="line.127"></a>
+<span class="sourceLineNo">128</span>    return master.isInitialized();<a name="line.128"></a>
+<span class="sourceLineNo">129</span>  }<a name="line.129"></a>
+<span class="sourceLineNo">130</span><a name="line.130"></a>
+<span class="sourceLineNo">131</span>  public boolean waitInitialized(Procedure proc) {<a name="line.131"></a>
+<span class="sourceLineNo">132</span>    return procSched.waitEvent(((HMaster)master).getInitializedEvent(), proc);<a name="line.132"></a>
+<span class="sourceLineNo">133</span>  }<a name="line.133"></a>
+<span class="sourceLineNo">134</span><a name="line.134"></a>
+<span class="sourceLineNo">135</span>  public boolean waitServerCrashProcessingEnabled(Procedure proc) {<a name="line.135"></a>
+<span class="sourceLineNo">136</span>    return procSched.waitEvent(((HMaster)master).getServerCrashProcessingEnabledEvent(), proc);<a name="line.136"></a>
+<span class="sourceLineNo">137</span>  }<a name="line.137"></a>
+<span class="sourceLineNo">138</span><a name="line.138"></a>
+<span class="sourceLineNo">139</span>  public void wake(ProcedureEvent event) {<a name="line.139"></a>
+<span class="sourceLineNo">140</span>    procSched.wake(event);<a name="line.140"></a>
+<span class="sourceLineNo">141</span>  }<a name="line.141"></a>
+<span class="sourceLineNo">142</span><a name="line.142"></a>
+<span class="sourceLineNo">143</span>  public void suspend(ProcedureEvent event) {<a name="line.143"></a>
+<span class="sourceLineNo">144</span>    procSched.suspend(event);<a name="line.144"></a>
+<span class="sourceLineNo">145</span>  }<a name="line.145"></a>
+<span class="sourceLineNo">146</span><a name="line.146"></a>
+<span class="sourceLineNo">147</span>  public void setEventReady(ProcedureEvent event, boolean isReady) {<a name="line.147"></a>
+<span class="sourceLineNo">148</span>    if (isReady) {<a name="line.148"></a>
+<span class="sourceLineNo">149</span>      procSched.wake(event);<a name="line.149"></a>
+<span class="sourceLineNo">150</span>    } else {<a name="line.150"></a>
+<span class="sourceLineNo">151</span>      procSched.suspend(event);<a name="line.151"></a>
+<span class="sourceLineNo">152</span>    }<a name="line.152"></a>
+<span class="sourceLineNo">153</span>  }<a name="line.153"></a>
+<span class="sourceLineNo">154</span>}<a name="line.154"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/50917b1d/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/MasterProcedureEnv.WALStoreLeaseRecovery.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/MasterProcedureEnv.WALStoreLeaseRecovery.html b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/MasterProcedureEnv.WALStoreLeaseRecovery.html
index 1610d02..5cdd36e 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/MasterProcedureEnv.WALStoreLeaseRecovery.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/MasterProcedureEnv.WALStoreLeaseRecovery.html
@@ -39,101 +39,127 @@
 <span class="sourceLineNo">031</span>import org.apache.hadoop.hbase.master.HMaster;<a name="line.31"></a>
 <span class="sourceLineNo">032</span>import org.apache.hadoop.hbase.master.MasterCoprocessorHost;<a name="line.32"></a>
 <span class="sourceLineNo">033</span>import org.apache.hadoop.hbase.master.MasterServices;<a name="line.33"></a>
-<span class="sourceLineNo">034</span>import org.apache.hadoop.hbase.procedure2.store.ProcedureStore;<a name="line.34"></a>
-<span class="sourceLineNo">035</span>import org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore;<a name="line.35"></a>
-<span class="sourceLineNo">036</span>import org.apache.hadoop.hbase.security.User;<a name="line.36"></a>
-<span class="sourceLineNo">037</span>import org.apache.hadoop.hbase.security.UserProvider;<a name="line.37"></a>
-<span class="sourceLineNo">038</span>import org.apache.hadoop.hbase.util.CancelableProgressable;<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>@InterfaceAudience.Private<a name="line.41"></a>
-<span class="sourceLineNo">042</span>@InterfaceStability.Evolving<a name="line.42"></a>
-<span class="sourceLineNo">043</span>public class MasterProcedureEnv {<a name="line.43"></a>
-<span class="sourceLineNo">044</span>  private static final Log LOG = LogFactory.getLog(MasterProcedureEnv.class);<a name="line.44"></a>
-<span class="sourceLineNo">045</span><a name="line.45"></a>
-<span class="sourceLineNo">046</span>  @InterfaceAudience.Private<a name="line.46"></a>
-<span class="sourceLineNo">047</span>  public static class WALStoreLeaseRecovery implements WALProcedureStore.LeaseRecovery {<a name="line.47"></a>
-<span class="sourceLineNo">048</span>    private final HMaster master;<a name="line.48"></a>
-<span class="sourceLineNo">049</span><a name="line.49"></a>
-<span class="sourceLineNo">050</span>    public WALStoreLeaseRecovery(final HMaster master) {<a name="line.50"></a>
-<span class="sourceLineNo">051</span>      this.master = master;<a name="line.51"></a>
-<span class="sourceLineNo">052</span>    }<a name="line.52"></a>
-<span class="sourceLineNo">053</span><a name="line.53"></a>
-<span class="sourceLineNo">054</span>    @Override<a name="line.54"></a>
-<span class="sourceLineNo">055</span>    public void recoverFileLease(final FileSystem fs, final Path path) throws IOException {<a name="line.55"></a>
-<span class="sourceLineNo">056</span>      final Configuration conf = master.getConfiguration();<a name="line.56"></a>
-<span class="sourceLineNo">057</span>      final FSUtils fsUtils = FSUtils.getInstance(fs, conf);<a name="line.57"></a>
-<span class="sourceLineNo">058</span>      fsUtils.recoverFileLease(fs, path, conf, new CancelableProgressable() {<a name="line.58"></a>
-<span class="sourceLineNo">059</span>        @Override<a name="line.59"></a>
-<span class="sourceLineNo">060</span>        public boolean progress() {<a name="line.60"></a>
-<span class="sourceLineNo">061</span>          LOG.debug("Recover Procedure Store log lease: " + path);<a name="line.61"></a>
-<span class="sourceLineNo">062</span>          return master.isActiveMaster();<a name="line.62"></a>
-<span class="sourceLineNo">063</span>        }<a name="line.63"></a>
-<span class="sourceLineNo">064</span>      });<a name="line.64"></a>
-<span class="sourceLineNo">065</span>    }<a name="line.65"></a>
-<span class="sourceLineNo">066</span>  }<a name="line.66"></a>
-<span class="sourceLineNo">067</span><a name="line.67"></a>
-<span class="sourceLineNo">068</span>  @InterfaceAudience.Private<a name="line.68"></a>
-<span class="sourceLineNo">069</span>  public static class MasterProcedureStoreListener<a name="line.69"></a>
-<span class="sourceLineNo">070</span>      implements ProcedureStore.ProcedureStoreListener {<a name="line.70"></a>
-<span class="sourceLineNo">071</span>    private final HMaster master;<a name="line.71"></a>
-<span class="sourceLineNo">072</span><a name="line.72"></a>
-<span class="sourceLineNo">073</span>    public MasterProcedureStoreListener(final HMaster master) {<a name="line.73"></a>
-<span class="sourceLineNo">074</span>      this.master = master;<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>    @Override<a name="line.77"></a>
-<span class="sourceLineNo">078</span>    public void postSync() {<a name="line.78"></a>
-<span class="sourceLineNo">079</span>      // no-op<a name="line.79"></a>
-<span class="sourceLineNo">080</span>    }<a name="line.80"></a>
-<span class="sourceLineNo">081</span><a name="line.81"></a>
-<span class="sourceLineNo">082</span>    @Override<a name="line.82"></a>
-<span class="sourceLineNo">083</span>    public void abortProcess() {<a name="line.83"></a>
-<span class="sourceLineNo">084</span>      master.abort("The Procedure Store lost the lease");<a name="line.84"></a>
-<span class="sourceLineNo">085</span>    }<a name="line.85"></a>
-<span class="sourceLineNo">086</span>  }<a name="line.86"></a>
-<span class="sourceLineNo">087</span><a name="line.87"></a>
-<span class="sourceLineNo">088</span>  private final MasterProcedureQueue procQueue;<a name="line.88"></a>
-<span class="sourceLineNo">089</span>  private final MasterServices master;<a name="line.89"></a>
-<span class="sourceLineNo">090</span><a name="line.90"></a>
-<span class="sourceLineNo">091</span>  public MasterProcedureEnv(final MasterServices master) {<a name="line.91"></a>
-<span class="sourceLineNo">092</span>    this.master = master;<a name="line.92"></a>
-<span class="sourceLineNo">093</span>    this.procQueue = new MasterProcedureQueue(master.getConfiguration(),<a name="line.93"></a>
-<span class="sourceLineNo">094</span>      master.getTableLockManager());<a name="line.94"></a>
-<span class="sourceLineNo">095</span>  }<a name="line.95"></a>
-<span class="sourceLineNo">096</span><a name="line.96"></a>
-<span class="sourceLineNo">097</span>  public User getRequestUser() throws IOException {<a name="line.97"></a>
-<span class="sourceLineNo">098</span>    User user = RpcServer.getRequestUser();<a name="line.98"></a>
-<span class="sourceLineNo">099</span>    if (user == null) {<a name="line.99"></a>
-<span class="sourceLineNo">100</span>      user = UserProvider.instantiate(getMasterConfiguration()).getCurrent();<a name="line.100"></a>
-<span class="sourceLineNo">101</span>    }<a name="line.101"></a>
-<span class="sourceLineNo">102</span>    return user;<a name="line.102"></a>
-<span class="sourceLineNo">103</span>  }<a name="line.103"></a>
-<span class="sourceLineNo">104</span><a name="line.104"></a>
-<span class="sourceLineNo">105</span>  public MasterServices getMasterServices() {<a name="line.105"></a>
-<span class="sourceLineNo">106</span>    return master;<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>  public Configuration getMasterConfiguration() {<a name="line.109"></a>
-<span class="sourceLineNo">110</span>    return master.getConfiguration();<a name="line.110"></a>
-<span class="sourceLineNo">111</span>  }<a name="line.111"></a>
-<span class="sourceLineNo">112</span><a name="line.112"></a>
-<span class="sourceLineNo">113</span>  public MasterCoprocessorHost getMasterCoprocessorHost() {<a name="line.113"></a>
-<span class="sourceLineNo">114</span>    return master.getMasterCoprocessorHost();<a name="line.114"></a>
-<span class="sourceLineNo">115</span>  }<a name="line.115"></a>
-<span class="sourceLineNo">116</span><a name="line.116"></a>
-<span class="sourceLineNo">117</span>  public MasterProcedureQueue getProcedureQueue() {<a name="line.117"></a>
-<span class="sourceLineNo">118</span>    return procQueue;<a name="line.118"></a>
-<span class="sourceLineNo">119</span>  }<a name="line.119"></a>
-<span class="sourceLineNo">120</span><a name="line.120"></a>
-<span class="sourceLineNo">121</span>  public boolean isRunning() {<a name="line.121"></a>
-<span class="sourceLineNo">122</span>    return master.getMasterProcedureExecutor().isRunning();<a name="line.122"></a>
-<span class="sourceLineNo">123</span>  }<a name="line.123"></a>
-<span class="sourceLineNo">124</span><a name="line.124"></a>
-<span class="sourceLineNo">125</span>  public boolean isInitialized() {<a name="line.125"></a>
-<span class="sourceLineNo">126</span>    return master.isInitialized();<a name="line.126"></a>
-<span class="sourceLineNo">127</span>  }<a name="line.127"></a>
-<span class="sourceLineNo">128</span>}<a name="line.128"></a>
+<span class="sourceLineNo">034</span>import org.apache.hadoop.hbase.master.procedure.MasterProcedureScheduler.ProcedureEvent;<a name="line.34"></a>
+<span class="sourceLineNo">035</span>import org.apache.hadoop.hbase.procedure2.Procedure;<a name="line.35"></a>
+<span class="sourceLineNo">036</span>import org.apache.hadoop.hbase.procedure2.store.ProcedureStore;<a name="line.36"></a>
+<span class="sourceLineNo">037</span>import org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore;<a name="line.37"></a>
+<span class="sourceLineNo">038</span>import org.apache.hadoop.hbase.security.User;<a name="line.38"></a>
+<span class="sourceLineNo">039</span>import org.apache.hadoop.hbase.security.UserProvider;<a name="line.39"></a>
+<span class="sourceLineNo">040</span>import org.apache.hadoop.hbase.util.CancelableProgressable;<a name="line.40"></a>
+<span class="sourceLineNo">041</span>import org.apache.hadoop.hbase.util.FSUtils;<a name="line.41"></a>
+<span class="sourceLineNo">042</span><a name="line.42"></a>
+<span class="sourceLineNo">043</span>@InterfaceAudience.Private<a name="line.43"></a>
+<span class="sourceLineNo">044</span>@InterfaceStability.Evolving<a name="line.44"></a>
+<span class="sourceLineNo">045</span>public class MasterProcedureEnv {<a name="line.45"></a>
+<span class="sourceLineNo">046</span>  private static final Log LOG = LogFactory.getLog(MasterProcedureEnv.class);<a name="line.46"></a>
+<span class="sourceLineNo">047</span><a name="line.47"></a>
+<span class="sourceLineNo">048</span>  @InterfaceAudience.Private<a name="line.48"></a>
+<span class="sourceLineNo">049</span>  public static class WALStoreLeaseRecovery implements WALProcedureStore.LeaseRecovery {<a name="line.49"></a>
+<span class="sourceLineNo">050</span>    private final HMaster master;<a name="line.50"></a>
+<span class="sourceLineNo">051</span><a name="line.51"></a>
+<span class="sourceLineNo">052</span>    public WALStoreLeaseRecovery(final HMaster master) {<a name="line.52"></a>
+<span class="sourceLineNo">053</span>      this.master = master;<a name="line.53"></a>
+<span class="sourceLineNo">054</span>    }<a name="line.54"></a>
+<span class="sourceLineNo">055</span><a name="line.55"></a>
+<span class="sourceLineNo">056</span>    @Override<a name="line.56"></a>
+<span class="sourceLineNo">057</span>    public void recoverFileLease(final FileSystem fs, final Path path) throws IOException {<a name="line.57"></a>
+<span class="sourceLineNo">058</span>      final Configuration conf = master.getConfiguration();<a name="line.58"></a>
+<span class="sourceLineNo">059</span>      final FSUtils fsUtils = FSUtils.getInstance(fs, conf);<a name="line.59"></a>
+<span class="sourceLineNo">060</span>      fsUtils.recoverFileLease(fs, path, conf, new CancelableProgressable() {<a name="line.60"></a>
+<span class="sourceLineNo">061</span>        @Override<a name="line.61"></a>
+<span class="sourceLineNo">062</span>        public boolean progress() {<a name="line.62"></a>
+<span class="sourceLineNo">063</span>          LOG.debug("Recover Procedure Store log lease: " + path);<a name="line.63"></a>
+<span class="sourceLineNo">064</span>          return master.isActiveMaster();<a name="line.64"></a>
+<span class="sourceLineNo">065</span>        }<a name="line.65"></a>
+<span class="sourceLineNo">066</span>      });<a name="line.66"></a>
+<span class="sourceLineNo">067</span>    }<a name="line.67"></a>
+<span class="sourceLineNo">068</span>  }<a name="line.68"></a>
+<span class="sourceLineNo">069</span><a name="line.69"></a>
+<span class="sourceLineNo">070</span>  @InterfaceAudience.Private<a name="line.70"></a>
+<span class="sourceLineNo">071</span>  public static class MasterProcedureStoreListener<a name="line.71"></a>
+<span class="sourceLineNo">072</span>      implements ProcedureStore.ProcedureStoreListener {<a name="line.72"></a>
+<span class="sourceLineNo">073</span>    private final HMaster master;<a name="line.73"></a>
+<span class="sourceLineNo">074</span><a name="line.74"></a>
+<span class="sourceLineNo">075</span>    public MasterProcedureStoreListener(final HMaster master) {<a name="line.75"></a>
+<span class="sourceLineNo">076</span>      this.master = master;<a name="line.76"></a>
+<span class="sourceLineNo">077</span>    }<a name="line.77"></a>
+<span class="sourceLineNo">078</span><a name="line.78"></a>
+<span class="sourceLineNo">079</span>    @Override<a name="line.79"></a>
+<span class="sourceLineNo">080</span>    public void postSync() {<a name="line.80"></a>
+<span class="sourceLineNo">081</span>      // no-op<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>    public void abortProcess() {<a name="line.85"></a>
+<span class="sourceLineNo">086</span>      master.abort("The Procedure Store lost the lease");<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><a name="line.89"></a>
+<span class="sourceLineNo">090</span>  private final MasterProcedureScheduler procSched;<a name="line.90"></a>
+<span class="sourceLineNo">091</span>  private final MasterServices master;<a name="line.91"></a>
+<span class="sourceLineNo">092</span><a name="line.92"></a>
+<span class="sourceLineNo">093</span>  public MasterProcedureEnv(final MasterServices master) {<a name="line.93"></a>
+<span class="sourceLineNo">094</span>    this.master = master;<a name="line.94"></a>
+<span class="sourceLineNo">095</span>    this.procSched = new MasterProcedureScheduler(master.getConfiguration(),<a name="line.95"></a>
+<span class="sourceLineNo">096</span>      master.getTableLockManager());<a name="line.96"></a>
+<span class="sourceLineNo">097</span>  }<a name="line.97"></a>
+<span class="sourceLineNo">098</span><a name="line.98"></a>
+<span class="sourceLineNo">099</span>  public User getRequestUser() throws IOException {<a name="line.99"></a>
+<span class="sourceLineNo">100</span>    User user = RpcServer.getRequestUser();<a name="line.100"></a>
+<span class="sourceLineNo">101</span>    if (user == null) {<a name="line.101"></a>
+<span class="sourceLineNo">102</span>      user = UserProvider.instantiate(getMasterConfiguration()).getCurrent();<a name="line.102"></a>
+<span class="sourceLineNo">103</span>    }<a name="line.103"></a>
+<span class="sourceLineNo">104</span>    return user;<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>  public MasterServices getMasterServices() {<a name="line.107"></a>
+<span class="sourceLineNo">108</span>    return master;<a name="line.108"></a>
+<span class="sourceLineNo">109</span>  }<a name="line.109"></a>
+<span class="sourceLineNo">110</span><a name="line.110"></a>
+<span class="sourceLineNo">111</span>  public Configuration getMasterConfiguration() {<a name="line.111"></a>
+<span class="sourceLineNo">112</span>    return master.getConfiguration();<a name="line.112"></a>
+<span class="sourceLineNo">113</span>  }<a name="line.113"></a>
+<span class="sourceLineNo">114</span><a name="line.114"></a>
+<span class="sourceLineNo">115</span>  public MasterCoprocessorHost getMasterCoprocessorHost() {<a name="line.115"></a>
+<span class="sourceLineNo">116</span>    return master.getMasterCoprocessorHost();<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>  public MasterProcedureScheduler getProcedureQueue() {<a name="line.119"></a>
+<span class="sourceLineNo">120</span>    return procSched;<a name="line.120"></a>
+<span class="sourceLineNo">121</span>  }<a name="line.121"></a>
+<span class="sourceLineNo">122</span><a name="line.122"></a>
+<span class="sourceLineNo">123</span>  public boolean isRunning() {<a name="line.123"></a>
+<span class="sourceLineNo">124</span>    return master.getMasterProcedureExecutor().isRunning();<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>
+<span class="sourceLineNo">127</span>  public boolean isInitialized() {<a name="line.127"></a>
+<span class="sourceLineNo">128</span>    return master.isInitialized();<a name="line.128"></a>
+<span class="sourceLineNo">129</span>  }<a name="line.129"></a>
+<span class="sourceLineNo">130</span><a name="line.130"></a>
+<span class="sourceLineNo">131</span>  public boolean waitInitialized(Procedure proc) {<a name="line.131"></a>
+<span class="sourceLineNo">132</span>    return procSched.waitEvent(((HMaster)master).getInitializedEvent(), proc);<a name="line.132"></a>
+<span class="sourceLineNo">133</span>  }<a name="line.133"></a>
+<span class="sourceLineNo">134</span><a name="line.134"></a>
+<span class="sourceLineNo">135</span>  public boolean waitServerCrashProcessingEnabled(Procedure proc) {<a name="line.135"></a>
+<span class="sourceLineNo">136</span>    return procSched.waitEvent(((HMaster)master).getServerCrashProcessingEnabledEvent(), proc);<a name="line.136"></a>
+<span class="sourceLineNo">137</span>  }<a name="line.137"></a>
+<span class="sourceLineNo">138</span><a name="line.138"></a>
+<span class="sourceLineNo">139</span>  public void wake(ProcedureEvent event) {<a name="line.139"></a>
+<span class="sourceLineNo">140</span>    procSched.wake(event);<a name="line.140"></a>
+<span class="sourceLineNo">141</span>  }<a name="line.141"></a>
+<span class="sourceLineNo">142</span><a name="line.142"></a>
+<span class="sourceLineNo">143</span>  public void suspend(ProcedureEvent event) {<a name="line.143"></a>
+<span class="sourceLineNo">144</span>    procSched.suspend(event);<a name="line.144"></a>
+<span class="sourceLineNo">145</span>  }<a name="line.145"></a>
+<span class="sourceLineNo">146</span><a name="line.146"></a>
+<span class="sourceLineNo">147</span>  public void setEventReady(ProcedureEvent event, boolean isReady) {<a name="line.147"></a>
+<span class="sourceLineNo">148</span>    if (isReady) {<a name="line.148"></a>
+<span class="sourceLineNo">149</span>      procSched.wake(event);<a name="line.149"></a>
+<span class="sourceLineNo">150</span>    } else {<a name="line.150"></a>
+<span class="sourceLineNo">151</span>      procSched.suspend(event);<a name="line.151"></a>
+<span class="sourceLineNo">152</span>    }<a name="line.152"></a>
+<span class="sourceLineNo">153</span>  }<a name="line.153"></a>
+<span class="sourceLineNo">154</span>}<a name="line.154"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/50917b1d/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/MasterProcedureEnv.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/MasterProcedureEnv.html b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/MasterProcedureEnv.html
index 1610d02..5cdd36e 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/MasterProcedureEnv.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/master/procedure/MasterProcedureEnv.html
@@ -39,101 +39,127 @@
 <span class="sourceLineNo">031</span>import org.apache.hadoop.hbase.master.HMaster;<a name="line.31"></a>
 <span class="sourceLineNo">032</span>import org.apache.hadoop.hbase.master.MasterCoprocessorHost;<a name="line.32"></a>
 <span class="sourceLineNo">033</span>import org.apache.hadoop.hbase.master.MasterServices;<a name="line.33"></a>
-<span class="sourceLineNo">034</span>import org.apache.hadoop.hbase.procedure2.store.ProcedureStore;<a name="line.34"></a>
-<span class="sourceLineNo">035</span>import org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore;<a name="line.35"></a>
-<span class="sourceLineNo">036</span>import org.apache.hadoop.hbase.security.User;<a name="line.36"></a>
-<span class="sourceLineNo">037</span>import org.apache.hadoop.hbase.security.UserProvider;<a name="line.37"></a>
-<span class="sourceLineNo">038</span>import org.apache.hadoop.hbase.util.CancelableProgressable;<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>@InterfaceAudience.Private<a name="line.41"></a>
-<span class="sourceLineNo">042</span>@InterfaceStability.Evolving<a name="line.42"></a>
-<span class="sourceLineNo">043</span>public class MasterProcedureEnv {<a name="line.43"></a>
-<span class="sourceLineNo">044</span>  private static final Log LOG = LogFactory.getLog(MasterProcedureEnv.class);<a name="line.44"></a>
-<span class="sourceLineNo">045</span><a name="line.45"></a>
-<span class="sourceLineNo">046</span>  @InterfaceAudience.Private<a name="line.46"></a>
-<span class="sourceLineNo">047</span>  public static class WALStoreLeaseRecovery implements WALProcedureStore.LeaseRecovery {<a name="line.47"></a>
-<span class="sourceLineNo">048</span>    private final HMaster master;<a name="line.48"></a>
-<span class="sourceLineNo">049</span><a name="line.49"></a>
-<span class="sourceLineNo">050</span>    public WALStoreLeaseRecovery(final HMaster master) {<a name="line.50"></a>
-<span class="sourceLineNo">051</span>      this.master = master;<a name="line.51"></a>
-<span class="sourceLineNo">052</span>    }<a name="line.52"></a>
-<span class="sourceLineNo">053</span><a name="line.53"></a>
-<span class="sourceLineNo">054</span>    @Override<a name="line.54"></a>
-<span class="sourceLineNo">055</span>    public void recoverFileLease(final FileSystem fs, final Path path) throws IOException {<a name="line.55"></a>
-<span class="sourceLineNo">056</span>      final Configuration conf = master.getConfiguration();<a name="line.56"></a>
-<span class="sourceLineNo">057</span>      final FSUtils fsUtils = FSUtils.getInstance(fs, conf);<a name="line.57"></a>
-<span class="sourceLineNo">058</span>      fsUtils.recoverFileLease(fs, path, conf, new CancelableProgressable() {<a name="line.58"></a>
-<span class="sourceLineNo">059</span>        @Override<a name="line.59"></a>
-<span class="sourceLineNo">060</span>        public boolean progress() {<a name="line.60"></a>
-<span class="sourceLineNo">061</span>          LOG.debug("Recover Procedure Store log lease: " + path);<a name="line.61"></a>
-<span class="sourceLineNo">062</span>          return master.isActiveMaster();<a name="line.62"></a>
-<span class="sourceLineNo">063</span>        }<a name="line.63"></a>
-<span class="sourceLineNo">064</span>      });<a name="line.64"></a>
-<span class="sourceLineNo">065</span>    }<a name="line.65"></a>
-<span class="sourceLineNo">066</span>  }<a name="line.66"></a>
-<span class="sourceLineNo">067</span><a name="line.67"></a>
-<span class="sourceLineNo">068</span>  @InterfaceAudience.Private<a name="line.68"></a>
-<span class="sourceLineNo">069</span>  public static class MasterProcedureStoreListener<a name="line.69"></a>
-<span class="sourceLineNo">070</span>      implements ProcedureStore.ProcedureStoreListener {<a name="line.70"></a>
-<span class="sourceLineNo">071</span>    private final HMaster master;<a name="line.71"></a>
-<span class="sourceLineNo">072</span><a name="line.72"></a>
-<span class="sourceLineNo">073</span>    public MasterProcedureStoreListener(final HMaster master) {<a name="line.73"></a>
-<span class="sourceLineNo">074</span>      this.master = master;<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>    @Override<a name="line.77"></a>
-<span class="sourceLineNo">078</span>    public void postSync() {<a name="line.78"></a>
-<span class="sourceLineNo">079</span>      // no-op<a name="line.79"></a>
-<span class="sourceLineNo">080</span>    }<a name="line.80"></a>
-<span class="sourceLineNo">081</span><a name="line.81"></a>
-<span class="sourceLineNo">082</span>    @Override<a name="line.82"></a>
-<span class="sourceLineNo">083</span>    public void abortProcess() {<a name="line.83"></a>
-<span class="sourceLineNo">084</span>      master.abort("The Procedure Store lost the lease");<a name="line.84"></a>
-<span class="sourceLineNo">085</span>    }<a name="line.85"></a>
-<span class="sourceLineNo">086</span>  }<a name="line.86"></a>
-<span class="sourceLineNo">087</span><a name="line.87"></a>
-<span class="sourceLineNo">088</span>  private final MasterProcedureQueue procQueue;<a name="line.88"></a>
-<span class="sourceLineNo">089</span>  private final MasterServices master;<a name="line.89"></a>
-<span class="sourceLineNo">090</span><a name="line.90"></a>
-<span class="sourceLineNo">091</span>  public MasterProcedureEnv(final MasterServices master) {<a name="line.91"></a>
-<span class="sourceLineNo">092</span>    this.master = master;<a name="line.92"></a>
-<span class="sourceLineNo">093</span>    this.procQueue = new MasterProcedureQueue(master.getConfiguration(),<a name="line.93"></a>
-<span class="sourceLineNo">094</span>      master.getTableLockManager());<a name="line.94"></a>
-<span class="sourceLineNo">095</span>  }<a name="line.95"></a>
-<span class="sourceLineNo">096</span><a name="line.96"></a>
-<span class="sourceLineNo">097</span>  public User getRequestUser() throws IOException {<a name="line.97"></a>
-<span class="sourceLineNo">098</span>    User user = RpcServer.getRequestUser();<a name="line.98"></a>
-<span class="sourceLineNo">099</span>    if (user == null) {<a name="line.99"></a>
-<span class="sourceLineNo">100</span>      user = UserProvider.instantiate(getMasterConfiguration()).getCurrent();<a name="line.100"></a>
-<span class="sourceLineNo">101</span>    }<a name="line.101"></a>
-<span class="sourceLineNo">102</span>    return user;<a name="line.102"></a>
-<span class="sourceLineNo">103</span>  }<a name="line.103"></a>
-<span class="sourceLineNo">104</span><a name="line.104"></a>
-<span class="sourceLineNo">105</span>  public MasterServices getMasterServices() {<a name="line.105"></a>
-<span class="sourceLineNo">106</span>    return master;<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>  public Configuration getMasterConfiguration() {<a name="line.109"></a>
-<span class="sourceLineNo">110</span>    return master.getConfiguration();<a name="line.110"></a>
-<span class="sourceLineNo">111</span>  }<a name="line.111"></a>
-<span class="sourceLineNo">112</span><a name="line.112"></a>
-<span class="sourceLineNo">113</span>  public MasterCoprocessorHost getMasterCoprocessorHost() {<a name="line.113"></a>
-<span class="sourceLineNo">114</span>    return master.getMasterCoprocessorHost();<a name="line.114"></a>
-<span class="sourceLineNo">115</span>  }<a name="line.115"></a>
-<span class="sourceLineNo">116</span><a name="line.116"></a>
-<span class="sourceLineNo">117</span>  public MasterProcedureQueue getProcedureQueue() {<a name="line.117"></a>
-<span class="sourceLineNo">118</span>    return procQueue;<a name="line.118"></a>
-<span class="sourceLineNo">119</span>  }<a name="line.119"></a>
-<span class="sourceLineNo">120</span><a name="line.120"></a>
-<span class="sourceLineNo">121</span>  public boolean isRunning() {<a name="line.121"></a>
-<span class="sourceLineNo">122</span>    return master.getMasterProcedureExecutor().isRunning();<a name="line.122"></a>
-<span class="sourceLineNo">123</span>  }<a name="line.123"></a>
-<span class="sourceLineNo">124</span><a name="line.124"></a>
-<span class="sourceLineNo">125</span>  public boolean isInitialized() {<a name="line.125"></a>
-<span class="sourceLineNo">126</span>    return master.isInitialized();<a name="line.126"></a>
-<span class="sourceLineNo">127</span>  }<a name="line.127"></a>
-<span class="sourceLineNo">128</span>}<a name="line.128"></a>
+<span class="sourceLineNo">034</span>import org.apache.hadoop.hbase.master.procedure.MasterProcedureScheduler.ProcedureEvent;<a name="line.34"></a>
+<span class="sourceLineNo">035</span>import org.apache.hadoop.hbase.procedure2.Procedure;<a name="line.35"></a>
+<span class="sourceLineNo">036</span>import org.apache.hadoop.hbase.procedure2.store.ProcedureStore;<a name="line.36"></a>
+<span class="sourceLineNo">037</span>import org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore;<a name="line.37"></a>
+<span class="sourceLineNo">038</span>import org.apache.hadoop.hbase.security.User;<a name="line.38"></a>
+<span class="sourceLineNo">039</span>import org.apache.hadoop.hbase.security.UserProvider;<a name="line.39"></a>
+<span class="sourceLineNo">040</span>import org.apache.hadoop.hbase.util.CancelableProgressable;<a name="line.40"></a>
+<span class="sourceLineNo">041</span>import org.apache.hadoop.hbase.util.FSUtils;<a name="line.41"></a>
+<span class="sourceLineNo">042</span><a name="line.42"></a>
+<span class="sourceLineNo">043</span>@InterfaceAudience.Private<a name="line.43"></a>
+<span class="sourceLineNo">044</span>@InterfaceStability.Evolving<a name="line.44"></a>
+<span class="sourceLineNo">045</span>public class MasterProcedureEnv {<a name="line.45"></a>
+<span class="sourceLineNo">046</span>  private static final Log LOG = LogFactory.getLog(MasterProcedureEnv.class);<a name="line.46"></a>
+<span class="sourceLineNo">047</span><a name="line.47"></a>
+<span class="sourceLineNo">048</span>  @InterfaceAudience.Private<a name="line.48"></a>
+<span class="sourceLineNo">049</span>  public static class WALStoreLeaseRecovery implements WALProcedureStore.LeaseRecovery {<a name="line.49"></a>
+<span class="sourceLineNo">050</span>    private final HMaster master;<a name="line.50"></a>
+<span class="sourceLineNo">051</span><a name="line.51"></a>
+<span class="sourceLineNo">052</span>    public WALStoreLeaseRecovery(final HMaster master) {<a name="line.52"></a>
+<span class="sourceLineNo">053</span>      this.master = master;<a name="line.53"></a>
+<span class="sourceLineNo">054</span>    }<a name="line.54"></a>
+<span class="sourceLineNo">055</span><a name="line.55"></a>
+<span class="sourceLineNo">056</span>    @Override<a name="line.56"></a>
+<span class="sourceLineNo">057</span>    public void recoverFileLease(final FileSystem fs, final Path path) throws IOException {<a name="line.57"></a>
+<span class="sourceLineNo">058</span>      final Configuration conf = master.getConfiguration();<a name="line.58"></a>
+<span class="sourceLineNo">059</span>      final FSUtils fsUtils = FSUtils.getInstance(fs, conf);<a name="line.59"></a>
+<span class="sourceLineNo">060</span>      fsUtils.recoverFileLease(fs, path, conf, new CancelableProgressable() {<a name="line.60"></a>
+<span class="sourceLineNo">061</span>        @Override<a name="line.61"></a>
+<span class="sourceLineNo">062</span>        public boolean progress() {<a name="line.62"></a>
+<span class="sourceLineNo">063</span>          LOG.debug("Recover Procedure Store log lease: " + path);<a name="line.63"></a>
+<span class="sourceLineNo">064</span>          return master.isActiveMaster();<a name="line.64"></a>
+<span class="sourceLineNo">065</span>        }<a name="line.65"></a>
+<span class="sourceLineNo">066</span>      });<a name="line.66"></a>
+<span class="sourceLineNo">067</span>    }<a name="line.67"></a>
+<span class="sourceLineNo">068</span>  }<a name="line.68"></a>
+<span class="sourceLineNo">069</span><a name="line.69"></a>
+<span class="sourceLineNo">070</span>  @InterfaceAudience.Private<a name="line.70"></a>
+<span class="sourceLineNo">071</span>  public static class MasterProcedureStoreListener<a name="line.71"></a>
+<span class="sourceLineNo">072</span>      implements ProcedureStore.ProcedureStoreListener {<a name="line.72"></a>
+<span class="sourceLineNo">073</span>    private final HMaster master;<a name="line.73"></a>
+<span class="sourceLineNo">074</span><a name="line.74"></a>
+<span class="sourceLineNo">075</span>    public MasterProcedureStoreListener(final HMaster master) {<a name="line.75"></a>
+<span class="sourceLineNo">076</span>      this.master = master;<a name="line.76"></a>
+<span class="sourceLineNo">077</span>    }<a name="line.77"></a>
+<span class="sourceLineNo">078</span><a name="line.78"></a>
+<span class="sourceLineNo">079</span>    @Override<a name="line.79"></a>
+<span class="sourceLineNo">080</span>    public void postSync() {<a name="line.80"></a>
+<span class="sourceLineNo">081</span>      // no-op<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>    public void abortProcess() {<a name="line.85"></a>
+<span class="sourceLineNo">086</span>      master.abort("The Procedure Store lost the lease");<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><a name="line.89"></a>
+<span class="sourceLineNo">090</span>  private final MasterProcedureScheduler procSched;<a name="line.90"></a>
+<span class="sourceLineNo">091</span>  private final MasterServices master;<a name="line.91"></a>
+<span class="sourceLineNo">092</span><a name="line.92"></a>
+<span class="sourceLineNo">093</span>  public MasterProcedureEnv(final MasterServices master) {<a name="line.93"></a>
+<span class="sourceLineNo">094</span>    this.master = master;<a name="line.94"></a>
+<span class="sourceLineNo">095</span>    this.procSched = new MasterProcedureScheduler(master.getConfiguration(),<a name="line.95"></a>
+<span class="sourceLineNo">096</span>      master.getTableLockManager());<a name="line.96"></a>
+<span class="sourceLineNo">097</span>  }<a name="line.97"></a>
+<span class="sourceLineNo">098</span><a name="line.98"></a>
+<span class="sourceLineNo">099</span>  public User getRequestUser() throws IOException {<a name="line.99"></a>
+<span class="sourceLineNo">100</span>    User user = RpcServer.getRequestUser();<a name="line.100"></a>
+<span class="sourceLineNo">101</span>    if (user == null) {<a name="line.101"></a>
+<span class="sourceLineNo">102</span>      user = UserProvider.instantiate(getMasterConfiguration()).getCurrent();<a name="line.102"></a>
+<span class="sourceLineNo">103</span>    }<a name="line.103"></a>
+<span class="sourceLineNo">104</span>    return user;<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>  public MasterServices getMasterServices() {<a name="line.107"></a>
+<span class="sourceLineNo">108</span>    return master;<a name="line.108"></a>
+<span class="sourceLineNo">109</span>  }<a name="line.109"></a>
+<span class="sourceLineNo">110</span><a name="line.110"></a>
+<span class="sourceLineNo">111</span>  public Configuration getMasterConfiguration() {<a name="line.111"></a>
+<span class="sourceLineNo">112</span>    return master.getConfiguration();<a name="line.112"></a>
+<span class="sourceLineNo">113</span>  }<a name="line.113"></a>
+<span class="sourceLineNo">114</span><a name="line.114"></a>
+<span class="sourceLineNo">115</span>  public MasterCoprocessorHost getMasterCoprocessorHost() {<a name="line.115"></a>
+<span class="sourceLineNo">116</span>    return master.getMasterCoprocessorHost();<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>  public MasterProcedureScheduler getProcedureQueue() {<a name="line.119"></a>
+<span class="sourceLineNo">120</span>    return procSched;<a name="line.120"></a>
+<span class="sourceLineNo">121</span>  }<a name="line.121"></a>
+<span class="sourceLineNo">122</span><a name="line.122"></a>
+<span class="sourceLineNo">123</span>  public boolean isRunning() {<a name="line.123"></a>
+<span class="sourceLineNo">124</span>    return master.getMasterProcedureExecutor().isRunning();<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>
+<span class="sourceLineNo">127</span>  public boolean isInitialized() {<a name="line.127"></a>
+<span class="sourceLineNo">128</span>    return master.isInitialized();<a name="line.128"></a>
+<span class="sourceLineNo">129</span>  }<a name="line.129"></a>
+<span class="sourceLineNo">130</span><a name="line.130"></a>
+<span class="sourceLineNo">131</span>  public boolean waitInitialized(Procedure proc) {<a name="line.131"></a>
+<span class="sourceLineNo">132</span>    return procSched.waitEvent(((HMaster)master).getInitializedEvent(), proc);<a name="line.132"></a>
+<span class="sourceLineNo">133</span>  }<a name="line.133"></a>
+<span class="sourceLineNo">134</span><a name="line.134"></a>
+<span class="sourceLineNo">135</span>  public boolean waitServerCrashProcessingEnabled(Procedure proc) {<a name="line.135"></a>
+<span class="sourceLineNo">136</span>    return procSched.waitEvent(((HMaster)master).getServerCrashProcessingEnabledEvent(), proc);<a name="line.136"></a>
+<span class="sourceLineNo">137</span>  }<a name="line.137"></a>
+<span class="sourceLineNo">138</span><a name="line.138"></a>
+<span class="sourceLineNo">139</span>  public void wake(ProcedureEvent event) {<a name="line.139"></a>
+<span class="sourceLineNo">140</span>    procSched.wake(event);<a name="line.140"></a>
+<span class="sourceLineNo">141</span>  }<a name="line.141"></a>
+<span class="sourceLineNo">142</span><a name="line.142"></a>
+<span class="sourceLineNo">143</span>  public void suspend(ProcedureEvent event) {<a name="line.143"></a>
+<span class="sourceLineNo">144</span>    procSched.suspend(event);<a name="line.144"></a>
+<span class="sourceLineNo">145</span>  }<a name="line.145"></a>
+<span class="sourceLineNo">146</span><a name="line.146"></a>
+<span class="sourceLineNo">147</span>  public void setEventReady(ProcedureEvent event, boolean isReady) {<a name="line.147"></a>
+<span class="sourceLineNo">148</span>    if (isReady) {<a name="line.148"></a>
+<span class="sourceLineNo">149</span>      procSched.wake(event);<a name="line.149"></a>
+<span class="sourceLineNo">150</span>    } else {<a name="line.150"></a>
+<span class="sourceLineNo">151</span>      procSched.suspend(event);<a name="line.151"></a>
+<span class="sourceLineNo">152</span>    }<a name="line.152"></a>
+<span class="sourceLineNo">153</span>  }<a name="line.153"></a>
+<span class="sourceLineNo">154</span>}<a name="line.154"></a>
 
 
 


Mime
View raw message