yuqi1129 commented on code in PR #9574:
URL: https://github.com/apache/gravitino/pull/9574#discussion_r2652476538
##########
core/src/main/java/org/apache/gravitino/catalog/CatalogManager.java:
##########
@@ -591,6 +573,44 @@ public void enableCatalog(NameIdentifier ident)
});
}
+ public void updateCatalogProperty(
+ NameIdentifier nameIdentifier, String propertyKey, String propertyValue)
{
+ try {
+ store.update(
+ nameIdentifier,
+ CatalogEntity.class,
+ EntityType.CATALOG,
+ catalog -> {
+ CatalogEntity.Builder newCatalogBuilder =
+ newCatalogBuilder(nameIdentifier.namespace(), catalog);
+
+ Map<String, String> newProps =
+ catalog.getProperties() == null
+ ? new HashMap<>()
+ : new HashMap<>(catalog.getProperties());
+ newProps.put(propertyKey, propertyValue);
+ newCatalogBuilder.withProperties(newProps);
+
+ return newCatalogBuilder.build();
+ });
+ catalogCache.invalidate(nameIdentifier);
+
+ } catch (NoSuchCatalogException e) {
+ LOG.error("Catalog {} does not exist", nameIdentifier, e);
+ throw new RuntimeException(e);
+ } catch (IllegalArgumentException e) {
+ LOG.error(
+ "Failed to update catalog {} property {} with unknown change",
+ nameIdentifier,
+ propertyKey,
+ e);
+ throw e;
+ } catch (IOException ioe) {
+ LOG.error("Failed to update catalog {} property {}", nameIdentifier,
propertyKey, ioe);
+ throw new RuntimeException(ioe);
+ }
+ }
Review Comment:
fix
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]