You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ma...@apache.org on 2018/05/02 08:49:16 UTC

carbondata git commit: [CARBONDATA-2406][Dataload] Dictionary Server and Dictionary Client MD5 Validation failed with hive.server2.enable.doAs = true

Repository: carbondata
Updated Branches:
  refs/heads/master 93724ec3a -> cfdde377a


[CARBONDATA-2406][Dataload] Dictionary Server and Dictionary Client MD5 Validation failed with hive.server2.enable.doAs = true

With conf hive.server2.enable.doAs = true, the dictionary server is started with the user who submit the load request. But the dictionary
client run as the user who started the executor process. Due to this dictionary client can not successfully communicate with the dictionary server.

This closes #2232


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

Branch: refs/heads/master
Commit: cfdde377a7890ec41a25eff7ac11413a0b2f0385
Parents: 93724ec
Author: mohammadshahidkhan <mo...@gmail.com>
Authored: Thu Apr 26 16:32:21 2018 +0530
Committer: manishgupta88 <to...@gmail.com>
Committed: Wed May 2 14:22:37 2018 +0530

----------------------------------------------------------------------
 .../server/SecureDictionaryServer.java          | 32 ++++++++++++++++++--
 1 file changed, 29 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/cfdde377/integration/spark-common/src/main/java/org/apache/carbondata/spark/dictionary/server/SecureDictionaryServer.java
----------------------------------------------------------------------
diff --git a/integration/spark-common/src/main/java/org/apache/carbondata/spark/dictionary/server/SecureDictionaryServer.java b/integration/spark-common/src/main/java/org/apache/carbondata/spark/dictionary/server/SecureDictionaryServer.java
index 6dd6581..1e98ec2 100644
--- a/integration/spark-common/src/main/java/org/apache/carbondata/spark/dictionary/server/SecureDictionaryServer.java
+++ b/integration/spark-common/src/main/java/org/apache/carbondata/spark/dictionary/server/SecureDictionaryServer.java
@@ -16,6 +16,9 @@
  */
 package org.apache.carbondata.spark.dictionary.server;
 
+import java.io.IOException;
+import java.security.PrivilegedExceptionAction;
+
 import org.apache.carbondata.common.logging.LogService;
 import org.apache.carbondata.common.logging.LogServiceFactory;
 import org.apache.carbondata.core.constants.CarbonCommonConstants;
@@ -29,6 +32,7 @@ import org.apache.carbondata.core.util.CarbonProperties;
 import com.google.common.collect.Lists;
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.nio.NioEventLoopGroup;
+import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.spark.SecurityManager;
 import org.apache.spark.SparkConf;
 import org.apache.spark.network.TransportContext;
@@ -63,7 +67,18 @@ public class SecureDictionaryServer extends AbstractDictionaryServer implements
     this.conf = conf;
     this.host = host;
     this.port = port;
-    startServer();
+    try {
+      UserGroupInformation.getLoginUser().doAs(new PrivilegedExceptionAction<Void>() {
+        @Override public Void run() throws Exception {
+          startServer();
+          return null;
+        }
+      });
+    } catch (IOException io) {
+      LOGGER.error(io, "Failed to start Dictionary Server in secure mode");
+    } catch (InterruptedException ie) {
+      LOGGER.error(ie, "Failed to start Dictionary Server in secure mode");
+    }
   }
 
   public static synchronized DictionaryServer getInstance(SparkConf conf, String host, int port,
@@ -186,8 +201,19 @@ public class SecureDictionaryServer extends AbstractDictionaryServer implements
   @Override
   public void shutdown() throws Exception {
     LOGGER.info("Shutting down dictionary server");
-    worker.shutdownGracefully();
-    boss.shutdownGracefully();
+    try {
+      UserGroupInformation.getLoginUser().doAs(new PrivilegedExceptionAction<Void>() {
+        @Override public Void run() throws Exception {
+          worker.shutdownGracefully();
+          boss.shutdownGracefully();
+          return null;
+        }
+      });
+    } catch (IOException io) {
+      LOGGER.error(io, "Failed to stop Dictionary Server in secure mode");
+    } catch (InterruptedException ie) {
+      LOGGER.error(ie, "Failed to stop Dictionary Server in secure mode");
+    }
   }
 
   public void initializeDictionaryGenerator(CarbonTable carbonTable) throws Exception {