[
https://issues.apache.org/jira/browse/HIVE-26076?focusedWorklogId=765498&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-765498
]
ASF GitHub Bot logged work on HIVE-26076:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 03/May/22 15:18
Start Date: 03/May/22 15:18
Worklog Time Spent: 10m
Work Description: deniskuzZ commented on code in PR #3122:
URL: https://github.com/apache/hive/pull/3122#discussion_r863893788
##########
ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager2.java:
##########
@@ -4028,4 +4005,88 @@ public void testAddDropConstraintNonBlocking() throws
Exception {
checkLock(LockType.EXCL_WRITE,
LockState.ACQUIRED, "default", "tab_acid", null, locks);
}
+
+ @Test
+ public void testAddPartitionIfNotExistsNonBlocking() throws Exception {
+ testAddPartitionIfNotExists(false);
+ }
+ @Test
+ public void testAddPartitionIfNotExistsBlocking() throws Exception {
+ testAddPartitionIfNotExists(true);
+ }
+
+ private void testAddPartitionIfNotExists(boolean blocking) throws Exception {
+ dropTable(new String[] {"T", "Tstage"});
+
+ HiveConf.setIntVar(conf, HiveConf.ConfVars.HIVE_LOCKS_PARTITION_THRESHOLD,
1);
+ driver = Mockito.spy(driver);
+
+ HiveConf.setBoolVar(driver2.getConf(),
HiveConf.ConfVars.HIVE_ACID_LOCKLESS_READS_ENABLED, !blocking);
+ driver2 = Mockito.spy(driver2);
+
+ driver.run("create table if not exists T (a int, b int) partitioned by (p
string) " +
+ "stored as orc TBLPROPERTIES ('transactional'='true')");
+ //bucketed just so that we get 2 files
+ driver.run("create table if not exists Tstage (a int, b int) clustered by
(a) into 2 " +
+ "buckets stored as orc TBLPROPERTIES ('transactional'='false')");
+ driver.run("insert into Tstage values(1,2),(3,4)");
+ String exportLoc = exportFolder.newFolder("1").toString();
+ driver.run("export table Tstage to '" + exportLoc + "'");
+
+ driver.compileAndRespond("select * from T");
+ List<String> res = new ArrayList<>();
Review Comment:
changed
Issue Time Tracking
-------------------
Worklog Id: (was: 765498)
Time Spent: 40m (was: 0.5h)
> Non blocking ADD PARTITION if not exists
> ----------------------------------------
>
> Key: HIVE-26076
> URL: https://issues.apache.org/jira/browse/HIVE-26076
> Project: Hive
> Issue Type: Task
> Reporter: Denys Kuzmenko
> Priority: Major
> Labels: pull-request-available
> Time Spent: 40m
> Remaining Estimate: 0h
>
> Originally X (EXCLUSIVE) lock was used to prevent races between concurrent
> add partition calls with IF NOT EXISTS, however, the same behavior could be
> achieved with a less restrictive X-write (EXCL_WRITE) lock.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)