Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yuqi1129 committed Feb 28, 2025
1 parent 1d181a8 commit 9e11e3e
Showing 1 changed file with 35 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,21 +290,23 @@ public BaseMetalake alterMetalake(NameIdentifier ident, MetalakeChange... change
"Metalake %s is not in use, please enable it first", ident);
}
METALAKE_CACHE.invalidate(ident);
return store.update(
ident,
BaseMetalake.class,
EntityType.METALAKE,
metalake -> {
BaseMetalake.Builder builder = newMetalakeBuilder(metalake);
Map<String, String> newProps =
metalake.properties() == null
? Maps.newHashMap()
: Maps.newHashMap(metalake.properties());
builder = updateEntity(builder, newProps, changes);

return builder.build();
});

BaseMetalake baseMetalake =
store.update(
ident,
BaseMetalake.class,
EntityType.METALAKE,
metalake -> {
BaseMetalake.Builder builder = newMetalakeBuilder(metalake);
Map<String, String> newProps =
metalake.properties() == null
? Maps.newHashMap()
: Maps.newHashMap(metalake.properties());
builder = updateEntity(builder, newProps, changes);

return builder.build();
});
METALAKE_CACHE.put(ident, newMetalakeWithResolvedProperties(baseMetalake));
return baseMetalake;
} catch (NoSuchEntityException ne) {
LOG.warn("Metalake {} does not exist", ident, ne);
throw new NoSuchMetalakeException(METALAKE_DOES_NOT_EXIST_MSG, ident);
Expand Down Expand Up @@ -370,22 +372,24 @@ public void enableMetalake(NameIdentifier ident) throws NoSuchMetalakeException
boolean inUse = metalakeInUse(store, ident);
if (!inUse) {
METALAKE_CACHE.invalidate(ident);
store.update(
ident,
BaseMetalake.class,
EntityType.METALAKE,
metalake -> {
BaseMetalake.Builder builder = newMetalakeBuilder(metalake);

Map<String, String> newProps =
metalake.properties() == null
? Maps.newHashMap()
: Maps.newHashMap(metalake.properties());
newProps.put(PROPERTY_IN_USE, "true");
builder.withProperties(newProps);

return builder.build();
});
BaseMetalake baseMetalake =
store.update(
ident,
BaseMetalake.class,
EntityType.METALAKE,
metalake -> {
BaseMetalake.Builder builder = newMetalakeBuilder(metalake);

Map<String, String> newProps =
metalake.properties() == null
? Maps.newHashMap()
: Maps.newHashMap(metalake.properties());
newProps.put(PROPERTY_IN_USE, "true");
builder.withProperties(newProps);

return builder.build();
});
METALAKE_CACHE.put(ident, newMetalakeWithResolvedProperties(baseMetalake));
}

return null;
Expand Down

0 comments on commit 9e11e3e

Please sign in to comment.