Fix HBase integration (asasvari, gezapeti)

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

Branch: refs/heads/branch-4.3
Commit: c8c04d2037186c187b83e71545b633e6cfcfedbf
Parents: cec2db5
Author: Gezapeti Cseh <gezap...@apache.org>
Authored: Mon Feb 5 12:47:18 2018 +0100
Committer: Gezapeti Cseh <gezap...@apache.org>
Committed: Mon Feb 5 12:55:32 2018 +0100

----------------------------------------------------------------------
 .../oozie/action/hadoop/HbaseCredentials.java   |  5 ++++
 .../oozie/action/hadoop/JavaActionExecutor.java | 14 ++++++++++++
 .../main/resources/oozie-hbase-client-site.xml  | 24 ++++++++++++++++++++
 3 files changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/c8c04d20/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java 
b/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java
index 307f565..2f7092c 100644
--- a/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java
+++ b/core/src/main/java/org/apache/oozie/action/hadoop/HbaseCredentials.java
@@ -44,7 +44,12 @@ import org.apache.hadoop.security.token.TokenIdentifier;
  *
  */
 public class HbaseCredentials extends Credentials {
+    static final String OOZIE_HBASE_CLIENT_SITE_XML = 
"oozie-hbase-client-site.xml";
+    static final String HBASE_USE_DYNAMIC_JARS = "hbase.dynamic.jars.dir";
 
+    static {
+        Configuration.addDefaultResource(OOZIE_HBASE_CLIENT_SITE_XML);
+    }
 
     /* (non-Javadoc)
      * @see 
org.apache.oozie.action.hadoop.Credentials#addtoJobConf(org.apache.hadoop.mapred.JobConf,
 org.apache.oozie.action.hadoop.CredentialsProperties, 
org.apache.oozie.action.ActionExecutor.Context)

http://git-wip-us.apache.org/repos/asf/oozie/blob/c8c04d20/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java 
b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
index 50577fd..7d957bc 100644
--- a/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
+++ b/core/src/main/java/org/apache/oozie/action/hadoop/JavaActionExecutor.java
@@ -1135,6 +1135,9 @@ public class JavaActionExecutor extends ActionExecutor {
 
             JobConf launcherJobConf = createLauncherConf(actionFs, context, 
action, actionXml, actionConf);
 
+            removeHBaseSettingFromOozieDefaultResource(launcherJobConf);
+            removeHBaseSettingFromOozieDefaultResource(actionConf);
+
             LOG.debug("Creating Job Client for action " + action.getId());
             jobClient = createJobClient(context, launcherJobConf);
             String launcherId = 
LauncherMapperHelper.getRecoveryId(launcherJobConf, context.getActionDir(), 
context
@@ -1216,6 +1219,17 @@ public class JavaActionExecutor extends ActionExecutor {
             }
         }
     }
+
+    private void removeHBaseSettingFromOozieDefaultResource(final 
Configuration jobConf) {
+        final String[] propertySources = 
jobConf.getPropertySources(HbaseCredentials.HBASE_USE_DYNAMIC_JARS);
+        if (propertySources != null && propertySources.length > 0 &&
+                
propertySources[0].contains(HbaseCredentials.OOZIE_HBASE_CLIENT_SITE_XML)) {
+            jobConf.unset(HbaseCredentials.HBASE_USE_DYNAMIC_JARS);
+            LOG.debug(String.format("Unset [%s] inserted from default Oozie 
resource XML [%s]",
+                    HbaseCredentials.HBASE_USE_DYNAMIC_JARS, 
HbaseCredentials.OOZIE_HBASE_CLIENT_SITE_XML));
+        }
+    }
+
     private boolean needInjectCredentials() {
         boolean methodExists = true;
 

http://git-wip-us.apache.org/repos/asf/oozie/blob/c8c04d20/core/src/main/resources/oozie-hbase-client-site.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/oozie-hbase-client-site.xml 
b/core/src/main/resources/oozie-hbase-client-site.xml
new file mode 100644
index 0000000..cc67f9e
--- /dev/null
+++ b/core/src/main/resources/oozie-hbase-client-site.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<configuration>
+    <property>
+        <name>hbase.use.dynamic.jars</name>
+        <value>false</value>
+    </property>
+</configuration>

Reply via email to