hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [18/51] [partial] hbase-site git commit: Published site at .
Date Sun, 28 Jan 2018 15:13:22 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/aa7ffc92/devapidocs/src-html/org/apache/hadoop/hbase/backup/impl/BackupManifest.BackupImage.Builder.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/backup/impl/BackupManifest.BackupImage.Builder.html b/devapidocs/src-html/org/apache/hadoop/hbase/backup/impl/BackupManifest.BackupImage.Builder.html
index 7509dcf..ec2aa41 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/backup/impl/BackupManifest.BackupImage.Builder.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/backup/impl/BackupManifest.BackupImage.Builder.html
@@ -64,152 +64,152 @@
 <span class="sourceLineNo">056</span> */<a name="line.56"></a>
 <span class="sourceLineNo">057</span>@InterfaceAudience.Private<a name="line.57"></a>
 <span class="sourceLineNo">058</span>public class BackupManifest {<a name="line.58"></a>
-<span class="sourceLineNo">059</span><a name="line.59"></a>
-<span class="sourceLineNo">060</span>  private static final Logger LOG = LoggerFactory.getLogger(BackupManifest.class);<a name="line.60"></a>
-<span class="sourceLineNo">061</span><a name="line.61"></a>
-<span class="sourceLineNo">062</span>  // manifest file name<a name="line.62"></a>
-<span class="sourceLineNo">063</span>  public static final String MANIFEST_FILE_NAME = ".backup.manifest";<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>   * Backup image, the dependency graph is made up by series of backup images BackupImage contains<a name="line.66"></a>
-<span class="sourceLineNo">067</span>   * all the relevant information to restore the backup and is used during restore operation<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>  public static class BackupImage implements Comparable&lt;BackupImage&gt; {<a name="line.70"></a>
+<span class="sourceLineNo">059</span>  private static final Logger LOG = LoggerFactory.getLogger(BackupManifest.class);<a name="line.59"></a>
+<span class="sourceLineNo">060</span><a name="line.60"></a>
+<span class="sourceLineNo">061</span>  // manifest file name<a name="line.61"></a>
+<span class="sourceLineNo">062</span>  public static final String MANIFEST_FILE_NAME = ".backup.manifest";<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>   * Backup image, the dependency graph is made up by series of backup images BackupImage contains<a name="line.65"></a>
+<span class="sourceLineNo">066</span>   * all the relevant information to restore the backup and is used during restore operation<a name="line.66"></a>
+<span class="sourceLineNo">067</span>   */<a name="line.67"></a>
+<span class="sourceLineNo">068</span>  public static class BackupImage implements Comparable&lt;BackupImage&gt; {<a name="line.68"></a>
+<span class="sourceLineNo">069</span>    static class Builder {<a name="line.69"></a>
+<span class="sourceLineNo">070</span>      BackupImage image;<a name="line.70"></a>
 <span class="sourceLineNo">071</span><a name="line.71"></a>
-<span class="sourceLineNo">072</span>    static class Builder {<a name="line.72"></a>
-<span class="sourceLineNo">073</span>      BackupImage image;<a name="line.73"></a>
-<span class="sourceLineNo">074</span><a name="line.74"></a>
-<span class="sourceLineNo">075</span>      Builder() {<a name="line.75"></a>
-<span class="sourceLineNo">076</span>        image = new BackupImage();<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>      Builder withBackupId(String backupId) {<a name="line.79"></a>
-<span class="sourceLineNo">080</span>        image.setBackupId(backupId);<a name="line.80"></a>
-<span class="sourceLineNo">081</span>        return this;<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>      Builder withType(BackupType type) {<a name="line.84"></a>
-<span class="sourceLineNo">085</span>        image.setType(type);<a name="line.85"></a>
-<span class="sourceLineNo">086</span>        return this;<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>      Builder withRootDir(String rootDir) {<a name="line.89"></a>
-<span class="sourceLineNo">090</span>        image.setRootDir(rootDir);<a name="line.90"></a>
-<span class="sourceLineNo">091</span>        return this;<a name="line.91"></a>
-<span class="sourceLineNo">092</span>      }<a name="line.92"></a>
-<span class="sourceLineNo">093</span><a name="line.93"></a>
-<span class="sourceLineNo">094</span>      Builder withTableList(List&lt;TableName&gt; tableList) {<a name="line.94"></a>
-<span class="sourceLineNo">095</span>        image.setTableList(tableList);<a name="line.95"></a>
-<span class="sourceLineNo">096</span>        return this;<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>      Builder withStartTime(long startTime) {<a name="line.99"></a>
-<span class="sourceLineNo">100</span>        image.setStartTs(startTime);<a name="line.100"></a>
-<span class="sourceLineNo">101</span>        return this;<a name="line.101"></a>
-<span class="sourceLineNo">102</span>      }<a name="line.102"></a>
-<span class="sourceLineNo">103</span><a name="line.103"></a>
-<span class="sourceLineNo">104</span>      Builder withCompleteTime(long completeTime) {<a name="line.104"></a>
-<span class="sourceLineNo">105</span>        image.setCompleteTs(completeTime);<a name="line.105"></a>
-<span class="sourceLineNo">106</span>        return this;<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>      BackupImage build() {<a name="line.109"></a>
-<span class="sourceLineNo">110</span>        return image;<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>    }<a name="line.113"></a>
-<span class="sourceLineNo">114</span><a name="line.114"></a>
-<span class="sourceLineNo">115</span>    private String backupId;<a name="line.115"></a>
-<span class="sourceLineNo">116</span>    private BackupType type;<a name="line.116"></a>
-<span class="sourceLineNo">117</span>    private String rootDir;<a name="line.117"></a>
-<span class="sourceLineNo">118</span>    private List&lt;TableName&gt; tableList;<a name="line.118"></a>
-<span class="sourceLineNo">119</span>    private long startTs;<a name="line.119"></a>
-<span class="sourceLineNo">120</span>    private long completeTs;<a name="line.120"></a>
-<span class="sourceLineNo">121</span>    private ArrayList&lt;BackupImage&gt; ancestors;<a name="line.121"></a>
-<span class="sourceLineNo">122</span>    private HashMap&lt;TableName, HashMap&lt;String, Long&gt;&gt; incrTimeRanges;<a name="line.122"></a>
-<span class="sourceLineNo">123</span><a name="line.123"></a>
-<span class="sourceLineNo">124</span>    static Builder newBuilder() {<a name="line.124"></a>
-<span class="sourceLineNo">125</span>      return new Builder();<a name="line.125"></a>
-<span class="sourceLineNo">126</span>    }<a name="line.126"></a>
-<span class="sourceLineNo">127</span><a name="line.127"></a>
-<span class="sourceLineNo">128</span>    public BackupImage() {<a name="line.128"></a>
-<span class="sourceLineNo">129</span>      super();<a name="line.129"></a>
-<span class="sourceLineNo">130</span>    }<a name="line.130"></a>
-<span class="sourceLineNo">131</span><a name="line.131"></a>
-<span class="sourceLineNo">132</span>    private BackupImage(String backupId, BackupType type, String rootDir,<a name="line.132"></a>
-<span class="sourceLineNo">133</span>        List&lt;TableName&gt; tableList, long startTs, long completeTs) {<a name="line.133"></a>
-<span class="sourceLineNo">134</span>      this.backupId = backupId;<a name="line.134"></a>
-<span class="sourceLineNo">135</span>      this.type = type;<a name="line.135"></a>
-<span class="sourceLineNo">136</span>      this.rootDir = rootDir;<a name="line.136"></a>
-<span class="sourceLineNo">137</span>      this.tableList = tableList;<a name="line.137"></a>
-<span class="sourceLineNo">138</span>      this.startTs = startTs;<a name="line.138"></a>
-<span class="sourceLineNo">139</span>      this.completeTs = completeTs;<a name="line.139"></a>
-<span class="sourceLineNo">140</span>    }<a name="line.140"></a>
-<span class="sourceLineNo">141</span><a name="line.141"></a>
-<span class="sourceLineNo">142</span>    static BackupImage fromProto(BackupProtos.BackupImage im) {<a name="line.142"></a>
-<span class="sourceLineNo">143</span>      String backupId = im.getBackupId();<a name="line.143"></a>
-<span class="sourceLineNo">144</span>      String rootDir = im.getBackupRootDir();<a name="line.144"></a>
-<span class="sourceLineNo">145</span>      long startTs = im.getStartTs();<a name="line.145"></a>
-<span class="sourceLineNo">146</span>      long completeTs = im.getCompleteTs();<a name="line.146"></a>
-<span class="sourceLineNo">147</span>      List&lt;HBaseProtos.TableName&gt; tableListList = im.getTableListList();<a name="line.147"></a>
-<span class="sourceLineNo">148</span>      List&lt;TableName&gt; tableList = new ArrayList&lt;TableName&gt;();<a name="line.148"></a>
-<span class="sourceLineNo">149</span>      for (HBaseProtos.TableName tn : tableListList) {<a name="line.149"></a>
-<span class="sourceLineNo">150</span>        tableList.add(ProtobufUtil.toTableName(tn));<a name="line.150"></a>
-<span class="sourceLineNo">151</span>      }<a name="line.151"></a>
-<span class="sourceLineNo">152</span><a name="line.152"></a>
-<span class="sourceLineNo">153</span>      List&lt;BackupProtos.BackupImage&gt; ancestorList = im.getAncestorsList();<a name="line.153"></a>
-<span class="sourceLineNo">154</span><a name="line.154"></a>
-<span class="sourceLineNo">155</span>      BackupType type =<a name="line.155"></a>
-<span class="sourceLineNo">156</span>          im.getBackupType() == BackupProtos.BackupType.FULL ? BackupType.FULL<a name="line.156"></a>
-<span class="sourceLineNo">157</span>              : BackupType.INCREMENTAL;<a name="line.157"></a>
-<span class="sourceLineNo">158</span><a name="line.158"></a>
-<span class="sourceLineNo">159</span>      BackupImage image = new BackupImage(backupId, type, rootDir, tableList, startTs, completeTs);<a name="line.159"></a>
-<span class="sourceLineNo">160</span>      for (BackupProtos.BackupImage img : ancestorList) {<a name="line.160"></a>
-<span class="sourceLineNo">161</span>        image.addAncestor(fromProto(img));<a name="line.161"></a>
-<span class="sourceLineNo">162</span>      }<a name="line.162"></a>
-<span class="sourceLineNo">163</span>      image.setIncrTimeRanges(loadIncrementalTimestampMap(im));<a name="line.163"></a>
-<span class="sourceLineNo">164</span>      return image;<a name="line.164"></a>
-<span class="sourceLineNo">165</span>    }<a name="line.165"></a>
-<span class="sourceLineNo">166</span><a name="line.166"></a>
-<span class="sourceLineNo">167</span>    BackupProtos.BackupImage toProto() {<a name="line.167"></a>
-<span class="sourceLineNo">168</span>      BackupProtos.BackupImage.Builder builder = BackupProtos.BackupImage.newBuilder();<a name="line.168"></a>
-<span class="sourceLineNo">169</span>      builder.setBackupId(backupId);<a name="line.169"></a>
-<span class="sourceLineNo">170</span>      builder.setCompleteTs(completeTs);<a name="line.170"></a>
-<span class="sourceLineNo">171</span>      builder.setStartTs(startTs);<a name="line.171"></a>
-<span class="sourceLineNo">172</span>      builder.setBackupRootDir(rootDir);<a name="line.172"></a>
-<span class="sourceLineNo">173</span>      if (type == BackupType.FULL) {<a name="line.173"></a>
-<span class="sourceLineNo">174</span>        builder.setBackupType(BackupProtos.BackupType.FULL);<a name="line.174"></a>
-<span class="sourceLineNo">175</span>      } else {<a name="line.175"></a>
-<span class="sourceLineNo">176</span>        builder.setBackupType(BackupProtos.BackupType.INCREMENTAL);<a name="line.176"></a>
-<span class="sourceLineNo">177</span>      }<a name="line.177"></a>
-<span class="sourceLineNo">178</span><a name="line.178"></a>
-<span class="sourceLineNo">179</span>      for (TableName name : tableList) {<a name="line.179"></a>
-<span class="sourceLineNo">180</span>        builder.addTableList(ProtobufUtil.toProtoTableName(name));<a name="line.180"></a>
-<span class="sourceLineNo">181</span>      }<a name="line.181"></a>
-<span class="sourceLineNo">182</span><a name="line.182"></a>
-<span class="sourceLineNo">183</span>      if (ancestors != null) {<a name="line.183"></a>
-<span class="sourceLineNo">184</span>        for (BackupImage im : ancestors) {<a name="line.184"></a>
-<span class="sourceLineNo">185</span>          builder.addAncestors(im.toProto());<a name="line.185"></a>
-<span class="sourceLineNo">186</span>        }<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>      setIncrementalTimestampMap(builder);<a name="line.189"></a>
-<span class="sourceLineNo">190</span>      return builder.build();<a name="line.190"></a>
-<span class="sourceLineNo">191</span>    }<a name="line.191"></a>
-<span class="sourceLineNo">192</span><a name="line.192"></a>
-<span class="sourceLineNo">193</span>    private static HashMap&lt;TableName, HashMap&lt;String, Long&gt;&gt; loadIncrementalTimestampMap(<a name="line.193"></a>
-<span class="sourceLineNo">194</span>        BackupProtos.BackupImage proto) {<a name="line.194"></a>
-<span class="sourceLineNo">195</span>      List&lt;BackupProtos.TableServerTimestamp&gt; list = proto.getTstMapList();<a name="line.195"></a>
-<span class="sourceLineNo">196</span><a name="line.196"></a>
-<span class="sourceLineNo">197</span>      HashMap&lt;TableName, HashMap&lt;String, Long&gt;&gt; incrTimeRanges =<a name="line.197"></a>
-<span class="sourceLineNo">198</span>          new HashMap&lt;TableName, HashMap&lt;String, Long&gt;&gt;();<a name="line.198"></a>
-<span class="sourceLineNo">199</span>      if (list == null || list.size() == 0) return incrTimeRanges;<a name="line.199"></a>
+<span class="sourceLineNo">072</span>      Builder() {<a name="line.72"></a>
+<span class="sourceLineNo">073</span>        image = new BackupImage();<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>      Builder withBackupId(String backupId) {<a name="line.76"></a>
+<span class="sourceLineNo">077</span>        image.setBackupId(backupId);<a name="line.77"></a>
+<span class="sourceLineNo">078</span>        return this;<a name="line.78"></a>
+<span class="sourceLineNo">079</span>      }<a name="line.79"></a>
+<span class="sourceLineNo">080</span><a name="line.80"></a>
+<span class="sourceLineNo">081</span>      Builder withType(BackupType type) {<a name="line.81"></a>
+<span class="sourceLineNo">082</span>        image.setType(type);<a name="line.82"></a>
+<span class="sourceLineNo">083</span>        return this;<a name="line.83"></a>
+<span class="sourceLineNo">084</span>      }<a name="line.84"></a>
+<span class="sourceLineNo">085</span><a name="line.85"></a>
+<span class="sourceLineNo">086</span>      Builder withRootDir(String rootDir) {<a name="line.86"></a>
+<span class="sourceLineNo">087</span>        image.setRootDir(rootDir);<a name="line.87"></a>
+<span class="sourceLineNo">088</span>        return this;<a name="line.88"></a>
+<span class="sourceLineNo">089</span>      }<a name="line.89"></a>
+<span class="sourceLineNo">090</span><a name="line.90"></a>
+<span class="sourceLineNo">091</span>      Builder withTableList(List&lt;TableName&gt; tableList) {<a name="line.91"></a>
+<span class="sourceLineNo">092</span>        image.setTableList(tableList);<a name="line.92"></a>
+<span class="sourceLineNo">093</span>        return this;<a name="line.93"></a>
+<span class="sourceLineNo">094</span>      }<a name="line.94"></a>
+<span class="sourceLineNo">095</span><a name="line.95"></a>
+<span class="sourceLineNo">096</span>      Builder withStartTime(long startTime) {<a name="line.96"></a>
+<span class="sourceLineNo">097</span>        image.setStartTs(startTime);<a name="line.97"></a>
+<span class="sourceLineNo">098</span>        return this;<a name="line.98"></a>
+<span class="sourceLineNo">099</span>      }<a name="line.99"></a>
+<span class="sourceLineNo">100</span><a name="line.100"></a>
+<span class="sourceLineNo">101</span>      Builder withCompleteTime(long completeTime) {<a name="line.101"></a>
+<span class="sourceLineNo">102</span>        image.setCompleteTs(completeTime);<a name="line.102"></a>
+<span class="sourceLineNo">103</span>        return this;<a name="line.103"></a>
+<span class="sourceLineNo">104</span>      }<a name="line.104"></a>
+<span class="sourceLineNo">105</span><a name="line.105"></a>
+<span class="sourceLineNo">106</span>      BackupImage build() {<a name="line.106"></a>
+<span class="sourceLineNo">107</span>        return image;<a name="line.107"></a>
+<span class="sourceLineNo">108</span>      }<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><a name="line.111"></a>
+<span class="sourceLineNo">112</span>    private String backupId;<a name="line.112"></a>
+<span class="sourceLineNo">113</span>    private BackupType type;<a name="line.113"></a>
+<span class="sourceLineNo">114</span>    private String rootDir;<a name="line.114"></a>
+<span class="sourceLineNo">115</span>    private List&lt;TableName&gt; tableList;<a name="line.115"></a>
+<span class="sourceLineNo">116</span>    private long startTs;<a name="line.116"></a>
+<span class="sourceLineNo">117</span>    private long completeTs;<a name="line.117"></a>
+<span class="sourceLineNo">118</span>    private ArrayList&lt;BackupImage&gt; ancestors;<a name="line.118"></a>
+<span class="sourceLineNo">119</span>    private HashMap&lt;TableName, HashMap&lt;String, Long&gt;&gt; incrTimeRanges;<a name="line.119"></a>
+<span class="sourceLineNo">120</span><a name="line.120"></a>
+<span class="sourceLineNo">121</span>    static Builder newBuilder() {<a name="line.121"></a>
+<span class="sourceLineNo">122</span>      return new Builder();<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 BackupImage() {<a name="line.125"></a>
+<span class="sourceLineNo">126</span>      super();<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">129</span>    private BackupImage(String backupId, BackupType type, String rootDir,<a name="line.129"></a>
+<span class="sourceLineNo">130</span>        List&lt;TableName&gt; tableList, long startTs, long completeTs) {<a name="line.130"></a>
+<span class="sourceLineNo">131</span>      this.backupId = backupId;<a name="line.131"></a>
+<span class="sourceLineNo">132</span>      this.type = type;<a name="line.132"></a>
+<span class="sourceLineNo">133</span>      this.rootDir = rootDir;<a name="line.133"></a>
+<span class="sourceLineNo">134</span>      this.tableList = tableList;<a name="line.134"></a>
+<span class="sourceLineNo">135</span>      this.startTs = startTs;<a name="line.135"></a>
+<span class="sourceLineNo">136</span>      this.completeTs = completeTs;<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>    static BackupImage fromProto(BackupProtos.BackupImage im) {<a name="line.139"></a>
+<span class="sourceLineNo">140</span>      String backupId = im.getBackupId();<a name="line.140"></a>
+<span class="sourceLineNo">141</span>      String rootDir = im.getBackupRootDir();<a name="line.141"></a>
+<span class="sourceLineNo">142</span>      long startTs = im.getStartTs();<a name="line.142"></a>
+<span class="sourceLineNo">143</span>      long completeTs = im.getCompleteTs();<a name="line.143"></a>
+<span class="sourceLineNo">144</span>      List&lt;HBaseProtos.TableName&gt; tableListList = im.getTableListList();<a name="line.144"></a>
+<span class="sourceLineNo">145</span>      List&lt;TableName&gt; tableList = new ArrayList&lt;&gt;();<a name="line.145"></a>
+<span class="sourceLineNo">146</span>      for (HBaseProtos.TableName tn : tableListList) {<a name="line.146"></a>
+<span class="sourceLineNo">147</span>        tableList.add(ProtobufUtil.toTableName(tn));<a name="line.147"></a>
+<span class="sourceLineNo">148</span>      }<a name="line.148"></a>
+<span class="sourceLineNo">149</span><a name="line.149"></a>
+<span class="sourceLineNo">150</span>      List&lt;BackupProtos.BackupImage&gt; ancestorList = im.getAncestorsList();<a name="line.150"></a>
+<span class="sourceLineNo">151</span><a name="line.151"></a>
+<span class="sourceLineNo">152</span>      BackupType type =<a name="line.152"></a>
+<span class="sourceLineNo">153</span>          im.getBackupType() == BackupProtos.BackupType.FULL ? BackupType.FULL<a name="line.153"></a>
+<span class="sourceLineNo">154</span>              : BackupType.INCREMENTAL;<a name="line.154"></a>
+<span class="sourceLineNo">155</span><a name="line.155"></a>
+<span class="sourceLineNo">156</span>      BackupImage image = new BackupImage(backupId, type, rootDir, tableList, startTs, completeTs);<a name="line.156"></a>
+<span class="sourceLineNo">157</span>      for (BackupProtos.BackupImage img : ancestorList) {<a name="line.157"></a>
+<span class="sourceLineNo">158</span>        image.addAncestor(fromProto(img));<a name="line.158"></a>
+<span class="sourceLineNo">159</span>      }<a name="line.159"></a>
+<span class="sourceLineNo">160</span>      image.setIncrTimeRanges(loadIncrementalTimestampMap(im));<a name="line.160"></a>
+<span class="sourceLineNo">161</span>      return image;<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>    BackupProtos.BackupImage toProto() {<a name="line.164"></a>
+<span class="sourceLineNo">165</span>      BackupProtos.BackupImage.Builder builder = BackupProtos.BackupImage.newBuilder();<a name="line.165"></a>
+<span class="sourceLineNo">166</span>      builder.setBackupId(backupId);<a name="line.166"></a>
+<span class="sourceLineNo">167</span>      builder.setCompleteTs(completeTs);<a name="line.167"></a>
+<span class="sourceLineNo">168</span>      builder.setStartTs(startTs);<a name="line.168"></a>
+<span class="sourceLineNo">169</span>      builder.setBackupRootDir(rootDir);<a name="line.169"></a>
+<span class="sourceLineNo">170</span>      if (type == BackupType.FULL) {<a name="line.170"></a>
+<span class="sourceLineNo">171</span>        builder.setBackupType(BackupProtos.BackupType.FULL);<a name="line.171"></a>
+<span class="sourceLineNo">172</span>      } else {<a name="line.172"></a>
+<span class="sourceLineNo">173</span>        builder.setBackupType(BackupProtos.BackupType.INCREMENTAL);<a name="line.173"></a>
+<span class="sourceLineNo">174</span>      }<a name="line.174"></a>
+<span class="sourceLineNo">175</span><a name="line.175"></a>
+<span class="sourceLineNo">176</span>      for (TableName name : tableList) {<a name="line.176"></a>
+<span class="sourceLineNo">177</span>        builder.addTableList(ProtobufUtil.toProtoTableName(name));<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>      if (ancestors != null) {<a name="line.180"></a>
+<span class="sourceLineNo">181</span>        for (BackupImage im : ancestors) {<a name="line.181"></a>
+<span class="sourceLineNo">182</span>          builder.addAncestors(im.toProto());<a name="line.182"></a>
+<span class="sourceLineNo">183</span>        }<a name="line.183"></a>
+<span class="sourceLineNo">184</span>      }<a name="line.184"></a>
+<span class="sourceLineNo">185</span><a name="line.185"></a>
+<span class="sourceLineNo">186</span>      setIncrementalTimestampMap(builder);<a name="line.186"></a>
+<span class="sourceLineNo">187</span>      return builder.build();<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>    private static HashMap&lt;TableName, HashMap&lt;String, Long&gt;&gt; loadIncrementalTimestampMap(<a name="line.190"></a>
+<span class="sourceLineNo">191</span>        BackupProtos.BackupImage proto) {<a name="line.191"></a>
+<span class="sourceLineNo">192</span>      List&lt;BackupProtos.TableServerTimestamp&gt; list = proto.getTstMapList();<a name="line.192"></a>
+<span class="sourceLineNo">193</span><a name="line.193"></a>
+<span class="sourceLineNo">194</span>      HashMap&lt;TableName, HashMap&lt;String, Long&gt;&gt; incrTimeRanges = new HashMap&lt;&gt;();<a name="line.194"></a>
+<span class="sourceLineNo">195</span><a name="line.195"></a>
+<span class="sourceLineNo">196</span>      if (list == null || list.size() == 0) {<a name="line.196"></a>
+<span class="sourceLineNo">197</span>        return incrTimeRanges;<a name="line.197"></a>
+<span class="sourceLineNo">198</span>      }<a name="line.198"></a>
+<span class="sourceLineNo">199</span><a name="line.199"></a>
 <span class="sourceLineNo">200</span>      for (BackupProtos.TableServerTimestamp tst : list) {<a name="line.200"></a>
 <span class="sourceLineNo">201</span>        TableName tn = ProtobufUtil.toTableName(tst.getTableName());<a name="line.201"></a>
 <span class="sourceLineNo">202</span>        HashMap&lt;String, Long&gt; map = incrTimeRanges.get(tn);<a name="line.202"></a>
 <span class="sourceLineNo">203</span>        if (map == null) {<a name="line.203"></a>
-<span class="sourceLineNo">204</span>          map = new HashMap&lt;String, Long&gt;();<a name="line.204"></a>
+<span class="sourceLineNo">204</span>          map = new HashMap&lt;&gt;();<a name="line.204"></a>
 <span class="sourceLineNo">205</span>          incrTimeRanges.put(tn, map);<a name="line.205"></a>
 <span class="sourceLineNo">206</span>        }<a name="line.206"></a>
 <span class="sourceLineNo">207</span>        List&lt;BackupProtos.ServerTimestamp&gt; listSt = tst.getServerTimestampList();<a name="line.207"></a>
@@ -298,13 +298,13 @@
 <span class="sourceLineNo">290</span><a name="line.290"></a>
 <span class="sourceLineNo">291</span>    public ArrayList&lt;BackupImage&gt; getAncestors() {<a name="line.291"></a>
 <span class="sourceLineNo">292</span>      if (this.ancestors == null) {<a name="line.292"></a>
-<span class="sourceLineNo">293</span>        this.ancestors = new ArrayList&lt;BackupImage&gt;();<a name="line.293"></a>
+<span class="sourceLineNo">293</span>        this.ancestors = new ArrayList&lt;&gt;();<a name="line.293"></a>
 <span class="sourceLineNo">294</span>      }<a name="line.294"></a>
 <span class="sourceLineNo">295</span>      return this.ancestors;<a name="line.295"></a>
 <span class="sourceLineNo">296</span>    }<a name="line.296"></a>
 <span class="sourceLineNo">297</span><a name="line.297"></a>
 <span class="sourceLineNo">298</span>    public void removeAncestors(List&lt;String&gt; backupIds) {<a name="line.298"></a>
-<span class="sourceLineNo">299</span>      List&lt;BackupImage&gt; toRemove = new ArrayList&lt;BackupImage&gt;();<a name="line.299"></a>
+<span class="sourceLineNo">299</span>      List&lt;BackupImage&gt; toRemove = new ArrayList&lt;&gt;();<a name="line.299"></a>
 <span class="sourceLineNo">300</span>      for (BackupImage im : this.ancestors) {<a name="line.300"></a>
 <span class="sourceLineNo">301</span>        if (backupIds.contains(im.getBackupId())) {<a name="line.301"></a>
 <span class="sourceLineNo">302</span>          toRemove.add(im);<a name="line.302"></a>
@@ -385,302 +385,296 @@
 <span class="sourceLineNo">377</span>   * @param backup The ongoing backup info<a name="line.377"></a>
 <span class="sourceLineNo">378</span>   */<a name="line.378"></a>
 <span class="sourceLineNo">379</span>  public BackupManifest(BackupInfo backup) {<a name="line.379"></a>
-<span class="sourceLineNo">380</span><a name="line.380"></a>
-<span class="sourceLineNo">381</span>    BackupImage.Builder builder = BackupImage.newBuilder();<a name="line.381"></a>
-<span class="sourceLineNo">382</span>    this.backupImage =<a name="line.382"></a>
-<span class="sourceLineNo">383</span>        builder.withBackupId(backup.getBackupId()).withType(backup.getType())<a name="line.383"></a>
-<span class="sourceLineNo">384</span>            .withRootDir(backup.getBackupRootDir()).withTableList(backup.getTableNames())<a name="line.384"></a>
-<span class="sourceLineNo">385</span>            .withStartTime(backup.getStartTs()).withCompleteTime(backup.getCompleteTs()).build();<a name="line.385"></a>
-<span class="sourceLineNo">386</span>  }<a name="line.386"></a>
-<span class="sourceLineNo">387</span><a name="line.387"></a>
-<span class="sourceLineNo">388</span>  /**<a name="line.388"></a>
-<span class="sourceLineNo">389</span>   * Construct a table level manifest for a backup of the named table.<a name="line.389"></a>
-<span class="sourceLineNo">390</span>   * @param backup The ongoing backup session info<a name="line.390"></a>
-<span class="sourceLineNo">391</span>   */<a name="line.391"></a>
-<span class="sourceLineNo">392</span>  public BackupManifest(BackupInfo backup, TableName table) {<a name="line.392"></a>
-<span class="sourceLineNo">393</span>    this.tableBackupDir = backup.getTableBackupDir(table);<a name="line.393"></a>
-<span class="sourceLineNo">394</span>    List&lt;TableName&gt; tables = new ArrayList&lt;TableName&gt;();<a name="line.394"></a>
-<span class="sourceLineNo">395</span>    tables.add(table);<a name="line.395"></a>
-<span class="sourceLineNo">396</span>    BackupImage.Builder builder = BackupImage.newBuilder();<a name="line.396"></a>
-<span class="sourceLineNo">397</span>    this.backupImage =<a name="line.397"></a>
-<span class="sourceLineNo">398</span>        builder.withBackupId(backup.getBackupId()).withType(backup.getType())<a name="line.398"></a>
-<span class="sourceLineNo">399</span>            .withRootDir(backup.getBackupRootDir()).withTableList(tables)<a name="line.399"></a>
-<span class="sourceLineNo">400</span>            .withStartTime(backup.getStartTs()).withCompleteTime(backup.getCompleteTs()).build();<a name="line.400"></a>
-<span class="sourceLineNo">401</span>  }<a name="line.401"></a>
-<span class="sourceLineNo">402</span><a name="line.402"></a>
-<span class="sourceLineNo">403</span>  /**<a name="line.403"></a>
-<span class="sourceLineNo">404</span>   * Construct manifest from a backup directory.<a name="line.404"></a>
+<span class="sourceLineNo">380</span>    BackupImage.Builder builder = BackupImage.newBuilder();<a name="line.380"></a>
+<span class="sourceLineNo">381</span>    this.backupImage =<a name="line.381"></a>
+<span class="sourceLineNo">382</span>        builder.withBackupId(backup.getBackupId()).withType(backup.getType())<a name="line.382"></a>
+<span class="sourceLineNo">383</span>            .withRootDir(backup.getBackupRootDir()).withTableList(backup.getTableNames())<a name="line.383"></a>
+<span class="sourceLineNo">384</span>            .withStartTime(backup.getStartTs()).withCompleteTime(backup.getCompleteTs()).build();<a name="line.384"></a>
+<span class="sourceLineNo">385</span>  }<a name="line.385"></a>
+<span class="sourceLineNo">386</span><a name="line.386"></a>
+<span class="sourceLineNo">387</span>  /**<a name="line.387"></a>
+<span class="sourceLineNo">388</span>   * Construct a table level manifest for a backup of the named table.<a name="line.388"></a>
+<span class="sourceLineNo">389</span>   * @param backup The ongoing backup session info<a name="line.389"></a>
+<span class="sourceLineNo">390</span>   */<a name="line.390"></a>
+<span class="sourceLineNo">391</span>  public BackupManifest(BackupInfo backup, TableName table) {<a name="line.391"></a>
+<span class="sourceLineNo">392</span>    this.tableBackupDir = backup.getTableBackupDir(table);<a name="line.392"></a>
+<span class="sourceLineNo">393</span>    List&lt;TableName&gt; tables = new ArrayList&lt;TableName&gt;();<a name="line.393"></a>
+<span class="sourceLineNo">394</span>    tables.add(table);<a name="line.394"></a>
+<span class="sourceLineNo">395</span>    BackupImage.Builder builder = BackupImage.newBuilder();<a name="line.395"></a>
+<span class="sourceLineNo">396</span>    this.backupImage =<a name="line.396"></a>
+<span class="sourceLineNo">397</span>        builder.withBackupId(backup.getBackupId()).withType(backup.getType())<a name="line.397"></a>
+<span class="sourceLineNo">398</span>            .withRootDir(backup.getBackupRootDir()).withTableList(tables)<a name="line.398"></a>
+<span class="sourceLineNo">399</span>            .withStartTime(backup.getStartTs()).withCompleteTime(backup.getCompleteTs()).build();<a name="line.399"></a>
+<span class="sourceLineNo">400</span>  }<a name="line.400"></a>
+<span class="sourceLineNo">401</span><a name="line.401"></a>
+<span class="sourceLineNo">402</span>  /**<a name="line.402"></a>
+<span class="sourceLineNo">403</span>   * Construct manifest from a backup directory.<a name="line.403"></a>
+<span class="sourceLineNo">404</span>   *<a name="line.404"></a>
 <span class="sourceLineNo">405</span>   * @param conf configuration<a name="line.405"></a>
 <span class="sourceLineNo">406</span>   * @param backupPath backup path<a name="line.406"></a>
-<span class="sourceLineNo">407</span>   * @throws IOException<a name="line.407"></a>
+<span class="sourceLineNo">407</span>   * @throws IOException if constructing the manifest from the backup directory fails<a name="line.407"></a>
 <span class="sourceLineNo">408</span>   */<a name="line.408"></a>
-<span class="sourceLineNo">409</span><a name="line.409"></a>
-<span class="sourceLineNo">410</span>  public BackupManifest(Configuration conf, Path backupPath) throws IOException {<a name="line.410"></a>
-<span class="sourceLineNo">411</span>    this(backupPath.getFileSystem(conf), backupPath);<a name="line.411"></a>
-<span class="sourceLineNo">412</span>  }<a name="line.412"></a>
-<span class="sourceLineNo">413</span><a name="line.413"></a>
-<span class="sourceLineNo">414</span>  /**<a name="line.414"></a>
-<span class="sourceLineNo">415</span>   * Construct manifest from a backup directory.<a name="line.415"></a>
-<span class="sourceLineNo">416</span>   * @param fs the FileSystem<a name="line.416"></a>
-<span class="sourceLineNo">417</span>   * @param backupPath backup path<a name="line.417"></a>
-<span class="sourceLineNo">418</span>   * @throws BackupException exception<a name="line.418"></a>
-<span class="sourceLineNo">419</span>   */<a name="line.419"></a>
-<span class="sourceLineNo">420</span><a name="line.420"></a>
-<span class="sourceLineNo">421</span>  public BackupManifest(FileSystem fs, Path backupPath) throws BackupException {<a name="line.421"></a>
-<span class="sourceLineNo">422</span>    if (LOG.isDebugEnabled()) {<a name="line.422"></a>
-<span class="sourceLineNo">423</span>      LOG.debug("Loading manifest from: " + backupPath.toString());<a name="line.423"></a>
-<span class="sourceLineNo">424</span>    }<a name="line.424"></a>
-<span class="sourceLineNo">425</span>    // The input backupDir may not exactly be the backup table dir.<a name="line.425"></a>
-<span class="sourceLineNo">426</span>    // It could be the backup log dir where there is also a manifest file stored.<a name="line.426"></a>
-<span class="sourceLineNo">427</span>    // This variable's purpose is to keep the correct and original location so<a name="line.427"></a>
-<span class="sourceLineNo">428</span>    // that we can store/persist it.<a name="line.428"></a>
-<span class="sourceLineNo">429</span>    try {<a name="line.429"></a>
-<span class="sourceLineNo">430</span><a name="line.430"></a>
-<span class="sourceLineNo">431</span>      FileStatus[] subFiles = BackupUtils.listStatus(fs, backupPath, null);<a name="line.431"></a>
-<span class="sourceLineNo">432</span>      if (subFiles == null) {<a name="line.432"></a>
-<span class="sourceLineNo">433</span>        String errorMsg = backupPath.toString() + " does not exist";<a name="line.433"></a>
-<span class="sourceLineNo">434</span>        LOG.error(errorMsg);<a name="line.434"></a>
-<span class="sourceLineNo">435</span>        throw new IOException(errorMsg);<a name="line.435"></a>
-<span class="sourceLineNo">436</span>      }<a name="line.436"></a>
-<span class="sourceLineNo">437</span>      for (FileStatus subFile : subFiles) {<a name="line.437"></a>
-<span class="sourceLineNo">438</span>        if (subFile.getPath().getName().equals(MANIFEST_FILE_NAME)) {<a name="line.438"></a>
-<span class="sourceLineNo">439</span><a name="line.439"></a>
-<span class="sourceLineNo">440</span>          // load and set manifest field from file content<a name="line.440"></a>
-<span class="sourceLineNo">441</span>          FSDataInputStream in = fs.open(subFile.getPath());<a name="line.441"></a>
-<span class="sourceLineNo">442</span>          long len = subFile.getLen();<a name="line.442"></a>
-<span class="sourceLineNo">443</span>          byte[] pbBytes = new byte[(int) len];<a name="line.443"></a>
-<span class="sourceLineNo">444</span>          in.readFully(pbBytes);<a name="line.444"></a>
-<span class="sourceLineNo">445</span>          BackupProtos.BackupImage proto = null;<a name="line.445"></a>
-<span class="sourceLineNo">446</span>          try {<a name="line.446"></a>
-<span class="sourceLineNo">447</span>            proto = BackupProtos.BackupImage.parseFrom(pbBytes);<a name="line.447"></a>
-<span class="sourceLineNo">448</span>          } catch (Exception e) {<a name="line.448"></a>
-<span class="sourceLineNo">449</span>            throw new BackupException(e);<a name="line.449"></a>
-<span class="sourceLineNo">450</span>          }<a name="line.450"></a>
-<span class="sourceLineNo">451</span>          this.backupImage = BackupImage.fromProto(proto);<a name="line.451"></a>
-<span class="sourceLineNo">452</span>          LOG.debug("Loaded manifest instance from manifest file: "<a name="line.452"></a>
-<span class="sourceLineNo">453</span>              + BackupUtils.getPath(subFile.getPath()));<a name="line.453"></a>
-<span class="sourceLineNo">454</span>          return;<a name="line.454"></a>
-<span class="sourceLineNo">455</span>        }<a name="line.455"></a>
-<span class="sourceLineNo">456</span>      }<a name="line.456"></a>
-<span class="sourceLineNo">457</span>      String errorMsg = "No manifest file found in: " + backupPath.toString();<a name="line.457"></a>
-<span class="sourceLineNo">458</span>      throw new IOException(errorMsg);<a name="line.458"></a>
+<span class="sourceLineNo">409</span>  public BackupManifest(Configuration conf, Path backupPath) throws IOException {<a name="line.409"></a>
+<span class="sourceLineNo">410</span>    this(backupPath.getFileSystem(conf), backupPath);<a name="line.410"></a>
+<span class="sourceLineNo">411</span>  }<a name="line.411"></a>
+<span class="sourceLineNo">412</span><a name="line.412"></a>
+<span class="sourceLineNo">413</span>  /**<a name="line.413"></a>
+<span class="sourceLineNo">414</span>   * Construct manifest from a backup directory.<a name="line.414"></a>
+<span class="sourceLineNo">415</span>   * @param fs the FileSystem<a name="line.415"></a>
+<span class="sourceLineNo">416</span>   * @param backupPath backup path<a name="line.416"></a>
+<span class="sourceLineNo">417</span>   * @throws BackupException exception<a name="line.417"></a>
+<span class="sourceLineNo">418</span>   */<a name="line.418"></a>
+<span class="sourceLineNo">419</span>  public BackupManifest(FileSystem fs, Path backupPath) throws BackupException {<a name="line.419"></a>
+<span class="sourceLineNo">420</span>    if (LOG.isDebugEnabled()) {<a name="line.420"></a>
+<span class="sourceLineNo">421</span>      LOG.debug("Loading manifest from: " + backupPath.toString());<a name="line.421"></a>
+<span class="sourceLineNo">422</span>    }<a name="line.422"></a>
+<span class="sourceLineNo">423</span>    // The input backupDir may not exactly be the backup table dir.<a name="line.423"></a>
+<span class="sourceLineNo">424</span>    // It could be the backup log dir where there is also a manifest file stored.<a name="line.424"></a>
+<span class="sourceLineNo">425</span>    // This variable's purpose is to keep the correct and original location so<a name="line.425"></a>
+<span class="sourceLineNo">426</span>    // that we can store/persist it.<a name="line.426"></a>
+<span class="sourceLineNo">427</span>    try {<a name="line.427"></a>
+<span class="sourceLineNo">428</span>      FileStatus[] subFiles = BackupUtils.listStatus(fs, backupPath, null);<a name="line.428"></a>
+<span class="sourceLineNo">429</span>      if (subFiles == null) {<a name="line.429"></a>
+<span class="sourceLineNo">430</span>        String errorMsg = backupPath.toString() + " does not exist";<a name="line.430"></a>
+<span class="sourceLineNo">431</span>        LOG.error(errorMsg);<a name="line.431"></a>
+<span class="sourceLineNo">432</span>        throw new IOException(errorMsg);<a name="line.432"></a>
+<span class="sourceLineNo">433</span>      }<a name="line.433"></a>
+<span class="sourceLineNo">434</span>      for (FileStatus subFile : subFiles) {<a name="line.434"></a>
+<span class="sourceLineNo">435</span>        if (subFile.getPath().getName().equals(MANIFEST_FILE_NAME)) {<a name="line.435"></a>
+<span class="sourceLineNo">436</span>          // load and set manifest field from file content<a name="line.436"></a>
+<span class="sourceLineNo">437</span>          FSDataInputStream in = fs.open(subFile.getPath());<a name="line.437"></a>
+<span class="sourceLineNo">438</span>          long len = subFile.getLen();<a name="line.438"></a>
+<span class="sourceLineNo">439</span>          byte[] pbBytes = new byte[(int) len];<a name="line.439"></a>
+<span class="sourceLineNo">440</span>          in.readFully(pbBytes);<a name="line.440"></a>
+<span class="sourceLineNo">441</span>          BackupProtos.BackupImage proto = null;<a name="line.441"></a>
+<span class="sourceLineNo">442</span>          try {<a name="line.442"></a>
+<span class="sourceLineNo">443</span>            proto = BackupProtos.BackupImage.parseFrom(pbBytes);<a name="line.443"></a>
+<span class="sourceLineNo">444</span>          } catch (Exception e) {<a name="line.444"></a>
+<span class="sourceLineNo">445</span>            throw new BackupException(e);<a name="line.445"></a>
+<span class="sourceLineNo">446</span>          }<a name="line.446"></a>
+<span class="sourceLineNo">447</span>          this.backupImage = BackupImage.fromProto(proto);<a name="line.447"></a>
+<span class="sourceLineNo">448</span>          LOG.debug("Loaded manifest instance from manifest file: "<a name="line.448"></a>
+<span class="sourceLineNo">449</span>              + BackupUtils.getPath(subFile.getPath()));<a name="line.449"></a>
+<span class="sourceLineNo">450</span>          return;<a name="line.450"></a>
+<span class="sourceLineNo">451</span>        }<a name="line.451"></a>
+<span class="sourceLineNo">452</span>      }<a name="line.452"></a>
+<span class="sourceLineNo">453</span>      String errorMsg = "No manifest file found in: " + backupPath.toString();<a name="line.453"></a>
+<span class="sourceLineNo">454</span>      throw new IOException(errorMsg);<a name="line.454"></a>
+<span class="sourceLineNo">455</span>    } catch (IOException e) {<a name="line.455"></a>
+<span class="sourceLineNo">456</span>      throw new BackupException(e.getMessage());<a name="line.456"></a>
+<span class="sourceLineNo">457</span>    }<a name="line.457"></a>
+<span class="sourceLineNo">458</span>  }<a name="line.458"></a>
 <span class="sourceLineNo">459</span><a name="line.459"></a>
-<span class="sourceLineNo">460</span>    } catch (IOException e) {<a name="line.460"></a>
-<span class="sourceLineNo">461</span>      throw new BackupException(e.getMessage());<a name="line.461"></a>
-<span class="sourceLineNo">462</span>    }<a name="line.462"></a>
-<span class="sourceLineNo">463</span>  }<a name="line.463"></a>
-<span class="sourceLineNo">464</span><a name="line.464"></a>
-<span class="sourceLineNo">465</span>  public BackupType getType() {<a name="line.465"></a>
-<span class="sourceLineNo">466</span>    return backupImage.getType();<a name="line.466"></a>
-<span class="sourceLineNo">467</span>  }<a name="line.467"></a>
-<span class="sourceLineNo">468</span><a name="line.468"></a>
-<span class="sourceLineNo">469</span>  /**<a name="line.469"></a>
-<span class="sourceLineNo">470</span>   * Get the table set of this image.<a name="line.470"></a>
-<span class="sourceLineNo">471</span>   * @return The table set list<a name="line.471"></a>
-<span class="sourceLineNo">472</span>   */<a name="line.472"></a>
-<span class="sourceLineNo">473</span>  public List&lt;TableName&gt; getTableList() {<a name="line.473"></a>
-<span class="sourceLineNo">474</span>    return backupImage.getTableNames();<a name="line.474"></a>
-<span class="sourceLineNo">475</span>  }<a name="line.475"></a>
-<span class="sourceLineNo">476</span><a name="line.476"></a>
-<span class="sourceLineNo">477</span>  /**<a name="line.477"></a>
-<span class="sourceLineNo">478</span>   * TODO: fix it. Persist the manifest file.<a name="line.478"></a>
-<span class="sourceLineNo">479</span>   * @throws IOException IOException when storing the manifest file.<a name="line.479"></a>
-<span class="sourceLineNo">480</span>   */<a name="line.480"></a>
-<span class="sourceLineNo">481</span><a name="line.481"></a>
-<span class="sourceLineNo">482</span>  public void store(Configuration conf) throws BackupException {<a name="line.482"></a>
-<span class="sourceLineNo">483</span>    byte[] data = backupImage.toProto().toByteArray();<a name="line.483"></a>
-<span class="sourceLineNo">484</span>    // write the file, overwrite if already exist<a name="line.484"></a>
-<span class="sourceLineNo">485</span>    Path manifestFilePath =<a name="line.485"></a>
-<span class="sourceLineNo">486</span>        new Path(HBackupFileSystem.getBackupPath(backupImage.getRootDir(),<a name="line.486"></a>
-<span class="sourceLineNo">487</span>          backupImage.getBackupId()), MANIFEST_FILE_NAME);<a name="line.487"></a>
-<span class="sourceLineNo">488</span>    try (FSDataOutputStream out =<a name="line.488"></a>
-<span class="sourceLineNo">489</span>        manifestFilePath.getFileSystem(conf).create(manifestFilePath, true)) {<a name="line.489"></a>
-<span class="sourceLineNo">490</span>      out.write(data);<a name="line.490"></a>
-<span class="sourceLineNo">491</span>    } catch (IOException e) {<a name="line.491"></a>
-<span class="sourceLineNo">492</span>      throw new BackupException(e.getMessage());<a name="line.492"></a>
-<span class="sourceLineNo">493</span>    }<a name="line.493"></a>
-<span class="sourceLineNo">494</span><a name="line.494"></a>
-<span class="sourceLineNo">495</span>    LOG.info("Manifest file stored to " + manifestFilePath);<a name="line.495"></a>
-<span class="sourceLineNo">496</span>  }<a name="line.496"></a>
-<span class="sourceLineNo">497</span><a name="line.497"></a>
-<span class="sourceLineNo">498</span>  /**<a name="line.498"></a>
-<span class="sourceLineNo">499</span>   * Get this backup image.<a name="line.499"></a>
-<span class="sourceLineNo">500</span>   * @return the backup image.<a name="line.500"></a>
-<span class="sourceLineNo">501</span>   */<a name="line.501"></a>
-<span class="sourceLineNo">502</span>  public BackupImage getBackupImage() {<a name="line.502"></a>
-<span class="sourceLineNo">503</span>    return backupImage;<a name="line.503"></a>
-<span class="sourceLineNo">504</span>  }<a name="line.504"></a>
-<span class="sourceLineNo">505</span><a name="line.505"></a>
-<span class="sourceLineNo">506</span>  /**<a name="line.506"></a>
-<span class="sourceLineNo">507</span>   * Add dependent backup image for this backup.<a name="line.507"></a>
-<span class="sourceLineNo">508</span>   * @param image The direct dependent backup image<a name="line.508"></a>
-<span class="sourceLineNo">509</span>   */<a name="line.509"></a>
-<span class="sourceLineNo">510</span>  public void addDependentImage(BackupImage image) {<a name="line.510"></a>
-<span class="sourceLineNo">511</span>    this.backupImage.addAncestor(image);<a name="line.511"></a>
-<span class="sourceLineNo">512</span>  }<a name="line.512"></a>
-<span class="sourceLineNo">513</span><a name="line.513"></a>
-<span class="sourceLineNo">514</span>  /**<a name="line.514"></a>
-<span class="sourceLineNo">515</span>   * Set the incremental timestamp map directly.<a name="line.515"></a>
-<span class="sourceLineNo">516</span>   * @param incrTimestampMap timestamp map<a name="line.516"></a>
-<span class="sourceLineNo">517</span>   */<a name="line.517"></a>
-<span class="sourceLineNo">518</span>  public void setIncrTimestampMap(HashMap&lt;TableName, HashMap&lt;String, Long&gt;&gt; incrTimestampMap) {<a name="line.518"></a>
-<span class="sourceLineNo">519</span>    this.backupImage.setIncrTimeRanges(incrTimestampMap);<a name="line.519"></a>
-<span class="sourceLineNo">520</span>  }<a name="line.520"></a>
-<span class="sourceLineNo">521</span><a name="line.521"></a>
-<span class="sourceLineNo">522</span>  public Map&lt;TableName, HashMap&lt;String, Long&gt;&gt; getIncrTimestampMap() {<a name="line.522"></a>
-<span class="sourceLineNo">523</span>    return backupImage.getIncrTimeRanges();<a name="line.523"></a>
-<span class="sourceLineNo">524</span>  }<a name="line.524"></a>
-<span class="sourceLineNo">525</span><a name="line.525"></a>
-<span class="sourceLineNo">526</span>  /**<a name="line.526"></a>
-<span class="sourceLineNo">527</span>   * Get the image list of this backup for restore in time order.<a name="line.527"></a>
-<span class="sourceLineNo">528</span>   * @param reverse If true, then output in reverse order, otherwise in time order from old to new<a name="line.528"></a>
-<span class="sourceLineNo">529</span>   * @return the backup image list for restore in time order<a name="line.529"></a>
-<span class="sourceLineNo">530</span>   */<a name="line.530"></a>
-<span class="sourceLineNo">531</span>  public ArrayList&lt;BackupImage&gt; getRestoreDependentList(boolean reverse) {<a name="line.531"></a>
-<span class="sourceLineNo">532</span>    TreeMap&lt;Long, BackupImage&gt; restoreImages = new TreeMap&lt;Long, BackupImage&gt;();<a name="line.532"></a>
-<span class="sourceLineNo">533</span>    restoreImages.put(backupImage.startTs, backupImage);<a name="line.533"></a>
-<span class="sourceLineNo">534</span>    for (BackupImage image : backupImage.getAncestors()) {<a name="line.534"></a>
-<span class="sourceLineNo">535</span>      restoreImages.put(Long.valueOf(image.startTs), image);<a name="line.535"></a>
-<span class="sourceLineNo">536</span>    }<a name="line.536"></a>
-<span class="sourceLineNo">537</span>    return new ArrayList&lt;BackupImage&gt;(reverse ? (restoreImages.descendingMap().values())<a name="line.537"></a>
-<span class="sourceLineNo">538</span>        : (restoreImages.values()));<a name="line.538"></a>
-<span class="sourceLineNo">539</span>  }<a name="line.539"></a>
-<span class="sourceLineNo">540</span><a name="line.540"></a>
-<span class="sourceLineNo">541</span>  /**<a name="line.541"></a>
-<span class="sourceLineNo">542</span>   * Get the dependent image list for a specific table of this backup in time order from old to new<a name="line.542"></a>
-<span class="sourceLineNo">543</span>   * if want to restore to this backup image level.<a name="line.543"></a>
-<span class="sourceLineNo">544</span>   * @param table table<a name="line.544"></a>
-<span class="sourceLineNo">545</span>   * @return the backup image list for a table in time order<a name="line.545"></a>
-<span class="sourceLineNo">546</span>   */<a name="line.546"></a>
-<span class="sourceLineNo">547</span>  public ArrayList&lt;BackupImage&gt; getDependentListByTable(TableName table) {<a name="line.547"></a>
-<span class="sourceLineNo">548</span>    ArrayList&lt;BackupImage&gt; tableImageList = new ArrayList&lt;BackupImage&gt;();<a name="line.548"></a>
-<span class="sourceLineNo">549</span>    ArrayList&lt;BackupImage&gt; imageList = getRestoreDependentList(true);<a name="line.549"></a>
-<span class="sourceLineNo">550</span>    for (BackupImage image : imageList) {<a name="line.550"></a>
-<span class="sourceLineNo">551</span>      if (image.hasTable(table)) {<a name="line.551"></a>
-<span class="sourceLineNo">552</span>        tableImageList.add(image);<a name="line.552"></a>
-<span class="sourceLineNo">553</span>        if (image.getType() == BackupType.FULL) {<a name="line.553"></a>
-<span class="sourceLineNo">554</span>          break;<a name="line.554"></a>
-<span class="sourceLineNo">555</span>        }<a name="line.555"></a>
-<span class="sourceLineNo">556</span>      }<a name="line.556"></a>
-<span class="sourceLineNo">557</span>    }<a name="line.557"></a>
-<span class="sourceLineNo">558</span>    Collections.reverse(tableImageList);<a name="line.558"></a>
-<span class="sourceLineNo">559</span>    return tableImageList;<a name="line.559"></a>
-<span class="sourceLineNo">560</span>  }<a name="line.560"></a>
-<span class="sourceLineNo">561</span><a name="line.561"></a>
-<span class="sourceLineNo">562</span>  /**<a name="line.562"></a>
-<span class="sourceLineNo">563</span>   * Get the full dependent image list in the whole dependency scope for a specific table of this<a name="line.563"></a>
-<span class="sourceLineNo">564</span>   * backup in time order from old to new.<a name="line.564"></a>
-<span class="sourceLineNo">565</span>   * @param table table<a name="line.565"></a>
-<span class="sourceLineNo">566</span>   * @return the full backup image list for a table in time order in the whole scope of the<a name="line.566"></a>
-<span class="sourceLineNo">567</span>   *         dependency of this image<a name="line.567"></a>
-<span class="sourceLineNo">568</span>   */<a name="line.568"></a>
-<span class="sourceLineNo">569</span>  public ArrayList&lt;BackupImage&gt; getAllDependentListByTable(TableName table) {<a name="line.569"></a>
-<span class="sourceLineNo">570</span>    ArrayList&lt;BackupImage&gt; tableImageList = new ArrayList&lt;BackupImage&gt;();<a name="line.570"></a>
-<span class="sourceLineNo">571</span>    ArrayList&lt;BackupImage&gt; imageList = getRestoreDependentList(false);<a name="line.571"></a>
-<span class="sourceLineNo">572</span>    for (BackupImage image : imageList) {<a name="line.572"></a>
-<span class="sourceLineNo">573</span>      if (image.hasTable(table)) {<a name="line.573"></a>
-<span class="sourceLineNo">574</span>        tableImageList.add(image);<a name="line.574"></a>
-<span class="sourceLineNo">575</span>      }<a name="line.575"></a>
-<span class="sourceLineNo">576</span>    }<a name="line.576"></a>
-<span class="sourceLineNo">577</span>    return tableImageList;<a name="line.577"></a>
-<span class="sourceLineNo">578</span>  }<a name="line.578"></a>
-<span class="sourceLineNo">579</span><a name="line.579"></a>
-<span class="sourceLineNo">580</span>  /**<a name="line.580"></a>
-<span class="sourceLineNo">581</span>   * Check whether backup image1 could cover backup image2 or not.<a name="line.581"></a>
-<span class="sourceLineNo">582</span>   * @param image1 backup image 1<a name="line.582"></a>
-<span class="sourceLineNo">583</span>   * @param image2 backup image 2<a name="line.583"></a>
-<span class="sourceLineNo">584</span>   * @return true if image1 can cover image2, otherwise false<a name="line.584"></a>
-<span class="sourceLineNo">585</span>   */<a name="line.585"></a>
-<span class="sourceLineNo">586</span>  public static boolean canCoverImage(BackupImage image1, BackupImage image2) {<a name="line.586"></a>
-<span class="sourceLineNo">587</span>    // image1 can cover image2 only when the following conditions are satisfied:<a name="line.587"></a>
-<span class="sourceLineNo">588</span>    // - image1 must not be an incremental image;<a name="line.588"></a>
-<span class="sourceLineNo">589</span>    // - image1 must be taken after image2 has been taken;<a name="line.589"></a>
-<span class="sourceLineNo">590</span>    // - table set of image1 must cover the table set of image2.<a name="line.590"></a>
-<span class="sourceLineNo">591</span>    if (image1.getType() == BackupType.INCREMENTAL) {<a name="line.591"></a>
-<span class="sourceLineNo">592</span>      return false;<a name="line.592"></a>
-<span class="sourceLineNo">593</span>    }<a name="line.593"></a>
-<span class="sourceLineNo">594</span>    if (image1.getStartTs() &lt; image2.getStartTs()) {<a name="line.594"></a>
-<span class="sourceLineNo">595</span>      return false;<a name="line.595"></a>
-<span class="sourceLineNo">596</span>    }<a name="line.596"></a>
-<span class="sourceLineNo">597</span>    List&lt;TableName&gt; image1TableList = image1.getTableNames();<a name="line.597"></a>
-<span class="sourceLineNo">598</span>    List&lt;TableName&gt; image2TableList = image2.getTableNames();<a name="line.598"></a>
-<span class="sourceLineNo">599</span>    boolean found = false;<a name="line.599"></a>
-<span class="sourceLineNo">600</span>    for (int i = 0; i &lt; image2TableList.size(); i++) {<a name="line.600"></a>
-<span class="sourceLineNo">601</span>      found = false;<a name="line.601"></a>
-<span class="sourceLineNo">602</span>      for (int j = 0; j &lt; image1TableList.size(); j++) {<a name="line.602"></a>
-<span class="sourceLineNo">603</span>        if (image2TableList.get(i).equals(image1TableList.get(j))) {<a name="line.603"></a>
-<span class="sourceLineNo">604</span>          found = true;<a name="line.604"></a>
-<span class="sourceLineNo">605</span>          break;<a name="line.605"></a>
-<span class="sourceLineNo">606</span>        }<a name="line.606"></a>
-<span class="sourceLineNo">607</span>      }<a name="line.607"></a>
-<span class="sourceLineNo">608</span>      if (!found) {<a name="line.608"></a>
-<span class="sourceLineNo">609</span>        return false;<a name="line.609"></a>
-<span class="sourceLineNo">610</span>      }<a name="line.610"></a>
-<span class="sourceLineNo">611</span>    }<a name="line.611"></a>
-<span class="sourceLineNo">612</span><a name="line.612"></a>
-<span class="sourceLineNo">613</span>    LOG.debug("Backup image " + image1.getBackupId() + " can cover " + image2.getBackupId());<a name="line.613"></a>
-<span class="sourceLineNo">614</span>    return true;<a name="line.614"></a>
-<span class="sourceLineNo">615</span>  }<a name="line.615"></a>
-<span class="sourceLineNo">616</span><a name="line.616"></a>
-<span class="sourceLineNo">617</span>  /**<a name="line.617"></a>
-<span class="sourceLineNo">618</span>   * Check whether backup image set could cover a backup image or not.<a name="line.618"></a>
-<span class="sourceLineNo">619</span>   * @param fullImages The backup image set<a name="line.619"></a>
-<span class="sourceLineNo">620</span>   * @param image The target backup image<a name="line.620"></a>
-<span class="sourceLineNo">621</span>   * @return true if fullImages can cover image, otherwise false<a name="line.621"></a>
-<span class="sourceLineNo">622</span>   */<a name="line.622"></a>
-<span class="sourceLineNo">623</span>  public static boolean canCoverImage(ArrayList&lt;BackupImage&gt; fullImages, BackupImage image) {<a name="line.623"></a>
-<span class="sourceLineNo">624</span>    // fullImages can cover image only when the following conditions are satisfied:<a name="line.624"></a>
-<span class="sourceLineNo">625</span>    // - each image of fullImages must not be an incremental image;<a name="line.625"></a>
-<span class="sourceLineNo">626</span>    // - each image of fullImages must be taken after image has been taken;<a name="line.626"></a>
-<span class="sourceLineNo">627</span>    // - sum table set of fullImages must cover the table set of image.<a name="line.627"></a>
-<span class="sourceLineNo">628</span>    for (BackupImage image1 : fullImages) {<a name="line.628"></a>
-<span class="sourceLineNo">629</span>      if (image1.getType() == BackupType.INCREMENTAL) {<a name="line.629"></a>
-<span class="sourceLineNo">630</span>        return false;<a name="line.630"></a>
-<span class="sourceLineNo">631</span>      }<a name="line.631"></a>
-<span class="sourceLineNo">632</span>      if (image1.getStartTs() &lt; image.getStartTs()) {<a name="line.632"></a>
-<span class="sourceLineNo">633</span>        return false;<a name="line.633"></a>
-<span class="sourceLineNo">634</span>      }<a name="line.634"></a>
-<span class="sourceLineNo">635</span>    }<a name="line.635"></a>
-<span class="sourceLineNo">636</span><a name="line.636"></a>
-<span class="sourceLineNo">637</span>    ArrayList&lt;String&gt; image1TableList = new ArrayList&lt;String&gt;();<a name="line.637"></a>
-<span class="sourceLineNo">638</span>    for (BackupImage image1 : fullImages) {<a name="line.638"></a>
-<span class="sourceLineNo">639</span>      List&lt;TableName&gt; tableList = image1.getTableNames();<a name="line.639"></a>
-<span class="sourceLineNo">640</span>      for (TableName table : tableList) {<a name="line.640"></a>
-<span class="sourceLineNo">641</span>        image1TableList.add(table.getNameAsString());<a name="line.641"></a>
-<span class="sourceLineNo">642</span>      }<a name="line.642"></a>
-<span class="sourceLineNo">643</span>    }<a name="line.643"></a>
-<span class="sourceLineNo">644</span>    ArrayList&lt;String&gt; image2TableList = new ArrayList&lt;String&gt;();<a name="line.644"></a>
-<span class="sourceLineNo">645</span>    List&lt;TableName&gt; tableList = image.getTableNames();<a name="line.645"></a>
-<span class="sourceLineNo">646</span>    for (TableName table : tableList) {<a name="line.646"></a>
-<span class="sourceLineNo">647</span>      image2TableList.add(table.getNameAsString());<a name="line.647"></a>
+<span class="sourceLineNo">460</span>  public BackupType getType() {<a name="line.460"></a>
+<span class="sourceLineNo">461</span>    return backupImage.getType();<a name="line.461"></a>
+<span class="sourceLineNo">462</span>  }<a name="line.462"></a>
+<span class="sourceLineNo">463</span><a name="line.463"></a>
+<span class="sourceLineNo">464</span>  /**<a name="line.464"></a>
+<span class="sourceLineNo">465</span>   * Get the table set of this image.<a name="line.465"></a>
+<span class="sourceLineNo">466</span>   * @return The table set list<a name="line.466"></a>
+<span class="sourceLineNo">467</span>   */<a name="line.467"></a>
+<span class="sourceLineNo">468</span>  public List&lt;TableName&gt; getTableList() {<a name="line.468"></a>
+<span class="sourceLineNo">469</span>    return backupImage.getTableNames();<a name="line.469"></a>
+<span class="sourceLineNo">470</span>  }<a name="line.470"></a>
+<span class="sourceLineNo">471</span><a name="line.471"></a>
+<span class="sourceLineNo">472</span>  /**<a name="line.472"></a>
+<span class="sourceLineNo">473</span>   * TODO: fix it. Persist the manifest file.<a name="line.473"></a>
+<span class="sourceLineNo">474</span>   * @throws IOException IOException when storing the manifest file.<a name="line.474"></a>
+<span class="sourceLineNo">475</span>   */<a name="line.475"></a>
+<span class="sourceLineNo">476</span>  public void store(Configuration conf) throws BackupException {<a name="line.476"></a>
+<span class="sourceLineNo">477</span>    byte[] data = backupImage.toProto().toByteArray();<a name="line.477"></a>
+<span class="sourceLineNo">478</span>    // write the file, overwrite if already exist<a name="line.478"></a>
+<span class="sourceLineNo">479</span>    Path manifestFilePath =<a name="line.479"></a>
+<span class="sourceLineNo">480</span>        new Path(HBackupFileSystem.getBackupPath(backupImage.getRootDir(),<a name="line.480"></a>
+<span class="sourceLineNo">481</span>          backupImage.getBackupId()), MANIFEST_FILE_NAME);<a name="line.481"></a>
+<span class="sourceLineNo">482</span>    try (FSDataOutputStream out =<a name="line.482"></a>
+<span class="sourceLineNo">483</span>        manifestFilePath.getFileSystem(conf).create(manifestFilePath, true)) {<a name="line.483"></a>
+<span class="sourceLineNo">484</span>      out.write(data);<a name="line.484"></a>
+<span class="sourceLineNo">485</span>    } catch (IOException e) {<a name="line.485"></a>
+<span class="sourceLineNo">486</span>      throw new BackupException(e.getMessage());<a name="line.486"></a>
+<span class="sourceLineNo">487</span>    }<a name="line.487"></a>
+<span class="sourceLineNo">488</span><a name="line.488"></a>
+<span class="sourceLineNo">489</span>    LOG.info("Manifest file stored to " + manifestFilePath);<a name="line.489"></a>
+<span class="sourceLineNo">490</span>  }<a name="line.490"></a>
+<span class="sourceLineNo">491</span><a name="line.491"></a>
+<span class="sourceLineNo">492</span>  /**<a name="line.492"></a>
+<span class="sourceLineNo">493</span>   * Get this backup image.<a name="line.493"></a>
+<span class="sourceLineNo">494</span>   * @return the backup image.<a name="line.494"></a>
+<span class="sourceLineNo">495</span>   */<a name="line.495"></a>
+<span class="sourceLineNo">496</span>  public BackupImage getBackupImage() {<a name="line.496"></a>
+<span class="sourceLineNo">497</span>    return backupImage;<a name="line.497"></a>
+<span class="sourceLineNo">498</span>  }<a name="line.498"></a>
+<span class="sourceLineNo">499</span><a name="line.499"></a>
+<span class="sourceLineNo">500</span>  /**<a name="line.500"></a>
+<span class="sourceLineNo">501</span>   * Add dependent backup image for this backup.<a name="line.501"></a>
+<span class="sourceLineNo">502</span>   * @param image The direct dependent backup image<a name="line.502"></a>
+<span class="sourceLineNo">503</span>   */<a name="line.503"></a>
+<span class="sourceLineNo">504</span>  public void addDependentImage(BackupImage image) {<a name="line.504"></a>
+<span class="sourceLineNo">505</span>    this.backupImage.addAncestor(image);<a name="line.505"></a>
+<span class="sourceLineNo">506</span>  }<a name="line.506"></a>
+<span class="sourceLineNo">507</span><a name="line.507"></a>
+<span class="sourceLineNo">508</span>  /**<a name="line.508"></a>
+<span class="sourceLineNo">509</span>   * Set the incremental timestamp map directly.<a name="line.509"></a>
+<span class="sourceLineNo">510</span>   * @param incrTimestampMap timestamp map<a name="line.510"></a>
+<span class="sourceLineNo">511</span>   */<a name="line.511"></a>
+<span class="sourceLineNo">512</span>  public void setIncrTimestampMap(HashMap&lt;TableName, HashMap&lt;String, Long&gt;&gt; incrTimestampMap) {<a name="line.512"></a>
+<span class="sourceLineNo">513</span>    this.backupImage.setIncrTimeRanges(incrTimestampMap);<a name="line.513"></a>
+<span class="sourceLineNo">514</span>  }<a name="line.514"></a>
+<span class="sourceLineNo">515</span><a name="line.515"></a>
+<span class="sourceLineNo">516</span>  public Map&lt;TableName, HashMap&lt;String, Long&gt;&gt; getIncrTimestampMap() {<a name="line.516"></a>
+<span class="sourceLineNo">517</span>    return backupImage.getIncrTimeRanges();<a name="line.517"></a>
+<span class="sourceLineNo">518</span>  }<a name="line.518"></a>
+<span class="sourceLineNo">519</span><a name="line.519"></a>
+<span class="sourceLineNo">520</span>  /**<a name="line.520"></a>
+<span class="sourceLineNo">521</span>   * Get the image list of this backup for restore in time order.<a name="line.521"></a>
+<span class="sourceLineNo">522</span>   * @param reverse If true, then output in reverse order, otherwise in time order from old to new<a name="line.522"></a>
+<span class="sourceLineNo">523</span>   * @return the backup image list for restore in time order<a name="line.523"></a>
+<span class="sourceLineNo">524</span>   */<a name="line.524"></a>
+<span class="sourceLineNo">525</span>  public ArrayList&lt;BackupImage&gt; getRestoreDependentList(boolean reverse) {<a name="line.525"></a>
+<span class="sourceLineNo">526</span>    TreeMap&lt;Long, BackupImage&gt; restoreImages = new TreeMap&lt;&gt;();<a name="line.526"></a>
+<span class="sourceLineNo">527</span>    restoreImages.put(backupImage.startTs, backupImage);<a name="line.527"></a>
+<span class="sourceLineNo">528</span>    for (BackupImage image : backupImage.getAncestors()) {<a name="line.528"></a>
+<span class="sourceLineNo">529</span>      restoreImages.put(Long.valueOf(image.startTs), image);<a name="line.529"></a>
+<span class="sourceLineNo">530</span>    }<a name="line.530"></a>
+<span class="sourceLineNo">531</span>    return new ArrayList&lt;&gt;(reverse ? (restoreImages.descendingMap().values())<a name="line.531"></a>
+<span class="sourceLineNo">532</span>        : (restoreImages.values()));<a name="line.532"></a>
+<span class="sourceLineNo">533</span>  }<a name="line.533"></a>
+<span class="sourceLineNo">534</span><a name="line.534"></a>
+<span class="sourceLineNo">535</span>  /**<a name="line.535"></a>
+<span class="sourceLineNo">536</span>   * Get the dependent image list for a specific table of this backup in time order from old to new<a name="line.536"></a>
+<span class="sourceLineNo">537</span>   * if want to restore to this backup image level.<a name="line.537"></a>
+<span class="sourceLineNo">538</span>   * @param table table<a name="line.538"></a>
+<span class="sourceLineNo">539</span>   * @return the backup image list for a table in time order<a name="line.539"></a>
+<span class="sourceLineNo">540</span>   */<a name="line.540"></a>
+<span class="sourceLineNo">541</span>  public ArrayList&lt;BackupImage&gt; getDependentListByTable(TableName table) {<a name="line.541"></a>
+<span class="sourceLineNo">542</span>    ArrayList&lt;BackupImage&gt; tableImageList = new ArrayList&lt;&gt;();<a name="line.542"></a>
+<span class="sourceLineNo">543</span>    ArrayList&lt;BackupImage&gt; imageList = getRestoreDependentList(true);<a name="line.543"></a>
+<span class="sourceLineNo">544</span>    for (BackupImage image : imageList) {<a name="line.544"></a>
+<span class="sourceLineNo">545</span>      if (image.hasTable(table)) {<a name="line.545"></a>
+<span class="sourceLineNo">546</span>        tableImageList.add(image);<a name="line.546"></a>
+<span class="sourceLineNo">547</span>        if (image.getType() == BackupType.FULL) {<a name="line.547"></a>
+<span class="sourceLineNo">548</span>          break;<a name="line.548"></a>
+<span class="sourceLineNo">549</span>        }<a name="line.549"></a>
+<span class="sourceLineNo">550</span>      }<a name="line.550"></a>
+<span class="sourceLineNo">551</span>    }<a name="line.551"></a>
+<span class="sourceLineNo">552</span>    Collections.reverse(tableImageList);<a name="line.552"></a>
+<span class="sourceLineNo">553</span>    return tableImageList;<a name="line.553"></a>
+<span class="sourceLineNo">554</span>  }<a name="line.554"></a>
+<span class="sourceLineNo">555</span><a name="line.555"></a>
+<span class="sourceLineNo">556</span>  /**<a name="line.556"></a>
+<span class="sourceLineNo">557</span>   * Get the full dependent image list in the whole dependency scope for a specific table of this<a name="line.557"></a>
+<span class="sourceLineNo">558</span>   * backup in time order from old to new.<a name="line.558"></a>
+<span class="sourceLineNo">559</span>   * @param table table<a name="line.559"></a>
+<span class="sourceLineNo">560</span>   * @return the full backup image list for a table in time order in the whole scope of the<a name="line.560"></a>
+<span class="sourceLineNo">561</span>   *         dependency of this image<a name="line.561"></a>
+<span class="sourceLineNo">562</span>   */<a name="line.562"></a>
+<span class="sourceLineNo">563</span>  public ArrayList&lt;BackupImage&gt; getAllDependentListByTable(TableName table) {<a name="line.563"></a>
+<span class="sourceLineNo">564</span>    ArrayList&lt;BackupImage&gt; tableImageList = new ArrayList&lt;&gt;();<a name="line.564"></a>
+<span class="sourceLineNo">565</span>    ArrayList&lt;BackupImage&gt; imageList = getRestoreDependentList(false);<a name="line.565"></a>
+<span class="sourceLineNo">566</span>    for (BackupImage image : imageList) {<a name="line.566"></a>
+<span class="sourceLineNo">567</span>      if (image.hasTable(table)) {<a name="line.567"></a>
+<span class="sourceLineNo">568</span>        tableImageList.add(image);<a name="line.568"></a>
+<span class="sourceLineNo">569</span>      }<a name="line.569"></a>
+<span class="sourceLineNo">570</span>    }<a name="line.570"></a>
+<span class="sourceLineNo">571</span>    return tableImageList;<a name="line.571"></a>
+<span class="sourceLineNo">572</span>  }<a name="line.572"></a>
+<span class="sourceLineNo">573</span><a name="line.573"></a>
+<span class="sourceLineNo">574</span>  /**<a name="line.574"></a>
+<span class="sourceLineNo">575</span>   * Check whether backup image1 could cover backup image2 or not.<a name="line.575"></a>
+<span class="sourceLineNo">576</span>   * @param image1 backup image 1<a name="line.576"></a>
+<span class="sourceLineNo">577</span>   * @param image2 backup image 2<a name="line.577"></a>
+<span class="sourceLineNo">578</span>   * @return true if image1 can cover image2, otherwise false<a name="line.578"></a>
+<span class="sourceLineNo">579</span>   */<a name="line.579"></a>
+<span class="sourceLineNo">580</span>  public static boolean canCoverImage(BackupImage image1, BackupImage image2) {<a name="line.580"></a>
+<span class="sourceLineNo">581</span>    // image1 can cover image2 only when the following conditions are satisfied:<a name="line.581"></a>
+<span class="sourceLineNo">582</span>    // - image1 must not be an incremental image;<a name="line.582"></a>
+<span class="sourceLineNo">583</span>    // - image1 must be taken after image2 has been taken;<a name="line.583"></a>
+<span class="sourceLineNo">584</span>    // - table set of image1 must cover the table set of image2.<a name="line.584"></a>
+<span class="sourceLineNo">585</span>    if (image1.getType() == BackupType.INCREMENTAL) {<a name="line.585"></a>
+<span class="sourceLineNo">586</span>      return false;<a name="line.586"></a>
+<span class="sourceLineNo">587</span>    }<a name="line.587"></a>
+<span class="sourceLineNo">588</span>    if (image1.getStartTs() &lt; image2.getStartTs()) {<a name="line.588"></a>
+<span class="sourceLineNo">589</span>      return false;<a name="line.589"></a>
+<span class="sourceLineNo">590</span>    }<a name="line.590"></a>
+<span class="sourceLineNo">591</span>    List&lt;TableName&gt; image1TableList = image1.getTableNames();<a name="line.591"></a>
+<span class="sourceLineNo">592</span>    List&lt;TableName&gt; image2TableList = image2.getTableNames();<a name="line.592"></a>
+<span class="sourceLineNo">593</span>    boolean found;<a name="line.593"></a>
+<span class="sourceLineNo">594</span>    for (int i = 0; i &lt; image2TableList.size(); i++) {<a name="line.594"></a>
+<span class="sourceLineNo">595</span>      found = false;<a name="line.595"></a>
+<span class="sourceLineNo">596</span>      for (int j = 0; j &lt; image1TableList.size(); j++) {<a name="line.596"></a>
+<span class="sourceLineNo">597</span>        if (image2TableList.get(i).equals(image1TableList.get(j))) {<a name="line.597"></a>
+<span class="sourceLineNo">598</span>          found = true;<a name="line.598"></a>
+<span class="sourceLineNo">599</span>          break;<a name="line.599"></a>
+<span class="sourceLineNo">600</span>        }<a name="line.600"></a>
+<span class="sourceLineNo">601</span>      }<a name="line.601"></a>
+<span class="sourceLineNo">602</span>      if (!found) {<a name="line.602"></a>
+<span class="sourceLineNo">603</span>        return false;<a name="line.603"></a>
+<span class="sourceLineNo">604</span>      }<a name="line.604"></a>
+<span class="sourceLineNo">605</span>    }<a name="line.605"></a>
+<span class="sourceLineNo">606</span><a name="line.606"></a>
+<span class="sourceLineNo">607</span>    LOG.debug("Backup image " + image1.getBackupId() + " can cover " + image2.getBackupId());<a name="line.607"></a>
+<span class="sourceLineNo">608</span>    return true;<a name="line.608"></a>
+<span class="sourceLineNo">609</span>  }<a name="line.609"></a>
+<span class="sourceLineNo">610</span><a name="line.610"></a>
+<span class="sourceLineNo">611</span>  /**<a name="line.611"></a>
+<span class="sourceLineNo">612</span>   * Check whether backup image set could cover a backup image or not.<a name="line.612"></a>
+<span class="sourceLineNo">613</span>   * @param fullImages The backup image set<a name="line.613"></a>
+<span class="sourceLineNo">614</span>   * @param image The target backup image<a name="line.614"></a>
+<span class="sourceLineNo">615</span>   * @return true if fullImages can cover image, otherwise false<a name="line.615"></a>
+<span class="sourceLineNo">616</span>   */<a name="line.616"></a>
+<span class="sourceLineNo">617</span>  public static boolean canCoverImage(ArrayList&lt;BackupImage&gt; fullImages, BackupImage image) {<a name="line.617"></a>
+<span class="sourceLineNo">618</span>    // fullImages can cover image only when the following conditions are satisfied:<a name="line.618"></a>
+<span class="sourceLineNo">619</span>    // - each image of fullImages must not be an incremental image;<a name="line.619"></a>
+<span class="sourceLineNo">620</span>    // - each image of fullImages must be taken after image has been taken;<a name="line.620"></a>
+<span class="sourceLineNo">621</span>    // - sum table set of fullImages must cover the table set of image.<a name="line.621"></a>
+<span class="sourceLineNo">622</span>    for (BackupImage image1 : fullImages) {<a name="line.622"></a>
+<span class="sourceLineNo">623</span>      if (image1.getType() == BackupType.INCREMENTAL) {<a name="line.623"></a>
+<span class="sourceLineNo">624</span>        return false;<a name="line.624"></a>
+<span class="sourceLineNo">625</span>      }<a name="line.625"></a>
+<span class="sourceLineNo">626</span>      if (image1.getStartTs() &lt; image.getStartTs()) {<a name="line.626"></a>
+<span class="sourceLineNo">627</span>        return false;<a name="line.627"></a>
+<span class="sourceLineNo">628</span>      }<a name="line.628"></a>
+<span class="sourceLineNo">629</span>    }<a name="line.629"></a>
+<span class="sourceLineNo">630</span><a name="line.630"></a>
+<span class="sourceLineNo">631</span>    ArrayList&lt;String&gt; image1TableList = new ArrayList&lt;&gt;();<a name="line.631"></a>
+<span class="sourceLineNo">632</span>    for (BackupImage image1 : fullImages) {<a name="line.632"></a>
+<span class="sourceLineNo">633</span>      List&lt;TableName&gt; tableList = image1.getTableNames();<a name="line.633"></a>
+<span class="sourceLineNo">634</span>      for (TableName table : tableList) {<a name="line.634"></a>
+<span class="sourceLineNo">635</span>        image1TableList.add(table.getNameAsString());<a name="line.635"></a>
+<span class="sourceLineNo">636</span>      }<a name="line.636"></a>
+<span class="sourceLineNo">637</span>    }<a name="line.637"></a>
+<span class="sourceLineNo">638</span>    ArrayList&lt;String&gt; image2TableList = new ArrayList&lt;&gt;();<a name="line.638"></a>
+<span class="sourceLineNo">639</span>    List&lt;TableName&gt; tableList = image.getTableNames();<a name="line.639"></a>
+<span class="sourceLineNo">640</span>    for (TableName table : tableList) {<a name="line.640"></a>
+<span class="sourceLineNo">641</span>      image2TableList.add(table.getNameAsString());<a name="line.641"></a>
+<span class="sourceLineNo">642</span>    }<a name="line.642"></a>
+<span class="sourceLineNo">643</span><a name="line.643"></a>
+<span class="sourceLineNo">644</span>    for (int i = 0; i &lt; image2TableList.size(); i++) {<a name="line.644"></a>
+<span class="sourceLineNo">645</span>      if (image1TableList.contains(image2TableList.get(i)) == false) {<a name="line.645"></a>
+<span class="sourceLineNo">646</span>        return false;<a name="line.646"></a>
+<span class="sourceLineNo">647</span>      }<a name="line.647"></a>
 <span class="sourceLineNo">648</span>    }<a name="line.648"></a>
 <span class="sourceLineNo">649</span><a name="line.649"></a>
-<span class="sourceLineNo">650</span>    for (int i = 0; i &lt; image2TableList.size(); i++) {<a name="line.650"></a>
-<span class="sourceLineNo">651</span>      if (image1TableList.contains(image2TableList.get(i)) == false) {<a name="line.651"></a>
-<span class="sourceLineNo">652</span>        return false;<a name="line.652"></a>
-<span class="sourceLineNo">653</span>      }<a name="line.653"></a>
-<span class="sourceLineNo">654</span>    }<a name="line.654"></a>
-<span class="sourceLineNo">655</span><a name="line.655"></a>
-<span class="sourceLineNo">656</span>    LOG.debug("Full image set can cover image " + image.getBackupId());<a name="line.656"></a>
-<span class="sourceLineNo">657</span>    return true;<a name="line.657"></a>
-<span class="sourceLineNo">658</span>  }<a name="line.658"></a>
-<span class="sourceLineNo">659</span><a name="line.659"></a>
-<span class="sourceLineNo">660</span>  public BackupInfo toBackupInfo() {<a name="line.660"></a>
-<span class="sourceLineNo">661</span>    BackupInfo info = new BackupInfo();<a name="line.661"></a>
-<span class="sourceLineNo">662</span>    info.setType(backupImage.getType());<a name="line.662"></a>
-<span class="sourceLineNo">663</span>    List&lt;TableName&gt; list = backupImage.getTableNames();<a name="line.663"></a>
-<span class="sourceLineNo">664</span>    TableName[] tables = new TableName[list.size()];<a name="line.664"></a>
-<span class="sourceLineNo">665</span>    info.addTables(list.toArray(tables));<a name="line.665"></a>
-<span class="sourceLineNo">666</span>    info.setBackupId(backupImage.getBackupId());<a name="line.666"></a>
-<span class="sourceLineNo">667</span>    info.setStartTs(backupImage.getStartTs());<a name="line.667"></a>
-<span class="sourceLineNo">668</span>    info.setBackupRootDir(backupImage.getRootDir());<a name="line.668"></a>
-<span class="sourceLineNo">669</span>    if (backupImage.getType() == BackupType.INCREMENTAL) {<a name="line.669"></a>
-<span class="sourceLineNo">670</span>      info.setHLogTargetDir(BackupUtils.getLogBackupDir(backupImage.getRootDir(),<a name="line.670"></a>
-<span class="sourceLineNo">671</span>        backupImage.getBackupId()));<a name="line.671"></a>
-<span class="sourceLineNo">672</span>    }<a name="line.672"></a>
-<span class="sourceLineNo">673</span>    return info;<a name="line.673"></a>
-<span class="sourceLineNo">674</span>  }<a name="line.674"></a>
-<span class="sourceLineNo">675</span>}<a name="line.675"></a>
+<span class="sourceLineNo">650</span>    LOG.debug("Full image set can cover image " + image.getBackupId());<a name="line.650"></a>
+<span class="sourceLineNo">651</span>    return true;<a name="line.651"></a>
+<span class="sourceLineNo">652</span>  }<a name="line.652"></a>
+<span class="sourceLineNo">653</span><a name="line.653"></a>
+<span class="sourceLineNo">654</span>  public BackupInfo toBackupInfo() {<a name="line.654"></a>
+<span class="sourceLineNo">655</span>    BackupInfo info = new BackupInfo();<a name="line.655"></a>
+<span class="sourceLineNo">656</span>    info.setType(backupImage.getType());<a name="line.656"></a>
+<span class="sourceLineNo">657</span>    List&lt;TableName&gt; list = backupImage.getTableNames();<a name="line.657"></a>
+<span class="sourceLineNo">658</span>    TableName[] tables = new TableName[list.size()];<a name="line.658"></a>
+<span class="sourceLineNo">659</span>    info.addTables(list.toArray(tables));<a name="line.659"></a>
+<span class="sourceLineNo">660</span>    info.setBackupId(backupImage.getBackupId());<a name="line.660"></a>
+<span class="sourceLineNo">661</span>    info.setStartTs(backupImage.getStartTs());<a name="line.661"></a>
+<span class="sourceLineNo">662</span>    info.setBackupRootDir(backupImage.getRootDir());<a name="line.662"></a>
+<span class="sourceLineNo">663</span>    if (backupImage.getType() == BackupType.INCREMENTAL) {<a name="line.663"></a>
+<span class="sourceLineNo">664</span>      info.setHLogTargetDir(BackupUtils.getLogBackupDir(backupImage.getRootDir(),<a name="line.664"></a>
+<span class="sourceLineNo">665</span>        backupImage.getBackupId()));<a name="line.665"></a>
+<span class="sourceLineNo">666</span>    }<a name="line.666"></a>
+<span class="sourceLineNo">667</span>    return info;<a name="line.667"></a>
+<span class="sourceLineNo">668</span>  }<a name="line.668"></a>
+<span class="sourceLineNo">669</span>}<a name="line.669"></a>
 
 
 


Mime
View raw message