Viewing transaction locks

As a Hive administrator, you can get troubleshooting information about locks on a table, partition, or schema.

  1. Enter a Hive query to check table locks.
    SHOW LOCKS mytable EXTENDED;         
  2. Check partition locks.
    SHOW LOCKS mytable PARTITION(ds='2018-05-01', hr='12') EXTENDED;
  3. Check schema locks.
    SHOW LOCKS SCHEMA mydatabase;
    Output generally appears as follows.
    • Database name
    • Table name
    • Partition, if the table is partitioned
    • Lock state:
      • Acquired - transaction initiator hold the lock
      • Waiting - transaction initiator is waiting for the lock
      • Aborted - the lock has timed out but has not yet been cleaned
    • Lock type:
      • Exclusive - the lock cannot be shared
      • Shared_read - the lock cannot be shared with any number of other shared_read locks
      • Shared_write - the lock may be shared by any number of other shared_read locks but not with other shared_write locks
    • Transaction ID associated with the lock, if one exists
    • Last time lock holder sent a heartbeat
    • Time the lock was acquired, if it has been acquired
    • Hive user who requested the lock
    • Host machine or virtual machine on which the Hive user is running a Hive client
    • Blocked By ID - ID of the lock causing current lock to be in Waiting mode, if the lock is in this mode