From f682f666180d4477aa5473ad33e9934db565cbe6 Mon Sep 17 00:00:00 2001 From: DaveTeng0 Date: Mon, 8 Aug 2022 15:26:44 -0400 Subject: [PATCH 01/14] Fix error message on console output when incorrect replication config is passed --- .../apache/hadoop/hdds/client/ECReplicationConfig.java | 4 +++- .../org/apache/hadoop/hdds/client/ReplicationConfig.java | 6 +++--- .../hadoop/hdds/client/ReplicationConfigValidator.java | 9 +-------- .../hadoop/ozone/shell/bucket/CreateBucketHandler.java | 4 ++++ 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java index daf1d531516..db380d4eeb0 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java @@ -33,6 +33,8 @@ public class ECReplicationConfig implements ReplicationConfig { public static final String EC_REPLICATION_PARAMS_DELIMITER = "-"; + public static final String EC_REPLICATION_PATTERN + = "^((STANDALONE|RATIS)/(ONE|THREE))|(EC/(3-2|6-3|10-4))$"; /** * Enum defining the allowed list of ECCodecs. @@ -58,7 +60,7 @@ public static String allValuesAsString() { // RS-3-2-2048 // XOR-10-4-4096K private static final Pattern STRING_FORMAT - = Pattern.compile("([a-zA-Z]+)-(\\d+)-(\\d+)-(\\d+)((?:k|K))?"); + = Pattern.compile(EC_REPLICATION_PATTERN); private int data; diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfig.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfig.java index 5d2fa9b66ea..bede392c4e9 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfig.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfig.java @@ -190,6 +190,9 @@ static ReplicationConfig parseWithoutFallback(ReplicationType type, } } replicationConfig = fromTypeAndFactor(type, factor); + ReplicationConfigValidator legacyValidator = + config.getObject(ReplicationConfigValidator.class); + legacyValidator.validate(replicationConfig); break; case EC: replicationConfig = new ECReplicationConfig(replication); @@ -199,9 +202,6 @@ static ReplicationConfig parseWithoutFallback(ReplicationType type, + "be parsed."); } - ReplicationConfigValidator validator = - config.getObject(ReplicationConfigValidator.class); - validator.validate(replicationConfig); return replicationConfig; } diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java index 7090c76563b..13f9bfe7e61 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java @@ -30,7 +30,7 @@ * Validator to check if replication config is enabled. */ @ConfigGroup(prefix = "ozone.replication") -public class ReplicationConfigValidator { +public class ReplicationConfigValidator { //For Legacy replication type: standalone, RETIS @Config(key = "allowed-configs", defaultValue = "^((STANDALONE|RATIS)/(ONE|THREE))|(EC/(3-2|6-3|10-4))$", @@ -54,13 +54,6 @@ public ReplicationConfig validate(ReplicationConfig replicationConfig) { if (!validationRegexp.matcher( replicationConfig.configFormat()).matches()) { String replication = replicationConfig.getReplication(); - if (HddsProtos.ReplicationType.EC == - replicationConfig.getReplicationType()) { - ECReplicationConfig ecConfig = - (ECReplicationConfig) replicationConfig; - replication = ecConfig.getCodec() + "-" + ecConfig.getData() + - "-" + ecConfig.getParity() + "-{CHUNK_SIZE}"; - } throw new IllegalArgumentException("Invalid replication config " + "for type " + replicationConfig.getReplicationType() + " and replication " + replication); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/CreateBucketHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/CreateBucketHandler.java index 277c5afff21..330415e1a62 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/CreateBucketHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/CreateBucketHandler.java @@ -32,6 +32,8 @@ import org.apache.hadoop.ozone.shell.SetSpaceQuotaOptions; import org.apache.hadoop.ozone.shell.ShellReplicationOptions; import org.apache.hadoop.security.UserGroupInformation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import picocli.CommandLine; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -44,6 +46,8 @@ @Command(name = "create", description = "creates a bucket in a given volume") public class CreateBucketHandler extends BucketHandler { + static final Logger LOG = + LoggerFactory.getLogger(CreateBucketHandler.class); @Option(names = {"--bucketkey", "-k"}, description = "bucket encryption key name") From 2fba49755063e88f852f8a1e71f9e250e94f69cf Mon Sep 17 00:00:00 2001 From: DaveTeng0 Date: Mon, 8 Aug 2022 16:48:11 -0400 Subject: [PATCH 02/14] fix code style --- .../hadoop/hdds/client/ReplicationConfigValidator.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java index 13f9bfe7e61..ebe22d7059f 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java @@ -22,7 +22,6 @@ import org.apache.hadoop.hdds.conf.ConfigTag; import org.apache.hadoop.hdds.conf.ConfigType; import org.apache.hadoop.hdds.conf.PostConstruct; -import org.apache.hadoop.hdds.protocol.proto.HddsProtos; import java.util.regex.Pattern; @@ -30,8 +29,8 @@ * Validator to check if replication config is enabled. */ @ConfigGroup(prefix = "ozone.replication") -public class ReplicationConfigValidator { //For Legacy replication type: standalone, RETIS - +public class ReplicationConfigValidator { + //For Legacy replication type: standalone, RETIS @Config(key = "allowed-configs", defaultValue = "^((STANDALONE|RATIS)/(ONE|THREE))|(EC/(3-2|6-3|10-4))$", type = ConfigType.STRING, From 84d8be118c861d5ecba303723e30ee3e92025aff Mon Sep 17 00:00:00 2001 From: DaveTeng0 Date: Mon, 8 Aug 2022 17:26:53 -0400 Subject: [PATCH 03/14] update regex pattern of ec replication --- .../java/org/apache/hadoop/hdds/client/ECReplicationConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java index db380d4eeb0..bb19eb70f5e 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java @@ -34,7 +34,7 @@ public class ECReplicationConfig implements ReplicationConfig { public static final String EC_REPLICATION_PARAMS_DELIMITER = "-"; public static final String EC_REPLICATION_PATTERN - = "^((STANDALONE|RATIS)/(ONE|THREE))|(EC/(3-2|6-3|10-4))$"; + = "^(rs-2|6-3|10-4)$"; /** * Enum defining the allowed list of ECCodecs. From 817aba98f6e40ec38fc45f623935c9cb6ee06ee8 Mon Sep 17 00:00:00 2001 From: DaveTeng0 Date: Mon, 8 Aug 2022 17:33:49 -0400 Subject: [PATCH 04/14] update regex pattern of ec replication --- .../java/org/apache/hadoop/hdds/client/ECReplicationConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java index bb19eb70f5e..59b5c43aa05 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java @@ -94,7 +94,7 @@ public ECReplicationConfig(int data, int parity, EcCodec codec, * @param string */ public ECReplicationConfig(String string) { - final Matcher matcher = STRING_FORMAT.matcher(string); + final Matcher matcher = STRING_FORMAT.matcher(string.toLowerCase()); if (!matcher.matches()) { throw new IllegalArgumentException("EC replication config should be " + "defined in the form rs-3-2-1024k, rs-6-3-1024; or rs-10-4-1024k." + From 786cae3347a63d85e5df9f94ea4f205a1882d811 Mon Sep 17 00:00:00 2001 From: DaveTeng0 Date: Mon, 8 Aug 2022 17:49:19 -0400 Subject: [PATCH 05/14] update regex pattern of ec replication --- .../java/org/apache/hadoop/hdds/client/ECReplicationConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java index 59b5c43aa05..f4c8c164fb5 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java @@ -34,7 +34,7 @@ public class ECReplicationConfig implements ReplicationConfig { public static final String EC_REPLICATION_PARAMS_DELIMITER = "-"; public static final String EC_REPLICATION_PATTERN - = "^(rs-2|6-3|10-4)$"; + = "^rs-2|6-3|10-\\d{4}(k|K)?$"; /** * Enum defining the allowed list of ECCodecs. From a4d656af598a00e12b5bf417c99028ead487e969 Mon Sep 17 00:00:00 2001 From: DaveTeng0 Date: Mon, 8 Aug 2022 18:03:25 -0400 Subject: [PATCH 06/14] update regex pattern of ec replication --- .../java/org/apache/hadoop/hdds/client/ECReplicationConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java index f4c8c164fb5..07a0c9565ff 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java @@ -34,7 +34,7 @@ public class ECReplicationConfig implements ReplicationConfig { public static final String EC_REPLICATION_PARAMS_DELIMITER = "-"; public static final String EC_REPLICATION_PATTERN - = "^rs-2|6-3|10-\\d{4}(k|K)?$"; + = "^(EC/(3-2|6-3|10-4))$"; /** * Enum defining the allowed list of ECCodecs. From f34271e896de2d17f367c563a2f318c31e0b1479 Mon Sep 17 00:00:00 2001 From: DaveTeng0 Date: Mon, 8 Aug 2022 19:55:34 -0400 Subject: [PATCH 07/14] update EC data-parity error message --- .../apache/hadoop/hdds/client/ECReplicationConfig.java | 6 ++---- .../apache/hadoop/hdds/client/ReplicationConfig.java | 6 +++--- .../hadoop/hdds/client/ReplicationConfigValidator.java | 10 ++++++++-- .../hadoop/ozone/shell/bucket/CreateBucketHandler.java | 4 ---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java index 07a0c9565ff..4af84b1859d 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java @@ -33,8 +33,6 @@ public class ECReplicationConfig implements ReplicationConfig { public static final String EC_REPLICATION_PARAMS_DELIMITER = "-"; - public static final String EC_REPLICATION_PATTERN - = "^(EC/(3-2|6-3|10-4))$"; /** * Enum defining the allowed list of ECCodecs. @@ -60,7 +58,7 @@ public static String allValuesAsString() { // RS-3-2-2048 // XOR-10-4-4096K private static final Pattern STRING_FORMAT - = Pattern.compile(EC_REPLICATION_PATTERN); + = Pattern.compile("\"([a-zA-Z]+)-(\\\\d+)-(\\\\d+)-(\\\\d+)((?:k|K))?\""); private int data; @@ -94,7 +92,7 @@ public ECReplicationConfig(int data, int parity, EcCodec codec, * @param string */ public ECReplicationConfig(String string) { - final Matcher matcher = STRING_FORMAT.matcher(string.toLowerCase()); + final Matcher matcher = STRING_FORMAT.matcher(string.toUpperCase()); if (!matcher.matches()) { throw new IllegalArgumentException("EC replication config should be " + "defined in the form rs-3-2-1024k, rs-6-3-1024; or rs-10-4-1024k." + diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfig.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfig.java index bede392c4e9..27fbf7a77dd 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfig.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfig.java @@ -190,9 +190,6 @@ static ReplicationConfig parseWithoutFallback(ReplicationType type, } } replicationConfig = fromTypeAndFactor(type, factor); - ReplicationConfigValidator legacyValidator = - config.getObject(ReplicationConfigValidator.class); - legacyValidator.validate(replicationConfig); break; case EC: replicationConfig = new ECReplicationConfig(replication); @@ -202,6 +199,9 @@ static ReplicationConfig parseWithoutFallback(ReplicationType type, + "be parsed."); } + ReplicationConfigValidator legacyValidator = + config.getObject(ReplicationConfigValidator.class); + legacyValidator.validate(replicationConfig); return replicationConfig; } diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java index ebe22d7059f..345c5234b76 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java @@ -30,7 +30,6 @@ */ @ConfigGroup(prefix = "ozone.replication") public class ReplicationConfigValidator { - //For Legacy replication type: standalone, RETIS @Config(key = "allowed-configs", defaultValue = "^((STANDALONE|RATIS)/(ONE|THREE))|(EC/(3-2|6-3|10-4))$", type = ConfigType.STRING, @@ -53,9 +52,16 @@ public ReplicationConfig validate(ReplicationConfig replicationConfig) { if (!validationRegexp.matcher( replicationConfig.configFormat()).matches()) { String replication = replicationConfig.getReplication(); + if (HddsProtos.ReplicationType.EC == + replicationConfig.getReplicationType()) { + ECReplicationConfig ecConfig = + (ECReplicationConfig) replicationConfig; + replication = ecConfig.getCodec() + "-" + ecConfig.getData() + + "-" + ecConfig.getParity() + "-{CHUNK_SIZE}"; + } throw new IllegalArgumentException("Invalid replication config " + "for type " + replicationConfig.getReplicationType() + - " and replication " + replication); + " and replication " + replication + ", Supported data-parity are 3-2,6-3,10-4"); } } return replicationConfig; diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/CreateBucketHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/CreateBucketHandler.java index 330415e1a62..277c5afff21 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/CreateBucketHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/CreateBucketHandler.java @@ -32,8 +32,6 @@ import org.apache.hadoop.ozone.shell.SetSpaceQuotaOptions; import org.apache.hadoop.ozone.shell.ShellReplicationOptions; import org.apache.hadoop.security.UserGroupInformation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import picocli.CommandLine; import picocli.CommandLine.Command; import picocli.CommandLine.Option; @@ -46,8 +44,6 @@ @Command(name = "create", description = "creates a bucket in a given volume") public class CreateBucketHandler extends BucketHandler { - static final Logger LOG = - LoggerFactory.getLogger(CreateBucketHandler.class); @Option(names = {"--bucketkey", "-k"}, description = "bucket encryption key name") From 345608feec5577674479a99b09c9ae0882163009 Mon Sep 17 00:00:00 2001 From: DaveTeng0 Date: Mon, 8 Aug 2022 20:00:46 -0400 Subject: [PATCH 08/14] update EC data-parity error message --- .../org/apache/hadoop/hdds/client/ECReplicationConfig.java | 4 ++-- .../org/apache/hadoop/hdds/client/ReplicationConfig.java | 6 +++--- .../hadoop/hdds/client/ReplicationConfigValidator.java | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java index 4af84b1859d..daf1d531516 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java @@ -58,7 +58,7 @@ public static String allValuesAsString() { // RS-3-2-2048 // XOR-10-4-4096K private static final Pattern STRING_FORMAT - = Pattern.compile("\"([a-zA-Z]+)-(\\\\d+)-(\\\\d+)-(\\\\d+)((?:k|K))?\""); + = Pattern.compile("([a-zA-Z]+)-(\\d+)-(\\d+)-(\\d+)((?:k|K))?"); private int data; @@ -92,7 +92,7 @@ public ECReplicationConfig(int data, int parity, EcCodec codec, * @param string */ public ECReplicationConfig(String string) { - final Matcher matcher = STRING_FORMAT.matcher(string.toUpperCase()); + final Matcher matcher = STRING_FORMAT.matcher(string); if (!matcher.matches()) { throw new IllegalArgumentException("EC replication config should be " + "defined in the form rs-3-2-1024k, rs-6-3-1024; or rs-10-4-1024k." + diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfig.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfig.java index 27fbf7a77dd..5d2fa9b66ea 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfig.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfig.java @@ -199,9 +199,9 @@ static ReplicationConfig parseWithoutFallback(ReplicationType type, + "be parsed."); } - ReplicationConfigValidator legacyValidator = - config.getObject(ReplicationConfigValidator.class); - legacyValidator.validate(replicationConfig); + ReplicationConfigValidator validator = + config.getObject(ReplicationConfigValidator.class); + validator.validate(replicationConfig); return replicationConfig; } diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java index 345c5234b76..a27e308b08d 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java @@ -22,6 +22,7 @@ import org.apache.hadoop.hdds.conf.ConfigTag; import org.apache.hadoop.hdds.conf.ConfigType; import org.apache.hadoop.hdds.conf.PostConstruct; +import org.apache.hadoop.hdds.protocol.proto.HddsProtos; import java.util.regex.Pattern; @@ -30,6 +31,7 @@ */ @ConfigGroup(prefix = "ozone.replication") public class ReplicationConfigValidator { + @Config(key = "allowed-configs", defaultValue = "^((STANDALONE|RATIS)/(ONE|THREE))|(EC/(3-2|6-3|10-4))$", type = ConfigType.STRING, @@ -55,9 +57,9 @@ public ReplicationConfig validate(ReplicationConfig replicationConfig) { if (HddsProtos.ReplicationType.EC == replicationConfig.getReplicationType()) { ECReplicationConfig ecConfig = - (ECReplicationConfig) replicationConfig; + (ECReplicationConfig) replicationConfig; replication = ecConfig.getCodec() + "-" + ecConfig.getData() + - "-" + ecConfig.getParity() + "-{CHUNK_SIZE}"; + "-" + ecConfig.getParity() + "-{CHUNK_SIZE}"; } throw new IllegalArgumentException("Invalid replication config " + "for type " + replicationConfig.getReplicationType() + From 971d3e5771bcbe7a00b19f80dd0384b9820a66bd Mon Sep 17 00:00:00 2001 From: DaveTeng0 Date: Mon, 8 Aug 2022 20:12:48 -0400 Subject: [PATCH 09/14] update EC data-parity error message --- .../apache/hadoop/hdds/client/ReplicationConfigValidator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java index a27e308b08d..31385817d8f 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java @@ -63,7 +63,7 @@ public ReplicationConfig validate(ReplicationConfig replicationConfig) { } throw new IllegalArgumentException("Invalid replication config " + "for type " + replicationConfig.getReplicationType() + - " and replication " + replication + ", Supported data-parity are 3-2,6-3,10-4"); + " and replication " + replication + ". Supported data-parity are 3-2,6-3,10-4"); } } return replicationConfig; From 48f25ea0ab61f72245c48ebe6bff19422e24aa28 Mon Sep 17 00:00:00 2001 From: DaveTeng0 Date: Mon, 8 Aug 2022 20:13:34 -0400 Subject: [PATCH 10/14] update EC data-parity error message --- .../apache/hadoop/hdds/client/ReplicationConfigValidator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java index 31385817d8f..71ef4c1b26c 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java @@ -61,7 +61,7 @@ public ReplicationConfig validate(ReplicationConfig replicationConfig) { replication = ecConfig.getCodec() + "-" + ecConfig.getData() + "-" + ecConfig.getParity() + "-{CHUNK_SIZE}"; } - throw new IllegalArgumentException("Invalid replication config " + + throw new IllegalArgumentException("Invalid data-parity replication config " + "for type " + replicationConfig.getReplicationType() + " and replication " + replication + ". Supported data-parity are 3-2,6-3,10-4"); } From 4cd011c7cf3806b27858205bb47c81500112e983 Mon Sep 17 00:00:00 2001 From: DaveTeng0 Date: Tue, 9 Aug 2022 13:31:42 -0400 Subject: [PATCH 11/14] Fix code style --- .../hadoop/hdds/client/ReplicationConfigValidator.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java index 71ef4c1b26c..148722ea272 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java @@ -61,9 +61,10 @@ public ReplicationConfig validate(ReplicationConfig replicationConfig) { replication = ecConfig.getCodec() + "-" + ecConfig.getData() + "-" + ecConfig.getParity() + "-{CHUNK_SIZE}"; } - throw new IllegalArgumentException("Invalid data-parity replication config " + - "for type " + replicationConfig.getReplicationType() + - " and replication " + replication + ". Supported data-parity are 3-2,6-3,10-4"); + throw new IllegalArgumentException( + "Invalid data-parity replication config " + + "for type " + replicationConfig.getReplicationType() + + " and replication " + replication + ". Supported data-parity are 3-2,6-3,10-4"); } } return replicationConfig; From fcdfd2ac96523fd71b8457fea04cd4b45852ebd0 Mon Sep 17 00:00:00 2001 From: DaveTeng0 Date: Tue, 9 Aug 2022 13:39:10 -0400 Subject: [PATCH 12/14] Fix unit test --- .../hadoop/hdds/client/TestReplicationConfigValidator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfigValidator.java b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfigValidator.java index bbdc78c94ab..a6f17541eeb 100644 --- a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfigValidator.java +++ b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfigValidator.java @@ -51,8 +51,8 @@ public void testValidation() { try { validator.validate(new ECReplicationConfig(invalidEcConfig1)); } catch (IllegalArgumentException ex) { - GenericTestUtils.assertExceptionContains("Invalid replication " + - "config for type EC and replication xor-6-4-{CHUNK_SIZE}", ex); + GenericTestUtils.assertExceptionContains("Invalid data-parity replication " + + "config for type EC and replication xor-6-4-{CHUNK_SIZE}. Supported data-parity are 3-2,6-3,10-4", ex); } } From aa9eb3a1392a84b1014771f5d729dd1b5101bc95 Mon Sep 17 00:00:00 2001 From: DaveTeng0 Date: Tue, 9 Aug 2022 16:02:13 -0400 Subject: [PATCH 13/14] Fix line length --- .../hadoop/hdds/client/TestReplicationConfigValidator.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfigValidator.java b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfigValidator.java index a6f17541eeb..acf657b4ba3 100644 --- a/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfigValidator.java +++ b/hadoop-hdds/common/src/test/java/org/apache/hadoop/hdds/client/TestReplicationConfigValidator.java @@ -51,8 +51,10 @@ public void testValidation() { try { validator.validate(new ECReplicationConfig(invalidEcConfig1)); } catch (IllegalArgumentException ex) { - GenericTestUtils.assertExceptionContains("Invalid data-parity replication " + - "config for type EC and replication xor-6-4-{CHUNK_SIZE}. Supported data-parity are 3-2,6-3,10-4", ex); + GenericTestUtils.assertExceptionContains( + "Invalid data-parity replication " + + "config for type EC and replication xor-6-4-{CHUNK_SIZE}. " + + "Supported data-parity are 3-2,6-3,10-4", ex); } } From ef55e980a5408753554e6b24b8c99c9df1b1c929 Mon Sep 17 00:00:00 2001 From: DaveTeng0 Date: Tue, 9 Aug 2022 16:42:48 -0400 Subject: [PATCH 14/14] Fix line length --- .../apache/hadoop/hdds/client/ReplicationConfigValidator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java index 148722ea272..36d95251ed9 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ReplicationConfigValidator.java @@ -64,7 +64,8 @@ public ReplicationConfig validate(ReplicationConfig replicationConfig) { throw new IllegalArgumentException( "Invalid data-parity replication config " + "for type " + replicationConfig.getReplicationType() + - " and replication " + replication + ". Supported data-parity are 3-2,6-3,10-4"); + " and replication " + replication + "." + + " Supported data-parity are 3-2,6-3,10-4"); } } return replicationConfig;