Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

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

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

New Contributor

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.

 

1 REPLY 1
Highlighted

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

Guru
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