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-8803. Move DfsClientConf to hdfs-client. (Mingliang Liu via wheat9)
HDFS-8917. Cleanup BlockInfoUnderConstruction from comments and tests.
(Zhe Zhang via jing9)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

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

View File

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

View File

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

View File

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

View File

@ -62,7 +62,7 @@ public class FileUnderConstructionFeature implements INode.Feature {
+ f.getFullPathName() + " is null when updating its length"; + f.getFullPathName() + " is null when updating its length";
assert !lastBlock.isComplete() assert !lastBlock.isComplete()
: "The last block for path " + f.getFullPathName() : "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); lastBlock.setNumBytes(lastBlockLength);
} }

View File

@ -693,7 +693,7 @@ public class INodeFile extends INodeWithAdditionalFields
return 0; return 0;
} }
final int last = blocks.length - 1; 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(); long size = blocks[last].getNumBytes();
if (!blocks[last].isComplete()) { if (!blocks[last].isComplete()) {
if (!includesLastUcBlock) { if (!includesLastUcBlock) {

View File

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

View File

@ -26,9 +26,9 @@ import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.BlockUCState;
import org.junit.Test; 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 @Test
public void testInitializeBlockRecovery() throws Exception { public void testInitializeBlockRecovery() throws Exception {
DatanodeStorageInfo s1 = DFSTestUtil.createDatanodeStorageInfo("10.10.1.1", "s1"); DatanodeStorageInfo s1 = DFSTestUtil.createDatanodeStorageInfo("10.10.1.1", "s1");

View File

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