You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/06/15 07:24:47 UTC

[GitHub] [ozone] umamaheswararao commented on a change in pull request #2331: HDDS-5247. EC: Create ECReplicationConfig on client side based on input string

umamaheswararao commented on a change in pull request #2331:
URL: https://github.com/apache/ozone/pull/2331#discussion_r651515758



##########
File path: hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/ECReplicationConfig.java
##########
@@ -36,6 +43,29 @@ public ECReplicationConfig(int data, int parity) {
     this.parity = parity;
   }
 
+  public ECReplicationConfig(String string) {
+    final Pattern pattern = Pattern.compile("(\\d+)-(\\d+)");
+    final Matcher matcher = pattern.matcher(string);
+    if (!matcher.matches()) {
+      throw new IllegalArgumentException("EC replication config should be " +
+          "defined in the form 3-2, 6-3 or 10-4");
+    }
+
+    data = Integer.parseInt(matcher.group(1));
+    parity = Integer.parseInt(matcher.group(2));
+    if (data <= 0 || parity <= 0) {
+      throw new IllegalArgumentException("Data and parity part in EC " +
+          "replication config supposed to be positive numbers");
+    }
+    if ((data == 3 && parity == 2)
+        || (data == 6 && parity == 3)
+        || (data == 10 && parity == 4)) {
+      return;
+    }
+    LOG.warn("We recommend to use EC 3-2, 6-3 or 10-4. Other combinations " +

Review comment:
       I prefer to restrict to allow only supported combinations. So, +1 to throw exception here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org