This is an automated email from the ASF dual-hosted git repository.

mmiller pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 512325e  Fix crypto in SplitLarge utility (#2145)
512325e is described below

commit 512325e1ab14351df7722ca1956b14c42fff90d7
Author: Mike Miller <mmil...@apache.org>
AuthorDate: Fri Jun 4 13:31:01 2021 -0400

    Fix crypto in SplitLarge utility (#2145)
    
    * The option that was added in 2.0 for the encryption only included the 
name of the service. You also need a way to pass in other options for it to 
work. This change just simplifies that by removing the option altogether and 
reading the config from classpath, similar to other utilities.
---
 .../org/apache/accumulo/core/file/rfile/SplitLarge.java    | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git 
a/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java 
b/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java
index f0ca7da..580c68d 100644
--- a/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java
+++ b/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java
@@ -21,10 +21,8 @@ package org.apache.accumulo.core.file.rfile;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.accumulo.core.cli.Help;
+import org.apache.accumulo.core.cli.ConfigOpts;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.conf.ConfigurationTypeHelper;
-import org.apache.accumulo.core.conf.DefaultConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.crypto.CryptoServiceFactory;
 import org.apache.accumulo.core.data.Key;
@@ -46,12 +44,10 @@ import com.beust.jcommander.Parameter;
  */
 public class SplitLarge {
 
-  static class Opts extends Help {
+  static class Opts extends ConfigOpts {
     @Parameter(names = "-m",
         description = "the maximum size of the key/value pair to shunt to the 
small file")
     long maxSize = 10 * 1024 * 1024;
-    @Parameter(names = "-crypto", description = "the class to perform 
encryption/decryption")
-    String cryptoClass = Property.INSTANCE_CRYPTO_SERVICE.getDefaultValue();
     @Parameter(description = "<file.rf> { <file.rf> ... }")
     List<String> files = new ArrayList<>();
   }
@@ -63,9 +59,9 @@ public class SplitLarge {
     opts.parseArgs(SplitLarge.class.getName(), args);
 
     for (String file : opts.files) {
-      AccumuloConfiguration aconf = DefaultConfiguration.getInstance();
-      CryptoService cryptoService = 
ConfigurationTypeHelper.getClassInstance(null, opts.cryptoClass,
-          CryptoService.class, CryptoServiceFactory.newDefaultInstance());
+      AccumuloConfiguration aconf = opts.getSiteConfiguration();
+      CryptoService cryptoService =
+          CryptoServiceFactory.newInstance(aconf, 
CryptoServiceFactory.ClassloaderType.JAVA);
       Path path = new Path(file);
       CachableBuilder cb =
           new CachableBuilder().fsPath(fs, 
path).conf(conf).cryptoService(cryptoService);

Reply via email to