HDFS-6198. DataNode rolling upgrade does not correctly identify current block pool directory and replace with trash on Windows. Contributed by Chris Nauroth.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1585627 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2014-04-08 00:00:33 +00:00
parent 2002dc63c9
commit 5bbf271712
3 changed files with 12 additions and 7 deletions

View File

@ -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

View File

@ -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 + ")(.*)$");

View File

@ -77,10 +77,10 @@ public class TestBlockPoolSliceStorage {
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 class TestBlockPoolSliceStorage {
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 class TestBlockPoolSliceStorage {
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);