http://git-wip-us.apache.org/repos/asf/hbase-site/blob/99c53df1/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/snapshot/FlushSnapshotSubprocedure.RegionSnapshotTask.html
----------------------------------------------------------------------
diff --git 
a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/snapshot/FlushSnapshotSubprocedure.RegionSnapshotTask.html
 
b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/snapshot/FlushSnapshotSubprocedure.RegionSnapshotTask.html
index c73100f..b3c1730 100644
--- 
a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/snapshot/FlushSnapshotSubprocedure.RegionSnapshotTask.html
+++ 
b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/snapshot/FlushSnapshotSubprocedure.RegionSnapshotTask.html
@@ -41,181 +41,190 @@
 <span class="sourceLineNo">033</span>import 
org.apache.hadoop.hbase.regionserver.HRegion;<a name="line.33"></a>
 <span class="sourceLineNo">034</span>import 
org.apache.hadoop.hbase.regionserver.Region;<a name="line.34"></a>
 <span class="sourceLineNo">035</span>import 
org.apache.hadoop.hbase.regionserver.Region.FlushResult;<a name="line.35"></a>
-<span class="sourceLineNo">036</span>import 
org.apache.hadoop.hbase.regionserver.snapshot.RegionServerSnapshotManager.SnapshotSubprocedurePool;<a
 name="line.36"></a>
-<span class="sourceLineNo">037</span>import 
org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription;<a
 name="line.37"></a>
-<span class="sourceLineNo">038</span>import 
org.apache.hadoop.hbase.snapshot.ClientSnapshotDescriptionUtils;<a 
name="line.38"></a>
-<span class="sourceLineNo">039</span><a name="line.39"></a>
-<span class="sourceLineNo">040</span>/**<a name="line.40"></a>
-<span class="sourceLineNo">041</span> * This online snapshot implementation 
uses the distributed procedure framework to force a<a name="line.41"></a>
-<span class="sourceLineNo">042</span> * store flush and then records the 
hfiles.  Its enter stage does nothing.  Its leave stage then<a 
name="line.42"></a>
-<span class="sourceLineNo">043</span> * flushes the memstore, builds the 
region server's snapshot manifest from its hfiles list, and<a 
name="line.43"></a>
-<span class="sourceLineNo">044</span> * copies .regioninfos into the snapshot 
working directory.  At the master side, there is an atomic<a name="line.44"></a>
-<span class="sourceLineNo">045</span> * rename of the working dir into the 
proper snapshot directory.<a name="line.45"></a>
-<span class="sourceLineNo">046</span> */<a name="line.46"></a>
-<span class="sourceLineNo">047</span>@InterfaceAudience.Private<a 
name="line.47"></a>
-<span class="sourceLineNo">048</span>@InterfaceStability.Unstable<a 
name="line.48"></a>
-<span class="sourceLineNo">049</span>public class FlushSnapshotSubprocedure 
extends Subprocedure {<a name="line.49"></a>
-<span class="sourceLineNo">050</span>  private static final Log LOG = 
LogFactory.getLog(FlushSnapshotSubprocedure.class);<a name="line.50"></a>
-<span class="sourceLineNo">051</span><a name="line.51"></a>
-<span class="sourceLineNo">052</span>  private final List&lt;Region&gt; 
regions;<a name="line.52"></a>
-<span class="sourceLineNo">053</span>  private final SnapshotDescription 
snapshot;<a name="line.53"></a>
-<span class="sourceLineNo">054</span>  private final SnapshotSubprocedurePool 
taskManager;<a name="line.54"></a>
-<span class="sourceLineNo">055</span>  private boolean snapshotSkipFlush = 
false;<a name="line.55"></a>
-<span class="sourceLineNo">056</span><a name="line.56"></a>
-<span class="sourceLineNo">057</span>  // the maximum number of attempts we 
flush<a name="line.57"></a>
-<span class="sourceLineNo">058</span>  final static int MAX_RETRIES = 3;<a 
name="line.58"></a>
-<span class="sourceLineNo">059</span><a name="line.59"></a>
-<span class="sourceLineNo">060</span>  public 
FlushSnapshotSubprocedure(ProcedureMember member,<a name="line.60"></a>
-<span class="sourceLineNo">061</span>      ForeignExceptionDispatcher 
errorListener, long wakeFrequency, long timeout,<a name="line.61"></a>
-<span class="sourceLineNo">062</span>      List&lt;Region&gt; regions, 
SnapshotDescription snapshot,<a name="line.62"></a>
-<span class="sourceLineNo">063</span>      SnapshotSubprocedurePool 
taskManager) {<a name="line.63"></a>
-<span class="sourceLineNo">064</span>    super(member, snapshot.getName(), 
errorListener, wakeFrequency, timeout);<a name="line.64"></a>
-<span class="sourceLineNo">065</span>    this.snapshot = snapshot;<a 
name="line.65"></a>
-<span class="sourceLineNo">066</span><a name="line.66"></a>
-<span class="sourceLineNo">067</span>    if (this.snapshot.getType() == 
SnapshotDescription.Type.SKIPFLUSH) {<a name="line.67"></a>
-<span class="sourceLineNo">068</span>      snapshotSkipFlush = true;<a 
name="line.68"></a>
-<span class="sourceLineNo">069</span>    }<a name="line.69"></a>
-<span class="sourceLineNo">070</span>    this.regions = regions;<a 
name="line.70"></a>
-<span class="sourceLineNo">071</span>    this.taskManager = taskManager;<a 
name="line.71"></a>
-<span class="sourceLineNo">072</span>  }<a name="line.72"></a>
-<span class="sourceLineNo">073</span><a name="line.73"></a>
-<span class="sourceLineNo">074</span>  /**<a name="line.74"></a>
-<span class="sourceLineNo">075</span>   * Callable for adding files to 
snapshot manifest working dir.  Ready for multithreading.<a name="line.75"></a>
-<span class="sourceLineNo">076</span>   */<a name="line.76"></a>
-<span class="sourceLineNo">077</span>  private class RegionSnapshotTask 
implements Callable&lt;Void&gt; {<a name="line.77"></a>
-<span class="sourceLineNo">078</span>    Region region;<a name="line.78"></a>
-<span class="sourceLineNo">079</span>    RegionSnapshotTask(Region region) {<a 
name="line.79"></a>
-<span class="sourceLineNo">080</span>      this.region = region;<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>    @Override<a name="line.83"></a>
-<span class="sourceLineNo">084</span>    public Void call() throws Exception 
{<a name="line.84"></a>
-<span class="sourceLineNo">085</span>      // Taking the region read lock 
prevents the individual region from being closed while a<a name="line.85"></a>
-<span class="sourceLineNo">086</span>      // snapshot is in progress.  This 
is helpful but not sufficient for preventing races with<a name="line.86"></a>
-<span class="sourceLineNo">087</span>      // snapshots that involve multiple 
regions and regionservers.  It is still possible to have<a name="line.87"></a>
-<span class="sourceLineNo">088</span>      // an interleaving such that 
globally regions are missing, so we still need the verification<a 
name="line.88"></a>
-<span class="sourceLineNo">089</span>      // step.<a name="line.89"></a>
-<span class="sourceLineNo">090</span>      LOG.debug("Starting region 
operation on " + region);<a name="line.90"></a>
-<span class="sourceLineNo">091</span>      region.startRegionOperation();<a 
name="line.91"></a>
-<span class="sourceLineNo">092</span>      try {<a name="line.92"></a>
-<span class="sourceLineNo">093</span>        if (snapshotSkipFlush) {<a 
name="line.93"></a>
-<span class="sourceLineNo">094</span>        /*<a name="line.94"></a>
-<span class="sourceLineNo">095</span>         * This is to take an 
online-snapshot without force a coordinated flush to prevent pause<a 
name="line.95"></a>
-<span class="sourceLineNo">096</span>         * The snapshot type is defined 
inside the snapshot description. FlushSnapshotSubprocedure<a name="line.96"></a>
-<span class="sourceLineNo">097</span>         * should be renamed to 
distributedSnapshotSubprocedure, and the flush() behavior can be<a 
name="line.97"></a>
-<span class="sourceLineNo">098</span>         * turned on/off based on the 
flush type.<a name="line.98"></a>
-<span class="sourceLineNo">099</span>         * To minimized the code change, 
class name is not changed.<a name="line.99"></a>
-<span class="sourceLineNo">100</span>         */<a name="line.100"></a>
-<span class="sourceLineNo">101</span>          LOG.debug("take snapshot 
without flush memstore first");<a name="line.101"></a>
-<span class="sourceLineNo">102</span>        } else {<a name="line.102"></a>
-<span class="sourceLineNo">103</span>          LOG.debug("Flush Snapshotting 
region " + region.toString() + " started...");<a name="line.103"></a>
-<span class="sourceLineNo">104</span>          boolean succeeded = false;<a 
name="line.104"></a>
-<span class="sourceLineNo">105</span>          long readPt = 
region.getReadpoint(IsolationLevel.READ_COMMITTED);<a name="line.105"></a>
-<span class="sourceLineNo">106</span>          for (int i = 0; i &lt; 
MAX_RETRIES; i++) {<a name="line.106"></a>
-<span class="sourceLineNo">107</span>            FlushResult res = 
region.flush(true);<a name="line.107"></a>
-<span class="sourceLineNo">108</span>            if (res.getResult() == 
FlushResult.Result.CANNOT_FLUSH) {<a name="line.108"></a>
-<span class="sourceLineNo">109</span>              // CANNOT_FLUSH may mean 
that a flush is already on-going<a name="line.109"></a>
-<span class="sourceLineNo">110</span>              // we need to wait for that 
flush to complete<a name="line.110"></a>
-<span class="sourceLineNo">111</span>              region.waitForFlushes();<a 
name="line.111"></a>
-<span class="sourceLineNo">112</span>              if 
(region.getMaxFlushedSeqId() &gt;= readPt) {<a name="line.112"></a>
-<span class="sourceLineNo">113</span>                // writes at the start of 
the snapshot have been persisted<a name="line.113"></a>
-<span class="sourceLineNo">114</span>                succeeded = true;<a 
name="line.114"></a>
-<span class="sourceLineNo">115</span>                break;<a 
name="line.115"></a>
-<span class="sourceLineNo">116</span>              }<a name="line.116"></a>
-<span class="sourceLineNo">117</span>            } else {<a 
name="line.117"></a>
-<span class="sourceLineNo">118</span>              succeeded = true;<a 
name="line.118"></a>
-<span class="sourceLineNo">119</span>              break;<a 
name="line.119"></a>
-<span class="sourceLineNo">120</span>            }<a name="line.120"></a>
-<span class="sourceLineNo">121</span>          }<a name="line.121"></a>
-<span class="sourceLineNo">122</span>          if (!succeeded) {<a 
name="line.122"></a>
-<span class="sourceLineNo">123</span>            throw new IOException("Unable 
to complete flush after " + MAX_RETRIES + " attempts");<a name="line.123"></a>
-<span class="sourceLineNo">124</span>          }<a name="line.124"></a>
-<span class="sourceLineNo">125</span>        }<a name="line.125"></a>
-<span class="sourceLineNo">126</span>        
((HRegion)region).addRegionToSnapshot(snapshot, monitor);<a name="line.126"></a>
-<span class="sourceLineNo">127</span>        if (snapshotSkipFlush) {<a 
name="line.127"></a>
-<span class="sourceLineNo">128</span>          LOG.debug("... SkipFlush 
Snapshotting region " + region.toString() + " completed.");<a 
name="line.128"></a>
-<span class="sourceLineNo">129</span>        } else {<a name="line.129"></a>
-<span class="sourceLineNo">130</span>          LOG.debug("... Flush 
Snapshotting region " + region.toString() + " completed.");<a 
name="line.130"></a>
-<span class="sourceLineNo">131</span>        }<a name="line.131"></a>
-<span class="sourceLineNo">132</span>      } finally {<a name="line.132"></a>
-<span class="sourceLineNo">133</span>        LOG.debug("Closing region 
operation on " + region);<a name="line.133"></a>
-<span class="sourceLineNo">134</span>        region.closeRegionOperation();<a 
name="line.134"></a>
-<span class="sourceLineNo">135</span>      }<a name="line.135"></a>
-<span class="sourceLineNo">136</span>      return null;<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><a name="line.139"></a>
-<span class="sourceLineNo">140</span>  private void flushSnapshot() throws 
ForeignException {<a name="line.140"></a>
-<span class="sourceLineNo">141</span>    if (regions.isEmpty()) {<a 
name="line.141"></a>
-<span class="sourceLineNo">142</span>      // No regions on this RS, we are 
basically done.<a name="line.142"></a>
-<span class="sourceLineNo">143</span>      return;<a name="line.143"></a>
-<span class="sourceLineNo">144</span>    }<a name="line.144"></a>
-<span class="sourceLineNo">145</span><a name="line.145"></a>
-<span class="sourceLineNo">146</span>    monitor.rethrowException();<a 
name="line.146"></a>
-<span class="sourceLineNo">147</span><a name="line.147"></a>
-<span class="sourceLineNo">148</span>    // assert that the taskManager is 
empty.<a name="line.148"></a>
-<span class="sourceLineNo">149</span>    if (taskManager.hasTasks()) {<a 
name="line.149"></a>
-<span class="sourceLineNo">150</span>      throw new 
IllegalStateException("Attempting to take snapshot "<a name="line.150"></a>
-<span class="sourceLineNo">151</span>          + 
ClientSnapshotDescriptionUtils.toString(snapshot)<a name="line.151"></a>
-<span class="sourceLineNo">152</span>          + " but we currently have 
outstanding tasks");<a name="line.152"></a>
+<span class="sourceLineNo">036</span>import 
org.apache.hadoop.hbase.regionserver.Region.Operation;<a name="line.36"></a>
+<span class="sourceLineNo">037</span>import 
org.apache.hadoop.hbase.regionserver.snapshot.RegionServerSnapshotManager.SnapshotSubprocedurePool;<a
 name="line.37"></a>
+<span class="sourceLineNo">038</span>import 
org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription;<a
 name="line.38"></a>
+<span class="sourceLineNo">039</span>import 
org.apache.hadoop.hbase.snapshot.ClientSnapshotDescriptionUtils;<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> * This online snapshot implementation 
uses the distributed procedure framework to force a<a name="line.42"></a>
+<span class="sourceLineNo">043</span> * store flush and then records the 
hfiles.  Its enter stage does nothing.  Its leave stage then<a 
name="line.43"></a>
+<span class="sourceLineNo">044</span> * flushes the memstore, builds the 
region server's snapshot manifest from its hfiles list, and<a 
name="line.44"></a>
+<span class="sourceLineNo">045</span> * copies .regioninfos into the snapshot 
working directory.  At the master side, there is an atomic<a name="line.45"></a>
+<span class="sourceLineNo">046</span> * rename of the working dir into the 
proper snapshot directory.<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>@InterfaceStability.Unstable<a 
name="line.49"></a>
+<span class="sourceLineNo">050</span>public class FlushSnapshotSubprocedure 
extends Subprocedure {<a name="line.50"></a>
+<span class="sourceLineNo">051</span>  private static final Log LOG = 
LogFactory.getLog(FlushSnapshotSubprocedure.class);<a name="line.51"></a>
+<span class="sourceLineNo">052</span><a name="line.52"></a>
+<span class="sourceLineNo">053</span>  private final List&lt;Region&gt; 
regions;<a name="line.53"></a>
+<span class="sourceLineNo">054</span>  private final SnapshotDescription 
snapshot;<a name="line.54"></a>
+<span class="sourceLineNo">055</span>  private final SnapshotSubprocedurePool 
taskManager;<a name="line.55"></a>
+<span class="sourceLineNo">056</span>  private boolean snapshotSkipFlush = 
false;<a name="line.56"></a>
+<span class="sourceLineNo">057</span><a name="line.57"></a>
+<span class="sourceLineNo">058</span>  // the maximum number of attempts we 
flush<a name="line.58"></a>
+<span class="sourceLineNo">059</span>  final static int MAX_RETRIES = 3;<a 
name="line.59"></a>
+<span class="sourceLineNo">060</span><a name="line.60"></a>
+<span class="sourceLineNo">061</span>  public 
FlushSnapshotSubprocedure(ProcedureMember member,<a name="line.61"></a>
+<span class="sourceLineNo">062</span>      ForeignExceptionDispatcher 
errorListener, long wakeFrequency, long timeout,<a name="line.62"></a>
+<span class="sourceLineNo">063</span>      List&lt;Region&gt; regions, 
SnapshotDescription snapshot,<a name="line.63"></a>
+<span class="sourceLineNo">064</span>      SnapshotSubprocedurePool 
taskManager) {<a name="line.64"></a>
+<span class="sourceLineNo">065</span>    super(member, snapshot.getName(), 
errorListener, wakeFrequency, timeout);<a name="line.65"></a>
+<span class="sourceLineNo">066</span>    this.snapshot = snapshot;<a 
name="line.66"></a>
+<span class="sourceLineNo">067</span><a name="line.67"></a>
+<span class="sourceLineNo">068</span>    if (this.snapshot.getType() == 
SnapshotDescription.Type.SKIPFLUSH) {<a name="line.68"></a>
+<span class="sourceLineNo">069</span>      snapshotSkipFlush = true;<a 
name="line.69"></a>
+<span class="sourceLineNo">070</span>    }<a name="line.70"></a>
+<span class="sourceLineNo">071</span>    this.regions = regions;<a 
name="line.71"></a>
+<span class="sourceLineNo">072</span>    this.taskManager = taskManager;<a 
name="line.72"></a>
+<span class="sourceLineNo">073</span>  }<a name="line.73"></a>
+<span class="sourceLineNo">074</span><a name="line.74"></a>
+<span class="sourceLineNo">075</span>  /**<a name="line.75"></a>
+<span class="sourceLineNo">076</span>   * Callable for adding files to 
snapshot manifest working dir.  Ready for multithreading.<a name="line.76"></a>
+<span class="sourceLineNo">077</span>   */<a name="line.77"></a>
+<span class="sourceLineNo">078</span>  public static class RegionSnapshotTask 
implements Callable&lt;Void&gt; {<a name="line.78"></a>
+<span class="sourceLineNo">079</span>    private Region region;<a 
name="line.79"></a>
+<span class="sourceLineNo">080</span>    private boolean skipFlush;<a 
name="line.80"></a>
+<span class="sourceLineNo">081</span>    private ForeignExceptionDispatcher 
monitor;<a name="line.81"></a>
+<span class="sourceLineNo">082</span>    private SnapshotDescription 
snapshotDesc;<a name="line.82"></a>
+<span class="sourceLineNo">083</span><a name="line.83"></a>
+<span class="sourceLineNo">084</span>    public RegionSnapshotTask(Region 
region, SnapshotDescription snapshotDesc,<a name="line.84"></a>
+<span class="sourceLineNo">085</span>        boolean skipFlush, 
ForeignExceptionDispatcher monitor) {<a name="line.85"></a>
+<span class="sourceLineNo">086</span>      this.region = region;<a 
name="line.86"></a>
+<span class="sourceLineNo">087</span>      this.skipFlush = skipFlush;<a 
name="line.87"></a>
+<span class="sourceLineNo">088</span>      this.monitor = monitor;<a 
name="line.88"></a>
+<span class="sourceLineNo">089</span>      this.snapshotDesc = snapshotDesc;<a 
name="line.89"></a>
+<span class="sourceLineNo">090</span>    }<a name="line.90"></a>
+<span class="sourceLineNo">091</span><a name="line.91"></a>
+<span class="sourceLineNo">092</span>    @Override<a name="line.92"></a>
+<span class="sourceLineNo">093</span>    public Void call() throws Exception 
{<a name="line.93"></a>
+<span class="sourceLineNo">094</span>      // Taking the region read lock 
prevents the individual region from being closed while a<a name="line.94"></a>
+<span class="sourceLineNo">095</span>      // snapshot is in progress.  This 
is helpful but not sufficient for preventing races with<a name="line.95"></a>
+<span class="sourceLineNo">096</span>      // snapshots that involve multiple 
regions and regionservers.  It is still possible to have<a name="line.96"></a>
+<span class="sourceLineNo">097</span>      // an interleaving such that 
globally regions are missing, so we still need the verification<a 
name="line.97"></a>
+<span class="sourceLineNo">098</span>      // step.<a name="line.98"></a>
+<span class="sourceLineNo">099</span>      LOG.debug("Starting snapshot 
operation on " + region);<a name="line.99"></a>
+<span class="sourceLineNo">100</span>      
region.startRegionOperation(Operation.SNAPSHOT);<a name="line.100"></a>
+<span class="sourceLineNo">101</span>      try {<a name="line.101"></a>
+<span class="sourceLineNo">102</span>        if (skipFlush) {<a 
name="line.102"></a>
+<span class="sourceLineNo">103</span>        /*<a name="line.103"></a>
+<span class="sourceLineNo">104</span>         * This is to take an 
online-snapshot without force a coordinated flush to prevent pause<a 
name="line.104"></a>
+<span class="sourceLineNo">105</span>         * The snapshot type is defined 
inside the snapshot description. FlushSnapshotSubprocedure<a 
name="line.105"></a>
+<span class="sourceLineNo">106</span>         * should be renamed to 
distributedSnapshotSubprocedure, and the flush() behavior can be<a 
name="line.106"></a>
+<span class="sourceLineNo">107</span>         * turned on/off based on the 
flush type.<a name="line.107"></a>
+<span class="sourceLineNo">108</span>         * To minimized the code change, 
class name is not changed.<a name="line.108"></a>
+<span class="sourceLineNo">109</span>         */<a name="line.109"></a>
+<span class="sourceLineNo">110</span>          LOG.debug("take snapshot 
without flush memstore first");<a name="line.110"></a>
+<span class="sourceLineNo">111</span>        } else {<a name="line.111"></a>
+<span class="sourceLineNo">112</span>          LOG.debug("Flush Snapshotting 
region " + region.toString() + " started...");<a name="line.112"></a>
+<span class="sourceLineNo">113</span>          boolean succeeded = false;<a 
name="line.113"></a>
+<span class="sourceLineNo">114</span>          long readPt = 
region.getReadpoint(IsolationLevel.READ_COMMITTED);<a name="line.114"></a>
+<span class="sourceLineNo">115</span>          for (int i = 0; i &lt; 
MAX_RETRIES; i++) {<a name="line.115"></a>
+<span class="sourceLineNo">116</span>            FlushResult res = 
region.flush(true);<a name="line.116"></a>
+<span class="sourceLineNo">117</span>            if (res.getResult() == 
FlushResult.Result.CANNOT_FLUSH) {<a name="line.117"></a>
+<span class="sourceLineNo">118</span>              // CANNOT_FLUSH may mean 
that a flush is already on-going<a name="line.118"></a>
+<span class="sourceLineNo">119</span>              // we need to wait for that 
flush to complete<a name="line.119"></a>
+<span class="sourceLineNo">120</span>              region.waitForFlushes();<a 
name="line.120"></a>
+<span class="sourceLineNo">121</span>              if 
(region.getMaxFlushedSeqId() &gt;= readPt) {<a name="line.121"></a>
+<span class="sourceLineNo">122</span>                // writes at the start of 
the snapshot have been persisted<a name="line.122"></a>
+<span class="sourceLineNo">123</span>                succeeded = true;<a 
name="line.123"></a>
+<span class="sourceLineNo">124</span>                break;<a 
name="line.124"></a>
+<span class="sourceLineNo">125</span>              }<a name="line.125"></a>
+<span class="sourceLineNo">126</span>            } else {<a 
name="line.126"></a>
+<span class="sourceLineNo">127</span>              succeeded = true;<a 
name="line.127"></a>
+<span class="sourceLineNo">128</span>              break;<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>          if (!succeeded) {<a 
name="line.131"></a>
+<span class="sourceLineNo">132</span>            throw new IOException("Unable 
to complete flush after " + MAX_RETRIES + " attempts");<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>        
((HRegion)region).addRegionToSnapshot(snapshotDesc, monitor);<a 
name="line.135"></a>
+<span class="sourceLineNo">136</span>        if (skipFlush) {<a 
name="line.136"></a>
+<span class="sourceLineNo">137</span>          LOG.debug("... SkipFlush 
Snapshotting region " + region.toString() + " completed.");<a 
name="line.137"></a>
+<span class="sourceLineNo">138</span>        } else {<a name="line.138"></a>
+<span class="sourceLineNo">139</span>          LOG.debug("... Flush 
Snapshotting region " + region.toString() + " completed.");<a 
name="line.139"></a>
+<span class="sourceLineNo">140</span>        }<a name="line.140"></a>
+<span class="sourceLineNo">141</span>      } finally {<a name="line.141"></a>
+<span class="sourceLineNo">142</span>        LOG.debug("Closing snapshot 
operation on " + region);<a name="line.142"></a>
+<span class="sourceLineNo">143</span>        
region.closeRegionOperation(Operation.SNAPSHOT);<a name="line.143"></a>
+<span class="sourceLineNo">144</span>      }<a name="line.144"></a>
+<span class="sourceLineNo">145</span>      return null;<a name="line.145"></a>
+<span class="sourceLineNo">146</span>    }<a name="line.146"></a>
+<span class="sourceLineNo">147</span>  }<a name="line.147"></a>
+<span class="sourceLineNo">148</span><a name="line.148"></a>
+<span class="sourceLineNo">149</span>  private void flushSnapshot() throws 
ForeignException {<a name="line.149"></a>
+<span class="sourceLineNo">150</span>    if (regions.isEmpty()) {<a 
name="line.150"></a>
+<span class="sourceLineNo">151</span>      // No regions on this RS, we are 
basically done.<a name="line.151"></a>
+<span class="sourceLineNo">152</span>      return;<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>
-<span class="sourceLineNo">155</span>    // Add all hfiles already existing in 
region.<a name="line.155"></a>
-<span class="sourceLineNo">156</span>    for (Region region : regions) {<a 
name="line.156"></a>
-<span class="sourceLineNo">157</span>      // submit one task per region for 
parallelize by region.<a name="line.157"></a>
-<span class="sourceLineNo">158</span>      taskManager.submitTask(new 
RegionSnapshotTask(region));<a name="line.158"></a>
-<span class="sourceLineNo">159</span>      monitor.rethrowException();<a 
name="line.159"></a>
-<span class="sourceLineNo">160</span>    }<a name="line.160"></a>
-<span class="sourceLineNo">161</span><a name="line.161"></a>
-<span class="sourceLineNo">162</span>    // wait for everything to complete.<a 
name="line.162"></a>
-<span class="sourceLineNo">163</span>    LOG.debug("Flush Snapshot Tasks 
submitted for " + regions.size() + " regions");<a name="line.163"></a>
-<span class="sourceLineNo">164</span>    try {<a name="line.164"></a>
-<span class="sourceLineNo">165</span>      
taskManager.waitForOutstandingTasks();<a name="line.165"></a>
-<span class="sourceLineNo">166</span>    } catch (InterruptedException e) {<a 
name="line.166"></a>
-<span class="sourceLineNo">167</span>      LOG.error("got interrupted 
exception for " + getMemberName());<a name="line.167"></a>
-<span class="sourceLineNo">168</span>      throw new 
ForeignException(getMemberName(), e);<a name="line.168"></a>
+<span class="sourceLineNo">155</span>    monitor.rethrowException();<a 
name="line.155"></a>
+<span class="sourceLineNo">156</span><a name="line.156"></a>
+<span class="sourceLineNo">157</span>    // assert that the taskManager is 
empty.<a name="line.157"></a>
+<span class="sourceLineNo">158</span>    if (taskManager.hasTasks()) {<a 
name="line.158"></a>
+<span class="sourceLineNo">159</span>      throw new 
IllegalStateException("Attempting to take snapshot "<a name="line.159"></a>
+<span class="sourceLineNo">160</span>          + 
ClientSnapshotDescriptionUtils.toString(snapshot)<a name="line.160"></a>
+<span class="sourceLineNo">161</span>          + " but we currently have 
outstanding tasks");<a name="line.161"></a>
+<span class="sourceLineNo">162</span>    }<a name="line.162"></a>
+<span class="sourceLineNo">163</span><a name="line.163"></a>
+<span class="sourceLineNo">164</span>    // Add all hfiles already existing in 
region.<a name="line.164"></a>
+<span class="sourceLineNo">165</span>    for (Region region : regions) {<a 
name="line.165"></a>
+<span class="sourceLineNo">166</span>      // submit one task per region for 
parallelize by region.<a name="line.166"></a>
+<span class="sourceLineNo">167</span>      taskManager.submitTask(new 
RegionSnapshotTask(region, snapshot, snapshotSkipFlush, monitor));<a 
name="line.167"></a>
+<span class="sourceLineNo">168</span>      monitor.rethrowException();<a 
name="line.168"></a>
 <span class="sourceLineNo">169</span>    }<a name="line.169"></a>
-<span class="sourceLineNo">170</span>  }<a name="line.170"></a>
-<span class="sourceLineNo">171</span><a name="line.171"></a>
-<span class="sourceLineNo">172</span>  /**<a name="line.172"></a>
-<span class="sourceLineNo">173</span>   * do nothing, core of snapshot is 
executed in {@link #insideBarrier} step.<a name="line.173"></a>
-<span class="sourceLineNo">174</span>   */<a name="line.174"></a>
-<span class="sourceLineNo">175</span>  @Override<a name="line.175"></a>
-<span class="sourceLineNo">176</span>  public void acquireBarrier() throws 
ForeignException {<a name="line.176"></a>
-<span class="sourceLineNo">177</span>    // NO OP<a name="line.177"></a>
-<span class="sourceLineNo">178</span>  }<a name="line.178"></a>
-<span class="sourceLineNo">179</span><a name="line.179"></a>
-<span class="sourceLineNo">180</span>  /**<a name="line.180"></a>
-<span class="sourceLineNo">181</span>   * do a flush snapshot of every region 
on this rs from the target table.<a name="line.181"></a>
-<span class="sourceLineNo">182</span>   */<a name="line.182"></a>
-<span class="sourceLineNo">183</span>  @Override<a name="line.183"></a>
-<span class="sourceLineNo">184</span>  public byte[] insideBarrier() throws 
ForeignException {<a name="line.184"></a>
-<span class="sourceLineNo">185</span>    flushSnapshot();<a 
name="line.185"></a>
-<span class="sourceLineNo">186</span>    return new byte[0];<a 
name="line.186"></a>
+<span class="sourceLineNo">170</span><a name="line.170"></a>
+<span class="sourceLineNo">171</span>    // wait for everything to complete.<a 
name="line.171"></a>
+<span class="sourceLineNo">172</span>    LOG.debug("Flush Snapshot Tasks 
submitted for " + regions.size() + " regions");<a name="line.172"></a>
+<span class="sourceLineNo">173</span>    try {<a name="line.173"></a>
+<span class="sourceLineNo">174</span>      
taskManager.waitForOutstandingTasks();<a name="line.174"></a>
+<span class="sourceLineNo">175</span>    } catch (InterruptedException e) {<a 
name="line.175"></a>
+<span class="sourceLineNo">176</span>      LOG.error("got interrupted 
exception for " + getMemberName());<a name="line.176"></a>
+<span class="sourceLineNo">177</span>      throw new 
ForeignException(getMemberName(), e);<a name="line.177"></a>
+<span class="sourceLineNo">178</span>    }<a name="line.178"></a>
+<span class="sourceLineNo">179</span>  }<a name="line.179"></a>
+<span class="sourceLineNo">180</span><a name="line.180"></a>
+<span class="sourceLineNo">181</span>  /**<a name="line.181"></a>
+<span class="sourceLineNo">182</span>   * do nothing, core of snapshot is 
executed in {@link #insideBarrier} step.<a name="line.182"></a>
+<span class="sourceLineNo">183</span>   */<a name="line.183"></a>
+<span class="sourceLineNo">184</span>  @Override<a name="line.184"></a>
+<span class="sourceLineNo">185</span>  public void acquireBarrier() throws 
ForeignException {<a name="line.185"></a>
+<span class="sourceLineNo">186</span>    // NO OP<a name="line.186"></a>
 <span class="sourceLineNo">187</span>  }<a name="line.187"></a>
 <span class="sourceLineNo">188</span><a name="line.188"></a>
 <span class="sourceLineNo">189</span>  /**<a name="line.189"></a>
-<span class="sourceLineNo">190</span>   * Cancel threads if they haven't 
finished.<a name="line.190"></a>
+<span class="sourceLineNo">190</span>   * do a flush snapshot of every region 
on this rs from the target table.<a name="line.190"></a>
 <span class="sourceLineNo">191</span>   */<a name="line.191"></a>
 <span class="sourceLineNo">192</span>  @Override<a name="line.192"></a>
-<span class="sourceLineNo">193</span>  public void cleanup(Exception e) {<a 
name="line.193"></a>
-<span class="sourceLineNo">194</span>    LOG.info("Aborting all online FLUSH 
snapshot subprocedure task threads for '"<a name="line.194"></a>
-<span class="sourceLineNo">195</span>        + snapshot.getName() + "' due to 
error", e);<a name="line.195"></a>
-<span class="sourceLineNo">196</span>    try {<a name="line.196"></a>
-<span class="sourceLineNo">197</span>      taskManager.cancelTasks();<a 
name="line.197"></a>
-<span class="sourceLineNo">198</span>    } catch (InterruptedException e1) {<a 
name="line.198"></a>
-<span class="sourceLineNo">199</span>      
Thread.currentThread().interrupt();<a name="line.199"></a>
-<span class="sourceLineNo">200</span>    }<a name="line.200"></a>
-<span class="sourceLineNo">201</span>  }<a name="line.201"></a>
-<span class="sourceLineNo">202</span><a name="line.202"></a>
-<span class="sourceLineNo">203</span>  /**<a name="line.203"></a>
-<span class="sourceLineNo">204</span>   * Hooray!<a name="line.204"></a>
-<span class="sourceLineNo">205</span>   */<a name="line.205"></a>
-<span class="sourceLineNo">206</span>  public void releaseBarrier() {<a 
name="line.206"></a>
-<span class="sourceLineNo">207</span>    // NO OP<a name="line.207"></a>
-<span class="sourceLineNo">208</span>  }<a name="line.208"></a>
-<span class="sourceLineNo">209</span><a name="line.209"></a>
-<span class="sourceLineNo">210</span>}<a name="line.210"></a>
+<span class="sourceLineNo">193</span>  public byte[] insideBarrier() throws 
ForeignException {<a name="line.193"></a>
+<span class="sourceLineNo">194</span>    flushSnapshot();<a 
name="line.194"></a>
+<span class="sourceLineNo">195</span>    return new byte[0];<a 
name="line.195"></a>
+<span class="sourceLineNo">196</span>  }<a name="line.196"></a>
+<span class="sourceLineNo">197</span><a name="line.197"></a>
+<span class="sourceLineNo">198</span>  /**<a name="line.198"></a>
+<span class="sourceLineNo">199</span>   * Cancel threads if they haven't 
finished.<a name="line.199"></a>
+<span class="sourceLineNo">200</span>   */<a name="line.200"></a>
+<span class="sourceLineNo">201</span>  @Override<a name="line.201"></a>
+<span class="sourceLineNo">202</span>  public void cleanup(Exception e) {<a 
name="line.202"></a>
+<span class="sourceLineNo">203</span>    LOG.info("Aborting all online FLUSH 
snapshot subprocedure task threads for '"<a name="line.203"></a>
+<span class="sourceLineNo">204</span>        + snapshot.getName() + "' due to 
error", e);<a name="line.204"></a>
+<span class="sourceLineNo">205</span>    try {<a name="line.205"></a>
+<span class="sourceLineNo">206</span>      taskManager.cancelTasks();<a 
name="line.206"></a>
+<span class="sourceLineNo">207</span>    } catch (InterruptedException e1) {<a 
name="line.207"></a>
+<span class="sourceLineNo">208</span>      
Thread.currentThread().interrupt();<a name="line.208"></a>
+<span class="sourceLineNo">209</span>    }<a name="line.209"></a>
+<span class="sourceLineNo">210</span>  }<a name="line.210"></a>
+<span class="sourceLineNo">211</span><a name="line.211"></a>
+<span class="sourceLineNo">212</span>  /**<a name="line.212"></a>
+<span class="sourceLineNo">213</span>   * Hooray!<a name="line.213"></a>
+<span class="sourceLineNo">214</span>   */<a name="line.214"></a>
+<span class="sourceLineNo">215</span>  public void releaseBarrier() {<a 
name="line.215"></a>
+<span class="sourceLineNo">216</span>    // NO OP<a name="line.216"></a>
+<span class="sourceLineNo">217</span>  }<a name="line.217"></a>
+<span class="sourceLineNo">218</span><a name="line.218"></a>
+<span class="sourceLineNo">219</span>}<a name="line.219"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/99c53df1/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/snapshot/FlushSnapshotSubprocedure.html
----------------------------------------------------------------------
diff --git 
a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/snapshot/FlushSnapshotSubprocedure.html
 
b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/snapshot/FlushSnapshotSubprocedure.html
index c73100f..b3c1730 100644
--- 
a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/snapshot/FlushSnapshotSubprocedure.html
+++ 
b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/snapshot/FlushSnapshotSubprocedure.html
@@ -41,181 +41,190 @@
 <span class="sourceLineNo">033</span>import 
org.apache.hadoop.hbase.regionserver.HRegion;<a name="line.33"></a>
 <span class="sourceLineNo">034</span>import 
org.apache.hadoop.hbase.regionserver.Region;<a name="line.34"></a>
 <span class="sourceLineNo">035</span>import 
org.apache.hadoop.hbase.regionserver.Region.FlushResult;<a name="line.35"></a>
-<span class="sourceLineNo">036</span>import 
org.apache.hadoop.hbase.regionserver.snapshot.RegionServerSnapshotManager.SnapshotSubprocedurePool;<a
 name="line.36"></a>
-<span class="sourceLineNo">037</span>import 
org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription;<a
 name="line.37"></a>
-<span class="sourceLineNo">038</span>import 
org.apache.hadoop.hbase.snapshot.ClientSnapshotDescriptionUtils;<a 
name="line.38"></a>
-<span class="sourceLineNo">039</span><a name="line.39"></a>
-<span class="sourceLineNo">040</span>/**<a name="line.40"></a>
-<span class="sourceLineNo">041</span> * This online snapshot implementation 
uses the distributed procedure framework to force a<a name="line.41"></a>
-<span class="sourceLineNo">042</span> * store flush and then records the 
hfiles.  Its enter stage does nothing.  Its leave stage then<a 
name="line.42"></a>
-<span class="sourceLineNo">043</span> * flushes the memstore, builds the 
region server's snapshot manifest from its hfiles list, and<a 
name="line.43"></a>
-<span class="sourceLineNo">044</span> * copies .regioninfos into the snapshot 
working directory.  At the master side, there is an atomic<a name="line.44"></a>
-<span class="sourceLineNo">045</span> * rename of the working dir into the 
proper snapshot directory.<a name="line.45"></a>
-<span class="sourceLineNo">046</span> */<a name="line.46"></a>
-<span class="sourceLineNo">047</span>@InterfaceAudience.Private<a 
name="line.47"></a>
-<span class="sourceLineNo">048</span>@InterfaceStability.Unstable<a 
name="line.48"></a>
-<span class="sourceLineNo">049</span>public class FlushSnapshotSubprocedure 
extends Subprocedure {<a name="line.49"></a>
-<span class="sourceLineNo">050</span>  private static final Log LOG = 
LogFactory.getLog(FlushSnapshotSubprocedure.class);<a name="line.50"></a>
-<span class="sourceLineNo">051</span><a name="line.51"></a>
-<span class="sourceLineNo">052</span>  private final List&lt;Region&gt; 
regions;<a name="line.52"></a>
-<span class="sourceLineNo">053</span>  private final SnapshotDescription 
snapshot;<a name="line.53"></a>
-<span class="sourceLineNo">054</span>  private final SnapshotSubprocedurePool 
taskManager;<a name="line.54"></a>
-<span class="sourceLineNo">055</span>  private boolean snapshotSkipFlush = 
false;<a name="line.55"></a>
-<span class="sourceLineNo">056</span><a name="line.56"></a>
-<span class="sourceLineNo">057</span>  // the maximum number of attempts we 
flush<a name="line.57"></a>
-<span class="sourceLineNo">058</span>  final static int MAX_RETRIES = 3;<a 
name="line.58"></a>
-<span class="sourceLineNo">059</span><a name="line.59"></a>
-<span class="sourceLineNo">060</span>  public 
FlushSnapshotSubprocedure(ProcedureMember member,<a name="line.60"></a>
-<span class="sourceLineNo">061</span>      ForeignExceptionDispatcher 
errorListener, long wakeFrequency, long timeout,<a name="line.61"></a>
-<span class="sourceLineNo">062</span>      List&lt;Region&gt; regions, 
SnapshotDescription snapshot,<a name="line.62"></a>
-<span class="sourceLineNo">063</span>      SnapshotSubprocedurePool 
taskManager) {<a name="line.63"></a>
-<span class="sourceLineNo">064</span>    super(member, snapshot.getName(), 
errorListener, wakeFrequency, timeout);<a name="line.64"></a>
-<span class="sourceLineNo">065</span>    this.snapshot = snapshot;<a 
name="line.65"></a>
-<span class="sourceLineNo">066</span><a name="line.66"></a>
-<span class="sourceLineNo">067</span>    if (this.snapshot.getType() == 
SnapshotDescription.Type.SKIPFLUSH) {<a name="line.67"></a>
-<span class="sourceLineNo">068</span>      snapshotSkipFlush = true;<a 
name="line.68"></a>
-<span class="sourceLineNo">069</span>    }<a name="line.69"></a>
-<span class="sourceLineNo">070</span>    this.regions = regions;<a 
name="line.70"></a>
-<span class="sourceLineNo">071</span>    this.taskManager = taskManager;<a 
name="line.71"></a>
-<span class="sourceLineNo">072</span>  }<a name="line.72"></a>
-<span class="sourceLineNo">073</span><a name="line.73"></a>
-<span class="sourceLineNo">074</span>  /**<a name="line.74"></a>
-<span class="sourceLineNo">075</span>   * Callable for adding files to 
snapshot manifest working dir.  Ready for multithreading.<a name="line.75"></a>
-<span class="sourceLineNo">076</span>   */<a name="line.76"></a>
-<span class="sourceLineNo">077</span>  private class RegionSnapshotTask 
implements Callable&lt;Void&gt; {<a name="line.77"></a>
-<span class="sourceLineNo">078</span>    Region region;<a name="line.78"></a>
-<span class="sourceLineNo">079</span>    RegionSnapshotTask(Region region) {<a 
name="line.79"></a>
-<span class="sourceLineNo">080</span>      this.region = region;<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>    @Override<a name="line.83"></a>
-<span class="sourceLineNo">084</span>    public Void call() throws Exception 
{<a name="line.84"></a>
-<span class="sourceLineNo">085</span>      // Taking the region read lock 
prevents the individual region from being closed while a<a name="line.85"></a>
-<span class="sourceLineNo">086</span>      // snapshot is in progress.  This 
is helpful but not sufficient for preventing races with<a name="line.86"></a>
-<span class="sourceLineNo">087</span>      // snapshots that involve multiple 
regions and regionservers.  It is still possible to have<a name="line.87"></a>
-<span class="sourceLineNo">088</span>      // an interleaving such that 
globally regions are missing, so we still need the verification<a 
name="line.88"></a>
-<span class="sourceLineNo">089</span>      // step.<a name="line.89"></a>
-<span class="sourceLineNo">090</span>      LOG.debug("Starting region 
operation on " + region);<a name="line.90"></a>
-<span class="sourceLineNo">091</span>      region.startRegionOperation();<a 
name="line.91"></a>
-<span class="sourceLineNo">092</span>      try {<a name="line.92"></a>
-<span class="sourceLineNo">093</span>        if (snapshotSkipFlush) {<a 
name="line.93"></a>
-<span class="sourceLineNo">094</span>        /*<a name="line.94"></a>
-<span class="sourceLineNo">095</span>         * This is to take an 
online-snapshot without force a coordinated flush to prevent pause<a 
name="line.95"></a>
-<span class="sourceLineNo">096</span>         * The snapshot type is defined 
inside the snapshot description. FlushSnapshotSubprocedure<a name="line.96"></a>
-<span class="sourceLineNo">097</span>         * should be renamed to 
distributedSnapshotSubprocedure, and the flush() behavior can be<a 
name="line.97"></a>
-<span class="sourceLineNo">098</span>         * turned on/off based on the 
flush type.<a name="line.98"></a>
-<span class="sourceLineNo">099</span>         * To minimized the code change, 
class name is not changed.<a name="line.99"></a>
-<span class="sourceLineNo">100</span>         */<a name="line.100"></a>
-<span class="sourceLineNo">101</span>          LOG.debug("take snapshot 
without flush memstore first");<a name="line.101"></a>
-<span class="sourceLineNo">102</span>        } else {<a name="line.102"></a>
-<span class="sourceLineNo">103</span>          LOG.debug("Flush Snapshotting 
region " + region.toString() + " started...");<a name="line.103"></a>
-<span class="sourceLineNo">104</span>          boolean succeeded = false;<a 
name="line.104"></a>
-<span class="sourceLineNo">105</span>          long readPt = 
region.getReadpoint(IsolationLevel.READ_COMMITTED);<a name="line.105"></a>
-<span class="sourceLineNo">106</span>          for (int i = 0; i &lt; 
MAX_RETRIES; i++) {<a name="line.106"></a>
-<span class="sourceLineNo">107</span>            FlushResult res = 
region.flush(true);<a name="line.107"></a>
-<span class="sourceLineNo">108</span>            if (res.getResult() == 
FlushResult.Result.CANNOT_FLUSH) {<a name="line.108"></a>
-<span class="sourceLineNo">109</span>              // CANNOT_FLUSH may mean 
that a flush is already on-going<a name="line.109"></a>
-<span class="sourceLineNo">110</span>              // we need to wait for that 
flush to complete<a name="line.110"></a>
-<span class="sourceLineNo">111</span>              region.waitForFlushes();<a 
name="line.111"></a>
-<span class="sourceLineNo">112</span>              if 
(region.getMaxFlushedSeqId() &gt;= readPt) {<a name="line.112"></a>
-<span class="sourceLineNo">113</span>                // writes at the start of 
the snapshot have been persisted<a name="line.113"></a>
-<span class="sourceLineNo">114</span>                succeeded = true;<a 
name="line.114"></a>
-<span class="sourceLineNo">115</span>                break;<a 
name="line.115"></a>
-<span class="sourceLineNo">116</span>              }<a name="line.116"></a>
-<span class="sourceLineNo">117</span>            } else {<a 
name="line.117"></a>
-<span class="sourceLineNo">118</span>              succeeded = true;<a 
name="line.118"></a>
-<span class="sourceLineNo">119</span>              break;<a 
name="line.119"></a>
-<span class="sourceLineNo">120</span>            }<a name="line.120"></a>
-<span class="sourceLineNo">121</span>          }<a name="line.121"></a>
-<span class="sourceLineNo">122</span>          if (!succeeded) {<a 
name="line.122"></a>
-<span class="sourceLineNo">123</span>            throw new IOException("Unable 
to complete flush after " + MAX_RETRIES + " attempts");<a name="line.123"></a>
-<span class="sourceLineNo">124</span>          }<a name="line.124"></a>
-<span class="sourceLineNo">125</span>        }<a name="line.125"></a>
-<span class="sourceLineNo">126</span>        
((HRegion)region).addRegionToSnapshot(snapshot, monitor);<a name="line.126"></a>
-<span class="sourceLineNo">127</span>        if (snapshotSkipFlush) {<a 
name="line.127"></a>
-<span class="sourceLineNo">128</span>          LOG.debug("... SkipFlush 
Snapshotting region " + region.toString() + " completed.");<a 
name="line.128"></a>
-<span class="sourceLineNo">129</span>        } else {<a name="line.129"></a>
-<span class="sourceLineNo">130</span>          LOG.debug("... Flush 
Snapshotting region " + region.toString() + " completed.");<a 
name="line.130"></a>
-<span class="sourceLineNo">131</span>        }<a name="line.131"></a>
-<span class="sourceLineNo">132</span>      } finally {<a name="line.132"></a>
-<span class="sourceLineNo">133</span>        LOG.debug("Closing region 
operation on " + region);<a name="line.133"></a>
-<span class="sourceLineNo">134</span>        region.closeRegionOperation();<a 
name="line.134"></a>
-<span class="sourceLineNo">135</span>      }<a name="line.135"></a>
-<span class="sourceLineNo">136</span>      return null;<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><a name="line.139"></a>
-<span class="sourceLineNo">140</span>  private void flushSnapshot() throws 
ForeignException {<a name="line.140"></a>
-<span class="sourceLineNo">141</span>    if (regions.isEmpty()) {<a 
name="line.141"></a>
-<span class="sourceLineNo">142</span>      // No regions on this RS, we are 
basically done.<a name="line.142"></a>
-<span class="sourceLineNo">143</span>      return;<a name="line.143"></a>
-<span class="sourceLineNo">144</span>    }<a name="line.144"></a>
-<span class="sourceLineNo">145</span><a name="line.145"></a>
-<span class="sourceLineNo">146</span>    monitor.rethrowException();<a 
name="line.146"></a>
-<span class="sourceLineNo">147</span><a name="line.147"></a>
-<span class="sourceLineNo">148</span>    // assert that the taskManager is 
empty.<a name="line.148"></a>
-<span class="sourceLineNo">149</span>    if (taskManager.hasTasks()) {<a 
name="line.149"></a>
-<span class="sourceLineNo">150</span>      throw new 
IllegalStateException("Attempting to take snapshot "<a name="line.150"></a>
-<span class="sourceLineNo">151</span>          + 
ClientSnapshotDescriptionUtils.toString(snapshot)<a name="line.151"></a>
-<span class="sourceLineNo">152</span>          + " but we currently have 
outstanding tasks");<a name="line.152"></a>
+<span class="sourceLineNo">036</span>import 
org.apache.hadoop.hbase.regionserver.Region.Operation;<a name="line.36"></a>
+<span class="sourceLineNo">037</span>import 
org.apache.hadoop.hbase.regionserver.snapshot.RegionServerSnapshotManager.SnapshotSubprocedurePool;<a
 name="line.37"></a>
+<span class="sourceLineNo">038</span>import 
org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription;<a
 name="line.38"></a>
+<span class="sourceLineNo">039</span>import 
org.apache.hadoop.hbase.snapshot.ClientSnapshotDescriptionUtils;<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> * This online snapshot implementation 
uses the distributed procedure framework to force a<a name="line.42"></a>
+<span class="sourceLineNo">043</span> * store flush and then records the 
hfiles.  Its enter stage does nothing.  Its leave stage then<a 
name="line.43"></a>
+<span class="sourceLineNo">044</span> * flushes the memstore, builds the 
region server's snapshot manifest from its hfiles list, and<a 
name="line.44"></a>
+<span class="sourceLineNo">045</span> * copies .regioninfos into the snapshot 
working directory.  At the master side, there is an atomic<a name="line.45"></a>
+<span class="sourceLineNo">046</span> * rename of the working dir into the 
proper snapshot directory.<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>@InterfaceStability.Unstable<a 
name="line.49"></a>
+<span class="sourceLineNo">050</span>public class FlushSnapshotSubprocedure 
extends Subprocedure {<a name="line.50"></a>
+<span class="sourceLineNo">051</span>  private static final Log LOG = 
LogFactory.getLog(FlushSnapshotSubprocedure.class);<a name="line.51"></a>
+<span class="sourceLineNo">052</span><a name="line.52"></a>
+<span class="sourceLineNo">053</span>  private final List&lt;Region&gt; 
regions;<a name="line.53"></a>
+<span class="sourceLineNo">054</span>  private final SnapshotDescription 
snapshot;<a name="line.54"></a>
+<span class="sourceLineNo">055</span>  private final SnapshotSubprocedurePool 
taskManager;<a name="line.55"></a>
+<span class="sourceLineNo">056</span>  private boolean snapshotSkipFlush = 
false;<a name="line.56"></a>
+<span class="sourceLineNo">057</span><a name="line.57"></a>
+<span class="sourceLineNo">058</span>  // the maximum number of attempts we 
flush<a name="line.58"></a>
+<span class="sourceLineNo">059</span>  final static int MAX_RETRIES = 3;<a 
name="line.59"></a>
+<span class="sourceLineNo">060</span><a name="line.60"></a>
+<span class="sourceLineNo">061</span>  public 
FlushSnapshotSubprocedure(ProcedureMember member,<a name="line.61"></a>
+<span class="sourceLineNo">062</span>      ForeignExceptionDispatcher 
errorListener, long wakeFrequency, long timeout,<a name="line.62"></a>
+<span class="sourceLineNo">063</span>      List&lt;Region&gt; regions, 
SnapshotDescription snapshot,<a name="line.63"></a>
+<span class="sourceLineNo">064</span>      SnapshotSubprocedurePool 
taskManager) {<a name="line.64"></a>
+<span class="sourceLineNo">065</span>    super(member, snapshot.getName(), 
errorListener, wakeFrequency, timeout);<a name="line.65"></a>
+<span class="sourceLineNo">066</span>    this.snapshot = snapshot;<a 
name="line.66"></a>
+<span class="sourceLineNo">067</span><a name="line.67"></a>
+<span class="sourceLineNo">068</span>    if (this.snapshot.getType() == 
SnapshotDescription.Type.SKIPFLUSH) {<a name="line.68"></a>
+<span class="sourceLineNo">069</span>      snapshotSkipFlush = true;<a 
name="line.69"></a>
+<span class="sourceLineNo">070</span>    }<a name="line.70"></a>
+<span class="sourceLineNo">071</span>    this.regions = regions;<a 
name="line.71"></a>
+<span class="sourceLineNo">072</span>    this.taskManager = taskManager;<a 
name="line.72"></a>
+<span class="sourceLineNo">073</span>  }<a name="line.73"></a>
+<span class="sourceLineNo">074</span><a name="line.74"></a>
+<span class="sourceLineNo">075</span>  /**<a name="line.75"></a>
+<span class="sourceLineNo">076</span>   * Callable for adding files to 
snapshot manifest working dir.  Ready for multithreading.<a name="line.76"></a>
+<span class="sourceLineNo">077</span>   */<a name="line.77"></a>
+<span class="sourceLineNo">078</span>  public static class RegionSnapshotTask 
implements Callable&lt;Void&gt; {<a name="line.78"></a>
+<span class="sourceLineNo">079</span>    private Region region;<a 
name="line.79"></a>
+<span class="sourceLineNo">080</span>    private boolean skipFlush;<a 
name="line.80"></a>
+<span class="sourceLineNo">081</span>    private ForeignExceptionDispatcher 
monitor;<a name="line.81"></a>
+<span class="sourceLineNo">082</span>    private SnapshotDescription 
snapshotDesc;<a name="line.82"></a>
+<span class="sourceLineNo">083</span><a name="line.83"></a>
+<span class="sourceLineNo">084</span>    public RegionSnapshotTask(Region 
region, SnapshotDescription snapshotDesc,<a name="line.84"></a>
+<span class="sourceLineNo">085</span>        boolean skipFlush, 
ForeignExceptionDispatcher monitor) {<a name="line.85"></a>
+<span class="sourceLineNo">086</span>      this.region = region;<a 
name="line.86"></a>
+<span class="sourceLineNo">087</span>      this.skipFlush = skipFlush;<a 
name="line.87"></a>
+<span class="sourceLineNo">088</span>      this.monitor = monitor;<a 
name="line.88"></a>
+<span class="sourceLineNo">089</span>      this.snapshotDesc = snapshotDesc;<a 
name="line.89"></a>
+<span class="sourceLineNo">090</span>    }<a name="line.90"></a>
+<span class="sourceLineNo">091</span><a name="line.91"></a>
+<span class="sourceLineNo">092</span>    @Override<a name="line.92"></a>
+<span class="sourceLineNo">093</span>    public Void call() throws Exception 
{<a name="line.93"></a>
+<span class="sourceLineNo">094</span>      // Taking the region read lock 
prevents the individual region from being closed while a<a name="line.94"></a>
+<span class="sourceLineNo">095</span>      // snapshot is in progress.  This 
is helpful but not sufficient for preventing races with<a name="line.95"></a>
+<span class="sourceLineNo">096</span>      // snapshots that involve multiple 
regions and regionservers.  It is still possible to have<a name="line.96"></a>
+<span class="sourceLineNo">097</span>      // an interleaving such that 
globally regions are missing, so we still need the verification<a 
name="line.97"></a>
+<span class="sourceLineNo">098</span>      // step.<a name="line.98"></a>
+<span class="sourceLineNo">099</span>      LOG.debug("Starting snapshot 
operation on " + region);<a name="line.99"></a>
+<span class="sourceLineNo">100</span>      
region.startRegionOperation(Operation.SNAPSHOT);<a name="line.100"></a>
+<span class="sourceLineNo">101</span>      try {<a name="line.101"></a>
+<span class="sourceLineNo">102</span>        if (skipFlush) {<a 
name="line.102"></a>
+<span class="sourceLineNo">103</span>        /*<a name="line.103"></a>
+<span class="sourceLineNo">104</span>         * This is to take an 
online-snapshot without force a coordinated flush to prevent pause<a 
name="line.104"></a>
+<span class="sourceLineNo">105</span>         * The snapshot type is defined 
inside the snapshot description. FlushSnapshotSubprocedure<a 
name="line.105"></a>
+<span class="sourceLineNo">106</span>         * should be renamed to 
distributedSnapshotSubprocedure, and the flush() behavior can be<a 
name="line.106"></a>
+<span class="sourceLineNo">107</span>         * turned on/off based on the 
flush type.<a name="line.107"></a>
+<span class="sourceLineNo">108</span>         * To minimized the code change, 
class name is not changed.<a name="line.108"></a>
+<span class="sourceLineNo">109</span>         */<a name="line.109"></a>
+<span class="sourceLineNo">110</span>          LOG.debug("take snapshot 
without flush memstore first");<a name="line.110"></a>
+<span class="sourceLineNo">111</span>        } else {<a name="line.111"></a>
+<span class="sourceLineNo">112</span>          LOG.debug("Flush Snapshotting 
region " + region.toString() + " started...");<a name="line.112"></a>
+<span class="sourceLineNo">113</span>          boolean succeeded = false;<a 
name="line.113"></a>
+<span class="sourceLineNo">114</span>          long readPt = 
region.getReadpoint(IsolationLevel.READ_COMMITTED);<a name="line.114"></a>
+<span class="sourceLineNo">115</span>          for (int i = 0; i &lt; 
MAX_RETRIES; i++) {<a name="line.115"></a>
+<span class="sourceLineNo">116</span>            FlushResult res = 
region.flush(true);<a name="line.116"></a>
+<span class="sourceLineNo">117</span>            if (res.getResult() == 
FlushResult.Result.CANNOT_FLUSH) {<a name="line.117"></a>
+<span class="sourceLineNo">118</span>              // CANNOT_FLUSH may mean 
that a flush is already on-going<a name="line.118"></a>
+<span class="sourceLineNo">119</span>              // we need to wait for that 
flush to complete<a name="line.119"></a>
+<span class="sourceLineNo">120</span>              region.waitForFlushes();<a 
name="line.120"></a>
+<span class="sourceLineNo">121</span>              if 
(region.getMaxFlushedSeqId() &gt;= readPt) {<a name="line.121"></a>
+<span class="sourceLineNo">122</span>                // writes at the start of 
the snapshot have been persisted<a name="line.122"></a>
+<span class="sourceLineNo">123</span>                succeeded = true;<a 
name="line.123"></a>
+<span class="sourceLineNo">124</span>                break;<a 
name="line.124"></a>
+<span class="sourceLineNo">125</span>              }<a name="line.125"></a>
+<span class="sourceLineNo">126</span>            } else {<a 
name="line.126"></a>
+<span class="sourceLineNo">127</span>              succeeded = true;<a 
name="line.127"></a>
+<span class="sourceLineNo">128</span>              break;<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>          if (!succeeded) {<a 
name="line.131"></a>
+<span class="sourceLineNo">132</span>            throw new IOException("Unable 
to complete flush after " + MAX_RETRIES + " attempts");<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>        
((HRegion)region).addRegionToSnapshot(snapshotDesc, monitor);<a 
name="line.135"></a>
+<span class="sourceLineNo">136</span>        if (skipFlush) {<a 
name="line.136"></a>
+<span class="sourceLineNo">137</span>          LOG.debug("... SkipFlush 
Snapshotting region " + region.toString() + " completed.");<a 
name="line.137"></a>
+<span class="sourceLineNo">138</span>        } else {<a name="line.138"></a>
+<span class="sourceLineNo">139</span>          LOG.debug("... Flush 
Snapshotting region " + region.toString() + " completed.");<a 
name="line.139"></a>
+<span class="sourceLineNo">140</span>        }<a name="line.140"></a>
+<span class="sourceLineNo">141</span>      } finally {<a name="line.141"></a>
+<span class="sourceLineNo">142</span>        LOG.debug("Closing snapshot 
operation on " + region);<a name="line.142"></a>
+<span class="sourceLineNo">143</span>        
region.closeRegionOperation(Operation.SNAPSHOT);<a name="line.143"></a>
+<span class="sourceLineNo">144</span>      }<a name="line.144"></a>
+<span class="sourceLineNo">145</span>      return null;<a name="line.145"></a>
+<span class="sourceLineNo">146</span>    }<a name="line.146"></a>
+<span class="sourceLineNo">147</span>  }<a name="line.147"></a>
+<span class="sourceLineNo">148</span><a name="line.148"></a>
+<span class="sourceLineNo">149</span>  private void flushSnapshot() throws 
ForeignException {<a name="line.149"></a>
+<span class="sourceLineNo">150</span>    if (regions.isEmpty()) {<a 
name="line.150"></a>
+<span class="sourceLineNo">151</span>      // No regions on this RS, we are 
basically done.<a name="line.151"></a>
+<span class="sourceLineNo">152</span>      return;<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>
-<span class="sourceLineNo">155</span>    // Add all hfiles already existing in 
region.<a name="line.155"></a>
-<span class="sourceLineNo">156</span>    for (Region region : regions) {<a 
name="line.156"></a>
-<span class="sourceLineNo">157</span>      // submit one task per region for 
parallelize by region.<a name="line.157"></a>
-<span class="sourceLineNo">158</span>      taskManager.submitTask(new 
RegionSnapshotTask(region));<a name="line.158"></a>
-<span class="sourceLineNo">159</span>      monitor.rethrowException();<a 
name="line.159"></a>
-<span class="sourceLineNo">160</span>    }<a name="line.160"></a>
-<span class="sourceLineNo">161</span><a name="line.161"></a>
-<span class="sourceLineNo">162</span>    // wait for everything to complete.<a 
name="line.162"></a>
-<span class="sourceLineNo">163</span>    LOG.debug("Flush Snapshot Tasks 
submitted for " + regions.size() + " regions");<a name="line.163"></a>
-<span class="sourceLineNo">164</span>    try {<a name="line.164"></a>
-<span class="sourceLineNo">165</span>      
taskManager.waitForOutstandingTasks();<a name="line.165"></a>
-<span class="sourceLineNo">166</span>    } catch (InterruptedException e) {<a 
name="line.166"></a>
-<span class="sourceLineNo">167</span>      LOG.error("got interrupted 
exception for " + getMemberName());<a name="line.167"></a>
-<span class="sourceLineNo">168</span>      throw new 
ForeignException(getMemberName(), e);<a name="line.168"></a>
+<span class="sourceLineNo">155</span>    monitor.rethrowException();<a 
name="line.155"></a>
+<span class="sourceLineNo">156</span><a name="line.156"></a>
+<span class="sourceLineNo">157</span>    // assert that the taskManager is 
empty.<a name="line.157"></a>
+<span class="sourceLineNo">158</span>    if (taskManager.hasTasks()) {<a 
name="line.158"></a>
+<span class="sourceLineNo">159</span>      throw new 
IllegalStateException("Attempting to take snapshot "<a name="line.159"></a>
+<span class="sourceLineNo">160</span>          + 
ClientSnapshotDescriptionUtils.toString(snapshot)<a name="line.160"></a>
+<span class="sourceLineNo">161</span>          + " but we currently have 
outstanding tasks");<a name="line.161"></a>
+<span class="sourceLineNo">162</span>    }<a name="line.162"></a>
+<span class="sourceLineNo">163</span><a name="line.163"></a>
+<span class="sourceLineNo">164</span>    // Add all hfiles already existing in 
region.<a name="line.164"></a>
+<span class="sourceLineNo">165</span>    for (Region region : regions) {<a 
name="line.165"></a>
+<span class="sourceLineNo">166</span>      // submit one task per region for 
parallelize by region.<a name="line.166"></a>
+<span class="sourceLineNo">167</span>      taskManager.submitTask(new 
RegionSnapshotTask(region, snapshot, snapshotSkipFlush, monitor));<a 
name="line.167"></a>
+<span class="sourceLineNo">168</span>      monitor.rethrowException();<a 
name="line.168"></a>
 <span class="sourceLineNo">169</span>    }<a name="line.169"></a>
-<span class="sourceLineNo">170</span>  }<a name="line.170"></a>
-<span class="sourceLineNo">171</span><a name="line.171"></a>
-<span class="sourceLineNo">172</span>  /**<a name="line.172"></a>
-<span class="sourceLineNo">173</span>   * do nothing, core of snapshot is 
executed in {@link #insideBarrier} step.<a name="line.173"></a>
-<span class="sourceLineNo">174</span>   */<a name="line.174"></a>
-<span class="sourceLineNo">175</span>  @Override<a name="line.175"></a>
-<span class="sourceLineNo">176</span>  public void acquireBarrier() throws 
ForeignException {<a name="line.176"></a>
-<span class="sourceLineNo">177</span>    // NO OP<a name="line.177"></a>
-<span class="sourceLineNo">178</span>  }<a name="line.178"></a>
-<span class="sourceLineNo">179</span><a name="line.179"></a>
-<span class="sourceLineNo">180</span>  /**<a name="line.180"></a>
-<span class="sourceLineNo">181</span>   * do a flush snapshot of every region 
on this rs from the target table.<a name="line.181"></a>
-<span class="sourceLineNo">182</span>   */<a name="line.182"></a>
-<span class="sourceLineNo">183</span>  @Override<a name="line.183"></a>
-<span class="sourceLineNo">184</span>  public byte[] insideBarrier() throws 
ForeignException {<a name="line.184"></a>
-<span class="sourceLineNo">185</span>    flushSnapshot();<a 
name="line.185"></a>
-<span class="sourceLineNo">186</span>    return new byte[0];<a 
name="line.186"></a>
+<span class="sourceLineNo">170</span><a name="line.170"></a>
+<span class="sourceLineNo">171</span>    // wait for everything to complete.<a 
name="line.171"></a>
+<span class="sourceLineNo">172</span>    LOG.debug("Flush Snapshot Tasks 
submitted for " + regions.size() + " regions");<a name="line.172"></a>
+<span class="sourceLineNo">173</span>    try {<a name="line.173"></a>
+<span class="sourceLineNo">174</span>      
taskManager.waitForOutstandingTasks();<a name="line.174"></a>
+<span class="sourceLineNo">175</span>    } catch (InterruptedException e) {<a 
name="line.175"></a>
+<span class="sourceLineNo">176</span>      LOG.error("got interrupted 
exception for " + getMemberName());<a name="line.176"></a>
+<span class="sourceLineNo">177</span>      throw new 
ForeignException(getMemberName(), e);<a name="line.177"></a>
+<span class="sourceLineNo">178</span>    }<a name="line.178"></a>
+<span class="sourceLineNo">179</span>  }<a name="line.179"></a>
+<span class="sourceLineNo">180</span><a name="line.180"></a>
+<span class="sourceLineNo">181</span>  /**<a name="line.181"></a>
+<span class="sourceLineNo">182</span>   * do nothing, core of snapshot is 
executed in {@link #insideBarrier} step.<a name="line.182"></a>
+<span class="sourceLineNo">183</span>   */<a name="line.183"></a>
+<span class="sourceLineNo">184</span>  @Override<a name="line.184"></a>
+<span class="sourceLineNo">185</span>  public void acquireBarrier() throws 
ForeignException {<a name="line.185"></a>
+<span class="sourceLineNo">186</span>    // NO OP<a name="line.186"></a>
 <span class="sourceLineNo">187</span>  }<a name="line.187"></a>
 <span class="sourceLineNo">188</span><a name="line.188"></a>
 <span class="sourceLineNo">189</span>  /**<a name="line.189"></a>
-<span class="sourceLineNo">190</span>   * Cancel threads if they haven't 
finished.<a name="line.190"></a>
+<span class="sourceLineNo">190</span>   * do a flush snapshot of every region 
on this rs from the target table.<a name="line.190"></a>
 <span class="sourceLineNo">191</span>   */<a name="line.191"></a>
 <span class="sourceLineNo">192</span>  @Override<a name="line.192"></a>
-<span class="sourceLineNo">193</span>  public void cleanup(Exception e) {<a 
name="line.193"></a>
-<span class="sourceLineNo">194</span>    LOG.info("Aborting all online FLUSH 
snapshot subprocedure task threads for '"<a name="line.194"></a>
-<span class="sourceLineNo">195</span>        + snapshot.getName() + "' due to 
error", e);<a name="line.195"></a>
-<span class="sourceLineNo">196</span>    try {<a name="line.196"></a>
-<span class="sourceLineNo">197</span>      taskManager.cancelTasks();<a 
name="line.197"></a>
-<span class="sourceLineNo">198</span>    } catch (InterruptedException e1) {<a 
name="line.198"></a>
-<span class="sourceLineNo">199</span>      
Thread.currentThread().interrupt();<a name="line.199"></a>
-<span class="sourceLineNo">200</span>    }<a name="line.200"></a>
-<span class="sourceLineNo">201</span>  }<a name="line.201"></a>
-<span class="sourceLineNo">202</span><a name="line.202"></a>
-<span class="sourceLineNo">203</span>  /**<a name="line.203"></a>
-<span class="sourceLineNo">204</span>   * Hooray!<a name="line.204"></a>
-<span class="sourceLineNo">205</span>   */<a name="line.205"></a>
-<span class="sourceLineNo">206</span>  public void releaseBarrier() {<a 
name="line.206"></a>
-<span class="sourceLineNo">207</span>    // NO OP<a name="line.207"></a>
-<span class="sourceLineNo">208</span>  }<a name="line.208"></a>
-<span class="sourceLineNo">209</span><a name="line.209"></a>
-<span class="sourceLineNo">210</span>}<a name="line.210"></a>
+<span class="sourceLineNo">193</span>  public byte[] insideBarrier() throws 
ForeignException {<a name="line.193"></a>
+<span class="sourceLineNo">194</span>    flushSnapshot();<a 
name="line.194"></a>
+<span class="sourceLineNo">195</span>    return new byte[0];<a 
name="line.195"></a>
+<span class="sourceLineNo">196</span>  }<a name="line.196"></a>
+<span class="sourceLineNo">197</span><a name="line.197"></a>
+<span class="sourceLineNo">198</span>  /**<a name="line.198"></a>
+<span class="sourceLineNo">199</span>   * Cancel threads if they haven't 
finished.<a name="line.199"></a>
+<span class="sourceLineNo">200</span>   */<a name="line.200"></a>
+<span class="sourceLineNo">201</span>  @Override<a name="line.201"></a>
+<span class="sourceLineNo">202</span>  public void cleanup(Exception e) {<a 
name="line.202"></a>
+<span class="sourceLineNo">203</span>    LOG.info("Aborting all online FLUSH 
snapshot subprocedure task threads for '"<a name="line.203"></a>
+<span class="sourceLineNo">204</span>        + snapshot.getName() + "' due to 
error", e);<a name="line.204"></a>
+<span class="sourceLineNo">205</span>    try {<a name="line.205"></a>
+<span class="sourceLineNo">206</span>      taskManager.cancelTasks();<a 
name="line.206"></a>
+<span class="sourceLineNo">207</span>    } catch (InterruptedException e1) {<a 
name="line.207"></a>
+<span class="sourceLineNo">208</span>      
Thread.currentThread().interrupt();<a name="line.208"></a>
+<span class="sourceLineNo">209</span>    }<a name="line.209"></a>
+<span class="sourceLineNo">210</span>  }<a name="line.210"></a>
+<span class="sourceLineNo">211</span><a name="line.211"></a>
+<span class="sourceLineNo">212</span>  /**<a name="line.212"></a>
+<span class="sourceLineNo">213</span>   * Hooray!<a name="line.213"></a>
+<span class="sourceLineNo">214</span>   */<a name="line.214"></a>
+<span class="sourceLineNo">215</span>  public void releaseBarrier() {<a 
name="line.215"></a>
+<span class="sourceLineNo">216</span>    // NO OP<a name="line.216"></a>
+<span class="sourceLineNo">217</span>  }<a name="line.217"></a>
+<span class="sourceLineNo">218</span><a name="line.218"></a>
+<span class="sourceLineNo">219</span>}<a name="line.219"></a>
 
 
 

Reply via email to