HDFS-15238. RBF: NamenodeHeartbeatService caused memory to grow rapidly. Contributed by xuzq.
This commit is contained in:
parent
eaaaba12b1
commit
cbe71eaddf
@ -79,6 +79,8 @@ public class NamenodeHeartbeatService extends PeriodicService {
|
|||||||
|
|
||||||
/** Namenode HA target. */
|
/** Namenode HA target. */
|
||||||
private NNHAServiceTarget localTarget;
|
private NNHAServiceTarget localTarget;
|
||||||
|
/** Cache HA protocol. */
|
||||||
|
private HAServiceProtocol localTargetHAProtocol;
|
||||||
/** RPC address for the namenode. */
|
/** RPC address for the namenode. */
|
||||||
private String rpcAddress;
|
private String rpcAddress;
|
||||||
/** Service RPC address for the namenode. */
|
/** Service RPC address for the namenode. */
|
||||||
@ -293,8 +295,10 @@ protected NamenodeStatusReport getNamenodeStatusReport() {
|
|||||||
try {
|
try {
|
||||||
// Determine if NN is active
|
// Determine if NN is active
|
||||||
// TODO: dynamic timeout
|
// TODO: dynamic timeout
|
||||||
HAServiceProtocol haProtocol = localTarget.getProxy(conf, 30*1000);
|
if (localTargetHAProtocol == null) {
|
||||||
HAServiceStatus status = haProtocol.getServiceStatus();
|
localTargetHAProtocol = localTarget.getProxy(conf, 30*1000);
|
||||||
|
}
|
||||||
|
HAServiceStatus status = localTargetHAProtocol.getServiceStatus();
|
||||||
report.setHAServiceState(status.getState());
|
report.setHAServiceState(status.getState());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
if (e.getMessage().startsWith("HA for namenode is not enabled")) {
|
if (e.getMessage().startsWith("HA for namenode is not enabled")) {
|
||||||
@ -305,6 +309,7 @@ protected NamenodeStatusReport getNamenodeStatusReport() {
|
|||||||
LOG.error("Cannot fetch HA status for {}: {}",
|
LOG.error("Cannot fetch HA status for {}: {}",
|
||||||
getNamenodeDesc(), e.getMessage(), e);
|
getNamenodeDesc(), e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
localTargetHAProtocol = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user