You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by pu...@apache.org on 2016/01/25 20:53:21 UTC

oozie git commit: OOZIE-2165 Job log fetching can fail in Oozie HA mode when using doAs impersonation

Repository: oozie
Updated Branches:
  refs/heads/master 55171fc09 -> fd3ae27da


OOZIE-2165 Job log fetching can fail in Oozie HA mode when using doAs impersonation


Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/fd3ae27d
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/fd3ae27d
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/fd3ae27d

Branch: refs/heads/master
Commit: fd3ae27da26cc410f02f1b3c580a6de98bf68e2f
Parents: 55171fc
Author: Purshotam Shah <pu...@yahoo-inc.com>
Authored: Mon Jan 25 11:53:02 2016 -0800
Committer: Purshotam Shah <pu...@yahoo-inc.com>
Committed: Mon Jan 25 11:53:02 2016 -0800

----------------------------------------------------------------------
 .../oozie/service/ZKXLogStreamingService.java   | 25 +++++++++++++-------
 release-log.txt                                 |  1 +
 2 files changed, 18 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/fd3ae27d/core/src/main/java/org/apache/oozie/service/ZKXLogStreamingService.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/oozie/service/ZKXLogStreamingService.java b/core/src/main/java/org/apache/oozie/service/ZKXLogStreamingService.java
index 834dbd8..97771ad 100644
--- a/core/src/main/java/org/apache/oozie/service/ZKXLogStreamingService.java
+++ b/core/src/main/java/org/apache/oozie/service/ZKXLogStreamingService.java
@@ -18,13 +18,9 @@
 package org.apache.oozie.service;
 
 import java.io.BufferedReader;
-
-import org.apache.oozie.util.Instrumentable;
-import org.apache.oozie.util.Instrumentation;
-import org.apache.oozie.util.XLogStreamer;
-
 import java.io.IOException;
 import java.io.Writer;
+import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -36,10 +32,13 @@ import org.apache.oozie.ErrorCode;
 import org.apache.oozie.client.OozieClient;
 import org.apache.oozie.client.rest.RestConstants;
 import org.apache.oozie.util.AuthUrlClient;
-import org.apache.oozie.util.XLogFilter;
+import org.apache.oozie.util.Instrumentable;
+import org.apache.oozie.util.Instrumentation;
 import org.apache.oozie.util.SimpleTimestampedMessageParser;
 import org.apache.oozie.util.TimestampedMessageParser;
 import org.apache.oozie.util.XLog;
+import org.apache.oozie.util.XLogFilter;
+import org.apache.oozie.util.XLogStreamer;
 import org.apache.oozie.util.ZKUtils;
 
 /**
@@ -237,8 +236,18 @@ public class ZKXLogStreamingService extends XLogStreamingService implements Serv
                         final String url = otherUrl + "/v" + OozieClient.WS_PROTOCOL_VERSION + "/" + RestConstants.JOB
                                 + "/" + jobId + "?" + RestConstants.JOB_SHOW_PARAM + "=" + logType
                                 + "&" + RestConstants.ALL_SERVER_REQUEST + "=false" + AuthUrlClient.getQueryParamString(params);
-
-                        BufferedReader reader = AuthUrlClient.callServer(url);
+                        // remove doAs from url to avoid failure while fetching
+                        // logs in case of HA mode
+                        String key = "doAs";
+                        String[] value = params.get(key);
+                        String urlWithoutdoAs = null;
+                        if (value != null && value.length > 0 && value[0] != null && value[0].length() > 0) {
+                            urlWithoutdoAs = url.replace("&" + key + "=" + URLEncoder.encode(value[0], "UTF-8"), "");
+                        }
+                        else {
+                            urlWithoutdoAs = url;
+                        }
+                        BufferedReader reader = AuthUrlClient.callServer(urlWithoutdoAs);
                         parsers.add(new SimpleTimestampedMessageParser(reader, filter));
                     }
                     catch(IOException ioe) {

http://git-wip-us.apache.org/repos/asf/oozie/blob/fd3ae27d/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 0804939..c25a82c 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 4.3.0 release (trunk - unreleased)
 
+OOZIE-2165 Job log fetching can fail in Oozie HA mode when using doAs impersonation (satishsaley via puru)
 OOZIE-2430 Add root logger for hive,sqoop action (satishsaley via puru)
 OOZIE-2441 SubWorkflow action with propagate-configuration but no global section throws NPE on submit (rkanter)
 OOZIE-2370 Docs for Coordinator Action Status Notification has wrong property name (eeeva via rkanter)