浏览代码

HUE-5691 [metadata] Parameterize search fetch call limits

Romain Rigaux 8 年之前
父节点
当前提交
df2d781

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

@@ -1584,4 +1584,11 @@
     ## auth_password_script=
 
     # Perform Sentry privilege filtering.
+    # Default to true automatically if the cluster is secure.
     ## apply_sentry_permissions=False
+
+    # Max number of items to fetch in one call in object search.
+    ## fetch_size_search=450
+
+    # Max number of items to fetch in one call in object search autocomplete.
+    ## fetch_size_search_interactive=450

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

@@ -1588,4 +1588,11 @@
     ## auth_password_script=
 
     # Perform Sentry privilege filtering.
+    # Default to true automatically if the cluster is secure.
     ## apply_sentry_permissions=False
+
+    # Max number of items to fetch in one call in object search.
+    ## fetch_size_search=450
+
+    # Max number of items to fetch in one call in object search autocomplete.
+    ## fetch_size_search_interactive=450

+ 13 - 1
desktop/libs/metadata/src/metadata/conf.py

@@ -174,10 +174,22 @@ NAVIGATOR = ConfigSection(
     ),
     APPLY_SENTRY_PERMISSIONS = Config(
       key="apply_sentry_permissions",
-      help=_t("Perform Sentry privilege filtering."),
+      help=_t("Perform Sentry privilege filtering. Default to true automatically if the cluster is secure."),
       dynamic_default=get_security_default,
       type=coerce_bool
     ),
+    FETCH_SIZE_SEARCH = Config(
+      key="fetch_size_search",
+      help=_t("Max number of items to fetch in one call in object search."),
+      default=450,
+      type=int
+    ),
+    FETCH_SIZE_SEARCH_INTERACTIVE = Config(
+      key="fetch_size_search_interactive",
+      help=_t("Max number of items to fetch in one call in object search autocomplete."),
+      default=450,
+      type=int
+    ),
   )
 )
 

+ 2 - 2
desktop/libs/metadata/src/metadata/navigator_client.py

@@ -138,7 +138,7 @@ class NavigatorApi(object):
       params += (
         ('query', filter_query),
         ('offset', offset),
-        ('limit', limit),
+        ('limit', NAVIGATOR.FETCH_SIZE_SEARCH.get()),
       )
 
       LOG.info(params)
@@ -157,7 +157,7 @@ class NavigatorApi(object):
     try:
       pagination = {
         'offset': offset,
-        'limit': limit,
+        'limit': NAVIGATOR.FETCH_SIZE_SEARCH_INTERACTIVE.get(),
       }
 
       entity_types = []