Selaa lähdekoodia

HDFS-3453. HDFS 1.x client is not interoperable with pre 1.x server. Contributed by Kihwal Lee.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1@1343738 13f79535-47bb-0310-9956-ffa450edef68
Suresh Srinivas 13 vuotta sitten
vanhempi
commit
e993623e57
2 muutettua tiedostoa jossa 14 lisäystä ja 2 poistoa
  1. 3 0
      CHANGES.txt
  2. 11 2
      src/hdfs/org/apache/hadoop/hdfs/DFSClient.java

+ 3 - 0
CHANGES.txt

@@ -249,6 +249,9 @@ Release 1.1.0 - unreleased
 
     HADOOP-8329. Build fails with Java 7. (eli)
 
+    HDFS-3453. HDFS 1.x client is not interoperable with pre 1.x server.
+    (Kihwal Lee via suresh)
+    
 Release 1.0.3 - 2012.05.07
 
   NEW FEATURES

+ 11 - 2
src/hdfs/org/apache/hadoop/hdfs/DFSClient.java

@@ -3342,8 +3342,17 @@ public class DFSClient implements FSConstants, java.io.Closeable {
       computePacketChunkSize(writePacketSize, bytesPerChecksum);
 
       try {
-        namenode.create(
-            src, masked, clientName, overwrite, createParent, replication, blockSize);
+        // Make sure the regular create() is done through the old create().
+        // This is done to ensure that newer clients (post-1.0) can talk to
+        // older clusters (pre-1.0). Older clusters lack the new  create()
+        // method accepting createParent as one of the arguments.
+        if (createParent) {
+          namenode.create(
+            src, masked, clientName, overwrite, replication, blockSize);
+        } else {
+          namenode.create(
+            src, masked, clientName, overwrite, false, replication, blockSize);
+        }
       } catch(RemoteException re) {
         throw re.unwrapRemoteException(AccessControlException.class,
                                        FileAlreadyExistsException.class,