|
@@ -18,6 +18,7 @@
|
|
package org.apache.hadoop.hdfs.server.blockmanagement;
|
|
package org.apache.hadoop.hdfs.server.blockmanagement;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@@ -60,11 +61,6 @@ public abstract class BlockInfoUnderConstruction extends BlockInfo {
|
|
*/
|
|
*/
|
|
protected Block truncateBlock;
|
|
protected Block truncateBlock;
|
|
|
|
|
|
- /** The number of times all replicas will be used to attempt recovery before
|
|
|
|
- * giving up and marking the block under construction missing.
|
|
|
|
- */
|
|
|
|
- private int recoveryAttemptsBeforeMarkingBlockMissing;
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* ReplicaUnderConstruction contains information about replicas while
|
|
* ReplicaUnderConstruction contains information about replicas while
|
|
* they are under construction.
|
|
* they are under construction.
|
|
@@ -178,8 +174,6 @@ public abstract class BlockInfoUnderConstruction extends BlockInfo {
|
|
"BlockInfoUnderConstruction cannot be in COMPLETE state");
|
|
"BlockInfoUnderConstruction cannot be in COMPLETE state");
|
|
this.blockUCState = state;
|
|
this.blockUCState = state;
|
|
setExpectedLocations(targets);
|
|
setExpectedLocations(targets);
|
|
- this.recoveryAttemptsBeforeMarkingBlockMissing =
|
|
|
|
- BlockManager.getMaxBlockUCRecoveries();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/** Set expected locations. */
|
|
/** Set expected locations. */
|
|
@@ -277,7 +271,7 @@ public abstract class BlockInfoUnderConstruction extends BlockInfo {
|
|
if (replicas.size() == 0) {
|
|
if (replicas.size() == 0) {
|
|
NameNode.blockStateChangeLog.warn("BLOCK* " +
|
|
NameNode.blockStateChangeLog.warn("BLOCK* " +
|
|
"BlockInfoUnderConstruction.initLeaseRecovery: " +
|
|
"BlockInfoUnderConstruction.initLeaseRecovery: " +
|
|
- "No replicas found.");
|
|
|
|
|
|
+ "No blocks found, lease removed.");
|
|
}
|
|
}
|
|
boolean allLiveReplicasTriedAsPrimary = true;
|
|
boolean allLiveReplicasTriedAsPrimary = true;
|
|
for (int i = 0; i < replicas.size(); i++) {
|
|
for (int i = 0; i < replicas.size(); i++) {
|
|
@@ -289,11 +283,6 @@ public abstract class BlockInfoUnderConstruction extends BlockInfo {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (allLiveReplicasTriedAsPrimary) {
|
|
if (allLiveReplicasTriedAsPrimary) {
|
|
- recoveryAttemptsBeforeMarkingBlockMissing--;
|
|
|
|
- NameNode.blockStateChangeLog.info("Tried to recover " + this +" using all"
|
|
|
|
- + " replicas. Will try " + recoveryAttemptsBeforeMarkingBlockMissing
|
|
|
|
- + " more times");
|
|
|
|
-
|
|
|
|
// Just set all the replicas to be chosen whether they are alive or not.
|
|
// Just set all the replicas to be chosen whether they are alive or not.
|
|
for (int i = 0; i < replicas.size(); i++) {
|
|
for (int i = 0; i < replicas.size(); i++) {
|
|
replicas.get(i).setChosenAsPrimary(false);
|
|
replicas.get(i).setChosenAsPrimary(false);
|
|
@@ -352,10 +341,6 @@ public abstract class BlockInfoUnderConstruction extends BlockInfo {
|
|
replicas.add(new ReplicaUnderConstruction(block, storage, rState));
|
|
replicas.add(new ReplicaUnderConstruction(block, storage, rState));
|
|
}
|
|
}
|
|
|
|
|
|
- public int getNumRecoveryAttemptsLeft() {
|
|
|
|
- return recoveryAttemptsBeforeMarkingBlockMissing;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Convert an under construction block to a complete block.
|
|
* Convert an under construction block to a complete block.
|
|
*
|
|
*
|