|
@@ -100,6 +100,8 @@ class BPServiceActor implements Runnable {
|
|
CONNECTING, INIT_FAILED, RUNNING, EXITED, FAILED;
|
|
CONNECTING, INIT_FAILED, RUNNING, EXITED, FAILED;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private String serviceId = null;
|
|
|
|
+ private String nnId = null;
|
|
private volatile RunningState runningState = RunningState.CONNECTING;
|
|
private volatile RunningState runningState = RunningState.CONNECTING;
|
|
private volatile boolean shouldServiceRun = true;
|
|
private volatile boolean shouldServiceRun = true;
|
|
private final DataNode dn;
|
|
private final DataNode dn;
|
|
@@ -115,8 +117,8 @@ class BPServiceActor implements Runnable {
|
|
final LinkedList<BPServiceActorAction> bpThreadQueue
|
|
final LinkedList<BPServiceActorAction> bpThreadQueue
|
|
= new LinkedList<BPServiceActorAction>();
|
|
= new LinkedList<BPServiceActorAction>();
|
|
|
|
|
|
- BPServiceActor(InetSocketAddress nnAddr, InetSocketAddress lifelineNnAddr,
|
|
|
|
- BPOfferService bpos) {
|
|
|
|
|
|
+ BPServiceActor(String serviceId, String nnId, InetSocketAddress nnAddr,
|
|
|
|
+ InetSocketAddress lifelineNnAddr, BPOfferService bpos) {
|
|
this.bpos = bpos;
|
|
this.bpos = bpos;
|
|
this.dn = bpos.getDataNode();
|
|
this.dn = bpos.getDataNode();
|
|
this.nnAddr = nnAddr;
|
|
this.nnAddr = nnAddr;
|
|
@@ -134,6 +136,12 @@ class BPServiceActor implements Runnable {
|
|
dnConf.outliersReportIntervalMs);
|
|
dnConf.outliersReportIntervalMs);
|
|
// get the value of maxDataLength.
|
|
// get the value of maxDataLength.
|
|
this.maxDataLength = dnConf.getMaxDataLength();
|
|
this.maxDataLength = dnConf.getMaxDataLength();
|
|
|
|
+ if (serviceId != null) {
|
|
|
|
+ this.serviceId = serviceId;
|
|
|
|
+ }
|
|
|
|
+ if (nnId != null) {
|
|
|
|
+ this.nnId = nnId;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
public DatanodeRegistration getBpRegistration() {
|
|
public DatanodeRegistration getBpRegistration() {
|
|
@@ -354,7 +362,7 @@ class BPServiceActor implements Runnable {
|
|
// or we will report an RBW replica after the BlockReport already reports
|
|
// or we will report an RBW replica after the BlockReport already reports
|
|
// a FINALIZED one.
|
|
// a FINALIZED one.
|
|
ibrManager.sendIBRs(bpNamenode, bpRegistration,
|
|
ibrManager.sendIBRs(bpNamenode, bpRegistration,
|
|
- bpos.getBlockPoolId());
|
|
|
|
|
|
+ bpos.getBlockPoolId(), getRpcMetricSuffix());
|
|
|
|
|
|
long brCreateStartTime = monotonicNow();
|
|
long brCreateStartTime = monotonicNow();
|
|
Map<DatanodeStorage, BlockListAsLongs> perVolumeBlockLists =
|
|
Map<DatanodeStorage, BlockListAsLongs> perVolumeBlockLists =
|
|
@@ -417,7 +425,7 @@ class BPServiceActor implements Runnable {
|
|
// Log the block report processing stats from Datanode perspective
|
|
// Log the block report processing stats from Datanode perspective
|
|
long brSendCost = monotonicNow() - brSendStartTime;
|
|
long brSendCost = monotonicNow() - brSendStartTime;
|
|
long brCreateCost = brSendStartTime - brCreateStartTime;
|
|
long brCreateCost = brSendStartTime - brCreateStartTime;
|
|
- dn.getMetrics().addBlockReport(brSendCost);
|
|
|
|
|
|
+ dn.getMetrics().addBlockReport(brSendCost, getRpcMetricSuffix());
|
|
final int nCmds = cmds.size();
|
|
final int nCmds = cmds.size();
|
|
LOG.info((success ? "S" : "Uns") +
|
|
LOG.info((success ? "S" : "Uns") +
|
|
"uccessfully sent block report 0x" +
|
|
"uccessfully sent block report 0x" +
|
|
@@ -439,6 +447,18 @@ class BPServiceActor implements Runnable {
|
|
return cmds.size() == 0 ? null : cmds;
|
|
return cmds.size() == 0 ? null : cmds;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private String getRpcMetricSuffix() {
|
|
|
|
+ if (serviceId == null && nnId == null) {
|
|
|
|
+ return null;
|
|
|
|
+ } else if (serviceId == null && nnId != null) {
|
|
|
|
+ return nnId;
|
|
|
|
+ } else if (serviceId != null && nnId == null) {
|
|
|
|
+ return serviceId;
|
|
|
|
+ } else {
|
|
|
|
+ return serviceId + "-" + nnId;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
DatanodeCommand cacheReport() throws IOException {
|
|
DatanodeCommand cacheReport() throws IOException {
|
|
// If caching is disabled, do not send a cache report
|
|
// If caching is disabled, do not send a cache report
|
|
if (dn.getFSDataset().getCacheCapacity() == 0) {
|
|
if (dn.getFSDataset().getCacheCapacity() == 0) {
|
|
@@ -657,7 +677,8 @@ class BPServiceActor implements Runnable {
|
|
}
|
|
}
|
|
fullBlockReportLeaseId = resp.getFullBlockReportLeaseId();
|
|
fullBlockReportLeaseId = resp.getFullBlockReportLeaseId();
|
|
}
|
|
}
|
|
- dn.getMetrics().addHeartbeat(scheduler.monotonicNow() - startTime);
|
|
|
|
|
|
+ dn.getMetrics().addHeartbeat(scheduler.monotonicNow() - startTime,
|
|
|
|
+ getRpcMetricSuffix());
|
|
|
|
|
|
// If the state of this NN has changed (eg STANDBY->ACTIVE)
|
|
// If the state of this NN has changed (eg STANDBY->ACTIVE)
|
|
// then let the BPOfferService update itself.
|
|
// then let the BPOfferService update itself.
|
|
@@ -687,7 +708,7 @@ class BPServiceActor implements Runnable {
|
|
if (!dn.areIBRDisabledForTests() &&
|
|
if (!dn.areIBRDisabledForTests() &&
|
|
(ibrManager.sendImmediately()|| sendHeartbeat)) {
|
|
(ibrManager.sendImmediately()|| sendHeartbeat)) {
|
|
ibrManager.sendIBRs(bpNamenode, bpRegistration,
|
|
ibrManager.sendIBRs(bpNamenode, bpRegistration,
|
|
- bpos.getBlockPoolId());
|
|
|
|
|
|
+ bpos.getBlockPoolId(), getRpcMetricSuffix());
|
|
}
|
|
}
|
|
|
|
|
|
List<DatanodeCommand> cmds = null;
|
|
List<DatanodeCommand> cmds = null;
|
|
@@ -709,7 +730,7 @@ class BPServiceActor implements Runnable {
|
|
|
|
|
|
if (sendHeartbeat) {
|
|
if (sendHeartbeat) {
|
|
dn.getMetrics().addHeartbeatTotal(
|
|
dn.getMetrics().addHeartbeatTotal(
|
|
- scheduler.monotonicNow() - startTime);
|
|
|
|
|
|
+ scheduler.monotonicNow() - startTime, getRpcMetricSuffix());
|
|
}
|
|
}
|
|
|
|
|
|
// There is no work to do; sleep until hearbeat timer elapses,
|
|
// There is no work to do; sleep until hearbeat timer elapses,
|
|
@@ -1059,7 +1080,8 @@ class BPServiceActor implements Runnable {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
sendLifeline();
|
|
sendLifeline();
|
|
- dn.getMetrics().addLifeline(scheduler.monotonicNow() - startTime);
|
|
|
|
|
|
+ dn.getMetrics().addLifeline(scheduler.monotonicNow() - startTime,
|
|
|
|
+ getRpcMetricSuffix());
|
|
scheduler.scheduleNextLifeline(scheduler.monotonicNow());
|
|
scheduler.scheduleNextLifeline(scheduler.monotonicNow());
|
|
}
|
|
}
|
|
|
|
|