yuqi1129 commented on code in PR #12350:
URL: https://github.com/apache/gravitino/pull/12350#discussion_r3766438496
##########
core/src/main/java/org/apache/gravitino/storage/relational/service/SchemaMetaService.java:
##########
@@ -227,20 +234,23 @@ public <E extends Entity & HasIdentifier> SchemaEntity
updateSchema(
NameIdentifierUtil.ofSchema(metalakeName, catalogName,
oldSchemaEntity.name()).toString();
boolean isRenamed = !Objects.equals(oldSchemaEntity.name(),
newEntity.name());
- AtomicInteger updateResult = new AtomicInteger(0);
try {
SessionUtils.doMultipleWithCommit(
- () ->
- updateResult.set(
- SessionUtils.getWithoutCommit(
- SchemaMetaMapper.class,
- mapper ->
- ops.updatePO(
- mapper,
-
POConverters.updateSchemaPOWithVersion(oldSchemaPO, newEntity),
- oldSchemaPO))),
() -> {
- if (isRenamed && updateResult.get() > 0) {
+ int updated =
+ SessionUtils.getWithoutCommit(
+ SchemaMetaMapper.class,
+ mapper ->
+ ops.updatePO(
+ mapper,
+
POConverters.updateSchemaPOWithVersion(oldSchemaPO, newEntity),
+ oldSchemaPO));
Review Comment:
This one and L477, L496, and CatalogMetaService:253/429 are the same problem.
The observation is accurate: these fences validate the immediate parent row
by id + name, and an ancestor rename does not change that row.
This is intentional. In Gravitino, entity identity is the ID, and rename
preserves identity — the request resolved metalakeId/catalogId, and after the
rename those ids still denote the same entity, so the write lands on exactly
the entity the caller resolved, just reachable under a new name. Nothing is
orphaned and no update is lost. The anomaly this PR is closing is the different
one where the parent is deleted (or replaced by a same-named entity with a new
id) and a child write would survive it — that case is fenced by the id +
existence check.
--
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]