hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gop...@apache.org
Subject hive git commit: HIVE-17194: JDBC: Implement Gzip compression for HTTP mode (Gopal V, reviewed by Thejas Nair)
Date Fri, 18 Aug 2017 05:29:49 GMT
Repository: hive
Updated Branches:
  refs/heads/master 48be6aecd -> c9e09400f


HIVE-17194: JDBC: Implement Gzip compression for HTTP mode (Gopal V, reviewed by Thejas Nair)


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

Branch: refs/heads/master
Commit: c9e09400ff7f2ca662acfaedf3cbf327efb3d00f
Parents: 48be6ae
Author: Gopal V <gopalv@apache.org>
Authored: Thu Aug 17 22:25:06 2017 -0700
Committer: Gopal V <gopalv@apache.org>
Committed: Thu Aug 17 22:25:06 2017 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/conf/HiveConf.java    |  4 +++-
 .../service/cli/thrift/ThriftHttpCLIService.java | 19 ++++++++++++++++---
 2 files changed, 19 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/c9e09400/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
index 3c158a6..33149d6 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -2430,7 +2430,9 @@ public class HiveConf extends Configuration {
     HIVE_SERVER2_THRIFT_HTTP_REQUEST_HEADER_SIZE("hive.server2.thrift.http.request.header.size",
6*1024,
         "Request header size in bytes, when using HTTP transport mode. Jetty defaults used."),
     HIVE_SERVER2_THRIFT_HTTP_RESPONSE_HEADER_SIZE("hive.server2.thrift.http.response.header.size",
6*1024,
-        "Response header size in bytes, when using HTTP transport mode. Jetty defaults used."),
+        "Response header size in bytes, when using HTTP transport mode. Jetty defaults used."),

+    HIVE_SERVER2_THRIFT_HTTP_COMPRESSION_ENABLED("hive.server2.thrift.http.compression.enabled",
true,
+        "Enable thrift http compression via Jetty compression support"),
 
     // Cookie based authentication when using HTTP Transport
     HIVE_SERVER2_THRIFT_HTTP_COOKIE_AUTH_ENABLED("hive.server2.thrift.http.cookie.auth.enabled",
true,

http://git-wip-us.apache.org/repos/asf/hive/blob/c9e09400/service/src/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java
----------------------------------------------------------------------
diff --git a/service/src/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java
b/service/src/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java
index c4d4e02..828486b 100644
--- a/service/src/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java
+++ b/service/src/java/org/apache/hive/service/cli/thrift/ThriftHttpCLIService.java
@@ -23,6 +23,8 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.TimeUnit;
 
+import javax.ws.rs.HttpMethod;
+
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
 import org.apache.hadoop.hive.shims.ShimLoader;
@@ -42,7 +44,7 @@ import org.eclipse.jetty.server.HttpConfiguration;
 import org.eclipse.jetty.server.HttpConnectionFactory;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.servlet.FilterMapping;
+import org.eclipse.jetty.server.handler.gzip.GzipHandler;
 import org.eclipse.jetty.servlet.ServletContextHandler;
 import org.eclipse.jetty.servlet.ServletHolder;
 import org.eclipse.jetty.util.ssl.SslContextFactory;
@@ -50,6 +52,8 @@ import org.eclipse.jetty.util.thread.ExecutorThreadPool;
 
 
 public class ThriftHttpCLIService extends ThriftCLIService {
+  private static final String APPLICATION_THRIFT = "application/x-thrift";
+
   private final Runnable oomHook;
 
   public ThriftHttpCLIService(CLIService cliService, Runnable oomHook) {
@@ -149,9 +153,18 @@ public class ThriftHttpCLIService extends ThriftCLIService {
         LOG.warn("XSRF filter disabled");
       }
 
-      String httpPath = getHttpPath(hiveConf
+      final String httpPath = getHttpPath(hiveConf
           .getVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_HTTP_PATH));
-      httpServer.setHandler(context);
+
+      if (HiveConf.getBoolVar(hiveConf, ConfVars.HIVE_SERVER2_THRIFT_HTTP_COMPRESSION_ENABLED))
{
+        final GzipHandler gzipHandler = new GzipHandler();
+        gzipHandler.setHandler(context);
+        gzipHandler.addIncludedMethods(HttpMethod.POST);
+        gzipHandler.addIncludedMimeTypes(APPLICATION_THRIFT);
+        httpServer.setHandler(gzipHandler);
+      } else {
+        httpServer.setHandler(context);
+      }
       context.addServlet(new ServletHolder(thriftHttpServlet), httpPath);
 
       // TODO: check defaults: maxTimeout, keepalive, maxBodySize, bodyRecieveDuration, etc.


Mime
View raw message