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

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

                Author: ASF GitHub Bot
            Created on: 22/Jun/21 07:57
            Start Date: 22/Jun/21 07:57
    Worklog Time Spent: 10m 
      Work Description: pkumarsinha commented on a change in pull request #2396:
URL: https://github.com/apache/hive/pull/2396#discussion_r655604672



##########
File path: ql/src/test/org/apache/hadoop/hive/metastore/txn/TestTxnHandler.java
##########
@@ -1690,6 +1701,19 @@ private void checkReplTxnForTest(Long startTxnId, Long 
endTxnId, String replPoli
     }
   }
 
+  private boolean targetTxnsPresentInReplTxnMap(Long startTxnId, Long 
endTxnId, List<Long> targetTxnId) throws Exception {
+    String[] output = TestTxnDbUtil.queryToString(conf, "SELECT 
\"RTM_TARGET_TXN_ID\" FROM \"REPL_TXN_MAP\" WHERE " +
+            " \"RTM_SRC_TXN_ID\" >=  " + startTxnId + "AND \"RTM_SRC_TXN_ID\" 
<=  " + endTxnId).split("\n");
+    List<Long> replayedTxns = new ArrayList<>();
+    for (int idx = 1; idx < output.length; idx++) {
+      Long txnId = Long.parseLong(output[idx].trim());
+      if (targetTxnId.contains(txnId)) {

Review comment:
       Do you really need this check?

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -1339,7 +1340,8 @@ public void commitTxn(CommitTxnRequest rqst)
             // corresponding open txn event.
             LOG.info("Target txn id is missing for source txn id : " + 
sourceTxnId +

Review comment:
       This isn't an info level log. We can remove it actually as the exception 
is being thrown and that would appear any way

##########
File path: ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager.java
##########
@@ -516,10 +516,17 @@ public void testHeartbeaterReplicationTxn() throws 
Exception {
     } catch (LockException e) {
       exception = e;
     }
-    Assert.assertNotNull("Txn should have been aborted", exception);
-    Assert.assertEquals(ErrorMsg.TXN_ABORTED, 
exception.getCanonicalErrorMsg());
+    Assert.assertNotNull("Source transaction with txnId: 1, missing from 
REPL_TXN_MAP", exception);

Review comment:
       The message you get if the assertion fails. If this entry is missing, 
the exception object would be null. Is that expected? 

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -1339,7 +1340,8 @@ public void commitTxn(CommitTxnRequest rqst)
             // corresponding open txn event.
             LOG.info("Target txn id is missing for source txn id : " + 
sourceTxnId +
                     " and repl policy " + rqst.getReplPolicy());
-            return;
+            throw new NoSuchTxnException("Source transaction: " + 
JavaUtils.txnIdToString(sourceTxnId)

Review comment:
       Add target txn id as well.

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -1339,7 +1340,8 @@ public void commitTxn(CommitTxnRequest rqst)
             // corresponding open txn event.
             LOG.info("Target txn id is missing for source txn id : " + 
sourceTxnId +
                     " and repl policy " + rqst.getReplPolicy());
-            return;
+            throw new NoSuchTxnException("Source transaction: " + 
JavaUtils.txnIdToString(sourceTxnId)

Review comment:
       Aren't we aborting based on target txn id so we know which target txn id 
we are looking for?

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -1339,7 +1340,8 @@ public void commitTxn(CommitTxnRequest rqst)
             // corresponding open txn event.
             LOG.info("Target txn id is missing for source txn id : " + 
sourceTxnId +
                     " and repl policy " + rqst.getReplPolicy());
-            return;
+            throw new NoSuchTxnException("Source transaction: " + 
JavaUtils.txnIdToString(sourceTxnId)

Review comment:
       Didn't get this. Don't we do "abort txn  <txnId>" here the txn  id is of 
target and not of source, right?

##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -1339,7 +1340,8 @@ public void commitTxn(CommitTxnRequest rqst)
             // corresponding open txn event.
             LOG.info("Target txn id is missing for source txn id : " + 
sourceTxnId +
                     " and repl policy " + rqst.getReplPolicy());
-            return;
+            throw new NoSuchTxnException("Source transaction: " + 
JavaUtils.txnIdToString(sourceTxnId)

Review comment:
       Didn't get this. Don't we do "abort txn  txnId" here the txn  id is of 
target and not of source, right?




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


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

    Worklog Id:     (was: 613179)
    Time Spent: 2h 20m  (was: 2h 10m)

> Fix the clean up of open repl created transactions
> --------------------------------------------------
>
>                 Key: HIVE-25246
>                 URL: https://issues.apache.org/jira/browse/HIVE-25246
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Haymant Mangla
>            Assignee: Haymant Mangla
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to