|
@@ -679,10 +679,10 @@ public class TestFileTruncate {
|
|
boolean isReady = fs.truncate(p, newLength);
|
|
boolean isReady = fs.truncate(p, newLength);
|
|
assertFalse(isReady);
|
|
assertFalse(isReady);
|
|
} finally {
|
|
} finally {
|
|
- cluster.restartDataNode(dn);
|
|
|
|
|
|
+ cluster.restartDataNode(dn, true, true);
|
|
cluster.waitActive();
|
|
cluster.waitActive();
|
|
- cluster.triggerBlockReports();
|
|
|
|
}
|
|
}
|
|
|
|
+ checkBlockRecovery(p);
|
|
|
|
|
|
LocatedBlock newBlock = getLocatedBlocks(p).getLastLocatedBlock();
|
|
LocatedBlock newBlock = getLocatedBlocks(p).getLastLocatedBlock();
|
|
/*
|
|
/*
|
|
@@ -699,7 +699,6 @@ public class TestFileTruncate {
|
|
assertEquals(newBlock.getBlock().getGenerationStamp(),
|
|
assertEquals(newBlock.getBlock().getGenerationStamp(),
|
|
oldBlock.getBlock().getGenerationStamp() + 1);
|
|
oldBlock.getBlock().getGenerationStamp() + 1);
|
|
|
|
|
|
- checkBlockRecovery(p);
|
|
|
|
// Wait replicas come to 3
|
|
// Wait replicas come to 3
|
|
DFSTestUtil.waitReplication(fs, p, REPLICATION);
|
|
DFSTestUtil.waitReplication(fs, p, REPLICATION);
|
|
// Old replica is disregarded and replaced with the truncated one
|
|
// Old replica is disregarded and replaced with the truncated one
|
|
@@ -741,10 +740,10 @@ public class TestFileTruncate {
|
|
boolean isReady = fs.truncate(p, newLength);
|
|
boolean isReady = fs.truncate(p, newLength);
|
|
assertFalse(isReady);
|
|
assertFalse(isReady);
|
|
} finally {
|
|
} finally {
|
|
- cluster.restartDataNode(dn);
|
|
|
|
|
|
+ cluster.restartDataNode(dn, true, true);
|
|
cluster.waitActive();
|
|
cluster.waitActive();
|
|
- cluster.triggerBlockReports();
|
|
|
|
}
|
|
}
|
|
|
|
+ checkBlockRecovery(p);
|
|
|
|
|
|
LocatedBlock newBlock = getLocatedBlocks(p).getLastLocatedBlock();
|
|
LocatedBlock newBlock = getLocatedBlocks(p).getLastLocatedBlock();
|
|
/*
|
|
/*
|
|
@@ -757,7 +756,6 @@ public class TestFileTruncate {
|
|
assertEquals(newBlock.getBlock().getGenerationStamp(),
|
|
assertEquals(newBlock.getBlock().getGenerationStamp(),
|
|
oldBlock.getBlock().getGenerationStamp() + 1);
|
|
oldBlock.getBlock().getGenerationStamp() + 1);
|
|
|
|
|
|
- checkBlockRecovery(p);
|
|
|
|
// Wait replicas come to 3
|
|
// Wait replicas come to 3
|
|
DFSTestUtil.waitReplication(fs, p, REPLICATION);
|
|
DFSTestUtil.waitReplication(fs, p, REPLICATION);
|
|
// New block is replicated to dn1
|
|
// New block is replicated to dn1
|
|
@@ -800,9 +798,10 @@ public class TestFileTruncate {
|
|
boolean isReady = fs.truncate(p, newLength);
|
|
boolean isReady = fs.truncate(p, newLength);
|
|
assertFalse(isReady);
|
|
assertFalse(isReady);
|
|
|
|
|
|
- cluster.restartDataNode(dn0);
|
|
|
|
- cluster.restartDataNode(dn1);
|
|
|
|
|
|
+ cluster.restartDataNode(dn0, true, true);
|
|
|
|
+ cluster.restartDataNode(dn1, true, true);
|
|
cluster.waitActive();
|
|
cluster.waitActive();
|
|
|
|
+ checkBlockRecovery(p);
|
|
cluster.triggerBlockReports();
|
|
cluster.triggerBlockReports();
|
|
|
|
|
|
LocatedBlock newBlock = getLocatedBlocks(p).getLastLocatedBlock();
|
|
LocatedBlock newBlock = getLocatedBlocks(p).getLastLocatedBlock();
|
|
@@ -815,7 +814,6 @@ public class TestFileTruncate {
|
|
assertEquals(newBlock.getBlock().getGenerationStamp(),
|
|
assertEquals(newBlock.getBlock().getGenerationStamp(),
|
|
oldBlock.getBlock().getGenerationStamp() + 1);
|
|
oldBlock.getBlock().getGenerationStamp() + 1);
|
|
|
|
|
|
- checkBlockRecovery(p);
|
|
|
|
// Wait replicas come to 3
|
|
// Wait replicas come to 3
|
|
DFSTestUtil.waitReplication(fs, p, REPLICATION);
|
|
DFSTestUtil.waitReplication(fs, p, REPLICATION);
|
|
// Old replica is disregarded and replaced with the truncated one on dn0
|
|
// Old replica is disregarded and replaced with the truncated one on dn0
|
|
@@ -859,6 +857,7 @@ public class TestFileTruncate {
|
|
assertFalse(isReady);
|
|
assertFalse(isReady);
|
|
|
|
|
|
cluster.shutdownDataNodes();
|
|
cluster.shutdownDataNodes();
|
|
|
|
+ cluster.setDataNodesDead();
|
|
try {
|
|
try {
|
|
for(int i = 0; i < SUCCESS_ATTEMPTS && cluster.isDataNodeUp(); i++) {
|
|
for(int i = 0; i < SUCCESS_ATTEMPTS && cluster.isDataNodeUp(); i++) {
|
|
Thread.sleep(SLEEP);
|
|
Thread.sleep(SLEEP);
|
|
@@ -871,6 +870,7 @@ public class TestFileTruncate {
|
|
StartupOption.REGULAR, null);
|
|
StartupOption.REGULAR, null);
|
|
cluster.waitActive();
|
|
cluster.waitActive();
|
|
}
|
|
}
|
|
|
|
+ checkBlockRecovery(p);
|
|
|
|
|
|
fs.delete(parent, true);
|
|
fs.delete(parent, true);
|
|
}
|
|
}
|