Skip to content

Commit

Permalink
[#5252] fix(catalog): fix disable catalog miss invalidate cache (#5258)
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?

 fix disable catalog miss invalidate cache

### Why are the changes needed?

Fix: #5252 

### Does this PR introduce _any_ user-facing change?

no

### How was this patch tested?

tests added

Co-authored-by: mchades <liminghuang@datastrato.com>
  • Loading branch information
github-actions[bot] and mchades authored Oct 25, 2024
1 parent 99addfb commit 659c352
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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

0 comments on commit 659c352

Please sign in to comment.