HDFS-6198. Merging change r1585627 from trunk to branch-2.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1585628 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2014-04-08 00:06:59 +00:00
parent 1b2a9412f8
commit 4b31af597b
3 changed files with 12 additions and 7 deletions

View File

@ -87,6 +87,9 @@ Release 2.4.1 - UNRELEASED
HDFS-6197. Rolling upgrade rollback on Windows can fail attempting to rename HDFS-6197. Rolling upgrade rollback on Windows can fail attempting to rename
edit log segment files to a destination that already exists. (cnauroth) 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 Release 2.4.0 - 2014-04-07
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -61,7 +61,9 @@ public class BlockPoolSliceStorage extends Storage {
static final String TRASH_ROOT_DIR = "trash"; static final String TRASH_ROOT_DIR = "trash";
private static final String BLOCK_POOL_ID_PATTERN_BASE = 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( private static final Pattern BLOCK_POOL_PATH_PATTERN = Pattern.compile(
"^(.*)(" + BLOCK_POOL_ID_PATTERN_BASE + ")(.*)$"); "^(.*)(" + BLOCK_POOL_ID_PATTERN_BASE + ")(.*)$");

View File

@ -77,10 +77,10 @@ public class TestBlockPoolSliceStorage {
private String makeRandomBlockFileSubdir(int nestingLevel) { private String makeRandomBlockFileSubdir(int nestingLevel) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("/"); sb.append(File.separator);
for (int i = 0; i < nestingLevel; ++i) { for (int i = 0; i < nestingLevel; ++i) {
sb.append("subdir" + rand.nextInt(64) + "/"); sb.append("subdir" + rand.nextInt(64) + File.separator);
} }
return sb.toString(); return sb.toString();
} }
@ -94,12 +94,12 @@ public class TestBlockPoolSliceStorage {
final String blockFileName = fileName; final String blockFileName = fileName;
String testFilePath = String testFilePath =
storage.getSingularStorageDir().getRoot() + "/" + storage.getSingularStorageDir().getRoot() + File.separator +
Storage.STORAGE_DIR_CURRENT + Storage.STORAGE_DIR_CURRENT +
blockFileSubdir + blockFileName; blockFileSubdir + blockFileName;
String expectedTrashPath = String expectedTrashPath =
storage.getSingularStorageDir().getRoot() + "/" + storage.getSingularStorageDir().getRoot() + File.separator +
BlockPoolSliceStorage.TRASH_ROOT_DIR + BlockPoolSliceStorage.TRASH_ROOT_DIR +
blockFileSubdir.substring(0, blockFileSubdir.length() - 1); blockFileSubdir.substring(0, blockFileSubdir.length() - 1);
@ -118,12 +118,12 @@ public class TestBlockPoolSliceStorage {
final String blockFileName = fileName; final String blockFileName = fileName;
String deletedFilePath = String deletedFilePath =
storage.getSingularStorageDir().getRoot() + "/" + storage.getSingularStorageDir().getRoot() + File.separator +
BlockPoolSliceStorage.TRASH_ROOT_DIR + BlockPoolSliceStorage.TRASH_ROOT_DIR +
blockFileSubdir + blockFileName; blockFileSubdir + blockFileName;
String expectedRestorePath = String expectedRestorePath =
storage.getSingularStorageDir().getRoot() + "/" + storage.getSingularStorageDir().getRoot() + File.separator +
Storage.STORAGE_DIR_CURRENT + Storage.STORAGE_DIR_CURRENT +
blockFileSubdir.substring(0, blockFileSubdir.length() - 1); blockFileSubdir.substring(0, blockFileSubdir.length() - 1);