瀏覽代碼

HADOOP-4234. Fix KFS "glue" layer to allow applications to interface with multiple KFS metaservers. (Sriram Rao via lohit)


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@698671 13f79535-47bb-0310-9956-ffa450edef68
Lohit Vijaya Renu 16 年之前
父節點
當前提交
21e431c8a3
共有 2 個文件被更改,包括 15 次插入6 次删除
  1. 3 0
      CHANGES.txt
  2. 12 6
      src/core/org/apache/hadoop/fs/kfs/KosmosFileSystem.java

+ 3 - 0
CHANGES.txt

@@ -12,6 +12,9 @@ Trunk (unreleased changes)
 
   BUG FIXES
 
+    HADOOP-4234. Fix KFS "glue" layer to allow applications to interface
+    with multiple KFS metaservers. (Sriram Rao via lohit)
+
 Release 0.19.0 - Unreleased
 
   INCOMPATIBLE CHANGES

+ 12 - 6
src/core/org/apache/hadoop/fs/kfs/KosmosFileSystem.java

@@ -59,15 +59,21 @@ public class KosmosFileSystem extends FileSystem {
     }
 
     public void initialize(URI uri, Configuration conf) throws IOException {
-        
         try {
-            if (kfsImpl == null) {
-                kfsImpl = new KFSImpl(conf.get("fs.kfs.metaServerHost", ""),
-                                      conf.getInt("fs.kfs.metaServerPort", -1),
-                                      statistics);
-            }
+	    if (kfsImpl == null) {
+                if (uri.getHost() == null) {
+                    kfsImpl = new KFSImpl(conf.get("fs.kfs.metaServerHost", ""),
+                                          conf.getInt("fs.kfs.metaServerPort", -1),
+                                          statistics);
+                } else {
+                    kfsImpl = new KFSImpl(uri.getHost(), uri.getPort(), statistics);
+                }
+	    }
+
             this.localFs = FileSystem.getLocal(conf);
             this.uri = URI.create(uri.getScheme() + "://" + uri.getAuthority());
+            this.workingDir = new Path("/user", System.getProperty("user.name")).makeQualified(this);
+            setConf(conf);
             
         } catch (Exception e) {
             e.printStackTrace();