singhpk234 commented on code in PR #1989: URL: https://github.com/apache/polaris/pull/1989#discussion_r2180357621
########## service/common/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java: ########## @@ -756,7 +756,7 @@ public boolean removeProperties(Namespace namespace, Set<String> properties) .map(PolarisEntity::new) .orElse(null); if (returnedEntity == null) { - throw new RuntimeException("Concurrent modification of namespace: " + namespace); + throw new CommitFailedException("Concurrent modification of namespace: %s", namespace); Review Comment: I am fine with overloading the CommitFailedException as the iceberg exception for that doesn't say specifically anything about the entities for which commit failed. ########## runtime/service/src/test/java/org/apache/polaris/service/quarkus/catalog/IcebergCatalogTest.java: ########## @@ -486,6 +488,31 @@ public Map<String, BaseResult> purgeRealms(Iterable<String> realms) { }; } + @Test + public void testPropertiesUpdateConcurrentException() { + PolarisMetaStoreManager spyMetaStore = spy(metaStoreManager); + PolarisPassthroughResolutionView passthroughView = + new PolarisPassthroughResolutionView( + polarisContext, entityManager, securityContext, CATALOG_NAME); + IcebergCatalog catalog = + new IcebergCatalog( + entityManager, + spyMetaStore, + polarisContext, + passthroughView, + securityContext, + Mockito.mock(TaskExecutor.class), + fileIOFactory, + polarisEventListener); + catalog.createNamespace(NS); + doReturn(new EntityResult(ENTITY_NOT_FOUND, "")) + .when(spyMetaStore) + .updateEntityPropertiesIfNotChanged(any(), any(), any()); + assertThrows( + CommitFailedException.class, () -> catalog.setProperties(NS, ImmutableMap.of("a", "b"))); + assertThrows(CommitFailedException.class, () -> catalog.removeProperties(NS, Set.of("a", "b"))); Review Comment: CommitFailedException would throw 409 from IcebergException mapper, but is there a way to just test the status code without relying on exception mapper on 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: issues-unsubscr...@polaris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org