Răsfoiți Sursa

HUE-8339 [impala] Adding a config flag to enable the smart Thrift pool

Romain Rigaux 7 ani în urmă
părinte
comite
b661456fc0

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

@@ -106,6 +106,11 @@
   # default value is 2097152 (2 MB), which equals to (2 * 1024 * 1024)
   ## sasl_max_buffer=2097152
 
+  # Hue will try to get the actual host of the Service, even if it resides behind a load balancer.
+  # This will enable an automatic configuration of the service without requiring custom configuration of the service load balancer.
+  # This is available for the Impala service only currently. It is highly recommended to only point to a series of coordinator-only nodes only.
+  # default=false
+
   # Filename of SSL Certificate
   ## ssl_certificate=
 

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

@@ -110,6 +110,11 @@
   # default value is 2097152 (2 MB), which equals to (2 * 1024 * 1024)
   ## sasl_max_buffer=2097152
 
+  # Hue will try to get the actual host of the Service, even if it resides behind a load balancer.
+  # This will enable an automatic configuration of the service without requiring custom configuration of the service load balancer.
+  # This is available for the Impala service only currently. It is highly recommended to only point to a series of coordinator-only nodes only.
+  # default=false
+
   # Filename of SSL Certificate
   ## ssl_certificate=
 

+ 10 - 0
desktop/core/src/desktop/conf.py

@@ -815,6 +815,16 @@ SASL_MAX_BUFFER = Config(
   type=int
 )
 
+ENABLE_SMART_THRIFT_POOL = Config(
+  key="enable_smart_thrift_pool",
+  help=_("Hue will try to get the actual host of the Service, even if it resides behind a load balancer. "
+         "This will enable an automatic configuration of the service without requiring custom configuration of the service load balancer. "
+         "This is available for the Impala service only currently. It is highly recommended to only point to a series of coordinator-only nodes only."),
+  type=coerce_bool,
+  default=False
+)
+
+
 # See python's documentation for time.tzset for valid values.
 TIME_ZONE = Config(
   key="time_zone",

+ 3 - 2
desktop/core/src/desktop/lib/thrift_util.py

@@ -35,7 +35,7 @@ from thrift.protocol.TMultiplexedProtocol import TMultiplexedProtocol
 
 from django.conf import settings
 from django.utils.translation import ugettext as _
-from desktop.conf import SASL_MAX_BUFFER, CHERRYPY_SERVER_THREADS
+from desktop.conf import SASL_MAX_BUFFER, CHERRYPY_SERVER_THREADS, ENABLE_SMART_THRIFT_POOL
 
 from desktop.lib.apputil import WARN_LEVEL_CALL_DURATION_MS, INFO_LEVEL_CALL_DURATION_MS
 from desktop.lib.python_util import create_synchronous_io_multiplexer
@@ -470,7 +470,8 @@ class SuperClient(object):
           logging.debug("Thrift call: %s.%s(args=%s, kwargs=%s)" % (str(self.wrapped.__class__), attr, str_args, repr(kwargs)))
 
           ret = res(*args, **kwargs)
-          if 'http_addr' in repr(ret):
+
+          if ENABLE_SMART_THRIFT_POOL.get() and 'OpenSession' == attr and 'http_addr' in repr(ret):
             coordinator_host = re.search('http_addr\':\ \'(.*:[0-9]{2,})\', \'', repr(ret))
             self.coordinator_host = coordinator_host.group(1)