Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void replayRefreshCatalog(CatalogLog log) {
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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,15 @@ public void onRefresh(boolean invalidCache) {
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void createDb(CreateDbStmt stmt) throws DdlException {
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);
}
Expand All @@ -146,7 +146,7 @@ public void dropDb(DropDbStmt stmt) throws DdlException {
}
try {
client.dropDatabase(dbName);
catalog.onRefresh(true);
catalog.onRefreshCache(true);
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void createDb(CreateDbStmt stmt) throws DdlException {
}
}
nsCatalog.createNamespace(Namespace.of(dbName), properties);
dorisCatalog.onRefresh(true);
dorisCatalog.onRefreshCache(true);
}

@Override
Expand All @@ -123,7 +123,7 @@ public void dropDb(DropDbStmt stmt) throws DdlException {
}
SupportsNamespaces nsCatalog = (SupportsNamespaces) catalog;
nsCatalog.dropNamespace(Namespace.of(dbName));
dorisCatalog.onRefresh(true);
dorisCatalog.onRefreshCache(true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ public void onRefresh(boolean invalidCache) {
}
}

@Override
public void onRefreshCache(boolean invalidCache) {
onRefresh(invalidCache);
}

@Override
public void onClose() {
super.onClose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,7 @@ public void testRefreshCatalogLastUpdateTime() throws Exception {
} catch (Exception e) {
// Do nothing
}
Assertions.assertFalse(((ExternalCatalog) test2).isInitialized());
table.makeSureInitialized();
Assertions.assertTrue(((ExternalCatalog) test2).isInitialized());
// table.makeSureInitialized() triggered init method
long l4 = test2.getLastUpdateTime();
Assertions.assertTrue(l4 > l3);
try {
DdlExecutor.execute(Env.getCurrentEnv(), refreshCatalogStmt);
} catch (Exception e) {
// Do nothing
}
Assertions.assertFalse(((ExternalCatalog) test2).isInitialized());
}

public static class RefreshCatalogProvider implements TestExternalCatalog.TestCatalogProvider {
Expand Down