InvisibleProgrammer commented on code in PR #4740:
URL: https://github.com/apache/hive/pull/4740#discussion_r1362347505


##########
ql/src/test/org/apache/hadoop/hive/metastore/txn/TestCompactionTxnHandler.java:
##########
@@ -1055,6 +1055,38 @@ public void testFindReadyToCleanAborts_limitFetchSize() 
throws Exception {
     assertEquals(1, potentials.size());
   }
 
+  @Test
+  public void testFindReadyToCleanAborts() throws Exception {
+    long txnId = openTxn();
+
+    List<LockComponent> components = new ArrayList<>();
+    components.add(createLockComponent(LockType.SHARED_WRITE, LockLevel.DB, 
"mydb", "mytable", "mypartition=myvalue", DataOperationType.UPDATE));
+    components.add(createLockComponent(LockType.SHARED_WRITE, LockLevel.DB, 
"mydb", "yourtable", "mypartition=myvalue", DataOperationType.UPDATE));
+
+    allocateTableWriteIds("mydb", "mytable", txnId);
+    allocateTableWriteIds("mydb", "yourtable", txnId);
+
+    LockRequest req = new LockRequest(components, "me", "localhost");
+    req.setTxnid(txnId);
+    LockResponse res = txnHandler.lock(req);
+    assertSame(res.getState(), LockState.ACQUIRED);
+
+    txnHandler.abortTxn(new AbortTxnRequest((txnId)));
+
+    txnId = openTxn();
+    components = new ArrayList<>();
+    components.add(createLockComponent(LockType.SHARED_WRITE, LockLevel.DB, 
"mydb", "mytable", "mypartition=myvalue", DataOperationType.UPDATE));
+    allocateTableWriteIds("mydb", "mytable", txnId);
+
+    req = new LockRequest(components, "me", "localhost");
+    req.setTxnid(txnId);
+    res = txnHandler.lock(req);
+    assertSame(res.getState(), LockState.ACQUIRED);
+
+    List<CompactionInfo> potentials = txnHandler.findReadyToCleanAborts(1, 0);
+    assertEquals(1, potentials.size());

Review Comment:
   I added checks on database and table name. 



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