HDFS-3035. Fix failure of TestFileAppendRestart due to OP_UPDATE_BLOCKS. Contributed by Todd Lipcon.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1295740 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Todd Lipcon 2012-03-01 18:57:58 +00:00
parent 6e5e1e54bc
commit 55832c6c96
2 changed files with 14 additions and 9 deletions

View File

@ -246,3 +246,5 @@ HDFS-3027. Implement a simple NN health check. (atm)
HDFS-3023. Optimize entries in edits log for persistBlocks call. (todd) HDFS-3023. Optimize entries in edits log for persistBlocks call. (todd)
HDFS-2979. Balancer should use logical uri for creating failover proxy with HA enabled. (atm) HDFS-2979. Balancer should use logical uri for creating failover proxy with HA enabled. (atm)
HDFS-3035. Fix failure of TestFileAppendRestart due to OP_UPDATE_BLOCKS (todd)

View File

@ -99,27 +99,30 @@ public void testAppendRestart() throws Exception {
counts = FSImageTestUtil.countEditLogOpTypes(editLog); counts = FSImageTestUtil.countEditLogOpTypes(editLog);
// OP_ADD to create file // OP_ADD to create file
// OP_ADD for first block // OP_UPDATE_BLOCKS for first block
// OP_CLOSE to close file // OP_CLOSE to close file
// OP_ADD to reopen file // OP_ADD to reopen file
// OP_ADD for second block // OP_UPDATE_BLOCKS for second block
// OP_CLOSE to close file // OP_CLOSE to close file
assertEquals(4, (int)counts.get(FSEditLogOpCodes.OP_ADD).held); assertEquals(2, (int)counts.get(FSEditLogOpCodes.OP_ADD).held);
assertEquals(2, (int)counts.get(FSEditLogOpCodes.OP_UPDATE_BLOCKS).held);
assertEquals(2, (int)counts.get(FSEditLogOpCodes.OP_CLOSE).held); assertEquals(2, (int)counts.get(FSEditLogOpCodes.OP_CLOSE).held);
Path p2 = new Path("/not-block-boundaries"); Path p2 = new Path("/not-block-boundaries");
writeAndAppend(fs, p2, BLOCK_SIZE/2, BLOCK_SIZE); writeAndAppend(fs, p2, BLOCK_SIZE/2, BLOCK_SIZE);
counts = FSImageTestUtil.countEditLogOpTypes(editLog); counts = FSImageTestUtil.countEditLogOpTypes(editLog);
// OP_ADD to create file // OP_ADD to create file
// OP_ADD for first block // OP_UPDATE_BLOCKS for first block
// OP_CLOSE to close file // OP_CLOSE to close file
// OP_ADD to re-establish the lease // OP_ADD to re-establish the lease
// OP_ADD from the updatePipeline call (increments genstamp of last block) // OP_UPDATE_BLOCKS from the updatePipeline call (increments genstamp of last block)
// OP_ADD at the start of the second block // OP_UPDATE_BLOCKS at the start of the second block
// OP_CLOSE to close file // OP_CLOSE to close file
// Total: 5 OP_ADDs and 2 OP_CLOSEs in addition to the ones above // Total: 2 OP_ADDs, 3 OP_UPDATE_BLOCKS, and 2 OP_CLOSEs in addition
assertEquals(9, (int)counts.get(FSEditLogOpCodes.OP_ADD).held); // to the ones above
assertEquals(4, (int)counts.get(FSEditLogOpCodes.OP_CLOSE).held); assertEquals(2+2, (int)counts.get(FSEditLogOpCodes.OP_ADD).held);
assertEquals(2+3, (int)counts.get(FSEditLogOpCodes.OP_UPDATE_BLOCKS).held);
assertEquals(2+2, (int)counts.get(FSEditLogOpCodes.OP_CLOSE).held);
cluster.restartNameNode(); cluster.restartNameNode();