Skip to content

Commit

Permalink
[FLINK-37093][table] Fix catalog that failed validation due to no typ…
Browse files Browse the repository at this point in the history
…e still exists in catalogStoreHolder
  • Loading branch information
jiefei30 committed Jan 17, 2025
1 parent d5ee298 commit ab3a228
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,12 @@ public void createCatalog(
throw new CatalogException(format("Catalog %s already exists.", catalogName));
}
} else {
// Store the catalog in the catalog store
catalogStoreHolder.catalogStore().storeCatalog(catalogName, catalogDescriptor);

// Initialize and store the catalog in memory
Catalog catalog = initCatalog(catalogName, catalogDescriptor);
catalog.open();
catalogs.put(catalogName, catalog);
// Store the catalog in the catalog store
catalogStoreHolder.catalogStore().storeCatalog(catalogName, catalogDescriptor);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,19 @@ void testCatalogStore() throws Exception {
false))
.isInstanceOf(CatalogException.class)
.hasMessage("Catalog cat_comment already exists.");
assertThatThrownBy(
() ->
catalogManager.createCatalog(
"cat_no_type",
CatalogDescriptor.of(
"cat_no_type",
new Configuration(),
"catalog without type"),
false))
.isInstanceOf(ValidationException.class)
.hasMessageContaining("Unable to create catalog 'cat_no_type'.");

assertFalse(catalogManager.listCatalogs().contains("cat_no_type"));
assertTrue(catalogManager.getCatalog("cat1").isPresent());
assertTrue(catalogManager.getCatalog("cat2").isPresent());
assertTrue(catalogManager.getCatalog("cat3").isPresent());
Expand Down

0 comments on commit ab3a228

Please sign in to comment.