|
@@ -1324,13 +1324,15 @@ public class BlockManager {
|
|
|
* Besides the block in question, it provides the ReplicaState
|
|
|
* reported by the datanode in the block report.
|
|
|
*/
|
|
|
- private static class StatefulBlockInfo {
|
|
|
+ static class StatefulBlockInfo {
|
|
|
final BlockInfoUnderConstruction storedBlock;
|
|
|
+ final Block reportedBlock;
|
|
|
final ReplicaState reportedState;
|
|
|
|
|
|
StatefulBlockInfo(BlockInfoUnderConstruction storedBlock,
|
|
|
- ReplicaState reportedState) {
|
|
|
+ Block reportedBlock, ReplicaState reportedState) {
|
|
|
this.storedBlock = storedBlock;
|
|
|
+ this.reportedBlock = reportedBlock;
|
|
|
this.reportedState = reportedState;
|
|
|
}
|
|
|
}
|
|
@@ -1415,7 +1417,7 @@ public class BlockManager {
|
|
|
|
|
|
// Process the blocks on each queue
|
|
|
for (StatefulBlockInfo b : toUC) {
|
|
|
- addStoredBlockUnderConstruction(b.storedBlock, node, b.reportedState);
|
|
|
+ addStoredBlockUnderConstruction(b, node);
|
|
|
}
|
|
|
for (Block b : toRemove) {
|
|
|
removeStoredBlock(b, node);
|
|
@@ -1591,7 +1593,7 @@ public class BlockManager {
|
|
|
|
|
|
if (isBlockUnderConstruction(storedBlock, ucState, reportedState)) {
|
|
|
toUC.add(new StatefulBlockInfo(
|
|
|
- (BlockInfoUnderConstruction)storedBlock, reportedState));
|
|
|
+ (BlockInfoUnderConstruction)storedBlock, block, reportedState));
|
|
|
return storedBlock;
|
|
|
}
|
|
|
|
|
@@ -1701,13 +1703,11 @@ public class BlockManager {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- void addStoredBlockUnderConstruction(
|
|
|
- BlockInfoUnderConstruction block,
|
|
|
- DatanodeDescriptor node,
|
|
|
- ReplicaState reportedState)
|
|
|
- throws IOException {
|
|
|
- block.addReplicaIfNotPresent(node, block, reportedState);
|
|
|
- if (reportedState == ReplicaState.FINALIZED && block.findDatanode(node) < 0) {
|
|
|
+ void addStoredBlockUnderConstruction(StatefulBlockInfo ucBlock,
|
|
|
+ DatanodeDescriptor node) throws IOException {
|
|
|
+ BlockInfoUnderConstruction block = ucBlock.storedBlock;
|
|
|
+ block.addReplicaIfNotPresent(node, ucBlock.reportedBlock, ucBlock.reportedState);
|
|
|
+ if (ucBlock.reportedState == ReplicaState.FINALIZED && block.findDatanode(node) < 0) {
|
|
|
addStoredBlock(block, node, null, true);
|
|
|
}
|
|
|
}
|
|
@@ -2223,7 +2223,7 @@ public class BlockManager {
|
|
|
: "The block should be only in one of the lists.";
|
|
|
|
|
|
for (StatefulBlockInfo b : toUC) {
|
|
|
- addStoredBlockUnderConstruction(b.storedBlock, node, b.reportedState);
|
|
|
+ addStoredBlockUnderConstruction(b, node);
|
|
|
}
|
|
|
for (BlockInfo b : toAdd) {
|
|
|
addStoredBlock(b, node, delHintNode, true);
|