You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "snazy (via GitHub)" <gi...@apache.org> on 2023/04/05 17:27:56 UTC

[GitHub] [iceberg] snazy opened a new pull request, #7283: Bump Nessie to 0.56.0

snazy opened a new pull request, #7283:
URL: https://github.com/apache/iceberg/pull/7283

   /cc @nastra 


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra commented on pull request #7283: Bump Nessie to 0.56.0

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on PR #7283:
URL: https://github.com/apache/iceberg/pull/7283#issuecomment-1498781321

   Does that mean we could now add the following test to verify that `NoSuchNamespaceException` is thrown?
   ```
     @Test
     public void testTableCreationWithoutNamespace() {
       Assume.assumeTrue(requiresNamespaceCreate());
   
       Assertions.assertThatThrownBy(
               () ->
                   catalog()
                       .buildTable(TableIdentifier.of("non-existing-namespace", "table"), SCHEMA)
                       .create())
           .isInstanceOf(NoSuchNamespaceException.class)
           .hasMessage("...");
     }
   ```


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra commented on a diff in pull request #7283: Bump Nessie to 0.56.0

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #7283:
URL: https://github.com/apache/iceberg/pull/7283#discussion_r1159547571


##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieTableOperations.java:
##########
@@ -152,6 +160,9 @@ protected void doCommit(TableMetadata base, TableMetadata metadata) {
       client.commitTable(base, metadata, newMetadataLocation, table, key);
       delete = false;
     } catch (NessieConflictException ex) {
+      if (ex instanceof NessieReferenceConflictException) {
+        handleReferenceConflictException((NessieReferenceConflictException) ex);

Review Comment:
   reading through the code one wouldn't immediately expect `handleReferenceConflictException` to throw an exception. I think it would be better if `handleReferenceConflictException` would return `Optional<RuntimeException>`. 
   Then the call in the `catch` clause could be `throw handleReferenceConflictException(ex).orElseGet(() -> new CommitFailedException(..))`.
   



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra commented on a diff in pull request #7283: Bump Nessie to 0.56.0

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #7283:
URL: https://github.com/apache/iceberg/pull/7283#discussion_r1159558326


##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieTableOperations.java:
##########
@@ -174,6 +185,38 @@ protected void doCommit(TableMetadata base, TableMetadata metadata) {
     }
   }
 
+  private static void handleReferenceConflictException(NessieReferenceConflictException ex) {
+    // Check if the server returned 'ReferenceConflicts' information
+    ReferenceConflicts referenceConflicts = ex.getErrorDetails();
+    if (referenceConflicts == null) {
+      return;
+    }
+
+    // Can only narrow down to a single exception, if there is only one conflict.
+    List<Conflict> conflicts = referenceConflicts.conflicts();
+    if (conflicts.size() != 1) {
+      return;
+    }
+
+    Conflict conflict = conflicts.get(0);
+    ConflictType conflictType = conflict.conflictType();
+    if (conflictType != null) {
+      switch (conflictType) {
+        case NAMESPACE_ABSENT:
+          throw new NoSuchNamespaceException(ex, "Cannot find namespace %s", conflict.key());

Review Comment:
   would it make more sense to slightly adjust this to `"Namespace does not exist: %s"`?



##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieTableOperations.java:
##########
@@ -174,6 +185,38 @@ protected void doCommit(TableMetadata base, TableMetadata metadata) {
     }
   }
 
+  private static void handleReferenceConflictException(NessieReferenceConflictException ex) {
+    // Check if the server returned 'ReferenceConflicts' information
+    ReferenceConflicts referenceConflicts = ex.getErrorDetails();
+    if (referenceConflicts == null) {
+      return;
+    }
+
+    // Can only narrow down to a single exception, if there is only one conflict.
+    List<Conflict> conflicts = referenceConflicts.conflicts();
+    if (conflicts.size() != 1) {
+      return;
+    }
+
+    Conflict conflict = conflicts.get(0);
+    ConflictType conflictType = conflict.conflictType();
+    if (conflictType != null) {
+      switch (conflictType) {
+        case NAMESPACE_ABSENT:
+          throw new NoSuchNamespaceException(ex, "Cannot find namespace %s", conflict.key());
+        case NAMESPACE_NOT_EMPTY:
+          throw new NamespaceNotEmptyException(ex, "Namespace %s is not empty", conflict.key());
+        case KEY_DOES_NOT_EXIST:
+          throw new NoSuchTableException(ex, "Table %s not found", conflict.key());

Review Comment:
   maybe: `Table does not exist: %s`



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra commented on a diff in pull request #7283: Bump Nessie to 0.56.0

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #7283:
URL: https://github.com/apache/iceberg/pull/7283#discussion_r1159632136


##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieTableOperations.java:
##########
@@ -174,6 +185,38 @@ protected void doCommit(TableMetadata base, TableMetadata metadata) {
     }
   }
 
+  private static void handleReferenceConflictException(NessieReferenceConflictException ex) {
+    // Check if the server returned 'ReferenceConflicts' information
+    ReferenceConflicts referenceConflicts = ex.getErrorDetails();
+    if (referenceConflicts == null) {
+      return;
+    }
+
+    // Can only narrow down to a single exception, if there is only one conflict.
+    List<Conflict> conflicts = referenceConflicts.conflicts();
+    if (conflicts.size() != 1) {
+      return;
+    }
+
+    Conflict conflict = conflicts.get(0);
+    ConflictType conflictType = conflict.conflictType();
+    if (conflictType != null) {
+      switch (conflictType) {
+        case NAMESPACE_ABSENT:
+          throw new NoSuchNamespaceException(ex, "Cannot find namespace %s", conflict.key());

Review Comment:
   this is to align with other error msg patterns across the codebase 



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] nastra commented on a diff in pull request #7283: Bump Nessie to 0.56.0

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #7283:
URL: https://github.com/apache/iceberg/pull/7283#discussion_r1159547571


##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieTableOperations.java:
##########
@@ -152,6 +160,9 @@ protected void doCommit(TableMetadata base, TableMetadata metadata) {
       client.commitTable(base, metadata, newMetadataLocation, table, key);
       delete = false;
     } catch (NessieConflictException ex) {
+      if (ex instanceof NessieReferenceConflictException) {
+        handleReferenceConflictException((NessieReferenceConflictException) ex);

Review Comment:
   threading through the code one wouldn't immediately expect `handleReferenceConflictException` to throw an exception. I think it would be better if `handleReferenceConflictException` would return `Optional<RuntimeException>`. 
   Then the call in the `catch` clause could be `throw handleReferenceConflictException(ex).orElseGet(() -> new CommitFailedException(..))`.
   



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] snazy commented on a diff in pull request #7283: Bump Nessie to 0.56.0

Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on code in PR #7283:
URL: https://github.com/apache/iceberg/pull/7283#discussion_r1159630273


##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieTableOperations.java:
##########
@@ -174,6 +185,38 @@ protected void doCommit(TableMetadata base, TableMetadata metadata) {
     }
   }
 
+  private static void handleReferenceConflictException(NessieReferenceConflictException ex) {
+    // Check if the server returned 'ReferenceConflicts' information
+    ReferenceConflicts referenceConflicts = ex.getErrorDetails();
+    if (referenceConflicts == null) {
+      return;
+    }
+
+    // Can only narrow down to a single exception, if there is only one conflict.
+    List<Conflict> conflicts = referenceConflicts.conflicts();
+    if (conflicts.size() != 1) {
+      return;
+    }
+
+    Conflict conflict = conflicts.get(0);
+    ConflictType conflictType = conflict.conflictType();
+    if (conflictType != null) {
+      switch (conflictType) {
+        case NAMESPACE_ABSENT:
+          throw new NoSuchNamespaceException(ex, "Cannot find namespace %s", conflict.key());

Review Comment:
   Not sure why the message matters.



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] snazy commented on pull request #7283: Bump Nessie to 0.56.0

Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on PR #7283:
URL: https://github.com/apache/iceberg/pull/7283#issuecomment-1498865894

   > Does that mean we could now add the following test to verify that `NoSuchNamespaceException` is thrown?
   > 
   
   Yes, but not the assertion on the full message, but if the message contains the key.
   
   


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] Fokko commented on pull request #7283: Bump Nessie to 0.56.0

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko commented on PR #7283:
URL: https://github.com/apache/iceberg/pull/7283#issuecomment-1502375236

   Thanks @snazy for raising the PR, and @dimas-b, @singhpk234 and @nastra for the review!


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] Fokko merged pull request #7283: Bump Nessie to 0.56.0

Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko merged PR #7283:
URL: https://github.com/apache/iceberg/pull/7283


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org