You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/07/19 07:05:36 UTC

[GitHub] [iceberg] pvary commented on a diff in pull request #5036: Fix concurrent transactions overwriting commits by adding hive lock heartbeats.

pvary commented on code in PR #5036:
URL: https://github.com/apache/iceberg/pull/5036#discussion_r924133966


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -274,14 +292,27 @@ protected void doCommit(TableMetadata base, TableMetadata metadata) {
       }
 
       try {
+        if (hiveLockHeartbeat.future.isCancelled() || hiveLockHeartbeat.encounteredException != null) {
+          throw new CommitFailedException("Failed to heartbeat for hive lock. %s",
+              hiveLockHeartbeat.encounteredException.getMessage());
+        }

Review Comment:
   nit: empty line after block



##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -274,14 +292,27 @@ protected void doCommit(TableMetadata base, TableMetadata metadata) {
       }
 
       try {
+        if (hiveLockHeartbeat.future.isCancelled() || hiveLockHeartbeat.encounteredException != null) {
+          throw new CommitFailedException("Failed to heartbeat for hive lock. %s",
+              hiveLockHeartbeat.encounteredException.getMessage());
+        }
         persistTable(tbl, updateHiveTable);
+        if (hiveLockHeartbeat.future.isCancelled() || hiveLockHeartbeat.encounteredException != null) {
+          throw new CommitStateUnknownException("Failed to heartbeat for hive lock while " +
+              "committing changes. This can lead to a concurrent commit attempt be able to overwrite this commit. " +
+              "Please check the commit history. If you are running into this issue, try reducing " +
+              "iceberg.hive.lock-heartbeat-interval-ms.", hiveLockHeartbeat.encounteredException);
+        }

Review Comment:
   nit: empty line after block



-- 
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