iting0321 commented on code in PR #5095:
URL: https://github.com/apache/polaris/pull/5095#discussion_r3621909176
##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/transactional/AbstractTransactionalPersistence.java:
##########
@@ -285,6 +285,32 @@ public void deleteEntity(@NonNull PolarisCallContext
callCtx, @NonNull PolarisBa
runActionInTransaction(callCtx, () ->
this.deleteEntityInCurrentTxn(callCtx, entity));
}
+ /** {@inheritDoc} */
+ @Override
+ public void deleteEntityAndCreateEntities(
+ @NonNull PolarisCallContext callCtx,
+ @NonNull PolarisBaseEntity entityToDelete,
+ @NonNull List<PolarisBaseEntity> entitiesToCreate) {
+ runActionInTransaction(
+ callCtx,
+ () -> {
+ this.deleteEntityInCurrentTxn(callCtx, entityToDelete);
+ for (PolarisBaseEntity entityToCreate : entitiesToCreate) {
+ try {
+ this.checkConditionsForWriteEntityInCurrentTxn(callCtx,
entityToCreate, null);
+ } catch (EntityAlreadyExistsException e) {
Review Comment:
Hi @jbonofre, Thanks for your feedback!
I agreed with the points.
I updated the drop path so `EntityAlreadyExistsException` no longer escapes
from `dropEntityIfExists`; cleanup-task name collisions are now translated into
a `DropEntityResult(ENTITY_ALREADY_EXISTS)`.
The same-ID case is still treated as an idempotent retry, while the
same-name/different-ID case is returned as a conflict. I also added the retry
recovery path where, if the entity is already dropped but
`entityCleanup_<entityId>` exists, we return success with the existing cleanup
task ID.
At the service boundary, `ENTITY_ALREADY_EXISTS` is now translated to
`CommitConflictException`, which maps to HTTP 409 for the affected Iceberg and
admin drop paths.
--
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]