HDFS-7064. Fix unit test failures in HDFS-6581 branch. (Contributed by Xiaoyu Yao)

This commit is contained in:
arp 2014-09-16 15:45:07 -07:00
parent e0d7fb48fb
commit 4603e4481f
4 changed files with 10 additions and 4 deletions

View File

@ -478,7 +478,8 @@ FSDataOutputStream create(PathData item, boolean lazyPersist)
createFlags.add(LAZY_PERSIST); createFlags.add(LAZY_PERSIST);
} }
return create(item.path, return create(item.path,
null, FsPermission.getFileDefault().applyUMask(
FsPermission.getUMask(getConf())),
createFlags, createFlags,
getConf().getInt("io.file.buffer.size", 4096), getConf().getInt("io.file.buffer.size", 4096),
lazyPersist ? 1 : getDefaultReplication(item.path), lazyPersist ? 1 : getDefaultReplication(item.path),

View File

@ -47,3 +47,7 @@
HDFS-7066. LazyWriter#evictBlocks misses a null check for replicaState. HDFS-7066. LazyWriter#evictBlocks misses a null check for replicaState.
(Xiaoyu Yao via Arpit Agarwal) (Xiaoyu Yao via Arpit Agarwal)
HDFS-7064. Fix unit test failures in HDFS-6581 branch. (Xiaoyu Yao via
Arpit Agarwal)

View File

@ -381,8 +381,9 @@ void deleteBPDirectories(String bpid, boolean force) throws IOException {
!FileUtil.fullyDelete(finalizedDir)) { !FileUtil.fullyDelete(finalizedDir)) {
throw new IOException("Failed to delete " + finalizedDir); throw new IOException("Failed to delete " + finalizedDir);
} }
if (!DatanodeUtil.dirNoFilesRecursive(lazypersistDir) || if (lazypersistDir.exists() &&
!FileUtil.fullyDelete(lazypersistDir)) { ((!DatanodeUtil.dirNoFilesRecursive(lazypersistDir) ||
!FileUtil.fullyDelete(lazypersistDir)))) {
throw new IOException("Failed to delete " + lazypersistDir); throw new IOException("Failed to delete " + lazypersistDir);
} }
FileUtil.fullyDelete(tmpDir); FileUtil.fullyDelete(tmpDir);

View File

@ -51,7 +51,7 @@ public void testDataDirParsing() throws Throwable {
String locations1 = "[disk]/dir0,[DISK]/dir1,[sSd]/dir2,[disK]/dir3,[ram_disk]/dir4"; String locations1 = "[disk]/dir0,[DISK]/dir1,[sSd]/dir2,[disK]/dir3,[ram_disk]/dir4";
conf.set(DFS_DATANODE_DATA_DIR_KEY, locations1); conf.set(DFS_DATANODE_DATA_DIR_KEY, locations1);
locations = DataNode.getStorageLocations(conf); locations = DataNode.getStorageLocations(conf);
assertThat(locations.size(), is(4)); assertThat(locations.size(), is(5));
assertThat(locations.get(0).getStorageType(), is(StorageType.DISK)); assertThat(locations.get(0).getStorageType(), is(StorageType.DISK));
assertThat(locations.get(0).getUri(), is(dir0.toURI())); assertThat(locations.get(0).getUri(), is(dir0.toURI()));
assertThat(locations.get(1).getStorageType(), is(StorageType.DISK)); assertThat(locations.get(1).getStorageType(), is(StorageType.DISK));