HBASE-17116 [PerformanceEvaluation] Add option to configure block size (Yi Liang)

This commit is contained in:
Jerry He 2016-11-27 19:04:32 -08:00
parent 8204337b5d
commit 4771c217cd
1 changed files with 18 additions and 1 deletions

View File

@ -371,6 +371,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
family.setDataBlockEncoding(opts.blockEncoding); family.setDataBlockEncoding(opts.blockEncoding);
family.setCompressionType(opts.compression); family.setCompressionType(opts.compression);
family.setBloomFilterType(opts.bloomType); family.setBloomFilterType(opts.bloomType);
family.setBlocksize(opts.blockSize);
if (opts.inMemoryCF) { if (opts.inMemoryCF) {
family.setInMemory(true); family.setInMemory(true);
} }
@ -625,6 +626,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
String splitPolicy = null; String splitPolicy = null;
Compression.Algorithm compression = Compression.Algorithm.NONE; Compression.Algorithm compression = Compression.Algorithm.NONE;
BloomType bloomType = BloomType.ROW; BloomType bloomType = BloomType.ROW;
int blockSize = HConstants.DEFAULT_BLOCKSIZE;
DataBlockEncoding blockEncoding = DataBlockEncoding.NONE; DataBlockEncoding blockEncoding = DataBlockEncoding.NONE;
boolean valueRandom = false; boolean valueRandom = false;
boolean valueZipf = false; boolean valueZipf = false;
@ -670,6 +672,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
this.blockEncoding = that.blockEncoding; this.blockEncoding = that.blockEncoding;
this.filterAll = that.filterAll; this.filterAll = that.filterAll;
this.bloomType = that.bloomType; this.bloomType = that.bloomType;
this.blockSize = that.blockSize;
this.valueRandom = that.valueRandom; this.valueRandom = that.valueRandom;
this.valueZipf = that.valueZipf; this.valueZipf = that.valueZipf;
this.valueSize = that.valueSize; this.valueSize = that.valueSize;
@ -834,6 +837,10 @@ public class PerformanceEvaluation extends Configured implements Tool {
this.bloomType = bloomType; this.bloomType = bloomType;
} }
public void setBlockSize(int blockSize) {
this.blockSize = blockSize;
}
public void setBlockEncoding(DataBlockEncoding blockEncoding) { public void setBlockEncoding(DataBlockEncoding blockEncoding) {
this.blockEncoding = blockEncoding; this.blockEncoding = blockEncoding;
} }
@ -950,6 +957,10 @@ public class PerformanceEvaluation extends Configured implements Tool {
return bloomType; return bloomType;
} }
public int getBlockSize() {
return blockSize;
}
public boolean isOneCon() { public boolean isOneCon() {
return oneCon; return oneCon;
} }
@ -1881,8 +1892,9 @@ public class PerformanceEvaluation extends Configured implements Tool {
System.err.println(" inmemory Tries to keep the HFiles of the CF " + System.err.println(" inmemory Tries to keep the HFiles of the CF " +
"inmemory as far as possible. Not guaranteed that reads are always served " + "inmemory as far as possible. Not guaranteed that reads are always served " +
"from memory. Default: false"); "from memory. Default: false");
System.err.println(" bloomFilter Bloom filter type, one of " System.err.println(" bloomFilter Bloom filter type, one of "
+ Arrays.toString(BloomType.values())); + Arrays.toString(BloomType.values()));
System.err.println(" blockSize Blocksize to use when writing out hfiles. ");
System.err.println(" inmemoryCompaction Makes the column family to do inmemory flushes/compactions. " System.err.println(" inmemoryCompaction Makes the column family to do inmemory flushes/compactions. "
+ "Uses the CompactingMemstore"); + "Uses the CompactingMemstore");
System.err.println(" addColumns Adds columns to scans/gets explicitly. Default: true"); System.err.println(" addColumns Adds columns to scans/gets explicitly. Default: true");
@ -2084,6 +2096,11 @@ public class PerformanceEvaluation extends Configured implements Tool {
continue; continue;
} }
final String blockSize = "--blockSize=";
if(cmd.startsWith(blockSize) ) {
opts.blockSize = Integer.parseInt(cmd.substring(blockSize.length()));
}
final String valueSize = "--valueSize="; final String valueSize = "--valueSize=";
if (cmd.startsWith(valueSize)) { if (cmd.startsWith(valueSize)) {
opts.valueSize = Integer.parseInt(cmd.substring(valueSize.length())); opts.valueSize = Integer.parseInt(cmd.substring(valueSize.length()));