You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/12/01 10:43:00 UTC

[jira] [Work logged] (HIVE-25740) Handle race condition between compaction txn abort/commit and heartbeater

     [ https://issues.apache.org/jira/browse/HIVE-25740?focusedWorklogId=688574&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-688574 ]

ASF GitHub Bot logged work on HIVE-25740:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/Dec/21 10:42
            Start Date: 01/Dec/21 10:42
    Worklog Time Spent: 10m 
      Work Description: marton-bod commented on a change in pull request #2817:
URL: https://github.com/apache/hive/pull/2817#discussion_r760061124



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Worker.java
##########
@@ -233,39 +234,36 @@ void gatherStats() {
     private final CompactionTxn compactionTxn;
     private final String tableName;
     private final HiveConf conf;
-    private final long txnTimeout;
+    private final AtomicBoolean shouldLogError;
 
     public CompactionHeartbeater(CompactionTxn compactionTxn, String tableName, HiveConf conf) {
       this.tableName = Objects.requireNonNull(tableName);
       this.compactionTxn = Objects.requireNonNull(compactionTxn);
       this.conf = Objects.requireNonNull(conf);
-
-      this.txnTimeout = MetastoreConf.getTimeVar(conf, MetastoreConf.ConfVars.TXN_TIMEOUT, TimeUnit.MILLISECONDS);
+      this.shouldLogError = new AtomicBoolean(true);
 
       setDaemon(true);
       setPriority(MIN_PRIORITY);
       setName("CompactionHeartbeater-" + compactionTxn.getTxnId());
     }
 
+    public void shouldLogError(boolean shouldLogError) {
+      this.shouldLogError.set(shouldLogError);
+    }
+
     @Override
     public void run() {
       LOG.debug("Heartbeating compaction transaction id {} for table: {}", compactionTxn, tableName);

Review comment:
       Yep, makes sense. I remove one of 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.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 688574)
    Time Spent: 1h 40m  (was: 1.5h)

> Handle race condition between compaction txn abort/commit and heartbeater
> -------------------------------------------------------------------------
>
>                 Key: HIVE-25740
>                 URL: https://issues.apache.org/jira/browse/HIVE-25740
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Marton Bod
>            Assignee: Marton Bod
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> This issue is the following: once the compaction worker finishes, commitTxn/abortTxn is invoked first, and the heartbeater thread is only interrupted after that. This can lead to race conditions where the txn has already been deleted from the backend DB via commit/abort, but the concurrently running heartbeater thread still attempts to send a last heartbeat after that, but the txn id won't be found in the DB, leading to {{{}NoSuchTxnException{}}}.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)