HDFS-2915. HA: TestFailureOfSharedDir.testFailureOfSharedDir() has race condition. Contributed by Bikas Saha.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1242522 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1b4c990b61
commit
b5d02a63cb
@ -188,3 +188,6 @@ HDFS-2579. Starting delegation token manager during safemode fails. (todd)
|
|||||||
HDFS-2510. Add HA-related metrics. (atm)
|
HDFS-2510. Add HA-related metrics. (atm)
|
||||||
|
|
||||||
HDFS-2924. Standby checkpointing fails to authenticate in secure cluster. (todd)
|
HDFS-2924. Standby checkpointing fails to authenticate in secure cluster. (todd)
|
||||||
|
|
||||||
|
HDFS-2915. HA: TestFailureOfSharedDir.testFailureOfSharedDir() has race condition. (Bikas Saha via jitendra)
|
||||||
|
|
||||||
|
@ -129,6 +129,8 @@ public void testFailureOfSharedDir() throws Exception {
|
|||||||
|
|
||||||
// The shared edits dir will automatically be marked required.
|
// The shared edits dir will automatically be marked required.
|
||||||
MiniDFSCluster cluster = null;
|
MiniDFSCluster cluster = null;
|
||||||
|
int chmodSucceeded = -1;
|
||||||
|
File sharedEditsDir = null;
|
||||||
try {
|
try {
|
||||||
cluster = new MiniDFSCluster.Builder(conf)
|
cluster = new MiniDFSCluster.Builder(conf)
|
||||||
.nnTopology(MiniDFSNNTopology.simpleHATopology())
|
.nnTopology(MiniDFSNNTopology.simpleHATopology())
|
||||||
@ -144,7 +146,13 @@ public void testFailureOfSharedDir() throws Exception {
|
|||||||
|
|
||||||
// Blow away the shared edits dir.
|
// Blow away the shared edits dir.
|
||||||
URI sharedEditsUri = cluster.getSharedEditsDir(0, 1);
|
URI sharedEditsUri = cluster.getSharedEditsDir(0, 1);
|
||||||
FileUtil.fullyDelete(new File(sharedEditsUri));
|
sharedEditsDir = new File(sharedEditsUri);
|
||||||
|
chmodSucceeded = FileUtil.chmod(sharedEditsDir.getAbsolutePath(), "-w",
|
||||||
|
true);
|
||||||
|
if (chmodSucceeded != 0) {
|
||||||
|
LOG.error("Failed to remove write permissions on shared edits dir:"
|
||||||
|
+ sharedEditsDir.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
NameNode nn0 = cluster.getNameNode(0);
|
NameNode nn0 = cluster.getNameNode(0);
|
||||||
try {
|
try {
|
||||||
@ -171,6 +179,10 @@ public void testFailureOfSharedDir() throws Exception {
|
|||||||
NNStorage.getInProgressEditsFileName(1));
|
NNStorage.getInProgressEditsFileName(1));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
if (chmodSucceeded == 0) {
|
||||||
|
// without this test cleanup will fail
|
||||||
|
FileUtil.chmod(sharedEditsDir.getAbsolutePath(), "+w", true);
|
||||||
|
}
|
||||||
if (cluster != null) {
|
if (cluster != null) {
|
||||||
cluster.shutdown();
|
cluster.shutdown();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user