your query is "select * from HIVE_LOCKS" but the output is not from HIVE_LOCKS.
What entries do you have in HIVE_LOCKS for this txn_id?

If all you see is an entry in TXN table in 'a' state - that is OK.  that just 
mean that this transaction was aborted.

Eugene

From: Igor Kuzmenko <f1she...@gmail.com<mailto:f1she...@gmail.com>>
Reply-To: "user@hive.apache.org<mailto:user@hive.apache.org>" 
<user@hive.apache.org<mailto:user@hive.apache.org>>
Date: Monday, August 22, 2016 at 8:27 AM
To: "user@hive.apache.org<mailto:user@hive.apache.org>" 
<user@hive.apache.org<mailto:user@hive.apache.org>>
Subject: Hive transaction doesn't release lock.

Hello, I'm using Apache Hive 1.2.1 and Apache Storm to stream data in hive 
table.
After making some tests I tried to truncate my table, but sql execution doesn't 
complete because of the lock on table:

select * from HIVE_LOCKS;

# TXN_ID, TXN_STATE, TXN_STARTED, TXN_LAST_HEARTBEAT, TXN_USER, TXN_HOST, 
TC_TXNID, TC_DATABASE, TC_TABLE, TC_PARTITION
'78461824', 'a', '1471762974000', '1471768488000', 'storm', 
'sorm-data03.msk.mts.ru', '78461824', 'default', 'data_http', 'dt=20160821'



At the same time:

select * from TXNS, TXN_COMPONENTS
where 1=1
and TXNS.TXN_ID = TXN_COMPONENTS.TC_TXNID
and TXNS.TXN_ID = 78461824
;


# TXN_ID, TXN_STATE, TXN_STARTED, TXN_LAST_HEARTBEAT, TXN_USER, TXN_HOST, 
TC_TXNID, TC_DATABASE, TC_TABLE, TC_PARTITION
78461824, a, 1471762974000, 1471768488000, storm, sorm-data03.msk.mts.ru, 
78461824, default, data_http, dt=20160821


Txn 78461824 is in aborted state, but still keep lock on table 'data_http'. How 
can I avoid this? What should I do to get rid of that lock?

Reply via email to