rda3mon commented on code in PR #4770:
URL: https://github.com/apache/hbase/pull/4770#discussion_r1083226789
##########
hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/WALPlayer.java:
##########
@@ -88,19 +104,23 @@ protected WALPlayer(final Configuration c) {
*/
@Deprecated
static class WALKeyValueMapper extends Mapper<WALKey, WALEdit,
ImmutableBytesWritable, KeyValue> {
- private byte[] table;
+ private Set<String> tableSet = new HashSet<String>();
+ private boolean multiTableSupport = false;
@Override
public void map(WALKey key, WALEdit value, Context context) throws
IOException {
try {
- // skip all other tables
- if (Bytes.equals(table, key.getTableName().getName())) {
+ TableName table = key.getTableName();
+ if (tableSet.contains(table.getNameAsString())) {
for (Cell cell : value.getCells()) {
- KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
- if (WALEdit.isMetaEditFamily(kv)) {
+ if (WALEdit.isMetaEditFamily(cell)) {
continue;
}
- context.write(new ImmutableBytesWritable(CellUtil.cloneRow(kv)),
kv);
+ byte[] outKey = multiTableSupport
+ ? Bytes.add(table.getName(), Bytes.toBytes(tableSeparator),
+ CellUtil.cloneRow(KeyValueUtil.ensureKeyValue(cell)))
+ : CellUtil.cloneRow(KeyValueUtil.ensureKeyValue(cell));
+ context.write(new ImmutableBytesWritable(outKey),
KeyValueUtil.ensureKeyValue(cell));
Review Comment:
Done. Seems like a miss from my side.
##########
hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/WALPlayer.java:
##########
@@ -88,19 +104,23 @@ protected WALPlayer(final Configuration c) {
*/
@Deprecated
static class WALKeyValueMapper extends Mapper<WALKey, WALEdit,
ImmutableBytesWritable, KeyValue> {
- private byte[] table;
+ private Set<String> tableSet = new HashSet<String>();
+ private boolean multiTableSupport = false;
@Override
public void map(WALKey key, WALEdit value, Context context) throws
IOException {
try {
- // skip all other tables
- if (Bytes.equals(table, key.getTableName().getName())) {
+ TableName table = key.getTableName();
+ if (tableSet.contains(table.getNameAsString())) {
for (Cell cell : value.getCells()) {
- KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
- if (WALEdit.isMetaEditFamily(kv)) {
+ if (WALEdit.isMetaEditFamily(cell)) {
continue;
}
- context.write(new ImmutableBytesWritable(CellUtil.cloneRow(kv)),
kv);
+ byte[] outKey = multiTableSupport
+ ? Bytes.add(table.getName(), Bytes.toBytes(tableSeparator),
+ CellUtil.cloneRow(KeyValueUtil.ensureKeyValue(cell)))
+ : CellUtil.cloneRow(KeyValueUtil.ensureKeyValue(cell));
+ context.write(new ImmutableBytesWritable(outKey),
KeyValueUtil.ensureKeyValue(cell));
Review Comment:
Done. A miss from my side.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]