accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmil...@apache.org
Subject [accumulo] branch master updated: Remove unused param from Summaries (#861)
Date Fri, 28 Dec 2018 16:19:33 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 9e66ba5  Remove unused param from Summaries (#861)
9e66ba5 is described below

commit 9e66ba53cdc916a72d7bfd10dd5889913a517f0e
Author: Mike Miller <mmiller@apache.org>
AuthorDate: Fri Dec 28 11:19:28 2018 -0500

    Remove unused param from Summaries (#861)
    
    * Also replace duplicate code in SummaryReader with method
    * Also inline print method only called by other print method
---
 .../core/client/rfile/RFileSummariesRetriever.java |  2 +-
 .../org/apache/accumulo/core/summary/Gatherer.java |  5 +--
 .../accumulo/core/summary/SummaryReader.java       | 44 +++++++++-------------
 .../tserver/compaction/MajorCompactionRequest.java |  4 +-
 4 files changed, 23 insertions(+), 32 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileSummariesRetriever.java
b/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileSummariesRetriever.java
index c02af8f..28f8bbc 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileSummariesRetriever.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileSummariesRetriever.java
@@ -93,7 +93,7 @@ class RFileSummariesRetriever implements SummaryInputArguments, SummaryFSOptions
       SummaryCollection all = new SummaryCollection();
       CryptoService cservice = CryptoServiceFactory.newInstance(acuconf, ClassloaderType.JAVA);
       for (RFileSource source : sources) {
-        SummaryReader fileSummary = SummaryReader.load(in.getFileSystem().getConf(), acuconf,
+        SummaryReader fileSummary = SummaryReader.load(in.getFileSystem().getConf(),
             source.getInputStream(), source.getLength(), summarySelector, factory, cservice);
         SummaryCollection sc = fileSummary
             .getSummaries(Collections.singletonList(new Gatherer.RowRange(startRow, endRow)));
diff --git a/core/src/main/java/org/apache/accumulo/core/summary/Gatherer.java b/core/src/main/java/org/apache/accumulo/core/summary/Gatherer.java
index 2caf03f..5bf92cb 100644
--- a/core/src/main/java/org/apache/accumulo/core/summary/Gatherer.java
+++ b/core/src/main/java/org/apache/accumulo/core/summary/Gatherer.java
@@ -660,8 +660,7 @@ public class Gatherer {
       Cache<String,Long> fileLenCache) {
     Path path = new Path(file);
     Configuration conf = CachedConfiguration.getInstance();
-    return SummaryReader.load(volMgr.get(path), conf, ctx.getConfiguration(), factory, path,
-        summarySelector, summaryCache, indexCache, fileLenCache, cryptoService)
-        .getSummaries(ranges);
+    return SummaryReader.load(volMgr.get(path), conf, factory, path, summarySelector, summaryCache,
+        indexCache, fileLenCache, cryptoService).getSummaries(ranges);
   }
 }
diff --git a/core/src/main/java/org/apache/accumulo/core/summary/SummaryReader.java b/core/src/main/java/org/apache/accumulo/core/summary/SummaryReader.java
index b36fb13..bd9459b 100644
--- a/core/src/main/java/org/apache/accumulo/core/summary/SummaryReader.java
+++ b/core/src/main/java/org/apache/accumulo/core/summary/SummaryReader.java
@@ -30,8 +30,6 @@ import java.util.Map;
 import java.util.function.Predicate;
 
 import org.apache.accumulo.core.client.summary.SummarizerConfiguration;
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.file.FileSKVIterator;
 import org.apache.accumulo.core.file.blockfile.impl.CachableBlockFile;
 import org.apache.accumulo.core.file.blockfile.impl.CachableBlockFile.CachableBuilder;
 import org.apache.accumulo.core.file.rfile.RFile.Reader;
@@ -174,18 +172,17 @@ public class SummaryReader {
     return fileSummaries;
   }
 
-  public static SummaryReader load(Configuration conf, AccumuloConfiguration aConf,
-      InputStream inputStream, long length, Predicate<SummarizerConfiguration> summarySelector,
-      SummarizerFactory factory, CryptoService cryptoService) throws IOException {
+  public static SummaryReader load(Configuration conf, InputStream inputStream, long length,
+      Predicate<SummarizerConfiguration> summarySelector, SummarizerFactory factory,
+      CryptoService cryptoService) throws IOException {
     CachableBuilder cb = new CachableBuilder().input(inputStream).length(length).conf(conf)
         .cryptoService(cryptoService);
     return load(new CachableBlockFile.Reader(cb), summarySelector, factory);
   }
 
-  public static SummaryReader load(FileSystem fs, Configuration conf, AccumuloConfiguration
aConf,
-      SummarizerFactory factory, Path file, Predicate<SummarizerConfiguration> summarySelector,
-      BlockCache summaryCache, BlockCache indexCache, Cache<String,Long> fileLenCache,
-      CryptoService cryptoService) {
+  public static SummaryReader load(FileSystem fs, Configuration conf, SummarizerFactory factory,
+      Path file, Predicate<SummarizerConfiguration> summarySelector, BlockCache summaryCache,
+      BlockCache indexCache, Cache<String,Long> fileLenCache, CryptoService cryptoService)
{
     CachableBlockFile.Reader bcReader = null;
 
     try {
@@ -197,19 +194,11 @@ public class SummaryReader {
       bcReader = new CachableBlockFile.Reader(cb);
       return load(bcReader, summarySelector, factory);
     } catch (FileNotFoundException fne) {
-      SummaryReader sr = new SummaryReader();
-      sr.factory = factory;
-      sr.summaryStores = Collections.emptyList();
-      sr.deleted = true;
-      return sr;
+      return getEmptyReader(factory);
     } catch (IOException e) {
       try {
         if (!fs.exists(file)) {
-          SummaryReader sr = new SummaryReader();
-          sr.factory = factory;
-          sr.summaryStores = Collections.emptyList();
-          sr.deleted = true;
-          return sr;
+          return getEmptyReader(factory);
         }
       } catch (IOException e1) {}
       throw new UncheckedIOException(e);
@@ -225,12 +214,19 @@ public class SummaryReader {
 
   }
 
-  private static void print(FileSKVIterator fsi, String indent, PrintStream out)
-      throws IOException {
+  private static SummaryReader getEmptyReader(SummarizerFactory factory) {
+    SummaryReader sr = new SummaryReader();
+    sr.factory = factory;
+    sr.summaryStores = Collections.emptyList();
+    sr.deleted = true;
+    return sr;
+  }
 
+  public static void print(Reader iter, PrintStream out) throws IOException {
+    String indent = "   ";
     out.print("Summary data : \n");
 
-    List<SummarySerializer> stores = load(fsi::getMetaStore, conf -> true);
+    List<SummarySerializer> stores = load(iter::getMetaStore, conf -> true);
     int i = 1;
     for (SummarySerializer summaryStore : stores) {
       out.printf("%sSummary %d of %d generated by : %s\n", indent, i, stores.size(),
@@ -240,10 +236,6 @@ public class SummaryReader {
     }
   }
 
-  public static void print(Reader iter, PrintStream out) throws IOException {
-    print(iter, "   ", out);
-  }
-
   private static SummarizerConfiguration readConfig(DataInputStream in) throws IOException
{
     // read summarizer configuration
     String summarizerClazz = in.readUTF();
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/compaction/MajorCompactionRequest.java
b/server/tserver/src/main/java/org/apache/accumulo/tserver/compaction/MajorCompactionRequest.java
index be01620..211fe51 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/compaction/MajorCompactionRequest.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/compaction/MajorCompactionRequest.java
@@ -157,8 +157,8 @@ public class MajorCompactionRequest implements Cloneable {
       FileSystem fs = volumeManager.getVolumeByPath(file.path()).getFileSystem();
       Configuration conf = CachedConfiguration.getInstance();
       SummaryCollection fsc = SummaryReader
-          .load(fs, conf, tableConfig, factory, file.path(), summarySelector, summaryCache,
-              indexCache, fileLenCache, context.getCryptoService())
+          .load(fs, conf, factory, file.path(), summarySelector, summaryCache, indexCache,
+              fileLenCache, context.getCryptoService())
           .getSummaries(Collections.singletonList(new Gatherer.RowRange(extent)));
       sc.merge(fsc, factory);
     }


Mime
View raw message