lirui-apache commented on code in PR #12637:
URL: https://github.com/apache/iceberg/pull/12637#discussion_r2024510734
##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -287,15 +277,33 @@ protected void doCommit(TableMetadata base, TableMetadata
metadata) {
e);
}
- LOG.error(
- "Cannot tell if commit to {}.{} succeeded, attempting to reconnect
and check.",
- database,
- tableName,
- e);
commitStatus = BaseMetastoreOperations.CommitStatus.UNKNOWN;
- commitStatus =
- BaseMetastoreOperations.CommitStatus.valueOf(
- checkCommitStatus(newMetadataLocation, metadata).name());
+ if (e.getMessage() != null
+ && e.getMessage()
+ .contains(
+ "The table has been modified. The parameter value for key
'"
+ + HiveTableOperations.METADATA_LOCATION_PROP
+ + "' is")) {
+ // It's possible the HMS client incorrectly retries a successful
operation, due to network
+ // issue for example, and triggers this exception. So we need
double-check to make sure
+ // this is really a concurrent modification. Hitting this exception
means no pending
+ // requests, if any, can succeed later, so it's safe to check status
in strict mode
+ commitStatus = checkCommitStatusStrict(newMetadataLocation,
metadata);
+ if (commitStatus == BaseMetastoreOperations.CommitStatus.FAILURE) {
+ throw new CommitFailedException(
+ e, "The table %s.%s has been modified concurrently", database,
tableName);
+ }
+ } else {
+ LOG.error(
+ "Cannot tell if commit to {}.{} succeeded, attempting to
reconnect and check.",
+ database,
+ tableName,
+ e);
+ commitStatus =
Review Comment:
I updated to address this issue. At least I think the new
`checkCommitStatusStrict` should not follow this pattern. @pvary please let me
know if you think otherwise.
--
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]