From 5e5e693a0a3591538e142ca9bf8d0af24cb4db68 Mon Sep 17 00:00:00 2001 From: Andrew Wang Date: Thu, 29 Oct 2015 11:30:47 -0700 Subject: [PATCH] HDFS-9332. Fix Precondition failures from NameNodeEditLogRoller while saving namespace. (cherry picked from commit 888c6245e20ba6bdaa57d16b5c62b4a9eda2cdaf) --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 13994099cbf..52775a8e958 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1361,6 +1361,9 @@ Release 2.8.0 - UNRELEASED HDFS-9044. Give Priority to FavouredNodes , before selecting nodes from FavouredNode's Node Group (J.Andreina via vinayakumarb) + HDFS-9332. Fix Precondition failures from NameNodeEditLogRoller while + saving namespace. (wang) + Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index 72d6dfe6323..2c09a2b888f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -3674,9 +3674,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, public void run() { while (fsRunning && shouldRun) { try { - FSEditLog editLog = getFSImage().getEditLog(); - long numEdits = - editLog.getLastWrittenTxId() - editLog.getCurSegmentTxId(); + long numEdits = getTransactionsSinceLastLogRoll(); if (numEdits > rollThreshold) { FSNamesystem.LOG.info("NameNode rolling its own edit log because" + " number of edits in open segment exceeds threshold of "