HDFS-8405. Fix a typo in NamenodeFsck. Contributed by Takanobu Asanuma
This commit is contained in:
parent
9bcb740049
commit
7bd4db968d
|
@ -534,6 +534,8 @@ Release 2.7.1 - UNRELEASED
|
||||||
HDFS-6300. Prevent multiple balancers from running simultaneously
|
HDFS-6300. Prevent multiple balancers from running simultaneously
|
||||||
(Rakesh R via vinayakumarb)
|
(Rakesh R via vinayakumarb)
|
||||||
|
|
||||||
|
HDFS-8405. Fix a typo in NamenodeFsck. (Takanobu Asanuma via szetszwo)
|
||||||
|
|
||||||
Release 2.7.0 - 2015-04-20
|
Release 2.7.0 - 2015-04-20
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class FsckServlet extends DfsServlet {
|
||||||
namesystem.getNumberOfDatanodes(DatanodeReportType.LIVE);
|
namesystem.getNumberOfDatanodes(DatanodeReportType.LIVE);
|
||||||
new NamenodeFsck(conf, nn,
|
new NamenodeFsck(conf, nn,
|
||||||
bm.getDatanodeManager().getNetworkTopology(), pmap, out,
|
bm.getDatanodeManager().getNetworkTopology(), pmap, out,
|
||||||
totalDatanodes, bm.minReplication, remoteAddress).fsck();
|
totalDatanodes, remoteAddress).fsck();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,6 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
|
||||||
private final NameNode namenode;
|
private final NameNode namenode;
|
||||||
private final NetworkTopology networktopology;
|
private final NetworkTopology networktopology;
|
||||||
private final int totalDatanodes;
|
private final int totalDatanodes;
|
||||||
private final short minReplication;
|
|
||||||
private final InetAddress remoteAddress;
|
private final InetAddress remoteAddress;
|
||||||
|
|
||||||
private String lostFound = null;
|
private String lostFound = null;
|
||||||
|
@ -180,19 +179,17 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
|
||||||
* @param pmap key=value[] map passed to the http servlet as url parameters
|
* @param pmap key=value[] map passed to the http servlet as url parameters
|
||||||
* @param out output stream to write the fsck output
|
* @param out output stream to write the fsck output
|
||||||
* @param totalDatanodes number of live datanodes
|
* @param totalDatanodes number of live datanodes
|
||||||
* @param minReplication minimum replication
|
|
||||||
* @param remoteAddress source address of the fsck request
|
* @param remoteAddress source address of the fsck request
|
||||||
*/
|
*/
|
||||||
NamenodeFsck(Configuration conf, NameNode namenode,
|
NamenodeFsck(Configuration conf, NameNode namenode,
|
||||||
NetworkTopology networktopology,
|
NetworkTopology networktopology,
|
||||||
Map<String,String[]> pmap, PrintWriter out,
|
Map<String,String[]> pmap, PrintWriter out,
|
||||||
int totalDatanodes, short minReplication, InetAddress remoteAddress) {
|
int totalDatanodes, InetAddress remoteAddress) {
|
||||||
this.conf = conf;
|
this.conf = conf;
|
||||||
this.namenode = namenode;
|
this.namenode = namenode;
|
||||||
this.networktopology = networktopology;
|
this.networktopology = networktopology;
|
||||||
this.out = out;
|
this.out = out;
|
||||||
this.totalDatanodes = totalDatanodes;
|
this.totalDatanodes = totalDatanodes;
|
||||||
this.minReplication = minReplication;
|
|
||||||
this.remoteAddress = remoteAddress;
|
this.remoteAddress = remoteAddress;
|
||||||
this.bpPolicy = BlockPlacementPolicy.getInstance(conf, null,
|
this.bpPolicy = BlockPlacementPolicy.getInstance(conf, null,
|
||||||
networktopology,
|
networktopology,
|
||||||
|
@ -306,7 +303,6 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
|
||||||
final long startTime = Time.monotonicNow();
|
final long startTime = Time.monotonicNow();
|
||||||
try {
|
try {
|
||||||
if(blockIds != null) {
|
if(blockIds != null) {
|
||||||
|
|
||||||
String[] blocks = blockIds.split(" ");
|
String[] blocks = blockIds.split(" ");
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("FSCK started by " +
|
sb.append("FSCK started by " +
|
||||||
|
@ -555,7 +551,7 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
|
||||||
res.numExpectedReplicas += targetFileReplication;
|
res.numExpectedReplicas += targetFileReplication;
|
||||||
|
|
||||||
// count under min repl'd blocks
|
// count under min repl'd blocks
|
||||||
if(totalReplicasPerBlock < minReplication){
|
if(totalReplicasPerBlock < res.minReplication){
|
||||||
res.numUnderMinReplicatedBlocks++;
|
res.numUnderMinReplicatedBlocks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,7 +571,7 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
// count minimally replicated blocks
|
// count minimally replicated blocks
|
||||||
if (totalReplicasPerBlock >= minReplication)
|
if (totalReplicasPerBlock >= res.minReplication)
|
||||||
res.numMinReplicatedBlocks++;
|
res.numMinReplicatedBlocks++;
|
||||||
|
|
||||||
// count missing replicas / under replicated blocks
|
// count missing replicas / under replicated blocks
|
||||||
|
@ -594,7 +590,7 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
|
||||||
decommissioningReplicas + " decommissioning replica(s).");
|
decommissioningReplicas + " decommissioning replica(s).");
|
||||||
}
|
}
|
||||||
|
|
||||||
// count mis replicated blocks block
|
// count mis replicated blocks
|
||||||
BlockPlacementStatus blockPlacementStatus = bpPolicy
|
BlockPlacementStatus blockPlacementStatus = bpPolicy
|
||||||
.verifyBlockPlacement(path, lBlk, targetFileReplication);
|
.verifyBlockPlacement(path, lBlk, targetFileReplication);
|
||||||
if (!blockPlacementStatus.isPlacementPolicySatisfied()) {
|
if (!blockPlacementStatus.isPlacementPolicySatisfied()) {
|
||||||
|
@ -1038,7 +1034,7 @@ public class NamenodeFsck implements DataEncryptionKeyFactory {
|
||||||
((float) (numUnderMinReplicatedBlocks * 100) / (float) totalBlocks))
|
((float) (numUnderMinReplicatedBlocks * 100) / (float) totalBlocks))
|
||||||
.append(" %)");
|
.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);
|
.append(minReplication);
|
||||||
}
|
}
|
||||||
if(corruptFiles>0) {
|
if(corruptFiles>0) {
|
||||||
|
|
|
@ -774,7 +774,7 @@ public class TestFsck {
|
||||||
System.out.println(outStr);
|
System.out.println(outStr);
|
||||||
assertTrue(outStr.contains(NamenodeFsck.HEALTHY_STATUS));
|
assertTrue(outStr.contains(NamenodeFsck.HEALTHY_STATUS));
|
||||||
assertTrue(outStr.contains("UNDER MIN REPL'D BLOCKS:\t1 (100.0 %)"));
|
assertTrue(outStr.contains("UNDER MIN REPL'D BLOCKS:\t1 (100.0 %)"));
|
||||||
assertTrue(outStr.contains("DFSConfigKeys.DFS_NAMENODE_REPLICATION_MIN_KEY:\t2"));
|
assertTrue(outStr.contains("dfs.namenode.replication.min:\t2"));
|
||||||
} finally {
|
} finally {
|
||||||
if (cluster != null) {cluster.shutdown();}
|
if (cluster != null) {cluster.shutdown();}
|
||||||
}
|
}
|
||||||
|
@ -1041,7 +1041,7 @@ public class TestFsck {
|
||||||
PrintWriter out = new PrintWriter(result, true);
|
PrintWriter out = new PrintWriter(result, true);
|
||||||
InetAddress remoteAddress = InetAddress.getLocalHost();
|
InetAddress remoteAddress = InetAddress.getLocalHost();
|
||||||
NamenodeFsck fsck = new NamenodeFsck(conf, namenode, nettop, pmap, out,
|
NamenodeFsck fsck = new NamenodeFsck(conf, namenode, nettop, pmap, out,
|
||||||
NUM_REPLICAS, (short)1, remoteAddress);
|
NUM_REPLICAS, remoteAddress);
|
||||||
|
|
||||||
// Run the fsck and check the Result
|
// Run the fsck and check the Result
|
||||||
final HdfsFileStatus file =
|
final HdfsFileStatus file =
|
||||||
|
@ -1118,7 +1118,7 @@ public class TestFsck {
|
||||||
PrintWriter out = new PrintWriter(result, true);
|
PrintWriter out = new PrintWriter(result, true);
|
||||||
InetAddress remoteAddress = InetAddress.getLocalHost();
|
InetAddress remoteAddress = InetAddress.getLocalHost();
|
||||||
NamenodeFsck fsck = new NamenodeFsck(conf, namenode, nettop, pmap, out,
|
NamenodeFsck fsck = new NamenodeFsck(conf, namenode, nettop, pmap, out,
|
||||||
NUM_DN, REPL_FACTOR, remoteAddress);
|
NUM_DN, remoteAddress);
|
||||||
|
|
||||||
// Run the fsck and check the Result
|
// Run the fsck and check the Result
|
||||||
final HdfsFileStatus file =
|
final HdfsFileStatus file =
|
||||||
|
@ -1165,7 +1165,7 @@ public class TestFsck {
|
||||||
when(blockManager.getDatanodeManager()).thenReturn(dnManager);
|
when(blockManager.getDatanodeManager()).thenReturn(dnManager);
|
||||||
|
|
||||||
NamenodeFsck fsck = new NamenodeFsck(conf, namenode, nettop, pmap, out,
|
NamenodeFsck fsck = new NamenodeFsck(conf, namenode, nettop, pmap, out,
|
||||||
NUM_REPLICAS, (short)1, remoteAddress);
|
NUM_REPLICAS, remoteAddress);
|
||||||
|
|
||||||
String pathString = "/tmp/testFile";
|
String pathString = "/tmp/testFile";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue