HDFS-7444. convertToBlockUnderConstruction should preserve BlockCollection. Contributed by Haohui Mai.
This commit is contained in:
parent
6545342a6d
commit
ae04ce29e5
|
@ -241,6 +241,9 @@ Release 2.7.0 - UNRELEASED
|
||||||
HDFS-7097. Allow block reports to be processed during checkpointing on
|
HDFS-7097. Allow block reports to be processed during checkpointing on
|
||||||
standby name node. (kihwal via wang)
|
standby name node. (kihwal via wang)
|
||||||
|
|
||||||
|
HDFS-7444. convertToBlockUnderConstruction should preserve BlockCollection.
|
||||||
|
(wheat9)
|
||||||
|
|
||||||
Release 2.6.1 - UNRELEASED
|
Release 2.6.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -369,13 +369,16 @@ public class BlockInfo extends Block implements LightWeightGSet.LinkedElement {
|
||||||
public BlockInfoUnderConstruction convertToBlockUnderConstruction(
|
public BlockInfoUnderConstruction convertToBlockUnderConstruction(
|
||||||
BlockUCState s, DatanodeStorageInfo[] targets) {
|
BlockUCState s, DatanodeStorageInfo[] targets) {
|
||||||
if(isComplete()) {
|
if(isComplete()) {
|
||||||
return new BlockInfoUnderConstruction(this,
|
BlockInfoUnderConstruction ucBlock = new BlockInfoUnderConstruction(this,
|
||||||
getBlockCollection().getBlockReplication(), s, targets);
|
getBlockCollection().getBlockReplication(), s, targets);
|
||||||
|
ucBlock.setBlockCollection(getBlockCollection());
|
||||||
|
return ucBlock;
|
||||||
}
|
}
|
||||||
// the block is already under construction
|
// the block is already under construction
|
||||||
BlockInfoUnderConstruction ucBlock = (BlockInfoUnderConstruction)this;
|
BlockInfoUnderConstruction ucBlock = (BlockInfoUnderConstruction)this;
|
||||||
ucBlock.setBlockUCState(s);
|
ucBlock.setBlockUCState(s);
|
||||||
ucBlock.setExpectedLocations(targets);
|
ucBlock.setExpectedLocations(targets);
|
||||||
|
ucBlock.setBlockCollection(getBlockCollection());
|
||||||
return ucBlock;
|
return ucBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,6 @@ public class INodeFile extends INodeWithAdditionalFields
|
||||||
BlockInfoUnderConstruction ucBlock =
|
BlockInfoUnderConstruction ucBlock =
|
||||||
lastBlock.convertToBlockUnderConstruction(
|
lastBlock.convertToBlockUnderConstruction(
|
||||||
BlockUCState.UNDER_CONSTRUCTION, locations);
|
BlockUCState.UNDER_CONSTRUCTION, locations);
|
||||||
ucBlock.setBlockCollection(this);
|
|
||||||
setBlock(numBlocks() - 1, ucBlock);
|
setBlock(numBlocks() - 1, ucBlock);
|
||||||
return ucBlock;
|
return ucBlock;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue