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.

check if locks exist on a table in a query

check if locks exist on a table in a query

Expert Contributor

I have

INSERT OVERWRITE

statements scheduled as hive queries through oozie. Before running INSERT OVERWRITE, I want to check if locks exist on the table

i.e something like show locks dbname.tablename

but it should basically return somethign that I can use to decide if I have to run UNLOCK TABLE dbname.tblname or not.

OR

Do we have somethign like UNLOCK TABLE IF EXISTS LOCK dbname.tblname?

It is really important as I have been tryign to find a way to update my tables in hive at the scheduled time but oozie gets stuck if a user was using select on the table and my scheduled queries tried to run right at the same time. I want to make sure that the query runs at its scheduled time even if the select may or may not give the updated results

2 REPLIES 2

Re: check if locks exist on a table in a query

Guru

IF EXISTS does not work for UNLOCK TABLE query, it is basically not supported. You would better to use Oozie to capture the output of your UNLOCK query and do decision based on that.

Re: check if locks exist on a table in a query

Expert Contributor
Exactly. How do I do it ?

#8t#- Please type your reply above this line -##