adutra commented on code in PR #8909:
URL: https://github.com/apache/iceberg/pull/8909#discussion_r1376192197
##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieTableOperations.java:
##########
@@ -135,71 +135,26 @@ protected void doCommit(TableMetadata base, TableMetadata
metadata) {
boolean newTable = base == null;
String newMetadataLocation = writeNewMetadataIfRequired(newTable,
metadata);
- String refName = client.refName();
- boolean failure = false;
+ AtomicBoolean failure = new AtomicBoolean(false);
try {
String contentId = table == null ? null : table.getId();
client.commitTable(base, metadata, newMetadataLocation, contentId, key);
- } catch (NessieConflictException ex) {
- failure = true;
- if (ex instanceof NessieReferenceConflictException) {
- // Throws a specialized exception, if possible
- maybeThrowSpecializedException((NessieReferenceConflictException) ex);
+ } catch (NessieConflictException | NessieNotFoundException |
HttpClientException ex) {
+ NessieUtil.handleExceptionsForCommits(ex, client.refName(), failure);
+ } catch (NessieBadRequestException ex) {
Review Comment:
1. Conflicts will _not_ be retried for `NessieReferenceConflictException`
since we throw specialized errors, see here:
https://github.com/apache/iceberg/blob/89b3a2111968f0aed79ec0ce1c87e2035e0d7f7c/nessie/src/main/java/org/apache/iceberg/nessie/NessieUtil.java#L188-L192
2. My main point was: we should get rid of this `catch
(NessieBadRequestException ex)` block as, in my opinion, it denotes a code
smell.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]