## Proposed changes bp: #39205 When the catalog attributes have not changed, refreshing the catalog only requires processing the cache, without rebuilding the entire catalog.
This commit is contained in:
@ -76,7 +76,7 @@ public class RefreshManager {
|
||||
private void refreshCatalogInternal(CatalogIf catalog, boolean invalidCache) {
|
||||
String catalogName = catalog.getName();
|
||||
if (!catalogName.equals(InternalCatalog.INTERNAL_CATALOG_NAME)) {
|
||||
((ExternalCatalog) catalog).onRefresh(invalidCache);
|
||||
((ExternalCatalog) catalog).onRefreshCache(invalidCache);
|
||||
LOG.info("refresh catalog {} with invalidCache {}", catalogName, invalidCache);
|
||||
}
|
||||
}
|
||||
|
||||
@ -388,6 +388,15 @@ public abstract class ExternalCatalog
|
||||
synchronized (this.propLock) {
|
||||
this.convertedProperties = null;
|
||||
}
|
||||
|
||||
refreshOnlyCatalogCache(invalidCache);
|
||||
}
|
||||
|
||||
public void onRefreshCache(boolean invalidCache) {
|
||||
refreshOnlyCatalogCache(invalidCache);
|
||||
}
|
||||
|
||||
private void refreshOnlyCatalogCache(boolean invalidCache) {
|
||||
if (useMetaCache.isPresent()) {
|
||||
if (useMetaCache.get() && metaCache != null) {
|
||||
metaCache.invalidateAll();
|
||||
|
||||
@ -126,7 +126,7 @@ public class HiveMetadataOps implements ExternalMetadataOps {
|
||||
catalogDatabase.setProperties(properties);
|
||||
catalogDatabase.setComment(properties.getOrDefault("comment", ""));
|
||||
client.createDatabase(catalogDatabase);
|
||||
catalog.onRefresh(true);
|
||||
catalog.onRefreshCache(true);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
@ -146,7 +146,7 @@ public class HiveMetadataOps implements ExternalMetadataOps {
|
||||
}
|
||||
try {
|
||||
client.dropDatabase(dbName);
|
||||
catalog.onRefresh(true);
|
||||
catalog.onRefreshCache(true);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ public class IcebergMetadataOps implements ExternalMetadataOps {
|
||||
}
|
||||
}
|
||||
nsCatalog.createNamespace(Namespace.of(dbName), properties);
|
||||
dorisCatalog.onRefresh(true);
|
||||
dorisCatalog.onRefreshCache(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -123,7 +123,7 @@ public class IcebergMetadataOps implements ExternalMetadataOps {
|
||||
}
|
||||
SupportsNamespaces nsCatalog = (SupportsNamespaces) catalog;
|
||||
nsCatalog.dropNamespace(Namespace.of(dbName));
|
||||
dorisCatalog.onRefresh(true);
|
||||
dorisCatalog.onRefreshCache(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -121,6 +121,11 @@ public class JdbcExternalCatalog extends ExternalCatalog {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshCache(boolean invalidCache) {
|
||||
onRefresh(invalidCache);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose() {
|
||||
super.onClose();
|
||||
|
||||
Reference in New Issue
Block a user