HBASE-15752 ClassNotFoundException is encountered when custom WAL codec is not found in WALPlayer job

This commit is contained in:
tedyu 2016-05-03 07:01:08 -07:00
parent 0ee3ca2a78
commit a7b31f74db
2 changed files with 8 additions and 1 deletions

View File

@ -38,6 +38,7 @@ import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.RegionLocator;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.regionserver.wal.WALCellCodec;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.wal.WALKey;
@ -294,6 +295,12 @@ public class WALPlayer extends Configured implements Tool {
// No reducers.
job.setNumReduceTasks(0);
}
String codecCls = WALCellCodec.getWALCellCodecClass(conf);
try {
TableMapReduceUtil.addDependencyJars(conf, Class.forName(codecCls));
} catch (Exception e) {
throw new IOException("Cannot determine wal codec class " + codecCls, e);
}
return job;
}

View File

@ -79,7 +79,7 @@ public class WALCellCodec implements Codec {
this.compression = compression;
}
static String getWALCellCodecClass(Configuration conf) {
public static String getWALCellCodecClass(Configuration conf) {
return conf.get(WAL_CELL_CODEC_CLASS_KEY, WALCellCodec.class.getName());
}