浏览代码

HDFS-7051. TestDataNodeRollingUpgrade#isBlockFileInPrevious assumes Unix file path separator. Contributed by Chris Nauroth.

cnauroth 10 年之前
父节点
当前提交
d6ce26986e

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -754,6 +754,9 @@ Release 2.6.0 - UNRELEASED
     HDFS-7042. Upgrade fails for Windows HA cluster due to file locks held during
     rename in JournalNode. (cnauroth)
 
+    HDFS-7051. TestDataNodeRollingUpgrade#isBlockFileInPrevious assumes Unix file
+    path separator. (cnauroth)
+
 Release 2.5.1 - 2014-09-05
 
   INCOMPATIBLE CHANGES

+ 4 - 2
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeRollingUpgrade.java

@@ -157,7 +157,9 @@ public class TestDataNodeRollingUpgrade {
   }
 
   private boolean isBlockFileInPrevious(File blockFile) {
-    Pattern blockFilePattern = Pattern.compile("^(.*/current/.*/)(current)(/.*)$");
+    Pattern blockFilePattern = Pattern.compile(String.format(
+      "^(.*%1$scurrent%1$s.*%1$s)(current)(%1$s.*)$",
+      Pattern.quote(File.separator)));
     Matcher matcher = blockFilePattern.matcher(blockFile.toString());
     String previousFileName = matcher.replaceFirst("$1" + "previous" + "$3");
     return ((new File(previousFileName)).exists());
@@ -355,7 +357,7 @@ public class TestDataNodeRollingUpgrade {
       assertTrue(isBlockFileInPrevious(blockFiles[1]));
       assertFalse(isTrashRootPresent());
 
-      // Rollback and ensure that neither block file exists in trash or previous.
+      // Finalize and ensure that neither block file exists in trash or previous.
       finalizeRollingUpgrade();
       assertFalse(isTrashRootPresent());
       assertFalse(isBlockFileInPrevious(blockFiles[0]));