dlmarion commented on code in PR #5743:
URL: https://github.com/apache/accumulo/pull/5743#discussion_r2214209511


##########
core/src/main/java/org/apache/accumulo/core/conf/Property.java:
##########
@@ -1412,6 +1412,15 @@ public enum Property {
           + "constraint.",
       "2.0.0"),
 
+  TABLE_ENABLE_ERASURE_CODES("table.file.ec.enable", "false", 
PropertyType.BOOLEAN,
+      "This determines if Accumulo will manage erasure codes on a table."
+          + " When setting this to true must also set erasure.code.policy.",
+      "2.1.4"),
+
+  TABLE_ERASURE_CODE_POLICY("table.file.ec.policy", "", PropertyType.STRING,

Review Comment:
   Could call `DistributedFileSystem.getAllErasureCodingPolicies()` when this 
is set to validate that the policy exists and is enabled. Would likely need to 
check all volumes.



##########
core/src/main/java/org/apache/accumulo/core/conf/Property.java:
##########
@@ -1412,6 +1412,15 @@ public enum Property {
           + "constraint.",
       "2.0.0"),
 
+  TABLE_ENABLE_ERASURE_CODES("table.file.ec.enable", "false", 
PropertyType.BOOLEAN,

Review Comment:
   I think TABLE_FILE_REPLICATION and TABLE_ENABLE_ERASURE_CODES should be 
mutually exclusive.



##########
core/src/main/java/org/apache/accumulo/core/client/admin/compaction/ErasureCodeConfigurer.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.client.admin.compaction;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.accumulo.core.conf.ConfigurationTypeHelper;
+import org.apache.accumulo.core.conf.Property;
+
+import com.google.common.base.Preconditions;
+
+/**
+ * <p>
+ * A compaction configurer that extends CompressionConfigurer and adds the 
ability to control and
+ * configure how Erasure Codes work. This plugin accepts the following 
options, when setting these
+ * options on a table prefix them with {@code 
table.compaction.configurer.opts.}.
+ *
+ * <ul>
+ * <li>Set {@value #ERASURE_CODE_SIZE} to a size in bytes. The suffixes 
K,M,and G can be used. This
+ * is the minimum file size to allow conversion to erasure code. If a file is 
below this size it
+ * will be replicated otherwise erasure coding will be enabled.

Review Comment:
   > If a file is below this size it will be replicated otherwise erasure 
coding will be enabled.
   
   If the current code always creates a replicated file then this is true. If 
not, and the current behavior is to take the directory settings, then the 
resulting file could be replicated or erasure-coded.



##########
core/src/main/java/org/apache/accumulo/core/file/rfile/RFileOperations.java:
##########
@@ -136,10 +137,23 @@ protected FileSKVWriter openWriter(FileOptions options) 
throws IOException {
       String file = options.getFilename();
       FileSystem fs = options.getFileSystem();
 
+      boolean useEC =
+          
options.getTableConfiguration().getBoolean(Property.TABLE_ENABLE_ERASURE_CODES);
+
       if (options.dropCacheBehind) {
+
         EnumSet<CreateFlag> set = EnumSet.of(CreateFlag.SYNC_BLOCK, 
CreateFlag.CREATE);
-        outputStream = fs.create(new Path(file), FsPermission.getDefault(), 
set, bufferSize,
-            (short) rep, block, null);
+        if (useEC && (fs instanceof DistributedFileSystem)) {
+          String ecPolicyName =
+              
options.getTableConfiguration().get(Property.TABLE_ERASURE_CODE_POLICY);

Review Comment:
   Might want to validate that the ec policy is still valid to prevent an error.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to