You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by we...@apache.org on 2019/02/08 00:53:27 UTC

[hadoop] branch branch-3.2 updated: HDFS-14140. JournalNodeSyncer authentication is failing in secure cluster. Contributed by Surendra Singh Lilhore.

This is an automated email from the ASF dual-hosted git repository.

weichiu pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/branch-3.2 by this push:
     new 2501fcd  HDFS-14140. JournalNodeSyncer authentication is failing in secure cluster. Contributed by Surendra Singh Lilhore.
2501fcd is described below

commit 2501fcd26bd7bef2738a8f6660dc63862c755ce3
Author: Surendra Singh Lilhore <su...@apache.org>
AuthorDate: Thu Feb 7 16:43:55 2019 -0800

    HDFS-14140. JournalNodeSyncer authentication is failing in secure cluster. Contributed by Surendra Singh Lilhore.
    
    Signed-off-by: Wei-Chiu Chuang <we...@apache.org>
    (cherry picked from commit 4be87353e35a30d95d8847b09a1890b014bfc6bb)
---
 .../hdfs/qjournal/server/JournalNodeSyncer.java    | 25 +++++++++++++++-------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNodeSyncer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNodeSyncer.java
index 7b3d970..d2b2c9b 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNodeSyncer.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNodeSyncer.java
@@ -38,6 +38,7 @@ import org.apache.hadoop.hdfs.util.DataTransferThrottler;
 import org.apache.hadoop.ipc.ProtobufRpcEngine;
 import org.apache.hadoop.ipc.RPC;
 import org.apache.hadoop.security.SecurityUtil;
+import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.util.Daemon;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -439,15 +440,23 @@ public class JournalNodeSyncer {
     File tmpEditsFile = jnStorage.getTemporaryEditsFile(
         log.getStartTxId(), log.getEndTxId());
 
-    try {
-      Util.doGetUrl(url, ImmutableList.of(tmpEditsFile), jnStorage, false,
-          logSegmentTransferTimeout, throttler);
-    } catch (IOException e) {
-      LOG.error("Download of Edit Log file for Syncing failed. Deleting temp " +
-          "file: " + tmpEditsFile);
-      if (!tmpEditsFile.delete()) {
-        LOG.warn("Deleting " + tmpEditsFile + " has failed");
+    if (!SecurityUtil.doAsLoginUser(() -> {
+      if (UserGroupInformation.isSecurityEnabled()) {
+        UserGroupInformation.getCurrentUser().checkTGTAndReloginFromKeytab();
+      }
+      try {
+        Util.doGetUrl(url, ImmutableList.of(tmpEditsFile), jnStorage, false,
+            logSegmentTransferTimeout, throttler);
+      } catch (IOException e) {
+        LOG.error("Download of Edit Log file for Syncing failed. Deleting temp "
+            + "file: " + tmpEditsFile, e);
+        if (!tmpEditsFile.delete()) {
+          LOG.warn("Deleting " + tmpEditsFile + " has failed");
+        }
+        return false;
       }
+      return true;
+    })) {
       return false;
     }
     LOG.info("Downloaded file " + tmpEditsFile.getName() + " of size " +


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org