HDFS-8917. Cleanup BlockInfoUnderConstruction from comments and tests. Contributed by Zhe Zhang.

This commit is contained in:
Jing Zhao 2015-08-19 15:11:37 -07:00
parent 3aac4758b0
commit 4e14f7982a
10 changed files with 15 additions and 14 deletions

View File

@ -816,6 +816,9 @@ Release 2.8.0 - UNRELEASED
HDFS-8803. Move DfsClientConf to hdfs-client. (Mingliang Liu via wheat9)
HDFS-8917. Cleanup BlockInfoUnderConstruction from comments and tests.
(Zhe Zhang via jing9)
OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -78,7 +78,6 @@ public BlockInfo(Block blk, short replication) {
/**
* Copy construction.
* This is used to convert BlockInfoUnderConstruction
* @param from BlockInfo to copy from.
*/
protected BlockInfo(BlockInfo from) {

View File

@ -37,8 +37,7 @@ public BlockInfoContiguous(Block blk, short size) {
/**
* Copy construction.
* This is used to convert BlockReplicationInfoUnderConstruction
* @param from BlockReplicationInfo to copy from.
* @param from BlockInfoContiguous to copy from.
*/
protected BlockInfoContiguous(BlockInfoContiguous from) {
super(from);

View File

@ -2236,7 +2236,7 @@ private void reportDiff(DatanodeStorageInfo storageInfo,
* is fully replicated.</li>
* <li>If the reported replica is for a block currently marked "under
* construction" in the NN, then it should be added to the
* BlockInfoUnderConstruction's list of replicas.</li>
* BlockUnderConstructionFeature's list of replicas.</li>
* </ol>
*
* @param storageInfo DatanodeStorageInfo that sent the report.

View File

@ -151,7 +151,7 @@ public String toString() {
public BlockUnderConstructionFeature(Block block, BlockUCState state,
DatanodeStorageInfo[] targets) {
assert getBlockUCState() != BlockUCState.COMPLETE :
"BlockInfoUnderConstruction cannot be in COMPLETE state";
"BlockUnderConstructionFeature cannot be in COMPLETE state";
this.blockUCState = state;
setExpectedLocations(block.getGenerationStamp(), targets);
}
@ -241,7 +241,7 @@ public void initializeBlockRecovery(BlockInfo block, long recoveryId) {
blockRecoveryId = recoveryId;
if (replicas.size() == 0) {
NameNode.blockStateChangeLog.warn("BLOCK*"
+ " BlockInfoUnderConstruction.initLeaseRecovery:"
+ " BlockUnderConstructionFeature.initLeaseRecovery:"
+ " No blocks found, lease removed.");
}
boolean allLiveReplicasTriedAsPrimary = true;

View File

@ -62,7 +62,7 @@ void updateLengthOfLastBlock(INodeFile f, long lastBlockLength)
+ f.getFullPathName() + " is null when updating its length";
assert !lastBlock.isComplete()
: "The last block for path " + f.getFullPathName()
+ " is not a BlockInfoUnderConstruction when updating its length";
+ " is not under-construction when updating its length";
lastBlock.setNumBytes(lastBlockLength);
}

View File

@ -693,7 +693,7 @@ public final long computeFileSize(boolean includesLastUcBlock,
return 0;
}
final int last = blocks.length - 1;
//check if the last block is BlockInfoUnderConstruction
//check if the last block is under-construction
long size = blocks[last].getNumBytes();
if (!blocks[last].isComplete()) {
if (!includesLastUcBlock) {

View File

@ -331,7 +331,7 @@ public void testAppendTwice() throws Exception {
//1st append does not add any data so that the last block remains full
//and the last block in INodeFileUnderConstruction is a BlockInfo
//but not BlockInfoUnderConstruction.
//but does not have a BlockUnderConstructionFeature.
fs2.append(p);
//2nd append should get AlreadyBeingCreatedException
@ -369,7 +369,7 @@ public void testAppend2Twice() throws Exception {
//1st append does not add any data so that the last block remains full
//and the last block in INodeFileUnderConstruction is a BlockInfo
//but not BlockInfoUnderConstruction.
//but does not have a BlockUnderConstructionFeature.
((DistributedFileSystem) fs2).append(p,
EnumSet.of(CreateFlag.APPEND, CreateFlag.NEW_BLOCK), 4096, null);

View File

@ -26,9 +26,9 @@
import org.junit.Test;
/**
* This class provides tests for BlockInfoUnderConstruction class
* This class provides tests for {@link BlockUnderConstructionFeature} class
*/
public class TestBlockInfoUnderConstruction {
public class TestBlockUnderConstructionFeature {
@Test
public void testInitializeBlockRecovery() throws Exception {
DatanodeStorageInfo s1 = DFSTestUtil.createDatanodeStorageInfo("10.10.1.1", "s1");

View File

@ -227,8 +227,8 @@ private static void compareDumpedTreeInFile(File file1, File file2,
line2 = line2.replaceAll("Quota\\[.*\\]", "Quota[]");
}
// skip the specific fields of BlockInfoUnderConstruction when the node
// is an INodeFileSnapshot or an INodeFileUnderConstructionSnapshot
// skip the specific fields of BlockUnderConstructionFeature when the
// node is an INodeFileSnapshot or INodeFileUnderConstructionSnapshot
if (line1.contains("(INodeFileSnapshot)")
|| line1.contains("(INodeFileUnderConstructionSnapshot)")) {
line1 = line1.replaceAll(