Marton Bod created HIVE-23236:
---------------------------------

             Summary: Remove the global lock from acquireLock
                 Key: HIVE-23236
                 URL: https://issues.apache.org/jira/browse/HIVE-23236
             Project: Hive
          Issue Type: Improvement
            Reporter: Marton Bod
            Assignee: Marton Bod


Currently we have a global lock (NEXT_LOCK_ID) when running enqueueLock, 
because the algorithm in checkLock requires the locks to have a well defined 
order, and also requires that every lock component is already stored in the 
RDBMS before checking the locks.

Proposed approach:
 * Enqueue lock without a global lock, using a sequence for getting the next 
lock ID
 * Insert the locks as usual, but with an additional timestamp (enqueued_at)
 * Check lock should check all enqueued locks for the given db/table/partition 
but order should be determined based on the enqueued_at time instead of the 
lockID
 * If there is no blocking lock, update the state to acquired as usual



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to