dimas-b commented on code in PR #3334:
URL: https://github.com/apache/polaris/pull/3334#discussion_r2653886815
##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcBasePersistenceImpl.java:
##########
@@ -189,21 +203,10 @@ private void persistEntity(
realmId));
} catch (SQLException e) {
if (datasourceOperations.isConstraintViolation(e)) {
- PolarisBaseEntity existingEntity =
- lookupEntityByName(
- callCtx,
- entity.getCatalogId(),
- entity.getParentId(),
- entity.getTypeCode(),
- entity.getName());
- // This happens in two scenarios:
- // 1. PRIMARY KEY violated
- // 2. UNIQUE CONSTRAINT on (realm_id, catalog_id, parent_id,
type_code, name) violated
- // With SERIALIZABLE isolation, the conflicting entity may _not_ be
visible and
- // existingEntity can be null, which would cause an NPE in
- // EntityAlreadyExistsException.message().
- throw new EntityAlreadyExistsException(
- existingEntity != null ? existingEntity : entity, e);
Review Comment:
Alternatively, we could explicitly start a new Tx for `lookupEntityByName`
only on failure... WDYT?
--
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]