<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="mysql-cluster-ndbinfo-server-locks">
      </a>
      25.6.17.54 The ndbinfo server_locks Table
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045088016256">
  </a>
  <p>
   The
   <code class="literal">
    server_locks
   </code>
   table is similar in
        structure to the
   <code class="literal">
    cluster_locks
   </code>
   table, and
        provides a subset of the information found in the latter table,
        but which is specific to the SQL node (MySQL server) where it
        resides. (The
   <code class="literal">
    cluster_locks
   </code>
   table provides
        information about all locks in the cluster.) More precisely,
   <code class="literal">
    server_locks
   </code>
   contains information about locks
        requested by threads belonging to the current
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   instance, and serves as a companion
        table to
   <a class="link" href="mysql-cluster-ndbinfo-server-operations.html" title="25.6.17.55 The ndbinfo server_operations Table">
    <code class="literal">
     server_operations
    </code>
   </a>
   .
        This may be useful for correlating locking patterns with
        specific MySQL user sessions, queries, or use cases.
  </p>
  <p>
   The
   <code class="literal">
    server_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">
       mysql_connection_id
      </code>
     </p>
     <p>
      MySQL connection ID
     </p>
    </li>
    <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="idm46045087980288">
   </a>
   Notes
  </h5>
  <p>
   The
   <code class="literal">
    mysql_connection_id
   </code>
   column shows the
        MySQL connection or thread ID as shown by
   <a class="link" href="show-processlist.html" title="15.7.7.31 SHOW PROCESSLIST Statement">
    <code class="literal">
     SHOW PROCESSLIST
    </code>
   </a>
   .
  </p>
  <p>
   <code class="literal">
    block_instance
   </code>
   refers to an instance of a
        kernel block. Together with the block name, this number can be
        used to look up a given instance in the
   <a class="link" href="mysql-cluster-ndbinfo-threadblocks.html" title="25.6.17.62 The ndbinfo threadblocks Table">
    <code class="literal">
     threadblocks
    </code>
   </a>
   table.
  </p>
  <p>
   The
   <code class="literal">
    tableid
   </code>
   is assigned to the table by
   <code class="literal">
    NDB
   </code>
   ; the same ID is used for this table in
        other
   <code class="literal">
    ndbinfo
   </code>
   tables, as well as 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 shown in the
   <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, which is
        always one of
   <code class="literal">
    S
   </code>
   (shared lock) or
   <code class="literal">
    X
   </code>
   (exclusive lock). If a transaction has 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>
   The
   <code class="literal">
    detail
   </code>
   column indicates whether this lock
        is the first holding lock in the affected row's lock queue,
        in which case it contains a
   <code class="literal">
    *
   </code>
   (asterisk
        character); 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>
   If the
   <code class="literal">
    lock_state
   </code>
   column's value is
   <code class="literal">
    W
   </code>
   , this 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,
   <code class="literal">
    waiting_for
   </code>
   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>
