You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2022/05/02 10:31:43 UTC

[GitHub] [hive] veghlaci05 commented on a diff in pull request #3165: HIVE-26106: Non blocking ADD, DROP CONSTRAINT

veghlaci05 commented on code in PR #3165:
URL: https://github.com/apache/hive/pull/3165#discussion_r862742761


##########
ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager2.java:
##########
@@ -3816,4 +3816,29 @@ private void testDropMaterializedView(boolean blocking) throws Exception {
     Assert.assertEquals("Expecting 2 rows and found " + res.size(), 2, res.size());
     driver.run("drop materialized view mv_tab_acid");
   }
+
+  @Test
+  public void testAddDropConstraintNonBlocking() throws Exception {
+    HiveConf.setBoolVar(conf, HiveConf.ConfVars.HIVE_ACID_LOCKLESS_READS_ENABLED, true);
+    dropTable(new String[] {"tab_acid"});
+
+    driver.run("create table if not exists tab_acid (a int, b int) " +
+      "stored as orc TBLPROPERTIES ('transactional'='true')");
+    driver.run("insert into tab_acid (a,b) values(1,2),(3,4)");
+
+    driver.compileAndRespond("alter table tab_acid ADD CONSTRAINT a_PK PRIMARY KEY (`a`) DISABLE NOVALIDATE");
+    driver.lockAndRespond();
+    
+    List<ShowLocksResponseElement> locks = getLocks();
+    checkLock(LockType.EXCL_WRITE,
+      LockState.ACQUIRED, "default", "tab_acid", null, locks);
+    driver.close();
+    
+    driver.compileAndRespond("alter table tab_acid  DROP CONSTRAINT a_PK");
+    driver.lockAndRespond();
+
+    locks = getLocks();
+    checkLock(LockType.EXCL_WRITE,
+      LockState.ACQUIRED, "default", "tab_acid", null, locks);
+  }

Review Comment:
   It could be separated to two tests, but no strong feelings about it, even the merged test case is small enough.



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

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


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