浏览代码

HUE-2277 [beeswax] Make Thrift protocol version configurable

Suhas Satish 11 年之前
父节点
当前提交
62f74cf

+ 4 - 1
apps/beeswax/gen-py/TCLIService/ttypes.py

@@ -2665,7 +2665,10 @@ class TOpenSessionReq(object):
     iprot.readStructEnd()
 
   def write(self, oprot):
-    self.client_protocol = 4
+    # This is wrong, because the user can't specify the version as it is always overwritten before
+    # serializing and sent over wire.
+    # self.client_protocol = 4
+
     if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
       oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
       return

+ 7 - 0
apps/beeswax/src/beeswax/conf.py

@@ -79,6 +79,13 @@ CLOSE_QUERIES = Config(
   default=False
 )
 
+THRIFT_VERSION = Config(
+  key="thrift_version",
+  help=_t("Thrift version to use when communicating with HiveServer2"),
+  type=int,
+  default=5
+)
+
 SSL = ConfigSection(
   key='ssl',
   help=_t('SSL configuration for the server.'),

+ 1 - 0
apps/beeswax/src/beeswax/server/hive_server2_lib.py

@@ -371,6 +371,7 @@ class HiveServerClient:
 
   def open_session(self, user):
     kwargs = {
+        'client_protocol': beeswax_conf.THRIFT_VERSION.get() - 1,
         'username': user.username, # If SASL or LDAP, it gets the username from the authentication mechanism" since it dependents on it.
         'configuration': {},
     }

+ 3 - 0
desktop/conf.dist/hue.ini

@@ -725,6 +725,9 @@
   # This will free all the query resources in HiveServer2, but also make its results inaccessible.
   ## close_queries=false
 
+  # Thrift version to use when communicating with HiveServer2
+  ## thrift_version=5
+
   [[ssl]]
     # SSL communication enabled for this server.
     ## enabled=false

+ 3 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -732,6 +732,9 @@
   # This will free all the query resources in HiveServer2, but also make its results inaccessible.
   ## close_queries=false
 
+  # Thrift version to use when communicating with HiveServer2
+  ## thrift_version=5
+
   [[ssl]]
     # SSL communication enabled for this server.
     ## enabled=false