File tree Expand file tree Collapse file tree 4 files changed +15
-9
lines changed
hadoop-hdfs-project/hadoop-hdfs
main/java/org/apache/hadoop/hdfs/server/namenode
test/java/org/apache/hadoop/hdfs/server/namenode Expand file tree Collapse file tree 4 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -299,6 +299,9 @@ Release 2.5.0 - UNRELEASED
299299 HDFS-6173. Move the default processor from Ls to Web in OfflineImageViewer.
300300 (Akira Ajisaka via wheat9)
301301
302+ HDFS-5591. Checkpointing should use monotonic time when calculating period.
303+ (Charles Lamb via wang)
304+
302305Release 2.4.1 - UNRELEASED
303306
304307 INCOMPATIBLE CHANGES
Original file line number Diff line number Diff line change @@ -129,7 +129,9 @@ public String toString() {
129129 return getClass ().getSimpleName () + " Status"
130130 + "\n Name Node Address : " + nameNodeAddr
131131 + "\n Start Time : " + new Date (starttime )
132- + "\n Last Checkpoint Time : " + (lastCheckpointTime == 0 ? "--" : new Date (lastCheckpointTime ))
132+ + "\n Last Checkpoint : " + (lastCheckpointTime == 0 ? "--" :
133+ ((Time .monotonicNow () - lastCheckpointTime ) / 1000 ))
134+ + " seconds ago"
133135 + "\n Checkpoint Period : " + checkpointConf .getPeriod () + " seconds"
134136 + "\n Checkpoint Size : " + StringUtils .byteDesc (checkpointConf .getTxnCount ())
135137 + " (= " + checkpointConf .getTxnCount () + " bytes)"
@@ -376,7 +378,7 @@ public void doWork() {
376378 if (UserGroupInformation .isSecurityEnabled ())
377379 UserGroupInformation .getCurrentUser ().checkTGTAndReloginFromKeytab ();
378380
379- long now = Time .now ();
381+ final long now = Time .monotonicNow ();
380382
381383 if (shouldCheckpointBasedOnCount () ||
382384 now >= lastCheckpointTime + 1000 * checkpointConf .getPeriod ()) {
Original file line number Diff line number Diff line change 1717 */
1818package org .apache .hadoop .hdfs .server .namenode .ha ;
1919
20- import static org .apache .hadoop .util .Time .now ;
20+ import static org .apache .hadoop .util .Time .monotonicNow ;
2121
2222import java .io .IOException ;
2323import java .net .URI ;
@@ -277,14 +277,14 @@ public Object run() {
277277 * prevented
278278 */
279279 private void preventCheckpointsFor (long delayMs ) {
280- preventCheckpointsUntil = now () + delayMs ;
280+ preventCheckpointsUntil = monotonicNow () + delayMs ;
281281 }
282282
283283 private void doWork () {
284284 final long checkPeriod = 1000 * checkpointConf .getCheckPeriod ();
285285 // Reset checkpoint time so that we don't always checkpoint
286286 // on startup.
287- lastCheckpointTime = now ();
287+ lastCheckpointTime = monotonicNow ();
288288 while (shouldRun ) {
289289 boolean needRollbackCheckpoint = namesystem .isNeedRollbackFsImage ();
290290 if (!needRollbackCheckpoint ) {
@@ -302,9 +302,9 @@ private void doWork() {
302302 UserGroupInformation .getCurrentUser ().checkTGTAndReloginFromKeytab ();
303303 }
304304
305- long now = now ();
306- long uncheckpointed = countUncheckpointedTxns ();
307- long secsSinceLast = (now - lastCheckpointTime )/ 1000 ;
305+ final long now = monotonicNow ();
306+ final long uncheckpointed = countUncheckpointedTxns ();
307+ final long secsSinceLast = (now - lastCheckpointTime ) / 1000 ;
308308
309309 boolean needCheckpoint = needRollbackCheckpoint ;
310310 if (needCheckpoint ) {
Original file line number Diff line number Diff line change @@ -62,7 +62,8 @@ public static void shutDownCluster() {
6262 public void testSecondaryWebUi () throws IOException {
6363 String pageContents = DFSTestUtil .urlGet (new URL ("http://localhost:" +
6464 SecondaryNameNode .getHttpAddress (conf ).getPort () + "/status.jsp" ));
65- assertTrue (pageContents .contains ("Last Checkpoint Time" ));
65+ assertTrue ("Didn't find \" Last Checkpoint\" " ,
66+ pageContents .contains ("Last Checkpoint" ));
6667 }
6768
6869 @ Test
You can’t perform that action at this time.
0 commit comments