From 824b7295e8e2493fc368755d16a919fc6ef0edce Mon Sep 17 00:00:00 2001 From: wenwj0 <36262341+wenwj0@users.noreply.github.com> Date: Sat, 11 Jun 2022 20:10:25 +0800 Subject: [PATCH] HBASE-26923 PerformanceEvaluation support encryption option (#4489) Signed-off-by: Duo Zhang (cherry picked from commit b7065c1cf5297074e79e5c58b3ee1ba5fd1a7f55) Conflicts: hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java --- .../hadoop/hbase/PerformanceEvaluation.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java index aed38bfdde2..af2ff6b6e13 100644 --- a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java +++ b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/PerformanceEvaluation.java @@ -408,6 +408,7 @@ public class PerformanceEvaluation extends Configured implements Tool { HColumnDescriptor familyDesc = new HColumnDescriptor(familyName); familyDesc.setDataBlockEncoding(opts.blockEncoding); familyDesc.setCompressionType(opts.compression); + familyDesc.setEncryptionType(opts.encryption); familyDesc.setBloomFilterType(opts.bloomType); familyDesc.setBlocksize(opts.blockSize); if (opts.inMemoryCF) { @@ -696,6 +697,7 @@ public class PerformanceEvaluation extends Configured implements Tool { int replicas = HTableDescriptor.DEFAULT_REGION_REPLICATION; String splitPolicy = null; Compression.Algorithm compression = Compression.Algorithm.NONE; + String encryption = null; BloomType bloomType = BloomType.ROW; int blockSize = HConstants.DEFAULT_BLOCKSIZE; DataBlockEncoding blockEncoding = DataBlockEncoding.NONE; @@ -751,6 +753,7 @@ public class PerformanceEvaluation extends Configured implements Tool { this.replicas = that.replicas; this.splitPolicy = that.splitPolicy; this.compression = that.compression; + this.encryption = that.encryption; this.blockEncoding = that.blockEncoding; this.filterAll = that.filterAll; this.bloomType = that.bloomType; @@ -940,6 +943,10 @@ public class PerformanceEvaluation extends Configured implements Tool { this.compression = compression; } + public void setEncryption(String encryption) { + this.encryption = encryption; + } + public void setBloomType(BloomType bloomType) { this.bloomType = bloomType; } @@ -1052,6 +1059,10 @@ public class PerformanceEvaluation extends Configured implements Tool { return compression; } + public String getEncryption() { + return encryption; + } + public DataBlockEncoding getBlockEncoding() { return blockEncoding; } @@ -2616,6 +2627,7 @@ public class PerformanceEvaluation extends Configured implements Tool { + " use size to specify the end range and --rows" + " specifies the number of rows within that range. " + "Default: 1.0."); System.err.println(" compress Compression type to use (GZ, LZO, ...). Default: 'NONE'"); + System.err.println(" encryption Encryption type to use (AES, ...). Default: 'NONE'"); System.err.println( " flushCommits Used to determine if the test should flush the table. " + "Default: false"); System.err.println(" valueZipf Set if we should vary value size between 0 and " @@ -2741,6 +2753,12 @@ public class PerformanceEvaluation extends Configured implements Tool { continue; } + final String encryption = "--encryption="; + if (cmd.startsWith(encryption)) { + opts.encryption = cmd.substring(encryption.length()); + continue; + } + final String traceRate = "--traceRate="; if (cmd.startsWith(traceRate)) { opts.traceRate = Double.parseDouble(cmd.substring(traceRate.length()));