HDFS-9297. Update TestBlockMissingException to use corruptBlockOnDataNodesByDeletingBlockFile(). (Tony Wu via lei)

This commit is contained in:
Lei Xu 2015-10-23 17:42:23 -07:00
parent 15eb84b37e
commit 5679e46b7f
2 changed files with 5 additions and 13 deletions

View File

@ -1602,6 +1602,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9280. Document NFS gateway export point parameter. (Xiao Chen via zhz)
HDFS-9297. Update TestBlockMissingException to use corruptBlockOnDataNodesByDeletingBlockFile().
(Tony Wu via lei)
BUG FIXES
HDFS-7501. TransactionsSinceLastCheckpoint can be negative on SBNs.

View File

@ -67,7 +67,8 @@ public class TestBlockMissingException {
0, numBlocks * blockSize);
// remove block of file
LOG.info("Remove first block of file");
corruptBlock(file1, locations.get(0).getBlock());
dfs.corruptBlockOnDataNodesByDeletingBlockFile(
locations.get(0).getBlock());
// validate that the system throws BlockMissingException
validateFile(fileSys, file1);
@ -118,16 +119,4 @@ public class TestBlockMissingException {
stm.close();
assertTrue("Expected BlockMissingException ", gotException);
}
//
// Corrupt specified block of file
//
void corruptBlock(Path file, ExtendedBlock blk) {
// Now deliberately remove/truncate data blocks from the file.
File[] blockFiles = dfs.getAllBlockFiles(blk);
for (File f : blockFiles) {
f.delete();
LOG.info("Deleted block " + f);
}
}
}