Reply
Highlighted
New Contributor
Posts: 1
Registered: ‎05-23-2017

Not able do insert with in the same session after acquiring exclusive lock on a table.

Hi Team,

 

I have acquired an exclusive lock on a hive table but I am not able to perform insert operation into that hive table with in the same session. Is this expected behaviour?

 

Expectation : With in the same session, if we lock a table it should allow us to perform any operations on the table and for other sessions it should block.

 

We are using CDH 5.10.

 

Cloudera Employee
Posts: 176
Registered: ‎03-23-2015

Re: Not able do insert with in the same session after acquiring exclusive lock on a table.

Yes, it is correct behaviour.

When you acquire an exclusive lock, it will apply at the GLOBAL level, no one will be able to update/read the table, INCLUDING yourself!

Why do you need to acquire lock manually on a table? The lock should be applied automatically to any table when you tried to SELECT/INSERT from/to the table. No manual locking needed.

I think you misunderstood the LOCK table command usage. Have a read through the apache doc for more info:

https://cwiki.apache.org/confluence/display/Hive/Locking
Announcements