From 4771c217cdcfa9daf9854635b2aa8c7ccc71cd0d Mon Sep 17 00:00:00 2001 From: Jerry He Date: Sun, 27 Nov 2016 19:04:32 -0800 Subject: [PATCH] HBASE-17116 [PerformanceEvaluation] Add option to configure block size (Yi Liang) --- .../hadoop/hbase/PerformanceEvaluation.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java index 53c126de097..d50bf6be610 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java @@ -371,6 +371,7 @@ public class PerformanceEvaluation extends Configured implements Tool { family.setDataBlockEncoding(opts.blockEncoding); family.setCompressionType(opts.compression); family.setBloomFilterType(opts.bloomType); + family.setBlocksize(opts.blockSize); if (opts.inMemoryCF) { family.setInMemory(true); } @@ -625,6 +626,7 @@ public class PerformanceEvaluation extends Configured implements Tool { String splitPolicy = null; Compression.Algorithm compression = Compression.Algorithm.NONE; BloomType bloomType = BloomType.ROW; + int blockSize = HConstants.DEFAULT_BLOCKSIZE; DataBlockEncoding blockEncoding = DataBlockEncoding.NONE; boolean valueRandom = false; boolean valueZipf = false; @@ -670,6 +672,7 @@ public class PerformanceEvaluation extends Configured implements Tool { this.blockEncoding = that.blockEncoding; this.filterAll = that.filterAll; this.bloomType = that.bloomType; + this.blockSize = that.blockSize; this.valueRandom = that.valueRandom; this.valueZipf = that.valueZipf; this.valueSize = that.valueSize; @@ -834,6 +837,10 @@ public class PerformanceEvaluation extends Configured implements Tool { this.bloomType = bloomType; } + public void setBlockSize(int blockSize) { + this.blockSize = blockSize; + } + public void setBlockEncoding(DataBlockEncoding blockEncoding) { this.blockEncoding = blockEncoding; } @@ -950,6 +957,10 @@ public class PerformanceEvaluation extends Configured implements Tool { return bloomType; } + public int getBlockSize() { + return blockSize; + } + public boolean isOneCon() { 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 " + "inmemory as far as possible. Not guaranteed that reads are always served " + "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())); + System.err.println(" blockSize Blocksize to use when writing out hfiles. "); System.err.println(" inmemoryCompaction Makes the column family to do inmemory flushes/compactions. " + "Uses the CompactingMemstore"); System.err.println(" addColumns Adds columns to scans/gets explicitly. Default: true"); @@ -2084,6 +2096,11 @@ public class PerformanceEvaluation extends Configured implements Tool { continue; } + final String blockSize = "--blockSize="; + if(cmd.startsWith(blockSize) ) { + opts.blockSize = Integer.parseInt(cmd.substring(blockSize.length())); + } + final String valueSize = "--valueSize="; if (cmd.startsWith(valueSize)) { opts.valueSize = Integer.parseInt(cmd.substring(valueSize.length()));