[ 
https://issues.apache.org/jira/browse/HIVE-12996?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15269840#comment-15269840
 ] 

Wei Zheng commented on HIVE-12996:
----------------------------------

The original symptom was that temp table records show up in metastore tables 
for ACID. But the root cause is we locked temporary table the same way as we do 
for regular table.

Since temp tables are only visible to current session, there cannot be 
concurrent operations on them, thus unnecessary to lock them.

> Temp tables shouldn't be locked
> -------------------------------
>
>                 Key: HIVE-12996
>                 URL: https://issues.apache.org/jira/browse/HIVE-12996
>             Project: Hive
>          Issue Type: Bug
>          Components: Transactions
>    Affects Versions: 2.0.0
>            Reporter: Wei Zheng
>            Assignee: Wei Zheng
>
> Internally, INSERT INTO ... VALUES statements use temp table to accomplish 
> its functionality. But temp tables shouldn't be stored in the metastore 
> tables for ACID, because they are by definition only visible inside the 
> session that created them, and we don't allow multiple threads inside a 
> session. If a temp table is used in a query, it should be ignored by lock 
> manager.
> {code}
> mysql> select * from COMPLETED_TXN_COMPONENTS;
> +-----------+--------------+-----------------------+------------------+
> | CTC_TXNID | CTC_DATABASE | CTC_TABLE             | CTC_PARTITION    |
> +-----------+--------------+-----------------------+------------------+
> |         1 | acid         | t1                    | NULL             |
> |         1 | acid         | values__tmp__table__1 | NULL             |
> |         2 | acid         | t1                    | NULL             |
> |         2 | acid         | values__tmp__table__2 | NULL             |
> |         3 | acid         | values__tmp__table__3 | NULL             |
> |         3 | acid         | t1                    | NULL             |
> |         4 | acid         | values__tmp__table__1 | NULL             |
> |         4 | acid         | t2p                   | ds=today         |
> |         5 | acid         | values__tmp__table__1 | NULL             |
> |         5 | acid         | t3p                   | ds=today/hour=12 |
> +-----------+--------------+-----------------------+------------------+
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to