<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="mysql-cluster-ndbinfo-cluster-locks">
      </a>
      25.6.17.7 The ndbinfo cluster_locks Table
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045090427296">
  </a>
  <p>
   The
   <code class="literal">
    cluster_locks
   </code>
   table provides information
        about current lock requests holding and waiting for locks on
   <code class="literal">
    NDB
   </code>
   tables in an NDB Cluster, and is intended
        as a companion table to
   <a class="link" href="mysql-cluster-ndbinfo-cluster-operations.html" title="25.6.17.8 The ndbinfo cluster_operations Table">
    <code class="literal">
     cluster_operations
    </code>
   </a>
   .
        Information obtain from the
   <code class="literal">
    cluster_locks
   </code>
   table may be useful in investigating stalls and deadlocks.
  </p>
  <p>
   The
   <code class="literal">
    cluster_locks
   </code>
   table contains the
        following columns:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       node_id
      </code>
     </p>
     <p>
      ID of reporting node
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       block_instance
      </code>
     </p>
     <p>
      ID of reporting LDM instance
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       tableid
      </code>
     </p>
     <p>
      ID of table containing this row
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       fragmentid
      </code>
     </p>
     <p>
      ID of fragment containing locked row
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       rowid
      </code>
     </p>
     <p>
      ID of locked row
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       transid
      </code>
     </p>
     <p>
      Transaction ID
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       mode
      </code>
     </p>
     <p>
      Lock request mode
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       state
      </code>
     </p>
     <p>
      Lock state
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       detail
      </code>
     </p>
     <p>
      Whether this is first holding lock in row lock queue
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       op
      </code>
     </p>
     <p>
      Operation type
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       duration_millis
      </code>
     </p>
     <p>
      Milliseconds spent waiting or holding lock
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       lock_num
      </code>
     </p>
     <p>
      ID of lock object
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       waiting_for
      </code>
     </p>
     <p>
      Waiting for lock with this ID
     </p>
    </li>
   </ul>
  </div>
  <h5>
   <a name="idm46045090395440">
   </a>
   Notes
  </h5>
  <p>
   The table ID (
   <code class="literal">
    tableid
   </code>
   column) is assigned
        internally, and is the same as that used in other
   <code class="literal">
    ndbinfo
   </code>
   tables. It is also shown in the
        output of
   <a class="link" href="mysql-cluster-programs-ndb-show-tables.html" title="25.5.27 ndb_show_tables — Display List of NDB Tables">
    <span class="command">
     <strong>
      ndb_show_tables
     </strong>
    </span>
   </a>
   .
  </p>
  <p>
   The transaction ID (
   <code class="literal">
    transid
   </code>
   column) is the
        identifier generated by the NDB API for the transaction
        requesting or holding the current lock.
  </p>
  <p>
   The
   <code class="literal">
    mode
   </code>
   column shows the lock mode; this is
        always one of
   <code class="literal">
    S
   </code>
   (indicating a shared lock) or
   <code class="literal">
    X
   </code>
   (an exclusive lock). If a transaction holds
        an exclusive lock on a given row, all other locks on that row
        have the same transaction ID.
  </p>
  <p>
   The
   <code class="literal">
    state
   </code>
   column shows the lock state. Its
        value is always one of
   <code class="literal">
    H
   </code>
   (holding) or
   <code class="literal">
    W
   </code>
   (waiting). A waiting lock request waits for
        a lock held by a different transaction.
  </p>
  <p>
   When the
   <code class="literal">
    detail
   </code>
   column contains a
   <code class="literal">
    *
   </code>
   (asterisk character), this means that this
        lock is the first holding lock in the affected row's lock
        queue; otherwise, this column is empty. This information can be
        used to help identify the unique entries in a list of lock
        requests.
  </p>
  <p>
   The
   <code class="literal">
    op
   </code>
   column shows the type of operation
        requesting the lock. This is always one of the values
   <code class="literal">
    READ
   </code>
   ,
   <code class="literal">
    INSERT
   </code>
   ,
   <code class="literal">
    UPDATE
   </code>
   ,
   <code class="literal">
    DELETE
   </code>
   ,
   <code class="literal">
    SCAN
   </code>
   , or
   <code class="literal">
    REFRESH
   </code>
   .
  </p>
  <p>
   The
   <code class="literal">
    duration_millis
   </code>
   column shows the number
        of milliseconds for which this lock request has been waiting or
        holding the lock. This is reset to 0 when a lock is granted for
        a waiting request.
  </p>
  <p>
   The lock ID (
   <code class="literal">
    lockid
   </code>
   column) is unique to this
        node and block instance.
  </p>
  <p>
   The lock state is shown in the
   <code class="literal">
    lock_state
   </code>
   column; if this is
   <code class="literal">
    W
   </code>
   , the lock is waiting to
        be granted, and the
   <code class="literal">
    waiting_for
   </code>
   column shows
        the lock ID of the lock object this request is waiting for.
        Otherwise, the
   <code class="literal">
    waiting_for
   </code>
   column is empty.
   <code class="literal">
    waiting_for
   </code>
   can refer only to locks on the
        same row, as identified by
   <code class="literal">
    node_id
   </code>
   ,
   <code class="literal">
    block_instance
   </code>
   ,
   <code class="literal">
    tableid
   </code>
   ,
   <code class="literal">
    fragmentid
   </code>
   , and
   <code class="literal">
    rowid
   </code>
   .
  </p>
 </div>
 <br/>
</div>
