HDFS-16350. Datanode start time should be set after RPC server starts successfully (#3711)
This commit is contained in:
parent
99b161dec7
commit
cdc13e91b6
@ -412,7 +412,7 @@ private static Tracer createTracer(Configuration conf) {
|
|||||||
|
|
||||||
private ScheduledThreadPoolExecutor metricsLoggerTimer;
|
private ScheduledThreadPoolExecutor metricsLoggerTimer;
|
||||||
|
|
||||||
private final long startTime = now();
|
private long startTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a dummy DataNode for testing purpose.
|
* Creates a dummy DataNode for testing purpose.
|
||||||
@ -2721,6 +2721,7 @@ public void runDatanodeDaemon() throws IOException {
|
|||||||
}
|
}
|
||||||
ipcServer.setTracer(tracer);
|
ipcServer.setTracer(tracer);
|
||||||
ipcServer.start();
|
ipcServer.start();
|
||||||
|
startTime = now();
|
||||||
startPlugins(getConf());
|
startPlugins(getConf());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +77,7 @@ public void testDataNodeMXBean() throws Exception {
|
|||||||
Assert.assertEquals(datanode.getVersion(),version);
|
Assert.assertEquals(datanode.getVersion(),version);
|
||||||
// get attribute "DNStartedTimeInMillis"
|
// get attribute "DNStartedTimeInMillis"
|
||||||
long startTime = (long) mbs.getAttribute(mxbeanName, "DNStartedTimeInMillis");
|
long startTime = (long) mbs.getAttribute(mxbeanName, "DNStartedTimeInMillis");
|
||||||
|
Assert.assertTrue("Datanode start time should not be 0", startTime > 0);
|
||||||
Assert.assertEquals(datanode.getDNStartedTimeInMillis(), startTime);
|
Assert.assertEquals(datanode.getDNStartedTimeInMillis(), startTime);
|
||||||
// get attribute "SotfwareVersion"
|
// get attribute "SotfwareVersion"
|
||||||
String softwareVersion =
|
String softwareVersion =
|
||||||
|
Loading…
Reference in New Issue
Block a user