HDFS-10769. BlockIdManager.clear doesn't reset the counter for blockGroupIdGenerator (Contributed by Yiqun Lin and Rakesh R)

This commit is contained in:
Vinayakumar B 2016-10-27 14:16:03 +05:30
parent 7b4e9ec3b0
commit 77f2684dd3
2 changed files with 6 additions and 0 deletions

View File

@ -225,6 +225,7 @@ public class BlockIdManager {
generationStamp.setCurrentValue(GenerationStamp.LAST_RESERVED_STAMP);
getBlockIdGenerator().setCurrentValue(SequentialBlockIdGenerator
.LAST_RESERVED_BLOCK_ID);
getBlockGroupIdGenerator().setCurrentValue(Long.MIN_VALUE);
legacyGenerationStampLimit = HdfsConstants.GRANDFATHER_GENERATION_STAMP;
}

View File

@ -124,6 +124,11 @@ public class TestSequentialBlockGroupId {
assertThat("BlockGrpId mismatches!", nextBlockGrpId,
is(nextBlockExpectedId));
}
// verify that the blockGroupId resets on #clear call.
cluster.getNamesystem().getBlockManager().clear();
assertThat("BlockGrpId mismatches!", blockGrpIdGenerator.getCurrentValue(),
is(Long.MIN_VALUE));
}
/**