kasakrisz commented on code in PR #5559:
URL: https://github.com/apache/hive/pull/5559#discussion_r1872967009


##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands2.java:
##########
@@ -2450,6 +2435,9 @@ public void testCleanerForTxnToWriteId() throws Exception 
{
     // Keep an open txn which refers to the aborted txn.
     Context ctx = new Context(hiveConf);
     HiveTxnManager txnMgr = 
TxnManagerFactory.getTxnManagerFactory().getTxnManager(hiveConf);
+    // Txn is not considered committed or aborted until TXN_OPENTXN_TIMEOUT 
expires
+    // See MinOpenTxnIdWaterMarkFunction, OpenTxnTimeoutLowBoundaryTxnIdHandler
+    waitUntilAllTxnFinished();

Review Comment:
   The next command is `txnMgr.openTxn(ctx, "u1");`. During txn opening a new 
record is inserted into `MIN_HISTORY_LEVEL`
   
https://github.com/apache/hive/blob/cf83d4751271622a9a700c6f2330dbfff38801d2/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/jdbc/functions/OpenTxnsFunction.java#L150
   It has an impact cleaning records from `TXN_TO_WRITE_ID`
   
   The column value `MHL_MIN_OPEN_TXNID` is coming from 
   
https://github.com/apache/hive/blob/cf83d4751271622a9a700c6f2330dbfff38801d2/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/jdbc/functions/OpenTxnsFunction.java#L101C26-L101C55
   It is calculated by taking the smaller value from `minOpenTxn` and 
`lowWaterMark`. `minOpenTxn` is the last open txn id which his null so we go 
with `lowWaterMark`.
   `lowWaterMark` is queried by 
   
https://github.com/apache/hive/blob/cf83d4751271622a9a700c6f2330dbfff38801d2/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/jdbc/queries/OpenTxnTimeoutLowBoundaryTxnIdHandler.java#L42-L43
   
   Maybe my test computer is running the queries with TEZ faster than MR and 
`openTxnTimeOutMillis` is not expired.
   When I added `Thread.sleep(openTxnTimeOutMillis)` the test passed so I 
assume this is a timing issue.
   



-- 
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-unsubscr...@hive.apache.org

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


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

Reply via email to