binarybrain-009 commented on code in PR #18692:
URL: https://github.com/apache/iceberg/pull/18692#discussion_r4549216475
##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveViewOperations.java:
##########
@@ -115,7 +115,7 @@ public void doRefresh() {
refreshFromMetadataLocation(metadataLocation);
}
- @SuppressWarnings("checkstyle:CyclomaticComplexity")
+ @SuppressWarnings({"checkstyle:CyclomaticComplexity", "MethodLength"})
Review Comment:
Extracted HMS metadata preparation into updateHmsTable in cd1852509 and
removed the MethodLength suppression. Commit-status handling and cleanup stay
together in doCommit. All 14 TestHiveViewCommits tests and Hive
formatting/checkstyle checks pass.
##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveViewCommits.java:
##########
@@ -483,6 +483,37 @@ public void testNoLockThriftExceptionConcurrentCommit()
throws TException, Inter
.isEqualTo(1);
}
+ @Test
+ void noLockConcurrentModificationErrorAfterSuccessfulCommit()
Review Comment:
Added an explicit metadataFileExists assertion after the successful commit
and refresh in cd1852509. The test now checks both the current metadata
location and that its file remains.
##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveViewOperations.java:
##########
@@ -228,18 +218,40 @@ public void doCommit(ViewMetadata base, ViewMetadata
metadata) {
e);
}
- LOG.error(
- "Cannot tell if commit to {}.{} succeeded, attempting to reconnect
and check.",
- database,
- viewName,
- e);
commitStatus = BaseMetastoreOperations.CommitStatus.UNKNOWN;
- commitStatus =
- checkCommitStatus(
- viewName,
- newMetadataLocation,
- metadata.properties(),
- () -> checkCurrentMetadataLocation(newMetadataLocation));
+ if (e.getMessage() != null
+ && e.getMessage()
+ .contains(
+ "The table has been modified. The parameter value for key
'"
+ + BaseMetastoreTableOperations.METADATA_LOCATION_PROP
+ + "' is")) {
+ // The HMS client may retry an alter that already succeeded, after a
network issue for
+ // example, and hit this exception, so check whether the commit was
applied. No pending
+ // request can succeed after this exception, so the strict status
check is safe.
+ commitStatus =
+ checkCommitStatusStrict(
+ viewName,
+ newMetadataLocation,
+ metadata.properties(),
+ () -> checkCurrentMetadataLocation(newMetadataLocation));
+ if (commitStatus == BaseMetastoreOperations.CommitStatus.FAILURE) {
Review Comment:
Done in cd1852509; both status references now use CommitStatus directly, and
the unused import is removed.
--
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]