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