hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [09/24] hbase-site git commit: Published site at 910b68082c8f200f0ba6395a76b7ee1c8917e401.
Date Wed, 05 Apr 2017 01:50:23 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/f5caf0f9/devapidocs/src-html/org/apache/hadoop/hbase/mapreduce/WALPlayer.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/mapreduce/WALPlayer.html b/devapidocs/src-html/org/apache/hadoop/hbase/mapreduce/WALPlayer.html
index bff248e..7c76f46 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/mapreduce/WALPlayer.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/mapreduce/WALPlayer.html
@@ -66,7 +66,7 @@
 <span class="sourceLineNo">058</span>/**<a name="line.58"></a>
 <span class="sourceLineNo">059</span> * A tool to replay WAL files as a M/R job.<a name="line.59"></a>
 <span class="sourceLineNo">060</span> * The WAL can be replayed for a set of tables or all tables,<a name="line.60"></a>
-<span class="sourceLineNo">061</span> * and a timerange can be provided (in milliseconds).<a name="line.61"></a>
+<span class="sourceLineNo">061</span> * and a time range can be provided (in milliseconds).<a name="line.61"></a>
 <span class="sourceLineNo">062</span> * The WAL is filtered to the passed set of tables and  the output<a name="line.62"></a>
 <span class="sourceLineNo">063</span> * can optionally be mapped to another set of tables.<a name="line.63"></a>
 <span class="sourceLineNo">064</span> *<a name="line.64"></a>
@@ -81,313 +81,317 @@
 <span class="sourceLineNo">073</span>  public final static String BULK_OUTPUT_CONF_KEY = "wal.bulk.output";<a name="line.73"></a>
 <span class="sourceLineNo">074</span>  public final static String TABLES_KEY = "wal.input.tables";<a name="line.74"></a>
 <span class="sourceLineNo">075</span>  public final static String TABLE_MAP_KEY = "wal.input.tablesmap";<a name="line.75"></a>
-<span class="sourceLineNo">076</span><a name="line.76"></a>
-<span class="sourceLineNo">077</span>  // This relies on Hadoop Configuration to handle warning about deprecated configs and<a name="line.77"></a>
-<span class="sourceLineNo">078</span>  // to set the correct non-deprecated configs when an old one shows up.<a name="line.78"></a>
-<span class="sourceLineNo">079</span>  static {<a name="line.79"></a>
-<span class="sourceLineNo">080</span>    Configuration.addDeprecation("hlog.bulk.output", BULK_OUTPUT_CONF_KEY);<a name="line.80"></a>
-<span class="sourceLineNo">081</span>    Configuration.addDeprecation("hlog.input.tables", TABLES_KEY);<a name="line.81"></a>
-<span class="sourceLineNo">082</span>    Configuration.addDeprecation("hlog.input.tablesmap", TABLE_MAP_KEY);<a name="line.82"></a>
-<span class="sourceLineNo">083</span>  }<a name="line.83"></a>
-<span class="sourceLineNo">084</span><a name="line.84"></a>
-<span class="sourceLineNo">085</span>  private final static String JOB_NAME_CONF_KEY = "mapreduce.job.name";<a name="line.85"></a>
-<span class="sourceLineNo">086</span><a name="line.86"></a>
-<span class="sourceLineNo">087</span>  public WALPlayer(){<a name="line.87"></a>
-<span class="sourceLineNo">088</span>  }<a name="line.88"></a>
+<span class="sourceLineNo">076</span>  public final static String INPUT_FILES_SEPARATOR_KEY = "wal.input.separator";<a name="line.76"></a>
+<span class="sourceLineNo">077</span>  public final static String IGNORE_MISSING_FILES = "wal.input.ignore.missing.files";<a name="line.77"></a>
+<span class="sourceLineNo">078</span><a name="line.78"></a>
+<span class="sourceLineNo">079</span><a name="line.79"></a>
+<span class="sourceLineNo">080</span>  // This relies on Hadoop Configuration to handle warning about deprecated configs and<a name="line.80"></a>
+<span class="sourceLineNo">081</span>  // to set the correct non-deprecated configs when an old one shows up.<a name="line.81"></a>
+<span class="sourceLineNo">082</span>  static {<a name="line.82"></a>
+<span class="sourceLineNo">083</span>    Configuration.addDeprecation("hlog.bulk.output", BULK_OUTPUT_CONF_KEY);<a name="line.83"></a>
+<span class="sourceLineNo">084</span>    Configuration.addDeprecation("hlog.input.tables", TABLES_KEY);<a name="line.84"></a>
+<span class="sourceLineNo">085</span>    Configuration.addDeprecation("hlog.input.tablesmap", TABLE_MAP_KEY);<a name="line.85"></a>
+<span class="sourceLineNo">086</span>  }<a name="line.86"></a>
+<span class="sourceLineNo">087</span><a name="line.87"></a>
+<span class="sourceLineNo">088</span>  private final static String JOB_NAME_CONF_KEY = "mapreduce.job.name";<a name="line.88"></a>
 <span class="sourceLineNo">089</span><a name="line.89"></a>
-<span class="sourceLineNo">090</span>  protected WALPlayer(final Configuration c) {<a name="line.90"></a>
-<span class="sourceLineNo">091</span>    super(c);<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>  /**<a name="line.94"></a>
-<span class="sourceLineNo">095</span>   * A mapper that just writes out KeyValues.<a name="line.95"></a>
-<span class="sourceLineNo">096</span>   * This one can be used together with {@link KeyValueSortReducer}<a name="line.96"></a>
-<span class="sourceLineNo">097</span>   */<a name="line.97"></a>
-<span class="sourceLineNo">098</span>  static class WALKeyValueMapper<a name="line.98"></a>
-<span class="sourceLineNo">099</span>    extends Mapper&lt;WALKey, WALEdit, ImmutableBytesWritable, KeyValue&gt; {<a name="line.99"></a>
-<span class="sourceLineNo">100</span>    private byte[] table;<a name="line.100"></a>
-<span class="sourceLineNo">101</span><a name="line.101"></a>
-<span class="sourceLineNo">102</span>    @Override<a name="line.102"></a>
-<span class="sourceLineNo">103</span>    public void map(WALKey key, WALEdit value,<a name="line.103"></a>
-<span class="sourceLineNo">104</span>      Context context)<a name="line.104"></a>
-<span class="sourceLineNo">105</span>    throws IOException {<a name="line.105"></a>
-<span class="sourceLineNo">106</span>      try {<a name="line.106"></a>
-<span class="sourceLineNo">107</span>        // skip all other tables<a name="line.107"></a>
-<span class="sourceLineNo">108</span>        if (Bytes.equals(table, key.getTablename().getName())) {<a name="line.108"></a>
-<span class="sourceLineNo">109</span>          for (Cell cell : value.getCells()) {<a name="line.109"></a>
-<span class="sourceLineNo">110</span>            KeyValue kv = KeyValueUtil.ensureKeyValue(cell);<a name="line.110"></a>
-<span class="sourceLineNo">111</span>            if (WALEdit.isMetaEditFamily(kv)) {<a name="line.111"></a>
-<span class="sourceLineNo">112</span>              continue;<a name="line.112"></a>
-<span class="sourceLineNo">113</span>            }<a name="line.113"></a>
-<span class="sourceLineNo">114</span>            context.write(new ImmutableBytesWritable(CellUtil.cloneRow(kv)), kv);<a name="line.114"></a>
-<span class="sourceLineNo">115</span>          }<a name="line.115"></a>
-<span class="sourceLineNo">116</span>        }<a name="line.116"></a>
-<span class="sourceLineNo">117</span>      } catch (InterruptedException e) {<a name="line.117"></a>
-<span class="sourceLineNo">118</span>        e.printStackTrace();<a name="line.118"></a>
-<span class="sourceLineNo">119</span>      }<a name="line.119"></a>
-<span class="sourceLineNo">120</span>    }<a name="line.120"></a>
-<span class="sourceLineNo">121</span><a name="line.121"></a>
-<span class="sourceLineNo">122</span>    @Override<a name="line.122"></a>
-<span class="sourceLineNo">123</span>    public void setup(Context context) throws IOException {<a name="line.123"></a>
-<span class="sourceLineNo">124</span>      // only a single table is supported when HFiles are generated with HFileOutputFormat<a name="line.124"></a>
-<span class="sourceLineNo">125</span>      String[] tables = context.getConfiguration().getStrings(TABLES_KEY);<a name="line.125"></a>
-<span class="sourceLineNo">126</span>      if (tables == null || tables.length != 1) {<a name="line.126"></a>
-<span class="sourceLineNo">127</span>        // this can only happen when WALMapper is used directly by a class other than WALPlayer<a name="line.127"></a>
-<span class="sourceLineNo">128</span>        throw new IOException("Exactly one table must be specified for bulk HFile case.");<a name="line.128"></a>
-<span class="sourceLineNo">129</span>      }<a name="line.129"></a>
-<span class="sourceLineNo">130</span>      table = Bytes.toBytes(tables[0]);<a name="line.130"></a>
-<span class="sourceLineNo">131</span>    }<a name="line.131"></a>
-<span class="sourceLineNo">132</span>  }<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>   * A mapper that writes out {@link Mutation} to be directly applied to<a name="line.135"></a>
-<span class="sourceLineNo">136</span>   * a running HBase instance.<a name="line.136"></a>
-<span class="sourceLineNo">137</span>   */<a name="line.137"></a>
-<span class="sourceLineNo">138</span>  protected static class WALMapper<a name="line.138"></a>
-<span class="sourceLineNo">139</span>  extends Mapper&lt;WALKey, WALEdit, ImmutableBytesWritable, Mutation&gt; {<a name="line.139"></a>
-<span class="sourceLineNo">140</span>    private Map&lt;TableName, TableName&gt; tables = new TreeMap&lt;&gt;();<a name="line.140"></a>
-<span class="sourceLineNo">141</span><a name="line.141"></a>
-<span class="sourceLineNo">142</span>    @Override<a name="line.142"></a>
-<span class="sourceLineNo">143</span>    public void map(WALKey key, WALEdit value, Context context)<a name="line.143"></a>
-<span class="sourceLineNo">144</span>    throws IOException {<a name="line.144"></a>
-<span class="sourceLineNo">145</span>      try {<a name="line.145"></a>
-<span class="sourceLineNo">146</span>        if (tables.isEmpty() || tables.containsKey(key.getTablename())) {<a name="line.146"></a>
-<span class="sourceLineNo">147</span>          TableName targetTable = tables.isEmpty() ?<a name="line.147"></a>
-<span class="sourceLineNo">148</span>                key.getTablename() :<a name="line.148"></a>
-<span class="sourceLineNo">149</span>                tables.get(key.getTablename());<a name="line.149"></a>
-<span class="sourceLineNo">150</span>          ImmutableBytesWritable tableOut = new ImmutableBytesWritable(targetTable.getName());<a name="line.150"></a>
-<span class="sourceLineNo">151</span>          Put put = null;<a name="line.151"></a>
-<span class="sourceLineNo">152</span>          Delete del = null;<a name="line.152"></a>
-<span class="sourceLineNo">153</span>          Cell lastCell = null;<a name="line.153"></a>
-<span class="sourceLineNo">154</span>          for (Cell cell : value.getCells()) {<a name="line.154"></a>
-<span class="sourceLineNo">155</span>            // filtering WAL meta entries<a name="line.155"></a>
-<span class="sourceLineNo">156</span>            if (WALEdit.isMetaEditFamily(cell)) {<a name="line.156"></a>
-<span class="sourceLineNo">157</span>              continue;<a name="line.157"></a>
-<span class="sourceLineNo">158</span>            }<a name="line.158"></a>
-<span class="sourceLineNo">159</span><a name="line.159"></a>
-<span class="sourceLineNo">160</span>            // Allow a subclass filter out this cell.<a name="line.160"></a>
-<span class="sourceLineNo">161</span>            if (filter(context, cell)) {<a name="line.161"></a>
-<span class="sourceLineNo">162</span>              // A WALEdit may contain multiple operations (HBASE-3584) and/or<a name="line.162"></a>
-<span class="sourceLineNo">163</span>              // multiple rows (HBASE-5229).<a name="line.163"></a>
-<span class="sourceLineNo">164</span>              // Aggregate as much as possible into a single Put/Delete<a name="line.164"></a>
-<span class="sourceLineNo">165</span>              // operation before writing to the context.<a name="line.165"></a>
-<span class="sourceLineNo">166</span>              if (lastCell == null || lastCell.getTypeByte() != cell.getTypeByte()<a name="line.166"></a>
-<span class="sourceLineNo">167</span>                  || !CellUtil.matchingRow(lastCell, cell)) {<a name="line.167"></a>
-<span class="sourceLineNo">168</span>                // row or type changed, write out aggregate KVs.<a name="line.168"></a>
-<span class="sourceLineNo">169</span>                if (put != null) {<a name="line.169"></a>
-<span class="sourceLineNo">170</span>                  context.write(tableOut, put);<a name="line.170"></a>
-<span class="sourceLineNo">171</span>                }<a name="line.171"></a>
-<span class="sourceLineNo">172</span>                if (del != null) {<a name="line.172"></a>
-<span class="sourceLineNo">173</span>                  context.write(tableOut, del);<a name="line.173"></a>
-<span class="sourceLineNo">174</span>                }<a name="line.174"></a>
-<span class="sourceLineNo">175</span>                if (CellUtil.isDelete(cell)) {<a name="line.175"></a>
-<span class="sourceLineNo">176</span>                  del = new Delete(CellUtil.cloneRow(cell));<a name="line.176"></a>
-<span class="sourceLineNo">177</span>                } else {<a name="line.177"></a>
-<span class="sourceLineNo">178</span>                  put = new Put(CellUtil.cloneRow(cell));<a name="line.178"></a>
+<span class="sourceLineNo">090</span>  public WALPlayer(){<a name="line.90"></a>
+<span class="sourceLineNo">091</span>  }<a name="line.91"></a>
+<span class="sourceLineNo">092</span><a name="line.92"></a>
+<span class="sourceLineNo">093</span>  protected WALPlayer(final Configuration c) {<a name="line.93"></a>
+<span class="sourceLineNo">094</span>    super(c);<a name="line.94"></a>
+<span class="sourceLineNo">095</span>  }<a name="line.95"></a>
+<span class="sourceLineNo">096</span><a name="line.96"></a>
+<span class="sourceLineNo">097</span>  /**<a name="line.97"></a>
+<span class="sourceLineNo">098</span>   * A mapper that just writes out KeyValues.<a name="line.98"></a>
+<span class="sourceLineNo">099</span>   * This one can be used together with {@link KeyValueSortReducer}<a name="line.99"></a>
+<span class="sourceLineNo">100</span>   */<a name="line.100"></a>
+<span class="sourceLineNo">101</span>  static class WALKeyValueMapper<a name="line.101"></a>
+<span class="sourceLineNo">102</span>    extends Mapper&lt;WALKey, WALEdit, ImmutableBytesWritable, KeyValue&gt; {<a name="line.102"></a>
+<span class="sourceLineNo">103</span>    private byte[] table;<a name="line.103"></a>
+<span class="sourceLineNo">104</span><a name="line.104"></a>
+<span class="sourceLineNo">105</span>    @Override<a name="line.105"></a>
+<span class="sourceLineNo">106</span>    public void map(WALKey key, WALEdit value,<a name="line.106"></a>
+<span class="sourceLineNo">107</span>      Context context)<a name="line.107"></a>
+<span class="sourceLineNo">108</span>    throws IOException {<a name="line.108"></a>
+<span class="sourceLineNo">109</span>      try {<a name="line.109"></a>
+<span class="sourceLineNo">110</span>        // skip all other tables<a name="line.110"></a>
+<span class="sourceLineNo">111</span>        if (Bytes.equals(table, key.getTablename().getName())) {<a name="line.111"></a>
+<span class="sourceLineNo">112</span>          for (Cell cell : value.getCells()) {<a name="line.112"></a>
+<span class="sourceLineNo">113</span>            KeyValue kv = KeyValueUtil.ensureKeyValue(cell);<a name="line.113"></a>
+<span class="sourceLineNo">114</span>            if (WALEdit.isMetaEditFamily(kv)) {<a name="line.114"></a>
+<span class="sourceLineNo">115</span>              continue;<a name="line.115"></a>
+<span class="sourceLineNo">116</span>            }<a name="line.116"></a>
+<span class="sourceLineNo">117</span>            context.write(new ImmutableBytesWritable(CellUtil.cloneRow(kv)), kv);<a name="line.117"></a>
+<span class="sourceLineNo">118</span>          }<a name="line.118"></a>
+<span class="sourceLineNo">119</span>        }<a name="line.119"></a>
+<span class="sourceLineNo">120</span>      } catch (InterruptedException e) {<a name="line.120"></a>
+<span class="sourceLineNo">121</span>        e.printStackTrace();<a name="line.121"></a>
+<span class="sourceLineNo">122</span>      }<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>    @Override<a name="line.125"></a>
+<span class="sourceLineNo">126</span>    public void setup(Context context) throws IOException {<a name="line.126"></a>
+<span class="sourceLineNo">127</span>      // only a single table is supported when HFiles are generated with HFileOutputFormat<a name="line.127"></a>
+<span class="sourceLineNo">128</span>      String[] tables = context.getConfiguration().getStrings(TABLES_KEY);<a name="line.128"></a>
+<span class="sourceLineNo">129</span>      if (tables == null || tables.length != 1) {<a name="line.129"></a>
+<span class="sourceLineNo">130</span>        // this can only happen when WALMapper is used directly by a class other than WALPlayer<a name="line.130"></a>
+<span class="sourceLineNo">131</span>        throw new IOException("Exactly one table must be specified for bulk HFile case.");<a name="line.131"></a>
+<span class="sourceLineNo">132</span>      }<a name="line.132"></a>
+<span class="sourceLineNo">133</span>      table = Bytes.toBytes(tables[0]);<a name="line.133"></a>
+<span class="sourceLineNo">134</span><a name="line.134"></a>
+<span class="sourceLineNo">135</span>    }<a name="line.135"></a>
+<span class="sourceLineNo">136</span><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>   * A mapper that writes out {@link Mutation} to be directly applied to<a name="line.140"></a>
+<span class="sourceLineNo">141</span>   * a running HBase instance.<a name="line.141"></a>
+<span class="sourceLineNo">142</span>   */<a name="line.142"></a>
+<span class="sourceLineNo">143</span>  protected static class WALMapper<a name="line.143"></a>
+<span class="sourceLineNo">144</span>  extends Mapper&lt;WALKey, WALEdit, ImmutableBytesWritable, Mutation&gt; {<a name="line.144"></a>
+<span class="sourceLineNo">145</span>    private Map&lt;TableName, TableName&gt; tables = new TreeMap&lt;&gt;();<a name="line.145"></a>
+<span class="sourceLineNo">146</span><a name="line.146"></a>
+<span class="sourceLineNo">147</span>    @Override<a name="line.147"></a>
+<span class="sourceLineNo">148</span>    public void map(WALKey key, WALEdit value, Context context)<a name="line.148"></a>
+<span class="sourceLineNo">149</span>    throws IOException {<a name="line.149"></a>
+<span class="sourceLineNo">150</span>      try {<a name="line.150"></a>
+<span class="sourceLineNo">151</span>        if (tables.isEmpty() || tables.containsKey(key.getTablename())) {<a name="line.151"></a>
+<span class="sourceLineNo">152</span>          TableName targetTable = tables.isEmpty() ?<a name="line.152"></a>
+<span class="sourceLineNo">153</span>                key.getTablename() :<a name="line.153"></a>
+<span class="sourceLineNo">154</span>                tables.get(key.getTablename());<a name="line.154"></a>
+<span class="sourceLineNo">155</span>          ImmutableBytesWritable tableOut = new ImmutableBytesWritable(targetTable.getName());<a name="line.155"></a>
+<span class="sourceLineNo">156</span>          Put put = null;<a name="line.156"></a>
+<span class="sourceLineNo">157</span>          Delete del = null;<a name="line.157"></a>
+<span class="sourceLineNo">158</span>          Cell lastCell = null;<a name="line.158"></a>
+<span class="sourceLineNo">159</span>          for (Cell cell : value.getCells()) {<a name="line.159"></a>
+<span class="sourceLineNo">160</span>            // filtering WAL meta entries<a name="line.160"></a>
+<span class="sourceLineNo">161</span>            if (WALEdit.isMetaEditFamily(cell)) {<a name="line.161"></a>
+<span class="sourceLineNo">162</span>              continue;<a name="line.162"></a>
+<span class="sourceLineNo">163</span>            }<a name="line.163"></a>
+<span class="sourceLineNo">164</span><a name="line.164"></a>
+<span class="sourceLineNo">165</span>            // Allow a subclass filter out this cell.<a name="line.165"></a>
+<span class="sourceLineNo">166</span>            if (filter(context, cell)) {<a name="line.166"></a>
+<span class="sourceLineNo">167</span>              // A WALEdit may contain multiple operations (HBASE-3584) and/or<a name="line.167"></a>
+<span class="sourceLineNo">168</span>              // multiple rows (HBASE-5229).<a name="line.168"></a>
+<span class="sourceLineNo">169</span>              // Aggregate as much as possible into a single Put/Delete<a name="line.169"></a>
+<span class="sourceLineNo">170</span>              // operation before writing to the context.<a name="line.170"></a>
+<span class="sourceLineNo">171</span>              if (lastCell == null || lastCell.getTypeByte() != cell.getTypeByte()<a name="line.171"></a>
+<span class="sourceLineNo">172</span>                  || !CellUtil.matchingRow(lastCell, cell)) {<a name="line.172"></a>
+<span class="sourceLineNo">173</span>                // row or type changed, write out aggregate KVs.<a name="line.173"></a>
+<span class="sourceLineNo">174</span>                if (put != null) {<a name="line.174"></a>
+<span class="sourceLineNo">175</span>                  context.write(tableOut, put);<a name="line.175"></a>
+<span class="sourceLineNo">176</span>                }<a name="line.176"></a>
+<span class="sourceLineNo">177</span>                if (del != null) {<a name="line.177"></a>
+<span class="sourceLineNo">178</span>                  context.write(tableOut, del);<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>              if (CellUtil.isDelete(cell)) {<a name="line.181"></a>
-<span class="sourceLineNo">182</span>                del.addDeleteMarker(cell);<a name="line.182"></a>
-<span class="sourceLineNo">183</span>              } else {<a name="line.183"></a>
-<span class="sourceLineNo">184</span>                put.add(cell);<a name="line.184"></a>
+<span class="sourceLineNo">180</span>                if (CellUtil.isDelete(cell)) {<a name="line.180"></a>
+<span class="sourceLineNo">181</span>                  del = new Delete(CellUtil.cloneRow(cell));<a name="line.181"></a>
+<span class="sourceLineNo">182</span>                } else {<a name="line.182"></a>
+<span class="sourceLineNo">183</span>                  put = new Put(CellUtil.cloneRow(cell));<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>            }<a name="line.186"></a>
-<span class="sourceLineNo">187</span>            lastCell = cell;<a name="line.187"></a>
-<span class="sourceLineNo">188</span>          }<a name="line.188"></a>
-<span class="sourceLineNo">189</span>          // write residual KVs<a name="line.189"></a>
-<span class="sourceLineNo">190</span>          if (put != null) {<a name="line.190"></a>
-<span class="sourceLineNo">191</span>            context.write(tableOut, put);<a name="line.191"></a>
-<span class="sourceLineNo">192</span>          }<a name="line.192"></a>
-<span class="sourceLineNo">193</span>          if (del != null) {<a name="line.193"></a>
-<span class="sourceLineNo">194</span>            context.write(tableOut, del);<a name="line.194"></a>
-<span class="sourceLineNo">195</span>          }<a name="line.195"></a>
-<span class="sourceLineNo">196</span>        }<a name="line.196"></a>
-<span class="sourceLineNo">197</span>      } catch (InterruptedException e) {<a name="line.197"></a>
-<span class="sourceLineNo">198</span>        e.printStackTrace();<a name="line.198"></a>
-<span class="sourceLineNo">199</span>      }<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>    protected boolean filter(Context context, final Cell cell) {<a name="line.202"></a>
-<span class="sourceLineNo">203</span>      return true;<a name="line.203"></a>
-<span class="sourceLineNo">204</span>    }<a name="line.204"></a>
-<span class="sourceLineNo">205</span><a name="line.205"></a>
-<span class="sourceLineNo">206</span>    @Override<a name="line.206"></a>
-<span class="sourceLineNo">207</span>    protected void<a name="line.207"></a>
-<span class="sourceLineNo">208</span>        cleanup(Mapper&lt;WALKey, WALEdit, ImmutableBytesWritable, Mutation&gt;.Context context)<a name="line.208"></a>
-<span class="sourceLineNo">209</span>            throws IOException, InterruptedException {<a name="line.209"></a>
-<span class="sourceLineNo">210</span>      super.cleanup(context);<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>    @Override<a name="line.213"></a>
-<span class="sourceLineNo">214</span>    public void setup(Context context) throws IOException {<a name="line.214"></a>
-<span class="sourceLineNo">215</span>      String[] tableMap = context.getConfiguration().getStrings(TABLE_MAP_KEY);<a name="line.215"></a>
-<span class="sourceLineNo">216</span>      String[] tablesToUse = context.getConfiguration().getStrings(TABLES_KEY);<a name="line.216"></a>
-<span class="sourceLineNo">217</span>      if (tableMap == null) {<a name="line.217"></a>
-<span class="sourceLineNo">218</span>        tableMap = tablesToUse;<a name="line.218"></a>
-<span class="sourceLineNo">219</span>      }<a name="line.219"></a>
-<span class="sourceLineNo">220</span>      if (tablesToUse == null) {<a name="line.220"></a>
-<span class="sourceLineNo">221</span>        // Then user wants all tables.<a name="line.221"></a>
-<span class="sourceLineNo">222</span>      } else if (tablesToUse.length != tableMap.length) {<a name="line.222"></a>
-<span class="sourceLineNo">223</span>        // this can only happen when WALMapper is used directly by a class other than WALPlayer<a name="line.223"></a>
-<span class="sourceLineNo">224</span>        throw new IOException("Incorrect table mapping specified .");<a name="line.224"></a>
-<span class="sourceLineNo">225</span>      }<a name="line.225"></a>
-<span class="sourceLineNo">226</span>      int i = 0;<a name="line.226"></a>
-<span class="sourceLineNo">227</span>      if (tablesToUse != null) {<a name="line.227"></a>
-<span class="sourceLineNo">228</span>        for (String table : tablesToUse) {<a name="line.228"></a>
-<span class="sourceLineNo">229</span>          tables.put(TableName.valueOf(table),<a name="line.229"></a>
-<span class="sourceLineNo">230</span>            TableName.valueOf(tableMap[i++]));<a name="line.230"></a>
-<span class="sourceLineNo">231</span>        }<a name="line.231"></a>
-<span class="sourceLineNo">232</span>      }<a name="line.232"></a>
-<span class="sourceLineNo">233</span>    }<a name="line.233"></a>
-<span class="sourceLineNo">234</span>  }<a name="line.234"></a>
-<span class="sourceLineNo">235</span><a name="line.235"></a>
-<span class="sourceLineNo">236</span>  void setupTime(Configuration conf, String option) throws IOException {<a name="line.236"></a>
-<span class="sourceLineNo">237</span>    String val = conf.get(option);<a name="line.237"></a>
-<span class="sourceLineNo">238</span>    if (null == val) {<a name="line.238"></a>
-<span class="sourceLineNo">239</span>      return;<a name="line.239"></a>
-<span class="sourceLineNo">240</span>    }<a name="line.240"></a>
-<span class="sourceLineNo">241</span>    long ms;<a name="line.241"></a>
-<span class="sourceLineNo">242</span>    try {<a name="line.242"></a>
-<span class="sourceLineNo">243</span>      // first try to parse in user friendly form<a name="line.243"></a>
-<span class="sourceLineNo">244</span>      ms = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS").parse(val).getTime();<a name="line.244"></a>
-<span class="sourceLineNo">245</span>    } catch (ParseException pe) {<a name="line.245"></a>
-<span class="sourceLineNo">246</span>      try {<a name="line.246"></a>
-<span class="sourceLineNo">247</span>        // then see if just a number of ms's was specified<a name="line.247"></a>
-<span class="sourceLineNo">248</span>        ms = Long.parseLong(val);<a name="line.248"></a>
-<span class="sourceLineNo">249</span>      } catch (NumberFormatException nfe) {<a name="line.249"></a>
-<span class="sourceLineNo">250</span>        throw new IOException(option<a name="line.250"></a>
-<span class="sourceLineNo">251</span>            + " must be specified either in the form 2001-02-20T16:35:06.99 "<a name="line.251"></a>
-<span class="sourceLineNo">252</span>            + "or as number of milliseconds");<a name="line.252"></a>
-<span class="sourceLineNo">253</span>      }<a name="line.253"></a>
-<span class="sourceLineNo">254</span>    }<a name="line.254"></a>
-<span class="sourceLineNo">255</span>    conf.setLong(option, ms);<a name="line.255"></a>
-<span class="sourceLineNo">256</span>  }<a name="line.256"></a>
-<span class="sourceLineNo">257</span><a name="line.257"></a>
-<span class="sourceLineNo">258</span>  /**<a name="line.258"></a>
-<span class="sourceLineNo">259</span>   * Sets up the actual job.<a name="line.259"></a>
-<span class="sourceLineNo">260</span>   *<a name="line.260"></a>
-<span class="sourceLineNo">261</span>   * @param args  The command line parameters.<a name="line.261"></a>
-<span class="sourceLineNo">262</span>   * @return The newly created job.<a name="line.262"></a>
-<span class="sourceLineNo">263</span>   * @throws IOException When setting up the job fails.<a name="line.263"></a>
-<span class="sourceLineNo">264</span>   */<a name="line.264"></a>
-<span class="sourceLineNo">265</span>  public Job createSubmittableJob(String[] args) throws IOException {<a name="line.265"></a>
-<span class="sourceLineNo">266</span>    Configuration conf = getConf();<a name="line.266"></a>
-<span class="sourceLineNo">267</span>    setupTime(conf, WALInputFormat.START_TIME_KEY);<a name="line.267"></a>
-<span class="sourceLineNo">268</span>    setupTime(conf, WALInputFormat.END_TIME_KEY);<a name="line.268"></a>
-<span class="sourceLineNo">269</span>    String inputDirs = args[0];<a name="line.269"></a>
-<span class="sourceLineNo">270</span>    String[] tables = args[1].split(",");<a name="line.270"></a>
-<span class="sourceLineNo">271</span>    String[] tableMap;<a name="line.271"></a>
-<span class="sourceLineNo">272</span>    if (args.length &gt; 2) {<a name="line.272"></a>
-<span class="sourceLineNo">273</span>      tableMap = args[2].split(",");<a name="line.273"></a>
-<span class="sourceLineNo">274</span>      if (tableMap.length != tables.length) {<a name="line.274"></a>
-<span class="sourceLineNo">275</span>        throw new IOException("The same number of tables and mapping must be provided.");<a name="line.275"></a>
-<span class="sourceLineNo">276</span>      }<a name="line.276"></a>
-<span class="sourceLineNo">277</span>    } else {<a name="line.277"></a>
-<span class="sourceLineNo">278</span>      // if not mapping is specified map each table to itself<a name="line.278"></a>
-<span class="sourceLineNo">279</span>      tableMap = tables;<a name="line.279"></a>
-<span class="sourceLineNo">280</span>    }<a name="line.280"></a>
-<span class="sourceLineNo">281</span>    conf.setStrings(TABLES_KEY, tables);<a name="line.281"></a>
-<span class="sourceLineNo">282</span>    conf.setStrings(TABLE_MAP_KEY, tableMap);<a name="line.282"></a>
-<span class="sourceLineNo">283</span>    Job job = Job.getInstance(conf, conf.get(JOB_NAME_CONF_KEY, NAME + "_" + System.currentTimeMillis()));<a name="line.283"></a>
-<span class="sourceLineNo">284</span>    job.setJarByClass(WALPlayer.class);<a name="line.284"></a>
-<span class="sourceLineNo">285</span><a name="line.285"></a>
-<span class="sourceLineNo">286</span>    FileInputFormat.addInputPaths(job, inputDirs);<a name="line.286"></a>
-<span class="sourceLineNo">287</span><a name="line.287"></a>
-<span class="sourceLineNo">288</span>    job.setInputFormatClass(WALInputFormat.class);<a name="line.288"></a>
-<span class="sourceLineNo">289</span>    job.setMapOutputKeyClass(ImmutableBytesWritable.class);<a name="line.289"></a>
-<span class="sourceLineNo">290</span><a name="line.290"></a>
-<span class="sourceLineNo">291</span>    String hfileOutPath = conf.get(BULK_OUTPUT_CONF_KEY);<a name="line.291"></a>
-<span class="sourceLineNo">292</span>    if (hfileOutPath != null) {<a name="line.292"></a>
-<span class="sourceLineNo">293</span>      LOG.debug("add incremental job :" + hfileOutPath + " from " + inputDirs);<a name="line.293"></a>
+<span class="sourceLineNo">186</span>              if (CellUtil.isDelete(cell)) {<a name="line.186"></a>
+<span class="sourceLineNo">187</span>                del.addDeleteMarker(cell);<a name="line.187"></a>
+<span class="sourceLineNo">188</span>              } else {<a name="line.188"></a>
+<span class="sourceLineNo">189</span>                put.add(cell);<a name="line.189"></a>
+<span class="sourceLineNo">190</span>              }<a name="line.190"></a>
+<span class="sourceLineNo">191</span>            }<a name="line.191"></a>
+<span class="sourceLineNo">192</span>            lastCell = cell;<a name="line.192"></a>
+<span class="sourceLineNo">193</span>          }<a name="line.193"></a>
+<span class="sourceLineNo">194</span>          // write residual KVs<a name="line.194"></a>
+<span class="sourceLineNo">195</span>          if (put != null) {<a name="line.195"></a>
+<span class="sourceLineNo">196</span>            context.write(tableOut, put);<a name="line.196"></a>
+<span class="sourceLineNo">197</span>          }<a name="line.197"></a>
+<span class="sourceLineNo">198</span>          if (del != null) {<a name="line.198"></a>
+<span class="sourceLineNo">199</span>            context.write(tableOut, del);<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>      } catch (InterruptedException e) {<a name="line.202"></a>
+<span class="sourceLineNo">203</span>        e.printStackTrace();<a name="line.203"></a>
+<span class="sourceLineNo">204</span>      }<a name="line.204"></a>
+<span class="sourceLineNo">205</span>    }<a name="line.205"></a>
+<span class="sourceLineNo">206</span><a name="line.206"></a>
+<span class="sourceLineNo">207</span>    protected boolean filter(Context context, final Cell cell) {<a name="line.207"></a>
+<span class="sourceLineNo">208</span>      return true;<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>    @Override<a name="line.211"></a>
+<span class="sourceLineNo">212</span>    protected void<a name="line.212"></a>
+<span class="sourceLineNo">213</span>        cleanup(Mapper&lt;WALKey, WALEdit, ImmutableBytesWritable, Mutation&gt;.Context context)<a name="line.213"></a>
+<span class="sourceLineNo">214</span>            throws IOException, InterruptedException {<a name="line.214"></a>
+<span class="sourceLineNo">215</span>      super.cleanup(context);<a name="line.215"></a>
+<span class="sourceLineNo">216</span>    }<a name="line.216"></a>
+<span class="sourceLineNo">217</span><a name="line.217"></a>
+<span class="sourceLineNo">218</span>    @Override<a name="line.218"></a>
+<span class="sourceLineNo">219</span>    public void setup(Context context) throws IOException {<a name="line.219"></a>
+<span class="sourceLineNo">220</span>      String[] tableMap = context.getConfiguration().getStrings(TABLE_MAP_KEY);<a name="line.220"></a>
+<span class="sourceLineNo">221</span>      String[] tablesToUse = context.getConfiguration().getStrings(TABLES_KEY);<a name="line.221"></a>
+<span class="sourceLineNo">222</span>      if (tableMap == null) {<a name="line.222"></a>
+<span class="sourceLineNo">223</span>        tableMap = tablesToUse;<a name="line.223"></a>
+<span class="sourceLineNo">224</span>      }<a name="line.224"></a>
+<span class="sourceLineNo">225</span>      if (tablesToUse == null) {<a name="line.225"></a>
+<span class="sourceLineNo">226</span>        // Then user wants all tables.<a name="line.226"></a>
+<span class="sourceLineNo">227</span>      } else if (tablesToUse.length != tableMap.length) {<a name="line.227"></a>
+<span class="sourceLineNo">228</span>        // this can only happen when WALMapper is used directly by a class other than WALPlayer<a name="line.228"></a>
+<span class="sourceLineNo">229</span>        throw new IOException("Incorrect table mapping specified .");<a name="line.229"></a>
+<span class="sourceLineNo">230</span>      }<a name="line.230"></a>
+<span class="sourceLineNo">231</span>      int i = 0;<a name="line.231"></a>
+<span class="sourceLineNo">232</span>      if (tablesToUse != null) {<a name="line.232"></a>
+<span class="sourceLineNo">233</span>        for (String table : tablesToUse) {<a name="line.233"></a>
+<span class="sourceLineNo">234</span>          tables.put(TableName.valueOf(table),<a name="line.234"></a>
+<span class="sourceLineNo">235</span>            TableName.valueOf(tableMap[i++]));<a name="line.235"></a>
+<span class="sourceLineNo">236</span>        }<a name="line.236"></a>
+<span class="sourceLineNo">237</span>      }<a name="line.237"></a>
+<span class="sourceLineNo">238</span>    }<a name="line.238"></a>
+<span class="sourceLineNo">239</span>  }<a name="line.239"></a>
+<span class="sourceLineNo">240</span><a name="line.240"></a>
+<span class="sourceLineNo">241</span>  void setupTime(Configuration conf, String option) throws IOException {<a name="line.241"></a>
+<span class="sourceLineNo">242</span>    String val = conf.get(option);<a name="line.242"></a>
+<span class="sourceLineNo">243</span>    if (null == val) {<a name="line.243"></a>
+<span class="sourceLineNo">244</span>      return;<a name="line.244"></a>
+<span class="sourceLineNo">245</span>    }<a name="line.245"></a>
+<span class="sourceLineNo">246</span>    long ms;<a name="line.246"></a>
+<span class="sourceLineNo">247</span>    try {<a name="line.247"></a>
+<span class="sourceLineNo">248</span>      // first try to parse in user friendly form<a name="line.248"></a>
+<span class="sourceLineNo">249</span>      ms = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS").parse(val).getTime();<a name="line.249"></a>
+<span class="sourceLineNo">250</span>    } catch (ParseException pe) {<a name="line.250"></a>
+<span class="sourceLineNo">251</span>      try {<a name="line.251"></a>
+<span class="sourceLineNo">252</span>        // then see if just a number of ms's was specified<a name="line.252"></a>
+<span class="sourceLineNo">253</span>        ms = Long.parseLong(val);<a name="line.253"></a>
+<span class="sourceLineNo">254</span>      } catch (NumberFormatException nfe) {<a name="line.254"></a>
+<span class="sourceLineNo">255</span>        throw new IOException(option<a name="line.255"></a>
+<span class="sourceLineNo">256</span>            + " must be specified either in the form 2001-02-20T16:35:06.99 "<a name="line.256"></a>
+<span class="sourceLineNo">257</span>            + "or as number of milliseconds");<a name="line.257"></a>
+<span class="sourceLineNo">258</span>      }<a name="line.258"></a>
+<span class="sourceLineNo">259</span>    }<a name="line.259"></a>
+<span class="sourceLineNo">260</span>    conf.setLong(option, ms);<a name="line.260"></a>
+<span class="sourceLineNo">261</span>  }<a name="line.261"></a>
+<span class="sourceLineNo">262</span><a name="line.262"></a>
+<span class="sourceLineNo">263</span>  /**<a name="line.263"></a>
+<span class="sourceLineNo">264</span>   * Sets up the actual job.<a name="line.264"></a>
+<span class="sourceLineNo">265</span>   *<a name="line.265"></a>
+<span class="sourceLineNo">266</span>   * @param args  The command line parameters.<a name="line.266"></a>
+<span class="sourceLineNo">267</span>   * @return The newly created job.<a name="line.267"></a>
+<span class="sourceLineNo">268</span>   * @throws IOException When setting up the job fails.<a name="line.268"></a>
+<span class="sourceLineNo">269</span>   */<a name="line.269"></a>
+<span class="sourceLineNo">270</span>  public Job createSubmittableJob(String[] args) throws IOException {<a name="line.270"></a>
+<span class="sourceLineNo">271</span>    Configuration conf = getConf();<a name="line.271"></a>
+<span class="sourceLineNo">272</span>    setupTime(conf, WALInputFormat.START_TIME_KEY);<a name="line.272"></a>
+<span class="sourceLineNo">273</span>    setupTime(conf, WALInputFormat.END_TIME_KEY);<a name="line.273"></a>
+<span class="sourceLineNo">274</span>    String inputDirs = args[0];<a name="line.274"></a>
+<span class="sourceLineNo">275</span>    String[] tables = args[1].split(",");<a name="line.275"></a>
+<span class="sourceLineNo">276</span>    String[] tableMap;<a name="line.276"></a>
+<span class="sourceLineNo">277</span>    if (args.length &gt; 2) {<a name="line.277"></a>
+<span class="sourceLineNo">278</span>      tableMap = args[2].split(",");<a name="line.278"></a>
+<span class="sourceLineNo">279</span>      if (tableMap.length != tables.length) {<a name="line.279"></a>
+<span class="sourceLineNo">280</span>        throw new IOException("The same number of tables and mapping must be provided.");<a name="line.280"></a>
+<span class="sourceLineNo">281</span>      }<a name="line.281"></a>
+<span class="sourceLineNo">282</span>    } else {<a name="line.282"></a>
+<span class="sourceLineNo">283</span>      // if not mapping is specified map each table to itself<a name="line.283"></a>
+<span class="sourceLineNo">284</span>      tableMap = tables;<a name="line.284"></a>
+<span class="sourceLineNo">285</span>    }<a name="line.285"></a>
+<span class="sourceLineNo">286</span>    conf.setStrings(TABLES_KEY, tables);<a name="line.286"></a>
+<span class="sourceLineNo">287</span>    conf.setStrings(TABLE_MAP_KEY, tableMap);<a name="line.287"></a>
+<span class="sourceLineNo">288</span>    conf.set(FileInputFormat.INPUT_DIR, inputDirs);<a name="line.288"></a>
+<span class="sourceLineNo">289</span>    Job job = Job.getInstance(conf, conf.get(JOB_NAME_CONF_KEY, NAME + "_" + System.currentTimeMillis()));<a name="line.289"></a>
+<span class="sourceLineNo">290</span>    job.setJarByClass(WALPlayer.class);<a name="line.290"></a>
+<span class="sourceLineNo">291</span><a name="line.291"></a>
+<span class="sourceLineNo">292</span>    job.setInputFormatClass(WALInputFormat.class);<a name="line.292"></a>
+<span class="sourceLineNo">293</span>    job.setMapOutputKeyClass(ImmutableBytesWritable.class);<a name="line.293"></a>
 <span class="sourceLineNo">294</span><a name="line.294"></a>
-<span class="sourceLineNo">295</span>      // the bulk HFile case<a name="line.295"></a>
-<span class="sourceLineNo">296</span>      if (tables.length != 1) {<a name="line.296"></a>
-<span class="sourceLineNo">297</span>        throw new IOException("Exactly one table must be specified for the bulk export option");<a name="line.297"></a>
-<span class="sourceLineNo">298</span>      }<a name="line.298"></a>
-<span class="sourceLineNo">299</span>      TableName tableName = TableName.valueOf(tables[0]);<a name="line.299"></a>
-<span class="sourceLineNo">300</span>      job.setMapperClass(WALKeyValueMapper.class);<a name="line.300"></a>
-<span class="sourceLineNo">301</span>      job.setReducerClass(KeyValueSortReducer.class);<a name="line.301"></a>
-<span class="sourceLineNo">302</span>      Path outputDir = new Path(hfileOutPath);<a name="line.302"></a>
-<span class="sourceLineNo">303</span>      FileOutputFormat.setOutputPath(job, outputDir);<a name="line.303"></a>
-<span class="sourceLineNo">304</span>      job.setMapOutputValueClass(KeyValue.class);<a name="line.304"></a>
-<span class="sourceLineNo">305</span>      try (Connection conn = ConnectionFactory.createConnection(conf);<a name="line.305"></a>
-<span class="sourceLineNo">306</span>          Table table = conn.getTable(tableName);<a name="line.306"></a>
-<span class="sourceLineNo">307</span>          RegionLocator regionLocator = conn.getRegionLocator(tableName)) {<a name="line.307"></a>
-<span class="sourceLineNo">308</span>        HFileOutputFormat2.configureIncrementalLoad(job, table.getTableDescriptor(), regionLocator);<a name="line.308"></a>
-<span class="sourceLineNo">309</span>      }<a name="line.309"></a>
-<span class="sourceLineNo">310</span>      TableMapReduceUtil.addDependencyJarsForClasses(job.getConfiguration(),<a name="line.310"></a>
-<span class="sourceLineNo">311</span>          com.google.common.base.Preconditions.class);<a name="line.311"></a>
-<span class="sourceLineNo">312</span>    } else {<a name="line.312"></a>
-<span class="sourceLineNo">313</span>      // output to live cluster<a name="line.313"></a>
-<span class="sourceLineNo">314</span>      job.setMapperClass(WALMapper.class);<a name="line.314"></a>
-<span class="sourceLineNo">315</span>      job.setOutputFormatClass(MultiTableOutputFormat.class);<a name="line.315"></a>
-<span class="sourceLineNo">316</span>      TableMapReduceUtil.addDependencyJars(job);<a name="line.316"></a>
-<span class="sourceLineNo">317</span>      TableMapReduceUtil.initCredentials(job);<a name="line.317"></a>
-<span class="sourceLineNo">318</span>      // No reducers.<a name="line.318"></a>
-<span class="sourceLineNo">319</span>      job.setNumReduceTasks(0);<a name="line.319"></a>
-<span class="sourceLineNo">320</span>    }<a name="line.320"></a>
-<span class="sourceLineNo">321</span>    String codecCls = WALCellCodec.getWALCellCodecClass(conf);<a name="line.321"></a>
-<span class="sourceLineNo">322</span>    try {<a name="line.322"></a>
-<span class="sourceLineNo">323</span>      TableMapReduceUtil.addDependencyJarsForClasses(job.getConfiguration(), Class.forName(codecCls));<a name="line.323"></a>
-<span class="sourceLineNo">324</span>    } catch (Exception e) {<a name="line.324"></a>
-<span class="sourceLineNo">325</span>      throw new IOException("Cannot determine wal codec class " + codecCls, e);<a name="line.325"></a>
-<span class="sourceLineNo">326</span>    }<a name="line.326"></a>
-<span class="sourceLineNo">327</span>    return job;<a name="line.327"></a>
-<span class="sourceLineNo">328</span>  }<a name="line.328"></a>
-<span class="sourceLineNo">329</span><a name="line.329"></a>
-<span class="sourceLineNo">330</span><a name="line.330"></a>
-<span class="sourceLineNo">331</span>  /**<a name="line.331"></a>
-<span class="sourceLineNo">332</span>   * Print usage<a name="line.332"></a>
-<span class="sourceLineNo">333</span>   * @param errorMsg Error message.  Can be null.<a name="line.333"></a>
-<span class="sourceLineNo">334</span>   */<a name="line.334"></a>
-<span class="sourceLineNo">335</span>  private void usage(final String errorMsg) {<a name="line.335"></a>
-<span class="sourceLineNo">336</span>    if (errorMsg != null &amp;&amp; errorMsg.length() &gt; 0) {<a name="line.336"></a>
-<span class="sourceLineNo">337</span>      System.err.println("ERROR: " + errorMsg);<a name="line.337"></a>
-<span class="sourceLineNo">338</span>    }<a name="line.338"></a>
-<span class="sourceLineNo">339</span>    System.err.println("Usage: " + NAME + " [options] &lt;wal inputdir&gt; &lt;tables&gt; [&lt;tableMappings&gt;]");<a name="line.339"></a>
-<span class="sourceLineNo">340</span>    System.err.println("Read all WAL entries for &lt;tables&gt;.");<a name="line.340"></a>
-<span class="sourceLineNo">341</span>    System.err.println("If no tables (\"\") are specific, all tables are imported.");<a name="line.341"></a>
-<span class="sourceLineNo">342</span>    System.err.println("(Careful, even hbase:meta entries will be imported"+<a name="line.342"></a>
-<span class="sourceLineNo">343</span>      " in that case.)");<a name="line.343"></a>
-<span class="sourceLineNo">344</span>    System.err.println("Otherwise &lt;tables&gt; is a comma separated list of tables.\n");<a name="line.344"></a>
-<span class="sourceLineNo">345</span>    System.err.println("The WAL entries can be mapped to new set of tables via &lt;tableMapping&gt;.");<a name="line.345"></a>
-<span class="sourceLineNo">346</span>    System.err.println("&lt;tableMapping&gt; is a command separated list of targettables.");<a name="line.346"></a>
-<span class="sourceLineNo">347</span>    System.err.println("If specified, each table in &lt;tables&gt; must have a mapping.\n");<a name="line.347"></a>
-<span class="sourceLineNo">348</span>    System.err.println("By default " + NAME + " will load data directly into HBase.");<a name="line.348"></a>
-<span class="sourceLineNo">349</span>    System.err.println("To generate HFiles for a bulk data load instead, pass the option:");<a name="line.349"></a>
-<span class="sourceLineNo">350</span>    System.err.println("  -D" + BULK_OUTPUT_CONF_KEY + "=/path/for/output");<a name="line.350"></a>
-<span class="sourceLineNo">351</span>    System.err.println("  (Only one table can be specified, and no mapping is allowed!)");<a name="line.351"></a>
-<span class="sourceLineNo">352</span>    System.err.println("Other options: (specify time range to WAL edit to consider)");<a name="line.352"></a>
-<span class="sourceLineNo">353</span>    System.err.println("  -D" + WALInputFormat.START_TIME_KEY + "=[date|ms]");<a name="line.353"></a>
-<span class="sourceLineNo">354</span>    System.err.println("  -D" + WALInputFormat.END_TIME_KEY + "=[date|ms]");<a name="line.354"></a>
-<span class="sourceLineNo">355</span>    System.err.println("   -D " + JOB_NAME_CONF_KEY<a name="line.355"></a>
-<span class="sourceLineNo">356</span>      + "=jobName - use the specified mapreduce job name for the wal player");<a name="line.356"></a>
-<span class="sourceLineNo">357</span>    System.err.println("For performance also consider the following options:\n"<a name="line.357"></a>
-<span class="sourceLineNo">358</span>      + "  -Dmapreduce.map.speculative=false\n"<a name="line.358"></a>
-<span class="sourceLineNo">359</span>      + "  -Dmapreduce.reduce.speculative=false");<a name="line.359"></a>
-<span class="sourceLineNo">360</span>  }<a name="line.360"></a>
-<span class="sourceLineNo">361</span><a name="line.361"></a>
-<span class="sourceLineNo">362</span>  /**<a name="line.362"></a>
-<span class="sourceLineNo">363</span>   * Main entry point.<a name="line.363"></a>
-<span class="sourceLineNo">364</span>   *<a name="line.364"></a>
-<span class="sourceLineNo">365</span>   * @param args  The command line parameters.<a name="line.365"></a>
-<span class="sourceLineNo">366</span>   * @throws Exception When running the job fails.<a name="line.366"></a>
-<span class="sourceLineNo">367</span>   */<a name="line.367"></a>
-<span class="sourceLineNo">368</span>  public static void main(String[] args) throws Exception {<a name="line.368"></a>
-<span class="sourceLineNo">369</span>    int ret = ToolRunner.run(new WALPlayer(HBaseConfiguration.create()), args);<a name="line.369"></a>
-<span class="sourceLineNo">370</span>    System.exit(ret);<a name="line.370"></a>
-<span class="sourceLineNo">371</span>  }<a name="line.371"></a>
-<span class="sourceLineNo">372</span><a name="line.372"></a>
-<span class="sourceLineNo">373</span>  @Override<a name="line.373"></a>
-<span class="sourceLineNo">374</span>  public int run(String[] args) throws Exception {<a name="line.374"></a>
-<span class="sourceLineNo">375</span>    if (args.length &lt; 2) {<a name="line.375"></a>
-<span class="sourceLineNo">376</span>      usage("Wrong number of arguments: " + args.length);<a name="line.376"></a>
-<span class="sourceLineNo">377</span>      System.exit(-1);<a name="line.377"></a>
-<span class="sourceLineNo">378</span>    }<a name="line.378"></a>
-<span class="sourceLineNo">379</span>    Job job = createSubmittableJob(args);<a name="line.379"></a>
-<span class="sourceLineNo">380</span>    return job.waitForCompletion(true) ? 0 : 1;<a name="line.380"></a>
-<span class="sourceLineNo">381</span>  }<a name="line.381"></a>
-<span class="sourceLineNo">382</span>}<a name="line.382"></a>
+<span class="sourceLineNo">295</span>    String hfileOutPath = conf.get(BULK_OUTPUT_CONF_KEY);<a name="line.295"></a>
+<span class="sourceLineNo">296</span>    if (hfileOutPath != null) {<a name="line.296"></a>
+<span class="sourceLineNo">297</span>      LOG.debug("add incremental job :" + hfileOutPath + " from " + inputDirs);<a name="line.297"></a>
+<span class="sourceLineNo">298</span><a name="line.298"></a>
+<span class="sourceLineNo">299</span>      // the bulk HFile case<a name="line.299"></a>
+<span class="sourceLineNo">300</span>      if (tables.length != 1) {<a name="line.300"></a>
+<span class="sourceLineNo">301</span>        throw new IOException("Exactly one table must be specified for the bulk export option");<a name="line.301"></a>
+<span class="sourceLineNo">302</span>      }<a name="line.302"></a>
+<span class="sourceLineNo">303</span>      TableName tableName = TableName.valueOf(tables[0]);<a name="line.303"></a>
+<span class="sourceLineNo">304</span>      job.setMapperClass(WALKeyValueMapper.class);<a name="line.304"></a>
+<span class="sourceLineNo">305</span>      job.setReducerClass(KeyValueSortReducer.class);<a name="line.305"></a>
+<span class="sourceLineNo">306</span>      Path outputDir = new Path(hfileOutPath);<a name="line.306"></a>
+<span class="sourceLineNo">307</span>      FileOutputFormat.setOutputPath(job, outputDir);<a name="line.307"></a>
+<span class="sourceLineNo">308</span>      job.setMapOutputValueClass(KeyValue.class);<a name="line.308"></a>
+<span class="sourceLineNo">309</span>      try (Connection conn = ConnectionFactory.createConnection(conf);<a name="line.309"></a>
+<span class="sourceLineNo">310</span>          Table table = conn.getTable(tableName);<a name="line.310"></a>
+<span class="sourceLineNo">311</span>          RegionLocator regionLocator = conn.getRegionLocator(tableName)) {<a name="line.311"></a>
+<span class="sourceLineNo">312</span>        HFileOutputFormat2.configureIncrementalLoad(job, table.getTableDescriptor(), regionLocator);<a name="line.312"></a>
+<span class="sourceLineNo">313</span>      }<a name="line.313"></a>
+<span class="sourceLineNo">314</span>      TableMapReduceUtil.addDependencyJarsForClasses(job.getConfiguration(),<a name="line.314"></a>
+<span class="sourceLineNo">315</span>          com.google.common.base.Preconditions.class);<a name="line.315"></a>
+<span class="sourceLineNo">316</span>    } else {<a name="line.316"></a>
+<span class="sourceLineNo">317</span>      // output to live cluster<a name="line.317"></a>
+<span class="sourceLineNo">318</span>      job.setMapperClass(WALMapper.class);<a name="line.318"></a>
+<span class="sourceLineNo">319</span>      job.setOutputFormatClass(MultiTableOutputFormat.class);<a name="line.319"></a>
+<span class="sourceLineNo">320</span>      TableMapReduceUtil.addDependencyJars(job);<a name="line.320"></a>
+<span class="sourceLineNo">321</span>      TableMapReduceUtil.initCredentials(job);<a name="line.321"></a>
+<span class="sourceLineNo">322</span>      // No reducers.<a name="line.322"></a>
+<span class="sourceLineNo">323</span>      job.setNumReduceTasks(0);<a name="line.323"></a>
+<span class="sourceLineNo">324</span>    }<a name="line.324"></a>
+<span class="sourceLineNo">325</span>    String codecCls = WALCellCodec.getWALCellCodecClass(conf);<a name="line.325"></a>
+<span class="sourceLineNo">326</span>    try {<a name="line.326"></a>
+<span class="sourceLineNo">327</span>      TableMapReduceUtil.addDependencyJarsForClasses(job.getConfiguration(), Class.forName(codecCls));<a name="line.327"></a>
+<span class="sourceLineNo">328</span>    } catch (Exception e) {<a name="line.328"></a>
+<span class="sourceLineNo">329</span>      throw new IOException("Cannot determine wal codec class " + codecCls, e);<a name="line.329"></a>
+<span class="sourceLineNo">330</span>    }<a name="line.330"></a>
+<span class="sourceLineNo">331</span>    return job;<a name="line.331"></a>
+<span class="sourceLineNo">332</span>  }<a name="line.332"></a>
+<span class="sourceLineNo">333</span><a name="line.333"></a>
+<span class="sourceLineNo">334</span><a name="line.334"></a>
+<span class="sourceLineNo">335</span>  /**<a name="line.335"></a>
+<span class="sourceLineNo">336</span>   * Print usage<a name="line.336"></a>
+<span class="sourceLineNo">337</span>   * @param errorMsg Error message.  Can be null.<a name="line.337"></a>
+<span class="sourceLineNo">338</span>   */<a name="line.338"></a>
+<span class="sourceLineNo">339</span>  private void usage(final String errorMsg) {<a name="line.339"></a>
+<span class="sourceLineNo">340</span>    if (errorMsg != null &amp;&amp; errorMsg.length() &gt; 0) {<a name="line.340"></a>
+<span class="sourceLineNo">341</span>      System.err.println("ERROR: " + errorMsg);<a name="line.341"></a>
+<span class="sourceLineNo">342</span>    }<a name="line.342"></a>
+<span class="sourceLineNo">343</span>    System.err.println("Usage: " + NAME + " [options] &lt;wal inputdir&gt; &lt;tables&gt; [&lt;tableMappings&gt;]");<a name="line.343"></a>
+<span class="sourceLineNo">344</span>    System.err.println("Read all WAL entries for &lt;tables&gt;.");<a name="line.344"></a>
+<span class="sourceLineNo">345</span>    System.err.println("If no tables (\"\") are specific, all tables are imported.");<a name="line.345"></a>
+<span class="sourceLineNo">346</span>    System.err.println("(Careful, even hbase:meta entries will be imported"+<a name="line.346"></a>
+<span class="sourceLineNo">347</span>      " in that case.)");<a name="line.347"></a>
+<span class="sourceLineNo">348</span>    System.err.println("Otherwise &lt;tables&gt; is a comma separated list of tables.\n");<a name="line.348"></a>
+<span class="sourceLineNo">349</span>    System.err.println("The WAL entries can be mapped to new set of tables via &lt;tableMapping&gt;.");<a name="line.349"></a>
+<span class="sourceLineNo">350</span>    System.err.println("&lt;tableMapping&gt; is a command separated list of targettables.");<a name="line.350"></a>
+<span class="sourceLineNo">351</span>    System.err.println("If specified, each table in &lt;tables&gt; must have a mapping.\n");<a name="line.351"></a>
+<span class="sourceLineNo">352</span>    System.err.println("By default " + NAME + " will load data directly into HBase.");<a name="line.352"></a>
+<span class="sourceLineNo">353</span>    System.err.println("To generate HFiles for a bulk data load instead, pass the option:");<a name="line.353"></a>
+<span class="sourceLineNo">354</span>    System.err.println("  -D" + BULK_OUTPUT_CONF_KEY + "=/path/for/output");<a name="line.354"></a>
+<span class="sourceLineNo">355</span>    System.err.println("  (Only one table can be specified, and no mapping is allowed!)");<a name="line.355"></a>
+<span class="sourceLineNo">356</span>    System.err.println("Other options: (specify time range to WAL edit to consider)");<a name="line.356"></a>
+<span class="sourceLineNo">357</span>    System.err.println("  -D" + WALInputFormat.START_TIME_KEY + "=[date|ms]");<a name="line.357"></a>
+<span class="sourceLineNo">358</span>    System.err.println("  -D" + WALInputFormat.END_TIME_KEY + "=[date|ms]");<a name="line.358"></a>
+<span class="sourceLineNo">359</span>    System.err.println("   -D " + JOB_NAME_CONF_KEY<a name="line.359"></a>
+<span class="sourceLineNo">360</span>      + "=jobName - use the specified mapreduce job name for the wal player");<a name="line.360"></a>
+<span class="sourceLineNo">361</span>    System.err.println("For performance also consider the following options:\n"<a name="line.361"></a>
+<span class="sourceLineNo">362</span>      + "  -Dmapreduce.map.speculative=false\n"<a name="line.362"></a>
+<span class="sourceLineNo">363</span>      + "  -Dmapreduce.reduce.speculative=false");<a name="line.363"></a>
+<span class="sourceLineNo">364</span>  }<a name="line.364"></a>
+<span class="sourceLineNo">365</span><a name="line.365"></a>
+<span class="sourceLineNo">366</span>  /**<a name="line.366"></a>
+<span class="sourceLineNo">367</span>   * Main entry point.<a name="line.367"></a>
+<span class="sourceLineNo">368</span>   *<a name="line.368"></a>
+<span class="sourceLineNo">369</span>   * @param args  The command line parameters.<a name="line.369"></a>
+<span class="sourceLineNo">370</span>   * @throws Exception When running the job fails.<a name="line.370"></a>
+<span class="sourceLineNo">371</span>   */<a name="line.371"></a>
+<span class="sourceLineNo">372</span>  public static void main(String[] args) throws Exception {<a name="line.372"></a>
+<span class="sourceLineNo">373</span>    int ret = ToolRunner.run(new WALPlayer(HBaseConfiguration.create()), args);<a name="line.373"></a>
+<span class="sourceLineNo">374</span>    System.exit(ret);<a name="line.374"></a>
+<span class="sourceLineNo">375</span>  }<a name="line.375"></a>
+<span class="sourceLineNo">376</span><a name="line.376"></a>
+<span class="sourceLineNo">377</span>  @Override<a name="line.377"></a>
+<span class="sourceLineNo">378</span>  public int run(String[] args) throws Exception {<a name="line.378"></a>
+<span class="sourceLineNo">379</span>    if (args.length &lt; 2) {<a name="line.379"></a>
+<span class="sourceLineNo">380</span>      usage("Wrong number of arguments: " + args.length);<a name="line.380"></a>
+<span class="sourceLineNo">381</span>      System.exit(-1);<a name="line.381"></a>
+<span class="sourceLineNo">382</span>    }<a name="line.382"></a>
+<span class="sourceLineNo">383</span>    Job job = createSubmittableJob(args);<a name="line.383"></a>
+<span class="sourceLineNo">384</span>    return job.waitForCompletion(true) ? 0 : 1;<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>
 
 
 


Mime
View raw message