Two Very Useful Hive Lock Settings
hive.lock.numretries
hive.lock.sleep.between.retries
The first property indicates the number of times the client will attempt to get a lock before it gives up. The second property indicates that time interval between retries for getting locks.
You would find yourself tweaking this to suit your needs. The default value for hive.lock.sleep.between.retries is very large. This could potentially mean that your query will be forever stuck in getting the lock if your table is being constantly hit with queries.
I generally use the following settings
SET hive.lock.numretries 100;
SET hive.lock.sleep.between.retries 1;
You can set the above in your ~/.hiverc file or you can set them whenever you open a new HIve CLI client session. The following shows description of the properties.
<property>
<name>hive.lock.numretries</name>
<value>100</value>
<description>The number of times you want to try to get all the
locks</description>
</property>
<property>
<name>hive.lock.sleep.between.retries</name>
<value>60</value>
<description>The sleep time (in seconds) between various retries</description>
</property>