Browse Source

HDFS-3918. EditLogTailer shouldn't log WARN when other node is in standby mode. Contributed by Todd Lipcon.

(cherry picked from commit cce66ba3c9ec293e8ba1afd0eb518c7ca0bbc7c9)
Harsh J 10 years ago
parent
commit
32766b6563

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -8,6 +8,9 @@ Release 2.8.0 - UNRELEASED
 
   IMPROVEMENTS
 
+    HDFS-3918. EditLogTailer shouldn't log WARN when other node
+    is in standby mode (todd via harsh)
+
     HDFS-4396. Add START_MSG/SHUTDOWN_MSG for ZKFC
     (Liang Xie via harsh)
 

+ 11 - 0
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/EditLogTailer.java

@@ -42,6 +42,8 @@ import org.apache.hadoop.hdfs.server.namenode.FSNamesystem;
 import org.apache.hadoop.hdfs.server.namenode.NameNode;
 import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocol;
 import org.apache.hadoop.ipc.RPC;
+import org.apache.hadoop.ipc.RemoteException;
+import org.apache.hadoop.ipc.StandbyException;
 import org.apache.hadoop.security.SecurityUtil;
 
 import static org.apache.hadoop.util.Time.monotonicNow;
@@ -273,6 +275,15 @@ public class EditLogTailer {
       getActiveNodeProxy().rollEditLog();
       lastRollTriggerTxId = lastLoadedTxnId;
     } catch (IOException ioe) {
+      if (ioe instanceof RemoteException) {
+        ioe = ((RemoteException)ioe).unwrapRemoteException();
+        if (ioe instanceof StandbyException) {
+          LOG.info("Skipping log roll. Remote node is not in Active state: " +
+              ioe.getMessage().split("\n")[0]);
+          return;
+        }
+      }
+
       LOG.warn("Unable to trigger a roll of the active NN", ioe);
     }
   }