deniskuzZ commented on code in PR #6286:
URL: https://github.com/apache/hive/pull/6286#discussion_r2834143849


##########
ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/CompactorTest.java:
##########
@@ -735,7 +733,13 @@ enum CommitAction {
   }
 
   protected long compactInTxn(CompactionRequest rqst) throws Exception {
-    return compactInTxn(rqst, CommitAction.COMMIT);
+    long compactorTxnId = compactInTxn(rqst, CommitAction.COMMIT);
+
+    // Wait for the cooldown period so the Cleaner can see the last committed 
txn as the highest committed watermark
+    // TODO: doesn't belong here, should probably be moved to 
CompactorTest#startCleaner()
+    Thread.sleep(MetastoreConf.getTimeVar(
+        conf, ConfVars.TXN_OPENTXN_TIMEOUT, TimeUnit.MILLISECONDS));
+    return compactorTxnId;

Review Comment:
   basically that sleep makes sure Cleaner sees txn in proper state and this 
hack currently used in multiple places:
   ````
     static void runCleaner(HiveConf hConf) throws Exception {
       // Wait for the cooldown period so the Cleaner can see last committed 
txn as the highest committed watermark
       Thread.sleep(MetastoreConf.getTimeVar(hConf, 
MetastoreConf.ConfVars.TXN_OPENTXN_TIMEOUT, TimeUnit.MILLISECONDS));
   ````
   we could probably query TXNS table and wait for 'c' status. c - committed. 
   
   however, as i understand the txn won't be considered committed sooner that 
this TXN_OPENTXN_TIMEOUT config



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to