You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2020/12/03 15:06:18 UTC

[GitHub] [hive] klcopp opened a new pull request #1735: HIVE-24474: Failed compaction always logs TxnAbortedException (again)

klcopp opened a new pull request #1735:
URL: https://github.com/apache/hive/pull/1735


   ### What changes were proposed in this pull request?
   ### Why are the changes needed?
   See HIVE-24474
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   ### How was this patch tested?
   Manually, since the TxnAbortedException only appears in the logs.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] pvary commented on a change in pull request #1735: HIVE-24474: Failed compaction always logs TxnAbortedException (again)

Posted by GitBox <gi...@apache.org>.
pvary commented on a change in pull request #1735:
URL: https://github.com/apache/hive/pull/1735#discussion_r540797373



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Worker.java
##########
@@ -579,7 +567,7 @@ protected Boolean findNextCompactionAndExecute(boolean computeStats) throws Inte
     } catch (Throwable t) {
       LOG.error("Caught an exception in the main loop of compactor worker " + workerName, t);
     } finally {
-      commitTxnIfSet(compactorTxnId);
+      compactionTxn.commit();

Review comment:
       Maybe commitOrAbort? Or close? This is not always commit if I understand correctly




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] klcopp commented on a change in pull request #1735: HIVE-24474: Failed compaction always logs TxnAbortedException (again)

Posted by GitBox <gi...@apache.org>.
klcopp commented on a change in pull request #1735:
URL: https://github.com/apache/hive/pull/1735#discussion_r536079340



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Worker.java
##########
@@ -561,12 +561,12 @@ protected Boolean findNextCompactionAndExecute(boolean computeStats) throws Inte
       } catch (Throwable e) {
         LOG.error("Caught exception while trying to compact " + ci +
             ".  Marking failed to avoid repeated failures", e);
-        abortCompactionAndMarkFailed(ci, compactorTxnId, e);
+        compactorTxnId = abortCompactionAndMarkFailed(ci, compactorTxnId, e);
       }
     } catch (TException | IOException t) {
       LOG.error("Caught an exception in the main loop of compactor worker " + workerName, t);
       try {
-        abortCompactionAndMarkFailed(ci, compactorTxnId, t);
+        compactorTxnId = abortCompactionAndMarkFailed(ci, compactorTxnId, t);

Review comment:
       I thought that this way it would be more obvious to future developers that the compactorTxnId needs to be unset every time it's aborted.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] klcopp commented on a change in pull request #1735: HIVE-24474: Failed compaction always logs TxnAbortedException (again)

Posted by GitBox <gi...@apache.org>.
klcopp commented on a change in pull request #1735:
URL: https://github.com/apache/hive/pull/1735#discussion_r540839467



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Worker.java
##########
@@ -556,20 +544,20 @@ protected Boolean findNextCompactionAndExecute(boolean computeStats) throws Inte
         verifyTableIdHasNotChanged(ci, t1);
 
         LOG.info("Completed " + ci.type.toString() + " compaction for " + ci.getFullPartitionName() + " in txn "
-            + JavaUtils.txnIdToString(compactorTxnId) + ", marking as compacted.");
+            + JavaUtils.txnIdToString(compactionTxn.getTxnId()) + ", marking as compacted.");

Review comment:
       Done

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Worker.java
##########
@@ -483,12 +471,12 @@ protected Boolean findNextCompactionAndExecute(boolean computeStats) throws Inte
        * multiple statements in it (for query based compactor) which is not supported (and since
        * this case some of the statements are DDL, even in the future will not be allowed in a
        * multi-stmt txn. {@link Driver#setCompactionWriteIds(ValidWriteIdList, long)} */
-      compactorTxnId = msc.openTxn(ci.runAs, TxnType.COMPACTION);
+      compactionTxn.open(ci);
 
-      heartbeater = new CompactionHeartbeater(compactorTxnId, fullTableName, conf);
+      heartbeater = new CompactionHeartbeater(compactionTxn.getTxnId(), fullTableName, conf);

Review comment:
       Done




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] pvary commented on a change in pull request #1735: HIVE-24474: Failed compaction always logs TxnAbortedException (again)

Posted by GitBox <gi...@apache.org>.
pvary commented on a change in pull request #1735:
URL: https://github.com/apache/hive/pull/1735#discussion_r540796707



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Worker.java
##########
@@ -556,20 +544,20 @@ protected Boolean findNextCompactionAndExecute(boolean computeStats) throws Inte
         verifyTableIdHasNotChanged(ci, t1);
 
         LOG.info("Completed " + ci.type.toString() + " compaction for " + ci.getFullPartitionName() + " in txn "
-            + JavaUtils.txnIdToString(compactorTxnId) + ", marking as compacted.");
+            + JavaUtils.txnIdToString(compactionTxn.getTxnId()) + ", marking as compacted.");

Review comment:
       Maybe toString for CompactionTxnId?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] pvary commented on a change in pull request #1735: HIVE-24474: Failed compaction always logs TxnAbortedException (again)

Posted by GitBox <gi...@apache.org>.
pvary commented on a change in pull request #1735:
URL: https://github.com/apache/hive/pull/1735#discussion_r541113701



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Worker.java
##########
@@ -636,4 +621,66 @@ private static boolean isDynPartAbort(Table t, CompactionInfo ci) {
     return t.getPartitionKeys() != null && t.getPartitionKeys().size() > 0
         && ci.partName == null;
   }
+
+  /**
+   * Keep track of the compaction's transaction and its operations.
+   */
+  private class CompactionTxn {

Review comment:
       What if we extend AutoCloseable?
   Then we can use the try withresource without finally magic. And close could say - if needed commit.
   
   I think this is the last comment.
   How do you like this code? Is it better?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] klcopp commented on a change in pull request #1735: HIVE-24474: Failed compaction always logs TxnAbortedException (again)

Posted by GitBox <gi...@apache.org>.
klcopp commented on a change in pull request #1735:
URL: https://github.com/apache/hive/pull/1735#discussion_r540841418



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Worker.java
##########
@@ -579,7 +567,7 @@ protected Boolean findNextCompactionAndExecute(boolean computeStats) throws Inte
     } catch (Throwable t) {
       LOG.error("Caught an exception in the main loop of compactor worker " + workerName, t);
     } finally {
-      commitTxnIfSet(compactorTxnId);
+      compactionTxn.commit();

Review comment:
       If compaction failed, it should be aborted before this. CompactionTxn#commit will only commit the txn if it's still open.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] pvary commented on a change in pull request #1735: HIVE-24474: Failed compaction always logs TxnAbortedException (again)

Posted by GitBox <gi...@apache.org>.
pvary commented on a change in pull request #1735:
URL: https://github.com/apache/hive/pull/1735#discussion_r541112397



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Worker.java
##########
@@ -579,7 +567,7 @@ protected Boolean findNextCompactionAndExecute(boolean computeStats) throws Inte
     } catch (Throwable t) {
       LOG.error("Caught an exception in the main loop of compactor worker " + workerName, t);
     } finally {
-      commitTxnIfSet(compactorTxnId);
+      compactionTxn.commit();

Review comment:
       Maybe rename commitIfOpen, or whatever




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] klcopp merged pull request #1735: HIVE-24474: Failed compaction always logs TxnAbortedException (again)

Posted by GitBox <gi...@apache.org>.
klcopp merged pull request #1735:
URL: https://github.com/apache/hive/pull/1735


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] pvary commented on a change in pull request #1735: HIVE-24474: Failed compaction always logs TxnAbortedException (again)

Posted by GitBox <gi...@apache.org>.
pvary commented on a change in pull request #1735:
URL: https://github.com/apache/hive/pull/1735#discussion_r540796283



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Worker.java
##########
@@ -483,12 +471,12 @@ protected Boolean findNextCompactionAndExecute(boolean computeStats) throws Inte
        * multiple statements in it (for query based compactor) which is not supported (and since
        * this case some of the statements are DDL, even in the future will not be allowed in a
        * multi-stmt txn. {@link Driver#setCompactionWriteIds(ValidWriteIdList, long)} */
-      compactorTxnId = msc.openTxn(ci.runAs, TxnType.COMPACTION);
+      compactionTxn.open(ci);
 
-      heartbeater = new CompactionHeartbeater(compactorTxnId, fullTableName, conf);
+      heartbeater = new CompactionHeartbeater(compactionTxn.getTxnId(), fullTableName, conf);

Review comment:
       Maybe change compactionHeartbeater to use the new class instead of Id?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] klcopp closed pull request #1735: HIVE-24474: Failed compaction always logs TxnAbortedException (again)

Posted by GitBox <gi...@apache.org>.
klcopp closed pull request #1735:
URL: https://github.com/apache/hive/pull/1735


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] pvary commented on a change in pull request #1735: HIVE-24474: Failed compaction always logs TxnAbortedException (again)

Posted by GitBox <gi...@apache.org>.
pvary commented on a change in pull request #1735:
URL: https://github.com/apache/hive/pull/1735#discussion_r536020769



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Worker.java
##########
@@ -561,12 +561,12 @@ protected Boolean findNextCompactionAndExecute(boolean computeStats) throws Inte
       } catch (Throwable e) {
         LOG.error("Caught exception while trying to compact " + ci +
             ".  Marking failed to avoid repeated failures", e);
-        abortCompactionAndMarkFailed(ci, compactorTxnId, e);
+        compactorTxnId = abortCompactionAndMarkFailed(ci, compactorTxnId, e);
       }
     } catch (TException | IOException t) {
       LOG.error("Caught an exception in the main loop of compactor worker " + workerName, t);
       try {
-        abortCompactionAndMarkFailed(ci, compactorTxnId, t);
+        compactorTxnId = abortCompactionAndMarkFailed(ci, compactorTxnId, t);

Review comment:
       Why not just set it to TXN_ID_NOT_SET after calling abortComapctionAndMarkFailed?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org