HDFS-11292. log lastWrittenTxId etc info in logSyncAll. Contributed by Yongjun Zhang.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/603cbcd5 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/603cbcd5 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/603cbcd5 Branch: refs/heads/YARN-5734 Commit: 603cbcd513a74c29e0e4ec9dc181ff08887d64a4 Parents: 0a212a4 Author: Yongjun Zhang <yzh...@cloudera.com> Authored: Mon Jan 9 15:44:42 2017 -0800 Committer: Yongjun Zhang <yzh...@cloudera.com> Committed: Mon Jan 9 15:44:42 2017 -0800 ---------------------------------------------------------------------- .../hadoop/hdfs/server/namenode/FSEditLog.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/603cbcd5/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java index c9ee32b..8454a46 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java @@ -596,7 +596,15 @@ public class FSEditLog implements LogsPurgeable { */ void logSyncAll() { // Make sure we're synced up to the most recent transaction ID. - logSync(getLastWrittenTxId()); + long lastWrittenTxId = getLastWrittenTxId(); + LOG.info("logSyncAll toSyncToTxId=" + lastWrittenTxId + + " lastSyncedTxid=" + synctxid + + " mostRecentTxid=" + txid); + logSync(lastWrittenTxId); + lastWrittenTxId = getLastWrittenTxId(); + LOG.info("Done logSyncAll lastWrittenTxId=" + lastWrittenTxId + + " lastSyncedTxid=" + synctxid + + " mostRecentTxid=" + txid); } /** @@ -1358,7 +1366,8 @@ public class FSEditLog implements LogsPurgeable { * Transitions from IN_SEGMENT state to BETWEEN_LOG_SEGMENTS state. */ public synchronized void endCurrentLogSegment(boolean writeEndTxn) { - LOG.info("Ending log segment " + curSegmentTxId); + LOG.info("Ending log segment " + curSegmentTxId + + ", " + getLastWrittenTxId()); Preconditions.checkState(isSegmentOpen(), "Bad state: %s", state); @@ -1372,7 +1381,10 @@ public class FSEditLog implements LogsPurgeable { printStatistics(true); final long lastTxId = getLastWrittenTxId(); - + final long lastSyncedTxId = getSyncTxId(); + Preconditions.checkArgument(lastTxId == lastSyncedTxId, + "LastWrittenTxId %s is expected to be the same as lastSyncedTxId %s", + lastTxId, lastSyncedTxId); try { journalSet.finalizeLogSegment(curSegmentTxId, lastTxId); editLogStream = null; --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org