hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjs...@apache.org
Subject [11/47] hadoop git commit: HDFS-8038. PBImageDelimitedTextWriter#getEntry output HDFS path in platform-specific format. Contributed by Xiaoyu Yao.
Date Fri, 10 Apr 2015 04:25:07 GMT
HDFS-8038. PBImageDelimitedTextWriter#getEntry output HDFS path in platform-specific format.
Contributed by Xiaoyu Yao.


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

Branch: refs/heads/YARN-2928
Commit: cd66d1b54d48308cee2cbd2d7bbe9c6fe56c63f9
Parents: 6f55a1b
Author: cnauroth <cnauroth@apache.org>
Authored: Tue Apr 7 13:33:11 2015 -0700
Committer: Zhijie Shen <zjshen@apache.org>
Committed: Thu Apr 9 20:55:57 2015 -0700

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt                  | 3 +++
 .../tools/offlineImageViewer/PBImageDelimitedTextWriter.java | 8 +++++---
 .../hdfs/tools/offlineImageViewer/PBImageTextWriter.java     | 7 +++++--
 3 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/cd66d1b5/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 3edc80e..51d84f4 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -1388,6 +1388,9 @@ Release 2.7.0 - UNRELEASED
     HDFS-7999. FsDatasetImpl#createTemporary sometimes holds the FSDatasetImpl
     lock for a very long time (sinago via cmccabe)
 
+    HDFS-8038. PBImageDelimitedTextWriter#getEntry output HDFS path in
+    platform-specific format. (Xiaoyu Yao via cnauroth)
+
     BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS
 
       HDFS-7720. Quota by Storage Type API, tools and ClientNameNode

http://git-wip-us.apache.org/repos/asf/hadoop/blob/cd66d1b5/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageDelimitedTextWriter.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageDelimitedTextWriter.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageDelimitedTextWriter.java
index 350967d..fbe7f3a 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageDelimitedTextWriter.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageDelimitedTextWriter.java
@@ -17,13 +17,13 @@
  */
 package org.apache.hadoop.hdfs.tools.offlineImageViewer;
 
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.PermissionStatus;
 import org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INode;
 import org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INodeDirectory;
 import org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INodeFile;
 import org.apache.hadoop.hdfs.server.namenode.FsImageProto.INodeSection.INodeSymlink;
 
-import java.io.File;
 import java.io.IOException;
 import java.io.PrintStream;
 import java.text.SimpleDateFormat;
@@ -79,8 +79,10 @@ public class PBImageDelimitedTextWriter extends PBImageTextWriter {
   @Override
   public String getEntry(String parent, INode inode) {
     StringBuffer buffer = new StringBuffer();
-    String path = new File(parent, inode.getName().toStringUtf8()).toString();
-    buffer.append(path);
+    String inodeName = inode.getName().toStringUtf8();
+    Path path = new Path(parent.isEmpty() ? "/" : parent,
+      inodeName.isEmpty() ? "/" : inodeName);
+    buffer.append(path.toString());
     PermissionStatus p = null;
 
     switch (inode.getType()) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/cd66d1b5/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageTextWriter.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageTextWriter.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageTextWriter.java
index d228920..d2ccc5c 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageTextWriter.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineImageViewer/PBImageTextWriter.java
@@ -21,6 +21,7 @@ import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
 import org.apache.commons.io.FileUtils;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.PermissionStatus;
 import org.apache.hadoop.hdfs.server.namenode.FSImageFormatPBINode;
 import org.apache.hadoop.hdfs.server.namenode.FSImageFormatProtobuf;
@@ -145,7 +146,8 @@ abstract class PBImageTextWriter implements Closeable {
           return "/";
         }
         if (this.path == null) {
-          this.path = new File(parent.getPath(), name).toString();
+          this.path = new Path(parent.getPath(), name.isEmpty() ? "/" : name).
+              toString();
           this.name = null;
         }
         return this.path;
@@ -364,7 +366,8 @@ abstract class PBImageTextWriter implements Closeable {
         }
         String parentName = toString(bytes);
         String parentPath =
-            new File(getParentPath(parent), parentName).toString();
+            new Path(getParentPath(parent),
+                parentName.isEmpty()? "/" : parentName).toString();
         dirPathCache.put(parent, parentPath);
       }
       return dirPathCache.get(parent);


Mime
View raw message