You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by mm...@apache.org on 2019/03/19 17:33:49 UTC

[accumulo] branch master updated: Improve use of DistributedCacheHelper. Closes #896 (#1035)

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 6f4c772  Improve use of DistributedCacheHelper. Closes #896 (#1035)
6f4c772 is described below

commit 6f4c7721809ce4e15e2296e83b54d003cea8e9a5
Author: Mike Miller <mm...@apache.org>
AuthorDate: Tue Mar 19 13:33:44 2019 -0400

    Improve use of DistributedCacheHelper. Closes #896 (#1035)
---
 .../mapreduce/lib/partition/RangePartitioner.java  |  6 +--
 .../mapreduce/lib/DistributedCacheHelper.java      |  2 -
 .../mapreduce/partition/RangePartitioner.java      |  5 +--
 .../hadoopImpl/mapreduce/lib/ConfiguratorBase.java |  1 +
 .../mapreduce/lib/DistributedCacheHelper.java      | 51 ----------------------
 5 files changed, 5 insertions(+), 60 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
index 9f890fe..6b32130 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
@@ -91,8 +91,7 @@ public class RangePartitioner extends Partitioner<Text,Writable> implements Conf
   private synchronized Text[] getCutPoints() throws IOException {
     if (cutPointArray == null) {
       String cutFileName = conf.get(CUTFILE_KEY);
-      Path[] cf = org.apache.accumulo.core.clientImpl.mapreduce.lib.DistributedCacheHelper
-          .getLocalCacheFiles(conf);
+      Path[] cf = Job.getInstance().getLocalCacheFiles();
 
       if (cf != null) {
         for (Path path : cf) {
@@ -131,8 +130,7 @@ public class RangePartitioner extends Partitioner<Text,Writable> implements Conf
    */
   public static void setSplitFile(Job job, String file) {
     URI uri = new Path(file).toUri();
-    org.apache.accumulo.core.clientImpl.mapreduce.lib.DistributedCacheHelper.addCacheFile(uri,
-        job.getConfiguration());
+    job.addCacheFile(uri);
     job.getConfiguration().set(CUTFILE_KEY, uri.getPath());
   }
 
diff --git a/core/src/main/java/org/apache/accumulo/core/clientImpl/mapreduce/lib/DistributedCacheHelper.java b/core/src/main/java/org/apache/accumulo/core/clientImpl/mapreduce/lib/DistributedCacheHelper.java
index f115ee7..f99a4ad 100644
--- a/core/src/main/java/org/apache/accumulo/core/clientImpl/mapreduce/lib/DistributedCacheHelper.java
+++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/mapreduce/lib/DistributedCacheHelper.java
@@ -24,9 +24,7 @@ import org.apache.hadoop.fs.Path;
 
 /**
  * @since 1.6.0
- * @deprecated since 2.0.0
  */
-@Deprecated
 public class DistributedCacheHelper {
 
   /**
diff --git a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoop/mapreduce/partition/RangePartitioner.java b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoop/mapreduce/partition/RangePartitioner.java
index abe01cc..7304904 100644
--- a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoop/mapreduce/partition/RangePartitioner.java
+++ b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoop/mapreduce/partition/RangePartitioner.java
@@ -29,7 +29,6 @@ import java.util.Base64;
 import java.util.Scanner;
 import java.util.TreeSet;
 
-import org.apache.accumulo.hadoopImpl.mapreduce.lib.DistributedCacheHelper;
 import org.apache.hadoop.conf.Configurable;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
@@ -90,7 +89,7 @@ public class RangePartitioner extends Partitioner<Text,Writable> implements Conf
   private synchronized Text[] getCutPoints() throws IOException {
     if (cutPointArray == null) {
       String cutFileName = conf.get(CUTFILE_KEY);
-      Path[] cf = DistributedCacheHelper.getLocalCacheFiles(conf);
+      Path[] cf = Job.getInstance().getLocalCacheFiles();
 
       if (cf != null) {
         for (Path path : cf) {
@@ -129,7 +128,7 @@ public class RangePartitioner extends Partitioner<Text,Writable> implements Conf
    */
   public static void setSplitFile(Job job, String file) {
     URI uri = new Path(file).toUri();
-    DistributedCacheHelper.addCacheFile(uri, job.getConfiguration());
+    job.addCacheFile(uri);
     job.getConfiguration().set(CUTFILE_KEY, uri.getPath());
   }
 
diff --git a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/ConfiguratorBase.java b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/ConfiguratorBase.java
index 810320d..5155b76 100644
--- a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/ConfiguratorBase.java
+++ b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/ConfiguratorBase.java
@@ -27,6 +27,7 @@ import java.util.Scanner;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.Accumulo;
 import org.apache.accumulo.core.client.AccumuloClient;
+import org.apache.accumulo.core.clientImpl.mapreduce.lib.DistributedCacheHelper;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.fs.FileSystem;
diff --git a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/DistributedCacheHelper.java b/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/DistributedCacheHelper.java
deleted file mode 100644
index eb1e650..0000000
--- a/hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapreduce/lib/DistributedCacheHelper.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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
- *
- *     http://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.hadoopImpl.mapreduce.lib;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-
-/**
- * @since 1.6.0
- */
-@SuppressWarnings("deprecation")
-public class DistributedCacheHelper {
-
-  /**
-   * @since 1.6.0
-   */
-  public static void addCacheFile(URI uri, Configuration conf) {
-    org.apache.hadoop.filecache.DistributedCache.addCacheFile(uri, conf);
-  }
-
-  /**
-   * @since 1.6.0
-   */
-  public static URI[] getCacheFiles(Configuration conf) throws IOException {
-    return org.apache.hadoop.filecache.DistributedCache.getCacheFiles(conf);
-  }
-
-  /**
-   * @since 1.6.0
-   */
-  public static Path[] getLocalCacheFiles(Configuration conf) throws IOException {
-    return org.apache.hadoop.filecache.DistributedCache.getLocalCacheFiles(conf);
-  }
-}