Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Locking Granularity on a Table

New Contributor

I have a partitioned table into which I am trying to insert data into a new partition. At the same time, I need to query a different partition on the same table. According to the documentation https://cwiki.apache.org/confluence/display/Hive/Locking I should be able to do it. But that is not what is happening in reality.

I have two hive shells open, in one shell, I write data into T1 into a new partition called P14. In the second shell, I do a simple select query on partition P2. The select query waits until the insert query finishes and only then gives results where i deally it should give results immediately since it is a shared_read lock on partition P2 and I am doing a static partition insert.

Also, when I do show locks on T1, I see an exclusive lock only the partition P14 and nothing else. Not even shared locks on other partitions. Am I missing something here?

2 REPLIES 2

Super Collaborator

Hi There,

In normal senario,Hive-CLI may take all the resorces in the same queue and keep the other apps submitted in pending state, which may result in same behavior, hence I would recommend to monitor the resource manager as well. - I presume this would be the reason.

Can you please test the same with Hive-jdbc (beeline), by opening two sessions, which try to give more insight.

or move the two sessions into two different queues, so that the query will not be delayed for resorces.

Hope this helps!!

New Contributor

Thanks you for your time. I had to set hive.support.concurrency=false to disable locking.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.