hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinayakum...@apache.org
Subject hadoop git commit: HDFS-8444. Erasure Coding: fix cannot rename a zone dir (Contributed by Walter Su)
Date Tue, 02 Jun 2015 11:12:37 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7285 9b54e66f3 -> 2d847e7d6


HDFS-8444. Erasure Coding: fix cannot rename a zone dir (Contributed by Walter Su)


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

Branch: refs/heads/HDFS-7285
Commit: 2d847e7d620f97ebe8e9297361e2541d7d0ecd50
Parents: 9b54e66
Author: Vinayakumar B <vinayakumarb@apache.org>
Authored: Tue Jun 2 16:41:19 2015 +0530
Committer: Vinayakumar B <vinayakumarb@apache.org>
Committed: Tue Jun 2 16:41:19 2015 +0530

----------------------------------------------------------------------
 .../hadoop-hdfs/CHANGES-HDFS-EC-7285.txt        |  3 +++
 .../namenode/ErasureCodingZoneManager.java      |  9 +++++++--
 .../hadoop/hdfs/TestErasureCodingZones.java     | 21 ++++++++++++--------
 3 files changed, 23 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/2d847e7d/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt
index e7335b2..c3c55c7 100755
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt
@@ -268,3 +268,6 @@
 
     HDFS-8336. Expose some administrative erasure coding operations to HdfsAdmin
     (Uma Maheswara Rao G via vinayakumarb)
+
+    HDFS-8444. Erasure Coding: fix cannot rename a zone dir
+    (Walter Su via vinayakumarb)

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2d847e7d/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ErasureCodingZoneManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ErasureCodingZoneManager.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ErasureCodingZoneManager.java
index 4b3e747..e853829 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ErasureCodingZoneManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ErasureCodingZoneManager.java
@@ -153,8 +153,13 @@ public class ErasureCodingZoneManager {
   void checkMoveValidity(INodesInPath srcIIP, INodesInPath dstIIP, String src)
       throws IOException {
     assert dir.hasReadLock();
-    final ECSchema srcSchema = getECSchema(srcIIP);
-    final ECSchema dstSchema = getECSchema(dstIIP);
+    final ErasureCodingZone srcZone = getECZone(srcIIP);
+    final ErasureCodingZone dstZone = getECZone(dstIIP);
+    if (srcZone != null && srcZone.getDir().equals(src) && dstZone == null)
{
+      return;
+    }
+    final ECSchema srcSchema = (srcZone != null) ? srcZone.getSchema() : null;
+    final ECSchema dstSchema = (dstZone != null) ? dstZone.getSchema() : null;
     if ((srcSchema != null && !srcSchema.equals(dstSchema)) ||
         (dstSchema != null && !dstSchema.equals(srcSchema))) {
       throw new IOException(

http://git-wip-us.apache.org/repos/asf/hadoop/blob/2d847e7d/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestErasureCodingZones.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestErasureCodingZones.java
b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestErasureCodingZones.java
index d724b53..1a10ebf 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestErasureCodingZones.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestErasureCodingZones.java
@@ -119,15 +119,20 @@ public class TestErasureCodingZones {
     final Path srcFile = new Path(srcECDir, "foo");
     fs.create(srcFile);
 
-    /* Verify that a file can be moved between 2 EC zones */
-    try {
-      fs.rename(srcFile, dstECDir);
-    } catch (IOException e) {
-      fail("A file should be able to move between 2 EC zones " + e);
-    }
+    // Test move dir
+    // Move EC dir under non-EC dir
+    final Path newDir = new Path("/srcEC_new");
+    fs.rename(srcECDir, newDir);
+    fs.rename(newDir, srcECDir); // move back
+
+    // Move EC dir under another EC dir
+    fs.rename(srcECDir, dstECDir);
+    fs.rename(new Path("/dstEC/srcEC"), srcECDir); // move back
 
-    // Move the file back
-    fs.rename(new Path(dstECDir, "foo"), srcECDir);
+    // Test move file
+    /* Verify that a file can be moved between 2 EC zones */
+    fs.rename(srcFile, dstECDir);
+    fs.rename(new Path(dstECDir, "foo"), srcECDir); // move back
 
     /* Verify that a file cannot be moved from a non-EC dir to an EC zone */
     final Path nonECDir = new Path("/nonEC");


Mime
View raw message