rdblue commented on a change in pull request #1998:
URL: https://github.com/apache/iceberg/pull/1998#discussion_r549448927
##########
File path:
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java
##########
@@ -367,6 +363,20 @@ private long acquireLock() throws UnknownHostException,
TException, InterruptedE
return lockId;
}
+ private void cleanupMetadataAndUnlock(boolean errorThrown, String
metadataLocation, Optional<Long> lockId) {
+ try {
+ if (errorThrown) {
+ // if anything went wrong, clean up the uncommitted metadata file
+ io().deleteFile(metadataLocation);
+ }
+ } catch (RuntimeException e) {
+ LOG.error("Fail to cleanup metadata file at {}", metadataLocation, e);
+ throw e;
Review comment:
I think this is fine because we don't want to wrap or modify the
original exception, and it is helpful to log the metadata location that was not
correctly deleted.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]