You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ar...@apache.org on 2015/07/14 22:25:33 UTC
[17/50] hadoop git commit: HADOOP-12201. Add tracing to
FileSystem#createFileSystem and Globber#glob (cmccabe)
HADOOP-12201. Add tracing to FileSystem#createFileSystem and Globber#glob (cmccabe)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b8832fcf
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b8832fcf
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b8832fcf
Branch: refs/heads/HDFS-7240
Commit: b8832fcf1e2ae1e43d5e4523016731af40ab58d7
Parents: 2e3d83f
Author: Colin Patrick Mccabe <cm...@cloudera.com>
Authored: Wed Jul 8 20:07:21 2015 -0700
Committer: Colin Patrick Mccabe <cm...@cloudera.com>
Committed: Wed Jul 8 20:07:21 2015 -0700
----------------------------------------------------------------------
hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++
.../java/org/apache/hadoop/fs/FileSystem.java | 20 ++++++++++++++++----
.../main/java/org/apache/hadoop/fs/Globber.java | 17 +++++++++++++++++
3 files changed, 36 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b8832fcf/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index eb18e6c..c99fb5e 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -687,6 +687,9 @@ Release 2.8.0 - UNRELEASED
HADOOP-12195. Add annotation to package-info.java file to workaround
MCOMPILER-205. (wang)
+ HADOOP-12201. Add tracing to FileSystem#createFileSystem and Globber#glob
+ (cmccabe)
+
OPTIMIZATIONS
HADOOP-11785. Reduce the number of listStatus operation in distcp
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b8832fcf/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 c73caf7..5e03e88 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
@@ -67,6 +67,9 @@ import org.apache.hadoop.util.Progressable;
import org.apache.hadoop.util.ReflectionUtils;
import org.apache.hadoop.util.ShutdownHookManager;
import org.apache.hadoop.util.StringUtils;
+import org.apache.htrace.Span;
+import org.apache.htrace.Trace;
+import org.apache.htrace.TraceScope;
import com.google.common.annotations.VisibleForTesting;
@@ -2675,10 +2678,19 @@ public abstract class FileSystem extends Configured implements Closeable {
private static FileSystem createFileSystem(URI uri, Configuration conf
) throws IOException {
- Class<?> clazz = getFileSystemClass(uri.getScheme(), conf);
- FileSystem fs = (FileSystem)ReflectionUtils.newInstance(clazz, conf);
- fs.initialize(uri, conf);
- return fs;
+ TraceScope scope = Trace.startSpan("FileSystem#createFileSystem");
+ Span span = scope.getSpan();
+ if (span != null) {
+ span.addKVAnnotation("scheme", uri.getScheme());
+ }
+ try {
+ Class<?> clazz = getFileSystemClass(uri.getScheme(), conf);
+ FileSystem fs = (FileSystem)ReflectionUtils.newInstance(clazz, conf);
+ fs.initialize(uri, conf);
+ return fs;
+ } finally {
+ scope.close();
+ }
}
/** Caching FileSystem objects */
http://git-wip-us.apache.org/repos/asf/hadoop/blob/b8832fcf/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 9cb810f..48639b4 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
@@ -28,6 +28,10 @@ import org.apache.commons.logging.Log;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.htrace.Span;
+import org.apache.htrace.Trace;
+import org.apache.htrace.TraceScope;
+
@InterfaceAudience.Private
@InterfaceStability.Unstable
class Globber {
@@ -136,6 +140,19 @@ class Globber {
}
public FileStatus[] glob() throws IOException {
+ TraceScope scope = Trace.startSpan("Globber#glob");
+ Span span = scope.getSpan();
+ if (span != null) {
+ span.addKVAnnotation("pattern", pathPattern.toUri().getPath());
+ }
+ try {
+ return doGlob();
+ } finally {
+ scope.close();
+ }
+ }
+
+ private FileStatus[] doGlob() throws IOException {
// First we get the scheme and authority of the pattern that was passed
// in.
String scheme = schemeFromPath(pathPattern);