hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmcc...@apache.org
Subject hadoop git commit: HDFS-9187. Fix null pointer error in Globber when FS was not constructed via FileSystem#createFileSystem (cmccabe)
Date Tue, 13 Oct 2015 23:21:24 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 ee04add69 -> d37f88674


HDFS-9187. Fix null pointer error in Globber when FS was not constructed via FileSystem#createFileSystem
(cmccabe)

(cherry picked from commit d286032b715192ddbdd770b07d623fdc396810e2)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/d37f8867
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/d37f8867
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/d37f8867

Branch: refs/heads/branch-2
Commit: d37f88674f6f83ec303997e4d54f77fc0a36a788
Parents: ee04add
Author: Colin Patrick Mccabe <cmccabe@cloudera.com>
Authored: Tue Oct 13 13:11:33 2015 -0700
Committer: Colin Patrick Mccabe <cmccabe@cloudera.com>
Committed: Tue Oct 13 16:21:13 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/fs/FileSystem.java     |  7 -------
 .../main/java/org/apache/hadoop/fs/Globber.java   |  2 +-
 .../org/apache/hadoop/tracing/TestTraceUtils.java | 18 ++++++++++++++++++
 3 files changed, 19 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/d37f8867/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
index b167cdf..86a7e19 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
@@ -129,12 +129,6 @@ public abstract class FileSystem extends Configured implements Closeable
{
   
   boolean resolveSymlinks;
 
-  private Tracer tracer;
-
-  protected final Tracer getTracer() {
-    return tracer;
-  }
-
   /**
    * This method adds a file system for testing so that we can find it later. It
    * is only for testing.
@@ -2698,7 +2692,6 @@ public abstract class FileSystem extends Configured implements Closeable
{
     try {
       Class<?> clazz = getFileSystemClass(uri.getScheme(), conf);
       FileSystem fs = (FileSystem)ReflectionUtils.newInstance(clazz, conf);
-      fs.tracer = tracer;
       fs.initialize(uri, conf);
       return fs;
     } finally {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d37f8867/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Globber.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Globber.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Globber.java
index 7a01575..7c69167 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Globber.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Globber.java
@@ -47,7 +47,7 @@ class Globber {
     this.fc = null;
     this.pathPattern = pathPattern;
     this.filter = filter;
-    this.tracer = fs.getTracer();
+    this.tracer = FsTracer.get(fs.getConf());
   }
 
   public Globber(FileContext fc, Path pathPattern, PathFilter filter) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/d37f8867/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/tracing/TestTraceUtils.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/tracing/TestTraceUtils.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/tracing/TestTraceUtils.java
index 75411da..fc0726e 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/tracing/TestTraceUtils.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/tracing/TestTraceUtils.java
@@ -18,8 +18,13 @@
 package org.apache.hadoop.tracing;
 
 import static org.junit.Assert.assertEquals;
+
+import java.net.URI;
 import java.util.LinkedList;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LocalFileSystem;
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.tracing.SpanReceiverInfo.ConfigurationPair;
 import org.apache.htrace.core.HTraceConfiguration;
 import org.junit.Test;
@@ -50,4 +55,17 @@ public class TestTraceUtils {
     HTraceConfiguration wrapped = TraceUtils.wrapHadoopConf(TEST_PREFIX, conf, extraConfig);
     assertEquals(newValue, wrapped.get(key));
   }
+
+  /**
+   * Test tracing the globber.  This is a regression test for HDFS-9187.
+   */
+  @Test
+  public void testTracingGlobber() throws Exception {
+    // Bypass the normal FileSystem object creation path by just creating an
+    // instance of a subclass.
+    FileSystem fs = new LocalFileSystem();
+    fs.initialize(new URI("file:///"), new Configuration());
+    fs.globStatus(new Path("/"));
+    fs.close();
+  }
 }


Mime
View raw message