|
@@ -121,7 +121,6 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
|
|
|
private final NameNode namenode;
|
|
|
private final NetworkTopology networktopology;
|
|
|
private final int totalDatanodes;
|
|
|
- private final short minReplication;
|
|
|
private final InetAddress remoteAddress;
|
|
|
|
|
|
private String lostFound = null;
|
|
@@ -181,19 +180,17 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
|
|
|
* @param pmap key=value[] map passed to the http servlet as url parameters
|
|
|
* @param out output stream to write the fsck output
|
|
|
* @param totalDatanodes number of live datanodes
|
|
|
- * @param minReplication minimum replication
|
|
|
* @param remoteAddress source address of the fsck request
|
|
|
*/
|
|
|
NamenodeFsck(Configuration conf, NameNode namenode,
|
|
|
NetworkTopology networktopology,
|
|
|
Map<String,String[]> pmap, PrintWriter out,
|
|
|
- int totalDatanodes, short minReplication, InetAddress remoteAddress) {
|
|
|
+ int totalDatanodes, InetAddress remoteAddress) {
|
|
|
this.conf = conf;
|
|
|
this.namenode = namenode;
|
|
|
this.networktopology = networktopology;
|
|
|
this.out = out;
|
|
|
this.totalDatanodes = totalDatanodes;
|
|
|
- this.minReplication = minReplication;
|
|
|
this.remoteAddress = remoteAddress;
|
|
|
this.bpPolicy = BlockPlacementPolicy.getInstance(conf, null,
|
|
|
networktopology,
|
|
@@ -308,7 +305,6 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
|
|
|
final long startTime = Time.monotonicNow();
|
|
|
try {
|
|
|
if(blockIds != null) {
|
|
|
-
|
|
|
String[] blocks = blockIds.split(" ");
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
sb.append("FSCK started by " +
|
|
@@ -561,7 +557,7 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
|
|
|
res.numExpectedReplicas += targetFileReplication;
|
|
|
|
|
|
// count under min repl'd blocks
|
|
|
- if(totalReplicasPerBlock < minReplication){
|
|
|
+ if(totalReplicasPerBlock < res.minReplication){
|
|
|
res.numUnderMinReplicatedBlocks++;
|
|
|
}
|
|
|
|
|
@@ -582,7 +578,7 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
|
|
|
}
|
|
|
|
|
|
// count minimally replicated blocks
|
|
|
- if (totalReplicasPerBlock >= minReplication)
|
|
|
+ if (totalReplicasPerBlock >= res.minReplication)
|
|
|
res.numMinReplicatedBlocks++;
|
|
|
|
|
|
// count missing replicas / under replicated blocks
|
|
@@ -601,7 +597,7 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
|
|
|
decommissioningReplicas + " decommissioning replica(s).");
|
|
|
}
|
|
|
|
|
|
- // count mis replicated blocks block
|
|
|
+ // count mis replicated blocks
|
|
|
BlockPlacementStatus blockPlacementStatus = bpPolicy
|
|
|
.verifyBlockPlacement(path, lBlk, targetFileReplication);
|
|
|
if (!blockPlacementStatus.isPlacementPolicySatisfied()) {
|
|
@@ -724,8 +720,8 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
|
|
|
private void countStorageTypeSummary(HdfsFileStatus file, LocatedBlock lBlk) {
|
|
|
StorageType[] storageTypes = lBlk.getStorageTypes();
|
|
|
storageTypeSummary.add(Arrays.copyOf(storageTypes, storageTypes.length),
|
|
|
- namenode.getNamesystem().getBlockManager()
|
|
|
- .getStoragePolicy(file.getStoragePolicy()));
|
|
|
+ namenode.getNamesystem().getBlockManager()
|
|
|
+ .getStoragePolicy(file.getStoragePolicy()));
|
|
|
}
|
|
|
|
|
|
private void deleteCorruptedFile(String path) {
|
|
@@ -1069,7 +1065,7 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
|
|
|
((float) (numUnderMinReplicatedBlocks * 100) / (float) totalBlocks))
|
|
|
.append(" %)");
|
|
|
}
|
|
|
- res.append("\n ").append("DFSConfigKeys.DFS_NAMENODE_REPLICATION_MIN_KEY:\t")
|
|
|
+ res.append("\n ").append(DFSConfigKeys.DFS_NAMENODE_REPLICATION_MIN_KEY + ":\t")
|
|
|
.append(minReplication);
|
|
|
}
|
|
|
if(corruptFiles>0) {
|