hmangla98 commented on a change in pull request #2396:
URL: https://github.com/apache/hive/pull/2396#discussion_r655105296
##########
File path: ql/src/test/org/apache/hadoop/hive/metastore/txn/TestTxnHandler.java
##########
@@ -244,8 +245,16 @@ public void testAbortTxns() throws Exception {
List<Long> txnList = openedTxns.getTxn_ids();
txnHandler.abortTxns(new AbortTxnsRequest(txnList));
+ OpenTxnRequest replRqst = new OpenTxnRequest(2, "me", "localhost");
+ replRqst.setReplPolicy("default.*");
+ replRqst.setReplSrcTxnIds(Arrays.asList(1L, 2L));
+ List<Long> targetTxns = txnHandler.openTxns(replRqst).getTxn_ids();
+ txnHandler.abortTxns(new AbortTxnsRequest(targetTxns));
+
+ assertFalse(targetTxnsPresentInReplTxnMap(targetTxns));
Review comment:
This test is included in TestDbTxnManager.
##########
File path: ql/src/test/org/apache/hadoop/hive/metastore/txn/TestTxnHandler.java
##########
@@ -244,8 +245,16 @@ public void testAbortTxns() throws Exception {
List<Long> txnList = openedTxns.getTxn_ids();
txnHandler.abortTxns(new AbortTxnsRequest(txnList));
+ OpenTxnRequest replRqst = new OpenTxnRequest(2, "me", "localhost");
+ replRqst.setReplPolicy("default.*");
+ replRqst.setReplSrcTxnIds(Arrays.asList(1L, 2L));
+ List<Long> targetTxns = txnHandler.openTxns(replRqst).getTxn_ids();
+ txnHandler.abortTxns(new AbortTxnsRequest(targetTxns));
+
+ assertFalse(targetTxnsPresentInReplTxnMap(targetTxns));
Review comment:
This test is included in TestDbTxnManager.
##########
File path: ql/src/test/org/apache/hadoop/hive/metastore/txn/TestTxnHandler.java
##########
@@ -244,8 +245,16 @@ public void testAbortTxns() throws Exception {
List<Long> txnList = openedTxns.getTxn_ids();
txnHandler.abortTxns(new AbortTxnsRequest(txnList));
+ OpenTxnRequest replRqst = new OpenTxnRequest(2, "me", "localhost");
+ replRqst.setReplPolicy("default.*");
+ replRqst.setReplSrcTxnIds(Arrays.asList(1L, 2L));
+ List<Long> targetTxns = txnHandler.openTxns(replRqst).getTxn_ids();
+ txnHandler.abortTxns(new AbortTxnsRequest(targetTxns));
+
+ assertFalse(targetTxnsPresentInReplTxnMap(targetTxns));
Review comment:
This test is included in TestDbTxnManager.
##########
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:
target txn id is not present. that's the reason this exception is being
thrown.
##########
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:
If this entry is missing, the exception would be thrown which will be
caught up in line 517. So, e would be not null.
##########
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:
no, we have only source txn id and the replPolicy. Using this info, we
query the REPL_TXN_MAP table and get corresponding target txn id and then
commit this txn.
##########
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:
abort txn txnId would not have replPolicy set. So, its execution would
not come here.
--
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]