Skip to content

Commit 2dc4048

Browse files
author
eddy.cao
committed
Fix upload fsimage failure when checkpoint takes a long time
1 parent b6da28f commit 2dc4048

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ void writeTransactionIdFile(StorageDirectory sd, long txid)
472472
* @param time time of the last checkpoint, in millis since the epoch
473473
*/
474474
void setMostRecentCheckpointInfo(long txid, long time) {
475+
LOG.info("setMostRecentCheckpointInfo txid is {}, time is {}", txid, time);
475476
this.mostRecentCheckpointTxId = txid;
476477
this.mostRecentCheckpointTime = time;
477478
}

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/StandbyCheckpointer.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -459,9 +459,10 @@ private void doWork() {
459459
uncheckpointed, checkpointConf.getTxnCount());
460460
needCheckpoint = true;
461461
} else if (secsSinceLast >= checkpointConf.getPeriod()) {
462-
LOG.info("Triggering checkpoint because it has been {} seconds " +
463-
"since the last checkpoint, which exceeds the configured " +
464-
"interval {}", secsSinceLast, checkpointConf.getPeriod());
462+
LOG.info("Triggering checkpoint because it has been {} seconds "
463+
+ "since the last checkpoint, which exceeds the configured "
464+
+ "interval {}, And now is {}, lastCheckpointTime is {}.",
465+
secsSinceLast, checkpointConf.getPeriod(), now, lastCheckpointTime);
465466
needCheckpoint = true;
466467
}
467468

@@ -487,8 +488,9 @@ private void doWork() {
487488
namesystem.setCreatedRollbackImages(true);
488489
namesystem.setNeedRollbackFsImage(false);
489490
}
490-
lastCheckpointTime = now;
491-
LOG.info("Checkpoint finished successfully.");
491+
lastCheckpointTime = monotonicNow();
492+
LOG.info("Checkpoint finished successfully, the lastCheckpointTime is:{}.",
493+
lastCheckpointTime);
492494
}
493495
} catch (SaveNamespaceCancelledException ce) {
494496
LOG.info("Checkpoint was cancelled: {}", ce.getMessage());

0 commit comments

Comments
 (0)