diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 4300ad80c0..1f6b8874ec 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -335,6 +335,9 @@ Release 2.4.1 - UNRELEASED HDFS-6197. Rolling upgrade rollback on Windows can fail attempting to rename edit log segment files to a destination that already exists. (cnauroth) + HDFS-6198. DataNode rolling upgrade does not correctly identify current + block pool directory and replace with trash on Windows. (cnauroth) + Release 2.4.0 - 2014-04-07 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceStorage.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceStorage.java index d684f21016..c8c3a7ec82 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceStorage.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceStorage.java @@ -61,7 +61,9 @@ public class BlockPoolSliceStorage extends Storage { static final String TRASH_ROOT_DIR = "trash"; private static final String BLOCK_POOL_ID_PATTERN_BASE = - "/BP-\\d+-\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}-\\d+/"; + Pattern.quote(File.separator) + + "BP-\\d+-\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}-\\d+" + + Pattern.quote(File.separator); private static final Pattern BLOCK_POOL_PATH_PATTERN = Pattern.compile( "^(.*)(" + BLOCK_POOL_ID_PATTERN_BASE + ")(.*)$"); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockPoolSliceStorage.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockPoolSliceStorage.java index faec990b2e..b5951a0aad 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockPoolSliceStorage.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestBlockPoolSliceStorage.java @@ -77,10 +77,10 @@ private BlockPoolSliceStorage makeBlockPoolStorage() { private String makeRandomBlockFileSubdir(int nestingLevel) { StringBuilder sb = new StringBuilder(); - sb.append("/"); + sb.append(File.separator); for (int i = 0; i < nestingLevel; ++i) { - sb.append("subdir" + rand.nextInt(64) + "/"); + sb.append("subdir" + rand.nextInt(64) + File.separator); } return sb.toString(); } @@ -94,12 +94,12 @@ public void getTrashDirectoryForBlockFile(String fileName, int nestingLevel) { final String blockFileName = fileName; String testFilePath = - storage.getSingularStorageDir().getRoot() + "/" + + storage.getSingularStorageDir().getRoot() + File.separator + Storage.STORAGE_DIR_CURRENT + blockFileSubdir + blockFileName; String expectedTrashPath = - storage.getSingularStorageDir().getRoot() + "/" + + storage.getSingularStorageDir().getRoot() + File.separator + BlockPoolSliceStorage.TRASH_ROOT_DIR + blockFileSubdir.substring(0, blockFileSubdir.length() - 1); @@ -118,12 +118,12 @@ public void getRestoreDirectoryForBlockFile(String fileName, int nestingLevel) { final String blockFileName = fileName; String deletedFilePath = - storage.getSingularStorageDir().getRoot() + "/" + + storage.getSingularStorageDir().getRoot() + File.separator + BlockPoolSliceStorage.TRASH_ROOT_DIR + blockFileSubdir + blockFileName; String expectedRestorePath = - storage.getSingularStorageDir().getRoot() + "/" + + storage.getSingularStorageDir().getRoot() + File.separator + Storage.STORAGE_DIR_CURRENT + blockFileSubdir.substring(0, blockFileSubdir.length() - 1);