Skip to content

Commit 34d73b4

Browse files
committed
review
1 parent 051114a commit 34d73b4

File tree

1 file changed

+7
-5
lines changed
  • persistence/nosql/persistence/metastore/src/main/java/org/apache/polaris/persistence/nosql/metastore/mutation

1 file changed

+7
-5
lines changed

persistence/nosql/persistence/metastore/src/main/java/org/apache/polaris/persistence/nosql/metastore/mutation/MutationAttempt.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,17 @@ public record MutationAttempt(
8787

8888
private static final Logger LOGGER = LoggerFactory.getLogger(MutationAttempt.class);
8989

90+
/**
91+
* Produces an {@linkplain ObjBase obj instance} that can be used to detect whether an update
92+
* operation results in an actual change or a noop. For this, the entity is mapped to an object,
93+
* but the technical attributes are taken from the existing object.
94+
*/
9095
public static ObjBase objForChangeComparison(
9196
PolarisBaseEntity entity,
9297
Optional<PolarisPrincipalSecrets> currentSecrets,
9398
ObjBase originalObj) {
9499
return mapToObj(entity, currentSecrets)
95-
.updateTimestamp(originalObj.createTimestamp())
100+
.updateTimestamp(originalObj.updateTimestamp())
96101
.id(originalObj.id())
97102
.numParts(originalObj.numParts())
98103
.entityVersion(originalObj.entityVersion())
@@ -355,10 +360,7 @@ private static void applyEntityUpdateMutation(
355360
mutationResults.entityResult(ENTITY_CANNOT_BE_RENAMED);
356361
return;
357362
}
358-
if (!byName.remove(originalNameKey)) {
359-
mutationResults.entityResult(ENTITY_NOT_FOUND);
360-
return;
361-
}
363+
checkState(byName.remove(originalNameKey));
362364

363365
var newNameKey = nameKeyForEntity(entity, byId, mutationResults::entityResult);
364366
if (newNameKey == null) {

0 commit comments

Comments
 (0)