Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#5252] fix(catalog): fix disable catalog miss invalidate cache #5258

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 @@ -163,17 +163,24 @@ public void testCatalogAvailable() {
catalogName, Catalog.Type.FILESET, "hadoop", "catalog comment", ImmutableMap.of());
Assertions.assertEquals("true", catalog.properties().get(PROPERTY_IN_USE));

// test in-use and can't drop
Exception exception =
Assertions.assertThrows(
CatalogInUseException.class, () -> metalake.dropCatalog(catalogName));
Assertions.assertTrue(
exception.getMessage().contains("please disable it first or use force option"),
exception.getMessage());

// test disable and enable again
Assertions.assertDoesNotThrow(() -> metalake.disableCatalog(catalogName));
Catalog loadedCatalog = metalake.loadCatalog(catalogName);
Assertions.assertEquals("false", loadedCatalog.properties().get(PROPERTY_IN_USE));

Assertions.assertDoesNotThrow(() -> metalake.enableCatalog(catalogName));
loadedCatalog = metalake.loadCatalog(catalogName);
Assertions.assertEquals("true", loadedCatalog.properties().get(PROPERTY_IN_USE));

Assertions.assertDoesNotThrow(() -> metalake.disableCatalog(catalogName));
exception =
Assertions.assertThrows(
CatalogNotInUseException.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,8 @@ public void enableCatalog(NameIdentifier ident)

return newCatalogBuilder.build();
});
catalogCache.invalidate(ident);

} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
Loading