HBASE-26276 Allow HashTable/SyncTable to perform rawScan when comparing cells (#3673)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Viraj Jasani <vjasani@apache.org>
(cherry-picked from commit ee632bdcae
)
This commit is contained in:
parent
1664f52066
commit
126f6bc520
|
@ -98,6 +98,7 @@ public class HashTable extends Configured implements Tool {
|
||||||
long startTime = 0;
|
long startTime = 0;
|
||||||
long endTime = 0;
|
long endTime = 0;
|
||||||
boolean ignoreTimestamps;
|
boolean ignoreTimestamps;
|
||||||
|
boolean rawScan;
|
||||||
|
|
||||||
List<ImmutableBytesWritable> partitions;
|
List<ImmutableBytesWritable> partitions;
|
||||||
|
|
||||||
|
@ -136,6 +137,7 @@ public class HashTable extends Configured implements Tool {
|
||||||
if (endTime != 0) {
|
if (endTime != 0) {
|
||||||
p.setProperty("endTimestamp", Long.toString(endTime));
|
p.setProperty("endTimestamp", Long.toString(endTime));
|
||||||
}
|
}
|
||||||
|
p.setProperty("rawScan", Boolean.toString(rawScan));
|
||||||
|
|
||||||
try (OutputStreamWriter osw = new OutputStreamWriter(fs.create(path), Charsets.UTF_8)) {
|
try (OutputStreamWriter osw = new OutputStreamWriter(fs.create(path), Charsets.UTF_8)) {
|
||||||
p.store(osw, null);
|
p.store(osw, null);
|
||||||
|
@ -173,6 +175,11 @@ public class HashTable extends Configured implements Tool {
|
||||||
versions = Integer.parseInt(versionString);
|
versions = Integer.parseInt(versionString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String rawScanString = p.getProperty("rawScan");
|
||||||
|
if (rawScanString != null) {
|
||||||
|
rawScan = Boolean.parseBoolean(rawScanString);
|
||||||
|
}
|
||||||
|
|
||||||
String startTimeString = p.getProperty("startTimestamp");
|
String startTimeString = p.getProperty("startTimestamp");
|
||||||
if (startTimeString != null) {
|
if (startTimeString != null) {
|
||||||
startTime = Long.parseLong(startTimeString);
|
startTime = Long.parseLong(startTimeString);
|
||||||
|
@ -207,6 +214,8 @@ public class HashTable extends Configured implements Tool {
|
||||||
scan.addFamily(Bytes.toBytes(fam));
|
scan.addFamily(Bytes.toBytes(fam));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
scan.setRaw(rawScan);
|
||||||
|
|
||||||
return scan;
|
return scan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,6 +313,7 @@ public class HashTable extends Configured implements Tool {
|
||||||
if (versions >= 0) {
|
if (versions >= 0) {
|
||||||
sb.append(", versions=").append(versions);
|
sb.append(", versions=").append(versions);
|
||||||
}
|
}
|
||||||
|
sb.append(", rawScan=").append(rawScan);
|
||||||
if (startTime != 0) {
|
if (startTime != 0) {
|
||||||
sb.append("startTime=").append(startTime);
|
sb.append("startTime=").append(startTime);
|
||||||
}
|
}
|
||||||
|
@ -476,7 +486,6 @@ public class HashTable extends Configured implements Tool {
|
||||||
private long batchSize = 0;
|
private long batchSize = 0;
|
||||||
boolean ignoreTimestamps;
|
boolean ignoreTimestamps;
|
||||||
|
|
||||||
|
|
||||||
public ResultHasher() {
|
public ResultHasher() {
|
||||||
try {
|
try {
|
||||||
digest = MessageDigest.getInstance("MD5");
|
digest = MessageDigest.getInstance("MD5");
|
||||||
|
@ -626,6 +635,7 @@ public class HashTable extends Configured implements Tool {
|
||||||
System.err.println(" Ignored if no starttime specified.");
|
System.err.println(" Ignored if no starttime specified.");
|
||||||
System.err.println(" scanbatch scanner batch size to support intra row scans");
|
System.err.println(" scanbatch scanner batch size to support intra row scans");
|
||||||
System.err.println(" versions number of cell versions to include");
|
System.err.println(" versions number of cell versions to include");
|
||||||
|
System.err.println(" rawScan performs a raw scan (false if omitted)");
|
||||||
System.err.println(" families comma-separated list of families to include");
|
System.err.println(" families comma-separated list of families to include");
|
||||||
System.err.println(" ignoreTimestamps if true, ignores cell timestamps");
|
System.err.println(" ignoreTimestamps if true, ignores cell timestamps");
|
||||||
System.err.println(" when calculating hashes");
|
System.err.println(" when calculating hashes");
|
||||||
|
@ -707,6 +717,12 @@ public class HashTable extends Configured implements Tool {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final String rawScanArgKey = "--rawScan=";
|
||||||
|
if (cmd.startsWith(rawScanArgKey)) {
|
||||||
|
tableHash.rawScan = Boolean.parseBoolean(cmd.substring(rawScanArgKey.length()));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final String familiesArgKey = "--families=";
|
final String familiesArgKey = "--families=";
|
||||||
if (cmd.startsWith(familiesArgKey)) {
|
if (cmd.startsWith(familiesArgKey)) {
|
||||||
tableHash.families = cmd.substring(familiesArgKey.length());
|
tableHash.families = cmd.substring(familiesArgKey.length());
|
||||||
|
|
Loading…
Reference in New Issue