HDFS-14167. RBF: Add stale nodes to federation metrics. Contributed by Inigo Goiri.
This commit is contained in:
parent
8f6f9d9c83
commit
1dc01e59af
|
@ -106,6 +106,12 @@ public interface FederationMBean {
|
||||||
*/
|
*/
|
||||||
int getNumDeadNodes();
|
int getNumDeadNodes();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of stale datanodes.
|
||||||
|
* @return Number of stale datanodes.
|
||||||
|
*/
|
||||||
|
int getNumStaleNodes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of decommissioning datanodes.
|
* Get the number of decommissioning datanodes.
|
||||||
* @return Number of decommissioning datanodes.
|
* @return Number of decommissioning datanodes.
|
||||||
|
|
|
@ -413,6 +413,12 @@ public class FederationMetrics implements FederationMBean {
|
||||||
return getNameserviceAggregatedInt(MembershipStats::getNumOfDeadDatanodes);
|
return getNameserviceAggregatedInt(MembershipStats::getNumOfDeadDatanodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getNumStaleNodes() {
|
||||||
|
return getNameserviceAggregatedInt(
|
||||||
|
MembershipStats::getNumOfStaleDatanodes);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumDecommissioningNodes() {
|
public int getNumDecommissioningNodes() {
|
||||||
return getNameserviceAggregatedInt(
|
return getNameserviceAggregatedInt(
|
||||||
|
|
|
@ -631,7 +631,12 @@ public class NamenodeBeanMetrics
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNumStaleDataNodes() {
|
public int getNumStaleDataNodes() {
|
||||||
return -1;
|
try {
|
||||||
|
return getFederationMetrics().getNumStaleNodes();
|
||||||
|
} catch (IOException e) {
|
||||||
|
LOG.debug("Failed to get number of stale nodes", e.getMessage());
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -280,6 +280,7 @@ public class MembershipNamenodeResolver
|
||||||
report.getNumDecommissioningDatanodes());
|
report.getNumDecommissioningDatanodes());
|
||||||
stats.setNumOfActiveDatanodes(report.getNumLiveDatanodes());
|
stats.setNumOfActiveDatanodes(report.getNumLiveDatanodes());
|
||||||
stats.setNumOfDeadDatanodes(report.getNumDeadDatanodes());
|
stats.setNumOfDeadDatanodes(report.getNumDeadDatanodes());
|
||||||
|
stats.setNumOfStaleDatanodes(report.getNumStaleDatanodes());
|
||||||
stats.setNumOfDecomActiveDatanodes(report.getNumDecomLiveDatanodes());
|
stats.setNumOfDecomActiveDatanodes(report.getNumDecomLiveDatanodes());
|
||||||
stats.setNumOfDecomDeadDatanodes(report.getNumDecomDeadDatanodes());
|
stats.setNumOfDecomDeadDatanodes(report.getNumDecomDeadDatanodes());
|
||||||
record.setStats(stats);
|
record.setStats(stats);
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class NamenodeStatusReport {
|
||||||
/** Datanodes stats. */
|
/** Datanodes stats. */
|
||||||
private int liveDatanodes = -1;
|
private int liveDatanodes = -1;
|
||||||
private int deadDatanodes = -1;
|
private int deadDatanodes = -1;
|
||||||
|
private int staleDatanodes = -1;
|
||||||
/** Decommissioning datanodes. */
|
/** Decommissioning datanodes. */
|
||||||
private int decomDatanodes = -1;
|
private int decomDatanodes = -1;
|
||||||
/** Live decommissioned datanodes. */
|
/** Live decommissioned datanodes. */
|
||||||
|
@ -223,14 +224,16 @@ public class NamenodeStatusReport {
|
||||||
*
|
*
|
||||||
* @param numLive Number of live nodes.
|
* @param numLive Number of live nodes.
|
||||||
* @param numDead Number of dead nodes.
|
* @param numDead Number of dead nodes.
|
||||||
|
* @param numStale Number of stale nodes.
|
||||||
* @param numDecom Number of decommissioning nodes.
|
* @param numDecom Number of decommissioning nodes.
|
||||||
* @param numLiveDecom Number of decommissioned live nodes.
|
* @param numLiveDecom Number of decommissioned live nodes.
|
||||||
* @param numDeadDecom Number of decommissioned dead nodes.
|
* @param numDeadDecom Number of decommissioned dead nodes.
|
||||||
*/
|
*/
|
||||||
public void setDatanodeInfo(int numLive, int numDead, int numDecom,
|
public void setDatanodeInfo(int numLive, int numDead, int numStale,
|
||||||
int numLiveDecom, int numDeadDecom) {
|
int numDecom, int numLiveDecom, int numDeadDecom) {
|
||||||
this.liveDatanodes = numLive;
|
this.liveDatanodes = numLive;
|
||||||
this.deadDatanodes = numDead;
|
this.deadDatanodes = numDead;
|
||||||
|
this.staleDatanodes = numStale;
|
||||||
this.decomDatanodes = numDecom;
|
this.decomDatanodes = numDecom;
|
||||||
this.liveDecomDatanodes = numLiveDecom;
|
this.liveDecomDatanodes = numLiveDecom;
|
||||||
this.deadDecomDatanodes = numDeadDecom;
|
this.deadDecomDatanodes = numDeadDecom;
|
||||||
|
@ -247,7 +250,7 @@ public class NamenodeStatusReport {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of dead blocks.
|
* Get the number of dead nodes.
|
||||||
*
|
*
|
||||||
* @return The number of dead nodes.
|
* @return The number of dead nodes.
|
||||||
*/
|
*/
|
||||||
|
@ -255,6 +258,15 @@ public class NamenodeStatusReport {
|
||||||
return this.deadDatanodes;
|
return this.deadDatanodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of stale nodes.
|
||||||
|
*
|
||||||
|
* @return The number of stale nodes.
|
||||||
|
*/
|
||||||
|
public int getNumStaleDatanodes() {
|
||||||
|
return this.staleDatanodes;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of decommissionining nodes.
|
* Get the number of decommissionining nodes.
|
||||||
*
|
*
|
||||||
|
|
|
@ -338,6 +338,7 @@ public class NamenodeHeartbeatService extends PeriodicService {
|
||||||
report.setDatanodeInfo(
|
report.setDatanodeInfo(
|
||||||
jsonObject.getInt("NumLiveDataNodes"),
|
jsonObject.getInt("NumLiveDataNodes"),
|
||||||
jsonObject.getInt("NumDeadDataNodes"),
|
jsonObject.getInt("NumDeadDataNodes"),
|
||||||
|
jsonObject.getInt("NumStaleDataNodes"),
|
||||||
jsonObject.getInt("NumDecommissioningDataNodes"),
|
jsonObject.getInt("NumDecommissioningDataNodes"),
|
||||||
jsonObject.getInt("NumDecomLiveDataNodes"),
|
jsonObject.getInt("NumDecomLiveDataNodes"),
|
||||||
jsonObject.getInt("NumDecomDeadDataNodes"));
|
jsonObject.getInt("NumDecomDeadDataNodes"));
|
||||||
|
|
|
@ -81,6 +81,10 @@ public abstract class MembershipStats extends BaseRecord {
|
||||||
|
|
||||||
public abstract int getNumOfDeadDatanodes();
|
public abstract int getNumOfDeadDatanodes();
|
||||||
|
|
||||||
|
public abstract void setNumOfStaleDatanodes(int nodes);
|
||||||
|
|
||||||
|
public abstract int getNumOfStaleDatanodes();
|
||||||
|
|
||||||
public abstract void setNumOfDecommissioningDatanodes(int nodes);
|
public abstract void setNumOfDecommissioningDatanodes(int nodes);
|
||||||
|
|
||||||
public abstract int getNumOfDecommissioningDatanodes();
|
public abstract int getNumOfDecommissioningDatanodes();
|
||||||
|
|
|
@ -168,6 +168,16 @@ public class MembershipStatsPBImpl extends MembershipStats
|
||||||
return this.translator.getProtoOrBuilder().getNumOfDeadDatanodes();
|
return this.translator.getProtoOrBuilder().getNumOfDeadDatanodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setNumOfStaleDatanodes(int nodes) {
|
||||||
|
this.translator.getBuilder().setNumOfStaleDatanodes(nodes);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getNumOfStaleDatanodes() {
|
||||||
|
return this.translator.getProtoOrBuilder().getNumOfStaleDatanodes();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNumOfDecommissioningDatanodes(int nodes) {
|
public void setNumOfDecommissioningDatanodes(int nodes) {
|
||||||
this.translator.getBuilder().setNumOfDecommissioningDatanodes(nodes);
|
this.translator.getBuilder().setNumOfDecommissioningDatanodes(nodes);
|
||||||
|
|
|
@ -45,6 +45,7 @@ message NamenodeMembershipStatsRecordProto {
|
||||||
optional uint32 numOfDecommissioningDatanodes = 22;
|
optional uint32 numOfDecommissioningDatanodes = 22;
|
||||||
optional uint32 numOfDecomActiveDatanodes = 23;
|
optional uint32 numOfDecomActiveDatanodes = 23;
|
||||||
optional uint32 numOfDecomDeadDatanodes = 24;
|
optional uint32 numOfDecomDeadDatanodes = 24;
|
||||||
|
optional uint32 numOfStaleDatanodes = 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
message NamenodeMembershipRecordProto {
|
message NamenodeMembershipRecordProto {
|
||||||
|
|
|
@ -137,6 +137,8 @@ public class TestFederationMetrics extends TestMetricsBase {
|
||||||
stats.getNumOfActiveDatanodes());
|
stats.getNumOfActiveDatanodes());
|
||||||
assertEquals(json.getLong("numOfDeadDatanodes"),
|
assertEquals(json.getLong("numOfDeadDatanodes"),
|
||||||
stats.getNumOfDeadDatanodes());
|
stats.getNumOfDeadDatanodes());
|
||||||
|
assertEquals(json.getLong("numOfStaleDatanodes"),
|
||||||
|
stats.getNumOfStaleDatanodes());
|
||||||
assertEquals(json.getLong("numOfDecommissioningDatanodes"),
|
assertEquals(json.getLong("numOfDecommissioningDatanodes"),
|
||||||
stats.getNumOfDecommissioningDatanodes());
|
stats.getNumOfDecommissioningDatanodes());
|
||||||
assertEquals(json.getLong("numOfDecomActiveDatanodes"),
|
assertEquals(json.getLong("numOfDecomActiveDatanodes"),
|
||||||
|
@ -187,6 +189,8 @@ public class TestFederationMetrics extends TestMetricsBase {
|
||||||
json.getLong("numOfActiveDatanodes"));
|
json.getLong("numOfActiveDatanodes"));
|
||||||
assertEquals(stats.getNumOfDeadDatanodes(),
|
assertEquals(stats.getNumOfDeadDatanodes(),
|
||||||
json.getLong("numOfDeadDatanodes"));
|
json.getLong("numOfDeadDatanodes"));
|
||||||
|
assertEquals(stats.getNumOfStaleDatanodes(),
|
||||||
|
json.getLong("numOfStaleDatanodes"));
|
||||||
assertEquals(stats.getNumOfDecommissioningDatanodes(),
|
assertEquals(stats.getNumOfDecommissioningDatanodes(),
|
||||||
json.getLong("numOfDecommissioningDatanodes"));
|
json.getLong("numOfDecommissioningDatanodes"));
|
||||||
assertEquals(stats.getNumOfDecomActiveDatanodes(),
|
assertEquals(stats.getNumOfDecomActiveDatanodes(),
|
||||||
|
@ -260,6 +264,7 @@ public class TestFederationMetrics extends TestMetricsBase {
|
||||||
long numBlocks = 0;
|
long numBlocks = 0;
|
||||||
long numLive = 0;
|
long numLive = 0;
|
||||||
long numDead = 0;
|
long numDead = 0;
|
||||||
|
long numStale = 0;
|
||||||
long numDecom = 0;
|
long numDecom = 0;
|
||||||
long numDecomLive = 0;
|
long numDecomLive = 0;
|
||||||
long numDecomDead = 0;
|
long numDecomDead = 0;
|
||||||
|
@ -269,6 +274,7 @@ public class TestFederationMetrics extends TestMetricsBase {
|
||||||
numBlocks += stats.getNumOfBlocks();
|
numBlocks += stats.getNumOfBlocks();
|
||||||
numLive += stats.getNumOfActiveDatanodes();
|
numLive += stats.getNumOfActiveDatanodes();
|
||||||
numDead += stats.getNumOfDeadDatanodes();
|
numDead += stats.getNumOfDeadDatanodes();
|
||||||
|
numStale += stats.getNumOfStaleDatanodes();
|
||||||
numDecom += stats.getNumOfDecommissioningDatanodes();
|
numDecom += stats.getNumOfDecommissioningDatanodes();
|
||||||
numDecomLive += stats.getNumOfDecomActiveDatanodes();
|
numDecomLive += stats.getNumOfDecomActiveDatanodes();
|
||||||
numDecomDead += stats.getNumOfDecomDeadDatanodes();
|
numDecomDead += stats.getNumOfDecomDeadDatanodes();
|
||||||
|
@ -277,6 +283,7 @@ public class TestFederationMetrics extends TestMetricsBase {
|
||||||
assertEquals(numBlocks, bean.getNumBlocks());
|
assertEquals(numBlocks, bean.getNumBlocks());
|
||||||
assertEquals(numLive, bean.getNumLiveNodes());
|
assertEquals(numLive, bean.getNumLiveNodes());
|
||||||
assertEquals(numDead, bean.getNumDeadNodes());
|
assertEquals(numDead, bean.getNumDeadNodes());
|
||||||
|
assertEquals(numStale, bean.getNumStaleNodes());
|
||||||
assertEquals(numDecom, bean.getNumDecommissioningNodes());
|
assertEquals(numDecom, bean.getNumDecommissioningNodes());
|
||||||
assertEquals(numDecomLive, bean.getNumDecomLiveNodes());
|
assertEquals(numDecomLive, bean.getNumDecomLiveNodes());
|
||||||
assertEquals(numDecomDead, bean.getNumDecomDeadNodes());
|
assertEquals(numDecomDead, bean.getNumDecomDeadNodes());
|
||||||
|
|
|
@ -47,6 +47,7 @@ public class TestMembershipState {
|
||||||
private static final long NUM_BLOCKS = 300;
|
private static final long NUM_BLOCKS = 300;
|
||||||
private static final long NUM_FILES = 400;
|
private static final long NUM_FILES = 400;
|
||||||
private static final int NUM_DEAD = 500;
|
private static final int NUM_DEAD = 500;
|
||||||
|
private static final int NUM_STALE = 550;
|
||||||
private static final int NUM_ACTIVE = 600;
|
private static final int NUM_ACTIVE = 600;
|
||||||
private static final int NUM_DECOM = 700;
|
private static final int NUM_DECOM = 700;
|
||||||
private static final int NUM_DECOM_ACTIVE = 800;
|
private static final int NUM_DECOM_ACTIVE = 800;
|
||||||
|
@ -73,6 +74,7 @@ public class TestMembershipState {
|
||||||
stats.setNumOfFiles(NUM_FILES);
|
stats.setNumOfFiles(NUM_FILES);
|
||||||
stats.setNumOfActiveDatanodes(NUM_ACTIVE);
|
stats.setNumOfActiveDatanodes(NUM_ACTIVE);
|
||||||
stats.setNumOfDeadDatanodes(NUM_DEAD);
|
stats.setNumOfDeadDatanodes(NUM_DEAD);
|
||||||
|
stats.setNumOfStaleDatanodes(NUM_STALE);
|
||||||
stats.setNumOfDecommissioningDatanodes(NUM_DECOM);
|
stats.setNumOfDecommissioningDatanodes(NUM_DECOM);
|
||||||
stats.setNumOfDecomActiveDatanodes(NUM_DECOM_ACTIVE);
|
stats.setNumOfDecomActiveDatanodes(NUM_DECOM_ACTIVE);
|
||||||
stats.setNumOfDecomDeadDatanodes(NUM_DECOM_DEAD);
|
stats.setNumOfDecomDeadDatanodes(NUM_DECOM_DEAD);
|
||||||
|
@ -101,6 +103,7 @@ public class TestMembershipState {
|
||||||
assertEquals(NUM_FILES, stats.getNumOfFiles());
|
assertEquals(NUM_FILES, stats.getNumOfFiles());
|
||||||
assertEquals(NUM_ACTIVE, stats.getNumOfActiveDatanodes());
|
assertEquals(NUM_ACTIVE, stats.getNumOfActiveDatanodes());
|
||||||
assertEquals(NUM_DEAD, stats.getNumOfDeadDatanodes());
|
assertEquals(NUM_DEAD, stats.getNumOfDeadDatanodes());
|
||||||
|
assertEquals(NUM_STALE, stats.getNumOfStaleDatanodes());
|
||||||
assertEquals(NUM_DECOM, stats.getNumOfDecommissioningDatanodes());
|
assertEquals(NUM_DECOM, stats.getNumOfDecommissioningDatanodes());
|
||||||
assertEquals(NUM_DECOM_ACTIVE, stats.getNumOfDecomActiveDatanodes());
|
assertEquals(NUM_DECOM_ACTIVE, stats.getNumOfDecomActiveDatanodes());
|
||||||
assertEquals(NUM_DECOM_DEAD, stats.getNumOfDecomDeadDatanodes());
|
assertEquals(NUM_DECOM_DEAD, stats.getNumOfDecomDeadDatanodes());
|
||||||
|
|
Loading…
Reference in New Issue