[ 
https://issues.apache.org/jira/browse/HIVE-24906?focusedWorklogId=578338&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-578338
 ]

ASF GitHub Bot logged work on HIVE-24906:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 07/Apr/21 12:56
            Start Date: 07/Apr/21 12:56
    Worklog Time Spent: 10m 
      Work Description: pvary commented on a change in pull request #2089:
URL: https://github.com/apache/hive/pull/2089#discussion_r608626658



##########
File path: ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager2.java
##########
@@ -3239,4 +3247,72 @@ public void testFullTableReadLock() throws Exception {
     checkLock(LockType.SHARED_READ, LockState.ACQUIRED, "default", "tab_acid", 
null, locks);
     checkLock(LockType.SHARED_READ, LockState.ACQUIRED, "default", 
"tab_not_acid", null, locks);
   }
-}
+
+  @Test
+  public void testNonBlockingDropAndReCreateTable() throws Exception {
+    dropTable(new String[] {"tab_acid"});
+
+    conf.setBoolVar(HiveConf.ConfVars.HIVE_TXN_NON_BLOCKING_DROP_TABLE, true);
+    driver2.getConf().setBoolVar( 
HiveConf.ConfVars.HIVE_TXN_NON_BLOCKING_DROP_TABLE, true);
+
+    driver.run("create table if not exists tab_acid (a int, b int) partitioned 
by (p string) " +
+      "stored as orc TBLPROPERTIES ('transactional'='true')");
+    driver.run("insert into tab_acid partition(p) (a,b,p) 
values(1,2,'foo'),(3,4,'bar')");
+
+    driver.compileAndRespond("select * from tab_acid");
+
+    DbTxnManager txnMgr2 = (DbTxnManager) 
TxnManagerFactory.getTxnManagerFactory().getTxnManager(conf);
+    swapTxnManager(txnMgr2);
+    driver2.run("drop table if exists tab_acid");
+
+    swapTxnManager(txnMgr);
+    driver.run();
+
+    FileSystem fs = FileSystem.get(conf);
+    FileStatus[] stat = fs.listStatus(new 
Path(Paths.get("target/warehouse").toUri()),
+      p -> p.getName().startsWith("tab_acid_v"));
+    if (1 == stat.length) {
+      Assert.fail("Table data was not removed from FS");
+    }
+
+    List res = new ArrayList();
+    driver.getFetchTask().fetch(res);
+    Assert.assertEquals("Non-empty resultset", 0, res.size());
+
+    try {
+      driver.run("select * from tab_acid");
+    } catch (CommandProcessorException ex) {
+      Assert.assertEquals(ErrorMsg.INVALID_TABLE.getErrorCode(), 
ex.getResponseCode());
+      
Assert.assertTrue(ex.getMessage().contains(ErrorMsg.INVALID_TABLE.getMsg("'tab_acid'")));
+    }
+
+    //re-create table with the same name
+    driver.compileAndRespond("create table if not exists tab_acid (a int, b 
int) partitioned by (p string) " +

Review comment:
       I would remove `if not exists` from the SQL, so we can detect if there 
is a problem with the test




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

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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 578338)
    Time Spent: 20m  (was: 10m)

> Suffix the table location with UUID/txnId
> -----------------------------------------
>
>                 Key: HIVE-24906
>                 URL: https://issues.apache.org/jira/browse/HIVE-24906
>             Project: Hive
>          Issue Type: Sub-task
>            Reporter: Denys Kuzmenko
>            Assignee: Denys Kuzmenko
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Suffixing the table location during create table with UUID/txnId can help in 
> deleting the data in asynchronous fashion.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to