Эх сурвалжийг харах

HUE-9259 [impala] Removing incremental refresh

Romain 5 жил өмнө
parent
commit
cfa2b3c6fa

+ 1 - 0
apps/impala/src/impala/dbms.py

@@ -96,6 +96,7 @@ class ImpalaDbms(HiveServer2Dbms):
     return 'SELECT histogram(%s) FROM %s' % (select_clause, from_clause)
 
 
+  # Deprecated
   def invalidate(self, database=None, table=None, flush_all=False):
     handle = None
 

+ 0 - 1
desktop/core/src/desktop/js/apps/table_browser/app.js

@@ -155,7 +155,6 @@ huePubSub.subscribe('app.dom.loaded', app => {
       })
       .done(entry => {
         entry.clearCache({
-          invalidate: viewModel.source().type === 'impala' ? 'invalidate' : 'cache',
           silenceErrors: true
         });
         hueUtils.replaceURL('?');

+ 7 - 11
desktop/core/src/desktop/js/apps/table_browser/metastoreDatabase.js

@@ -96,17 +96,13 @@ class MetastoreDatabase {
       return;
     }
     // Clear will publish when done
-    this.catalogEntry
-      .clearCache({
-        invalidate: this.catalogEntry.getSourceType() === 'impala' ? 'invalidate' : 'cache'
-      })
-      .then(() => {
-        this.load(
-          () => {},
-          this.metastoreViewModel.optimizerEnabled,
-          this.metastoreViewModel.navigatorEnabled
-        );
-      });
+    this.catalogEntry.clearCache().then(() => {
+      this.load(
+        () => {},
+        this.metastoreViewModel.optimizerEnabled,
+        this.metastoreViewModel.navigatorEnabled
+      );
+    });
   }
 
   load(callback, optimizerEnabled, navigatorEnabled) {

+ 2 - 4
desktop/core/src/desktop/js/apps/table_browser/metastoreNamespace.js

@@ -102,9 +102,7 @@ class MetastoreNamespace {
     if (!this.loading() && this.catalogEntry()) {
       this.loading(true);
       // Clear will publish when done
-      this.catalogEntry().clearCache({
-        invalidate: this.sourceType === 'impala' ? 'invalidate' : 'cache'
-      });
+      this.catalogEntry().clearCache();
     }
   }
 
@@ -158,7 +156,7 @@ class MetastoreNamespace {
         this.setDatabase(foundDatabases[0], callback);
       } else if (clearCacheOnMissing) {
         this.catalogEntry()
-          .clearCache({ invalidate: 'invalidate', silenceErrors: true })
+          .clearCache({ silenceErrors: true })
           .then(() => {
             this.loadDatabases().done(() => {
               whenLoaded(false);

+ 1 - 3
desktop/core/src/desktop/js/apps/table_browser/metastoreTable.js

@@ -380,9 +380,7 @@ class MetastoreTable {
     this.samples.loaded(false);
     this.partitions.loaded(false);
     // Clear will publish when done
-    this.catalogEntry.clearCache({
-      invalidate: this.catalogEntry.getSourceType() === 'impala' ? 'invalidate' : 'cache'
-    });
+    this.catalogEntry.clearCache();
   }
 
   showImportData() {

+ 2 - 33
desktop/core/src/desktop/js/catalog/dataCatalogEntry.js

@@ -306,7 +306,6 @@ class DataCatalogEntry {
    * Resets the entry and clears the cache
    *
    * @param {Object} options
-   * @param {string} [options.invalidate] - 'cache', 'invalidate' or 'invalidateAndFlush', default 'cache', only used for Impala
    * @param {boolean} [options.cascade] - Default false, only used when the entry is for the source
    * @param {boolean} [options.silenceErrors] - Default false
    * @param {string} [options.targetChild] - Optional specific child to invalidate
@@ -319,34 +318,6 @@ class DataCatalogEntry {
       options = {};
     }
 
-    let invalidatePromise;
-    let invalidate = options.invalidate || 'cache';
-
-    if (invalidate !== 'cache' && self.getSourceType() === 'impala') {
-      if (window.IS_K8S_ONLY) {
-        invalidate = 'invalidateAndFlush';
-      }
-      if (self.dataCatalog.invalidatePromise) {
-        invalidatePromise = self.dataCatalog.invalidatePromise;
-      } else {
-        invalidatePromise = apiHelper.invalidateSourceMetadata({
-          sourceType: self.getSourceType(),
-          compute: self.compute,
-          invalidate: invalidate,
-          path: options.targetChild ? self.path.concat(options.targetChild) : self.path,
-          silenceErrors: options.silenceErrors
-        });
-        self.dataCatalog.invalidatePromise = invalidatePromise;
-        invalidatePromise.always(() => {
-          delete self.dataCatalog.invalidatePromise;
-        });
-      }
-    } else {
-      invalidatePromise = $.Deferred()
-        .resolve()
-        .promise();
-    }
-
     if (self.definition && self.definition.optimizerLoaded) {
       delete self.definition.optimizerLoaded;
     }
@@ -356,16 +327,14 @@ class DataCatalogEntry {
       ? self.dataCatalog.clearStorageCascade(self.namespace, self.compute, self.path)
       : self.save();
 
-    const clearPromise = $.when(invalidatePromise, saveDeferred);
-
-    clearPromise.always(() => {
+    saveDeferred.always(() => {
       huePubSub.publish('data.catalog.entry.refreshed', {
         entry: self,
         cascade: !!options.cascade
       });
     });
 
-    return new CancellablePromise(clearPromise, undefined, [invalidatePromise]);
+    return new CancellablePromise(saveDeferred, undefined, []);
   }
 
   /**

+ 1 - 2
desktop/core/src/desktop/js/ko/components/assist/assistDbEntry.js

@@ -52,7 +52,6 @@ class AssistDbEntry {
     self.navigationSettings = navigationSettings;
 
     self.sourceType = assistDbNamespace.sourceType;
-    self.invalidateOnRefresh = assistDbNamespace.invalidateOnRefresh;
 
     self.expandable = self.catalogEntry.hasPossibleChildren();
 
@@ -264,7 +263,7 @@ class AssistDbEntry {
 
   triggerRefresh() {
     const self = this;
-    self.catalogEntry.clearCache({ invalidate: self.invalidateOnRefresh(), cascade: true });
+    self.catalogEntry.clearCache({ cascade: true });
   }
 
   highlightInside(path) {

+ 1 - 2
desktop/core/src/desktop/js/ko/components/assist/assistDbNamespace.js

@@ -63,7 +63,6 @@ class AssistDbNamespace {
     self.loading = ko.observable(false);
     self.reloading = ko.observable(false);
     self.hasErrors = ko.observable(false);
-    self.invalidateOnRefresh = ko.observable('cache');
 
     self.loadingTables = ko.pureComputed(
       () =>
@@ -361,7 +360,7 @@ class AssistDbNamespace {
   triggerRefresh() {
     const self = this;
     if (self.catalogEntry) {
-      self.catalogEntry.clearCache({ invalidate: self.invalidateOnRefresh() });
+      self.catalogEntry.clearCache();
     }
   }
 }

+ 0 - 22
desktop/core/src/desktop/js/ko/components/assist/ko.assistDbPanel.js

@@ -324,21 +324,6 @@ const TEMPLATE =
     &nbsp;<a class="pull-right pointer close-popover inactive-action">&times;</a>
   </script>
 
-  <script type="text/html" id="ask-for-invalidate-content">
-    <label class="radio">
-      <input type="radio" name="refreshImpala" value="cache" data-bind="checked: invalidateOnRefresh" />
-      ${I18n('Clear cache')}
-    </label>
-    <label class="radio">
-      <input type="radio" name="refreshImpala" value="invalidate" data-bind="checked: invalidateOnRefresh" />
-      ${I18n('Perform incremental metadata update.')}
-    </label>
-    <div class="assist-invalidate-description">${I18n('This will sync missing tables.')}</div>
-    <div style="width: 100%; display: inline-block; margin-top: 5px;"><button class="pull-right btn btn-primary" data-bind="css: { 'btn-primary': invalidateOnRefresh() !== 'invalidateAndFlush', 'btn-danger': invalidateOnRefresh() === 'invalidateAndFlush' }, click: function (data, event) { huePubSub.publish('close.popover'); triggerRefresh(data, event); }, clickBubble: false">${I18n(
-      'Refresh'
-    )}</button></div>
-  </script>
-
   <script type="text/html" id="assist-namespace-header-actions">
     <div class="assist-db-header-actions">
       <!-- ko ifnot: loading -->
@@ -380,17 +365,10 @@ const TEMPLATE =
         <i class="pointer fa fa-plus" title="${I18n('Create index')}"></i>
       </a>
       <!-- /ko -->
-      <!-- ko if: sourceType === 'impala' -->
-      <a class="inactive-action" href="javascript:void(0)" data-bind="templatePopover : { contentTemplate: 'ask-for-invalidate-content', titleTemplate: 'ask-for-invalidate-title', trigger: 'click', minWidth: '320px' }"><i class="pointer fa fa-refresh" data-bind="css: { 'fa-spin blue' : loading }" title="${I18n(
-        'Refresh'
-      )}"></i></a>
-      <!-- /ko -->
-      <!-- ko if: sourceType !== 'impala' -->
       <a class="inactive-action" href="javascript:void(0)" data-bind="click: triggerRefresh"><i class="pointer fa fa-refresh" data-bind="css: { 'fa-spin blue' : loading }" title="${I18n(
         'Refresh'
       )}"></i></a>
       <!-- /ko -->
-      <!-- /ko -->
       <!-- ko if: loading -->
       <i class="fa fa-refresh fa-spin blue" title="${I18n('Refresh')}"></i>
       <!-- /ko -->

+ 1 - 1
desktop/core/src/desktop/js/ko/components/contextPopover/dataCatalogContext.js

@@ -80,7 +80,7 @@ class DataCatalogContext {
     const self = this;
     self
       .catalogEntry()
-      .clearCache({ invalidate: 'invalidate', cascade: true })
+      .clearCache({ cascade: true })
       .always(self.load.bind(self));
   }
 

+ 1 - 1
desktop/core/src/desktop/js/ko/components/ko.historyPanel.js

@@ -280,7 +280,7 @@ class HistoryPanel {
                       path: []
                     })
                     .done(entry => {
-                      entry.clearCache({ invalidate: 'cache', cascade: true, silenceErrors: true });
+                      entry.clearCache({ cascade: true, silenceErrors: true });
                     });
                 } else if (notebook.onSuccessUrl()) {
                   huePubSub.publish(notebook.pubSubUrl());

+ 0 - 1
desktop/core/src/desktop/templates/global_js_constants.mako

@@ -449,7 +449,6 @@
     'Partition key': '${ _('Partition key') }',
     'Partitions': '${ _('Partitions') }',
     'Password': '${ _('Password') }',
-    'Perform incremental metadata update.': '${ _('Perform incremental metadata update.') }',
     'Permissions': '${ _('Permissions') }',
     'Pie Chart': '${ _('Pie Chart') }',
     'Pig Design': '${_('Pig Design')}',

+ 1 - 1
desktop/libs/indexer/src/indexer/templates/importer.mako

@@ -2862,7 +2862,7 @@ ${ commonheader(_("Importer"), "indexer", user, request, "60px") | n,unicode }
                       if (match) {
                         var db = match[1];
                         dataCatalog.getEntry({ sourceType: snippet.type(), connector: connector, namespace: self.namespace(), compute: self.compute(), path: [ db ]}).done(function (dbEntry) {
-                          dbEntry.clearCache({ invalidate: 'invalidate', silenceErrors: true }).done(function () {
+                          dbEntry.clearCache({ silenceErrors: true }).done(function () {
                             huePubSub.publish('open.link', self.editorVM.selectedNotebook().onSuccessUrl());
                           })
                         });