HDFS-11296. Maintenance state expiry should be an epoch time and not jvm monotonic. (Manoj Govindassamy via mingma)

This commit is contained in:
Ming Ma 2017-01-19 22:31:15 -08:00
parent 60865c8ea0
commit f3fb94be05
3 changed files with 8 additions and 8 deletions

View File

@ -511,7 +511,7 @@ public void stopMaintenance() {
}
public static boolean maintenanceNotExpired(long maintenanceExpireTimeInMS) {
return Time.monotonicNow() < maintenanceExpireTimeInMS;
return Time.now() < maintenanceExpireTimeInMS;
}
/**
* Returns true if the node is is entering_maintenance

View File

@ -114,7 +114,7 @@ public void testEnteringMaintenanceExpiration() throws Exception {
// Adjust the expiration.
takeNodeOutofService(0, nodeOutofService.getDatanodeUuid(),
Time.monotonicNow() + EXPIRATION_IN_MS, null, AdminStates.NORMAL);
Time.now() + EXPIRATION_IN_MS, null, AdminStates.NORMAL);
cleanupFile(fileSys, file);
}
@ -133,8 +133,8 @@ public void testInvalidExpiration() throws Exception {
final FileSystem fileSys = getCluster().getFileSystem(0);
writeFile(fileSys, file, replicas, 1);
// expiration has to be greater than Time.monotonicNow().
takeNodeOutofService(0, null, Time.monotonicNow(), null,
// expiration has to be greater than Time.now().
takeNodeOutofService(0, null, Time.now(), null,
AdminStates.NORMAL);
cleanupFile(fileSys, file);
@ -203,7 +203,7 @@ public void testPutDeadNodeToMaintenanceWithExpiration() throws Exception {
// Adjust the expiration.
takeNodeOutofService(0, nodeOutofService.getDatanodeUuid(),
Time.monotonicNow() + EXPIRATION_IN_MS, null, AdminStates.NORMAL);
Time.now() + EXPIRATION_IN_MS, null, AdminStates.NORMAL);
// no change
assertEquals(deadInMaintenance, ns.getNumInMaintenanceDeadDataNodes());
@ -257,7 +257,7 @@ public void testTransitionFromDecommissionedAndExpired() throws IOException {
// Adjust the expiration.
takeNodeOutofService(0, nodeOutofService.getDatanodeUuid(),
Time.monotonicNow() + EXPIRATION_IN_MS, null, AdminStates.NORMAL);
Time.now() + EXPIRATION_IN_MS, null, AdminStates.NORMAL);
cleanupFile(fileSys, file);
}
@ -398,7 +398,7 @@ public void testZeroMinMaintenanceReplicationWithExpiration()
// Adjust the expiration.
takeNodeOutofService(0, nodeOutofService.getDatanodeUuid(),
Time.monotonicNow() + EXPIRATION_IN_MS, null, AdminStates.NORMAL);
Time.now() + EXPIRATION_IN_MS, null, AdminStates.NORMAL);
cleanupFile(fileSys, file);
}

View File

@ -472,7 +472,7 @@ public void testMaintenanceNodes() throws Exception {
// Add the 1st DataNode to Maintenance list
Map<String, Long> maintenanceNodes = new HashMap<>();
maintenanceNodes.put(cluster.getDataNodes().get(0).getDisplayName(),
Time.monotonicNow() + expirationInMs);
Time.now() + expirationInMs);
hostsFileWriter.initOutOfServiceHosts(null, maintenanceNodes);
fsn.getBlockManager().getDatanodeManager().refreshNodes(conf);