You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polaris.apache.org by "eric-maynard (via GitHub)" <gi...@apache.org> on 2024/09/03 18:25:33 UTC
[PR] When a grant already exists, return the appropriate response [polaris]
eric-maynard opened a new pull request, #243:
URL: https://github.com/apache/polaris/pull/243
# Description
In the event that the persistence layer fails due to a primary key conflict, we should translate this to an AlreadyExistException which maps to response 409. Currently, we are returning a 500.
Fixes #226
## Type of change
Please delete options that are not relevant.
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] Documentation update
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update
# How Has This Been Tested?
As we don't have a robust test setup for eclipselink-backed Polaris currently, I manually tested with the following setup:
```
<property name="jakarta.persistence.jdbc.url"
value="jdbc:postgresql://localhost:5432/db"/>
<property name="jakarta.persistence.jdbc.user" value="polaris"/>
<property name="jakarta.persistence.jdbc.password" value="test"/>
<property name="jakarta.persistence.schema-generation.database.action" value="create"/>
<property name="eclipselink.logging.level.sql" value="FINE"/>
<property name="eclipselink.logging.parameters" value="true"/>
<property name="eclipselink.persistence-context.flush-mode" value="auto"/>
```
I then created a duplicate grant:
```
./polaris \
--access-token 'principal:root;realm:default-realm' \
catalogs \
create example_catalog \
--storage-type file \
--default-base-location 'file:///tmp/example'
./polaris \
--access-token 'principal:root;realm:default-realm' \
principals \
create \
example_user
./polaris \
--access-token 'principal:root;realm:default-realm' \
principal-roles \
create \
example_user_role
./polaris \
--access-token 'principal:root;realm:default-realm' \
principal-roles \
grant \
--principal example_user \
example_user_role
./polaris \
--access-token 'principal:root;realm:default-realm' \
principal-roles \
grant \
--principal example_user \
example_user_role
```
This PR fixes the 500 and causes Polaris to return a 409:
```
./polaris \
> --access-token 'principal:root;realm:default-realm' \
> principal-roles \
> grant \
> --principal example_user \
> example_user_role
Exception when communicating with the Polaris server. AlreadyExistsException: Grant already exists
```
# Checklist:
Please delete options that are not relevant.
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] My changes generate no new warnings
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1776302020
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +260,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new AlreadyExistsException(e, "Duplicate key error when persisting entity");
Review Comment:
IIRC from our offline discussion the dependency required to do that doesn't exist and we didn't want to add eclipse-link specific dependencies to the service or core modules. Rather, I would be supportive of each module potentially bringing its own exception mapper.
Of course, I think anything is better than a 500. The important thing is that we don't change the client-facing exception. We can always change the type here used to map to that exception
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1746652748
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +259,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new IllegalStateException("Duplicate key error when persisting entity", e);
Review Comment:
It seems that `jakarta.ws.rs.WebApplicationException` is also not available in `polaris-eclipselink` right now. So the same dependency mismatch issue as with `PersistenceException` / `AlreadyExistsException`.
I have tightened the catch to reduce the likelihood that a different `IllegalStateException` gets caught here, but I agree that ideally we could just throw a mapped exception here.
Perhaps we can add a new exception mapper? Or should we just add a dependency so this can throw `AlreadyExistsException`?
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1775706941
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +260,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new AlreadyExistsException(e, "Duplicate key error when persisting entity");
Review Comment:
It's not a `EntityExistsException` unfortunately.
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "aihuaxu (via GitHub)" <gi...@apache.org>.
aihuaxu commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1774070188
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +260,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new AlreadyExistsException(e, "Duplicate key error when persisting entity");
Review Comment:
Do we throw `jakarta.persistence.EntityExistsException` here or general PersistenceException?
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1742512814
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +259,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new IllegalStateException("Duplicate key error when persisting entity", e);
Review Comment:
`PersistenceException` is not visible in the service, and Iceberg's `AlreadyExistsException` is not visible here. It might be ideal to introduce our own exception mapper with our own exceptions kept in polaris-core, but that's a big migration.
For now, I'm using this `IllegalStateException` to negotiate between the two exception types.
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "dennishuo (via GitHub)" <gi...@apache.org>.
dennishuo commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1746609767
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +259,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new IllegalStateException("Duplicate key error when persisting entity", e);
Review Comment:
It looks like we do already have some specializations for specific jakarta exceptions in [IcebergExceptionMapper](https://github.com/apache/polaris/blob/8f14363abc42ea6d95b67bc407f825b0af9bb4f6/polaris-service/src/main/java/org/apache/polaris/service/IcebergExceptionMapper.java#L71) such as for:
case jakarta.ws.rs.ForbiddenException e -> Response.Status.FORBIDDEN.getStatusCode();
There's also a kind of catch-all for:
case WebApplicationException e -> e.getResponse().getStatus();
To avoid throwing a 500 `INTERNAL_SERVER_ERROR` maybe we can either throw `jakarta.persistence.EntityExistsException` here and add a case there to translate that into `CONFLICT` or we could throw a generic `WebApplicationException` here with `CONFLICT` status code already set.
##########
polaris-service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java:
##########
@@ -505,20 +515,23 @@ public Response addGrantToCatalogRole(
catalogName, catalogRoleName, Namespace.of(namespaceParts), privilege);
break;
}
- case CatalogGrant catalogGrant:
+ case CatalogGrant catalogGrant:
{
PolarisPrivilege privilege =
PolarisPrivilege.valueOf(catalogGrant.getPrivilege().toString());
adminService.grantPrivilegeOnCatalogToRole(catalogName, catalogRoleName, privilege);
break;
}
- default:
- LOGGER
- .atWarn()
- .addKeyValue("catalog", catalogName)
- .addKeyValue("role", catalogRoleName)
- .log("Don't know how to handle privilege grant: {}", grantRequest);
- return Response.status(Response.Status.BAD_REQUEST).build();
+ default:
+ LOGGER
+ .atWarn()
+ .addKeyValue("catalog", catalogName)
+ .addKeyValue("role", catalogRoleName)
+ .log("Don't know how to handle privilege grant: {}", grantRequest);
+ return Response.status(Response.Status.BAD_REQUEST).build();
+ }
+ } catch (IllegalStateException e) {
+ throw new AlreadyExistsException("Grant already exists or resolution failed");
Review Comment:
If we throw `jakarta.persistence.EntityExistsException` instead we won't need to assume that `IlegalStateException` should translate to `AlreadyExistsException`. In particular, some elements of the MetaStoreManger very well may throw `IllegalStateException` for true illegal states that are server errors and wouldn't make sense to translate into `AlreadyExistsException`.
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1746647160
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +259,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new IllegalStateException("Duplicate key error when persisting entity", e);
Review Comment:
I like the idea of using `jakarta.persistence.EntityExistsException` but it seems like that dependency might not be there yet. I will try the latter approach.
<img width="400" alt="Screenshot 2024-09-06 at 12 38 38 AM" src="https://github.com/user-attachments/assets/999b1ea1-f3ea-4cca-8a93-25a2c70ee1d0">
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "dennishuo (via GitHub)" <gi...@apache.org>.
dennishuo commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1747765662
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +259,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new IllegalStateException("Duplicate key error when persisting entity", e);
Review Comment:
If the problem is that `IcebergExceptionMapper` can't see `jakarta.persistence`, I think it's reasonable to include `jakarta.persistence` as a dependency there in `polaris-service`.
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "RussellSpitzer (via GitHub)" <gi...@apache.org>.
RussellSpitzer commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1772065245
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +260,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new AlreadyExistsException(e, "Duplicate key error when persisting entity");
Review Comment:
Why do we want to throw an Iceberg exception here? This is polaris only right?
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1776349699
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +260,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new AlreadyExistsException(e, "Duplicate key error when persisting entity");
Review Comment:
What do you think of letting modules bring their own exception mapper? I feel like that gives us the best of both words: good dependency hygiene and extensibility as new modules introduce new exceptions.
If you think that could work, I'll file an issue and then maybe merge this as-is. Otherwise, I can just add this dependency now too.
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "dennishuo (via GitHub)" <gi...@apache.org>.
dennishuo commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1776300626
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +260,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new AlreadyExistsException(e, "Duplicate key error when persisting entity");
Review Comment:
I'd prefer adding the mapping to `IcebergExceptionMapper` and explicitly throwing `jakarta.persistence.EntityExistsException` here. Even though we have some loose leaking between jakarta exceptions vs Iceberg exceptions in some places it'll be nice to start segmenting them better depending on whether the code is agnostic to Iceberg.
Classes that implement Iceberg interfaces directly should stick to Iceberg exceptions, and ideally the metastore layer can be kept as Iceberg-agnostic as possible.
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "dennishuo (via GitHub)" <gi...@apache.org>.
dennishuo commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1776342307
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +260,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new AlreadyExistsException(e, "Duplicate key error when persisting entity");
Review Comment:
Oh I see, didn't realize we hadn't already pulled in `jakarta.persistence-api`. Looks like we do pull it in as a `compileOnly` dependency in `polaris-core` and `polaris-service` already depends on `polaris-core` so it's kind of close.
Looking at the package it seems like the exceptions are indeed in `jakarta.persistence-api` so in theory it just makes the fatjar bigger if we do fully add it as a dependency in `polaris-service` (latest jar appears to just be ~200kB, so it's not *too* bad).
I guess I could go either way in this case.
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1773683079
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +260,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new AlreadyExistsException(e, "Duplicate key error when persisting entity");
Review Comment:
The practical reason we use an Iceberg exception is because we already have exception mapping via `IcebergExceptionMapper` for this exception. This exception is currently used throughout Polaris ([e.g.](https://github.com/apache/polaris/blob/81ec424de5bf4e466660b15dca1778026be07e9e/polaris-service/src/main/java/org/apache/polaris/service/catalog/BasePolarisCatalog.java#L1542)) and so I think it's good to be consistent with that.
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1746652748
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +259,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new IllegalStateException("Duplicate key error when persisting entity", e);
Review Comment:
It seems that `jakarta.ws.rs.WebApplicationException` is also not available right now. I have tightened the catch to reduce the likelihood that a different `IllegalStateException` gets caught here, but I agree that ideally we could just throw a mapped exception here. Perhaps we can add a new exception mapper?
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "eric-maynard (via GitHub)" <gi...@apache.org>.
eric-maynard commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1775706941
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +260,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new AlreadyExistsException(e, "Duplicate key error when persisting entity");
Review Comment:
It's not a `EntityExistsException` unfortunately. We could re-throw as one, but we lack a mapping for that type currently.
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] When a grant already exists, return the appropriate response [polaris]
Posted by "dennishuo (via GitHub)" <gi...@apache.org>.
dennishuo commented on code in PR #243:
URL: https://github.com/apache/polaris/pull/243#discussion_r1747764904
##########
extension/persistence/eclipselink/src/main/java/org/apache/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java:
##########
@@ -257,6 +259,12 @@ public <T> T runInTransaction(
} finally {
localSession.remove();
}
+ } catch (PersistenceException e) {
+ if (e.toString().toLowerCase(Locale.ROOT).contains("duplicate key")) {
+ throw new IllegalStateException("Duplicate key error when persisting entity", e);
Review Comment:
Do we still need to catch it just to rethrow in `PolarisServiceImpl`? Seems we should just let it bubble all the way out adn the `IcebergExceptionMapper` will handle it automatically. Or does `IcebergExceptionMapper` not kick in for these for some reason?
--
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: commits-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org