<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="mysql-cluster-logs-event-buffer">
      </a>
      25.6.2.3 Event Buffer Reporting in the Cluster Log
     </h4>
    </div>
   </div>
  </div>
  <p>
   <code class="literal">
    NDB
   </code>
   uses one or more memory buffers for
        events received from the data nodes. There is one such buffer
        for each
   <a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html" target="_top">
    <code class="literal">
     Ndb
    </code>
   </a>
   object subscribing
        to table events, which means that there are usually two buffers
        for each
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   performing binary logging
        (one buffer for schema events, and one for data events). Each
        buffer contains epochs made up of events. These events consist
        of operation types (insert, update, delete) and row data (before
        and after images plus metadata).
  </p>
  <p>
   <code class="literal">
    NDB
   </code>
   generates messages in the cluster log to
        describe the state of these buffers. Although these reports
        appear in the cluster log, they refer to buffers on API nodes
        (unlike most other cluster log messages, which are generated by
        data nodes).
  </p>
  <p>
   Event buffer logging reports in the cluster log use the format
        shown here:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-simple"><div class="docs-select-all right" id="sa43673943"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-simple">Node <em class="replaceable">node_id</em><span class="token operator">:</span> Event buffer status <span class="token punctuation">(</span><em class="replaceable">object_id</em><span class="token punctuation">)</span><span class="token operator">:</span>
used<span class="token operator">=</span><em class="replaceable">bytes_used</em> <span class="token punctuation">(</span><em class="replaceable">percent_used</em><span class="token operator">%</span> of alloc<span class="token punctuation">)</span>
alloc<span class="token operator">=</span><em class="replaceable">bytes_allocated</em> <span class="token punctuation">(</span><em class="replaceable">percent_alloc</em><span class="token operator">%</span> of max<span class="token punctuation">)</span> max<span class="token operator">=</span><em class="replaceable">bytes_available</em>
latest_consumed_epoch<span class="token operator">=</span><em class="replaceable">latest_consumed_epoch</em>
latest_buffered_epoch<span class="token operator">=</span><em class="replaceable">latest_buffered_epoch</em>
report_reason<span class="token operator">=</span><em class="replaceable">report_reason</em></code></pre>
  </div>
  <p>
   The fields making up this report are listed here, with
        descriptions:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <em class="replaceable">
       <code>
        node_id
       </code>
      </em>
      : ID of the node where the
            report originated.
     </p>
    </li>
    <li class="listitem">
     <p>
      <em class="replaceable">
       <code>
        object_id
       </code>
      </em>
      : ID of the
      <a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html" target="_top">
       <code class="literal">
        Ndb
       </code>
      </a>
      object where the report
            originated.
     </p>
    </li>
    <li class="listitem">
     <p>
      <em class="replaceable">
       <code>
        bytes_used
       </code>
      </em>
      : Number of bytes used
            by the buffer.
     </p>
    </li>
    <li class="listitem">
     <p>
      <em class="replaceable">
       <code>
        percent_used
       </code>
      </em>
      : Percentage of
            allocated bytes used.
     </p>
    </li>
    <li class="listitem">
     <p>
      <em class="replaceable">
       <code>
        bytes_allocated
       </code>
      </em>
      : Number of bytes
            allocated to this buffer.
     </p>
    </li>
    <li class="listitem">
     <p>
      <em class="replaceable">
       <code>
        percent_alloc
       </code>
      </em>
      : Percentage of
            available bytes used; not printed if
      <a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_eventbuffer_max_alloc">
       <code class="literal">
        ndb_eventbuffer_max_alloc
       </code>
      </a>
      is equal to 0 (unlimited).
     </p>
    </li>
    <li class="listitem">
     <p>
      <em class="replaceable">
       <code>
        bytes_available
       </code>
      </em>
      : Number of bytes
            available; this is 0 if
      <code class="literal">
       ndb_eventbuffer_max_alloc
      </code>
      is 0
            (unlimited).
     </p>
    </li>
    <li class="listitem">
     <p>
      <em class="replaceable">
       <code>
        latest_consumed_epoch
       </code>
      </em>
      : The epoch
            most recently consumed to completion. (In NDB API
            applications, this is done by calling
      <a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html#ndb-ndb-nextevent" target="_top">
       <code class="literal">
        nextEvent()
       </code>
      </a>
      .)
     </p>
    </li>
    <li class="listitem">
     <p>
      <em class="replaceable">
       <code>
        latest_buffered_epoch
       </code>
      </em>
      : The epoch
            most recently buffered (completely) in the event buffer.
     </p>
    </li>
    <li class="listitem">
     <p>
      <em class="replaceable">
       <code>
        report_reason
       </code>
      </em>
      : The reason for
            making the report. Possible reasons are shown later in this
            section.
     </p>
    </li>
   </ul>
  </div>
  <p>
   Possible reasons for reporting are described in the following
        list:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       ENOUGH_FREE_EVENTBUFFER
      </code>
      : The event buffer
            has sufficient space.
     </p>
     <p>
      <code class="literal">
       LOW_FREE_EVENTBUFFER
      </code>
      : The event buffer is
            running low on free space.
     </p>
     <p>
      The threshold free percentage level triggering these reports
            can be adjusted by setting the
      <a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_report_thresh_binlog_mem_usage">
       <code class="literal">
        ndb_report_thresh_binlog_mem_usage
       </code>
      </a>
      server variable.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       BUFFERED_EPOCHS_OVER_THRESHOLD
      </code>
      : Whether
            the number of buffered epochs has exceeded the configured
            threshold. This number is the difference between the latest
            epoch that has been received in its entirety and the epoch
            that has most recently been consumed (in NDB API
            applications, this is done by calling
      <a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html#ndb-ndb-nextevent" target="_top">
       <code class="literal">
        nextEvent()
       </code>
      </a>
      or
      <a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html#ndb-ndb-nextevent2" target="_top">
       <code class="literal">
        nextEvent2()
       </code>
      </a>
      ). The
            report is generated every second until the number of
            buffered epochs goes below the threshold, which can be
            adjusted by setting the
      <a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_report_thresh_binlog_epoch_slip">
       <code class="literal">
        ndb_report_thresh_binlog_epoch_slip
       </code>
      </a>
      server variable. You can also adjust the threshold in NDB
            API applications by calling
      <a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html#ndb-ndb-seteventbufferqueueemptyepoch" target="_top">
       <code class="literal">
        setEventBufferQueueEmptyEpoch()
       </code>
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       PARTIALLY_DISCARDING
      </code>
      : Event buffer memory
            is exhausted—that is, 100% of
      <a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_eventbuffer_max_alloc">
       <code class="literal">
        ndb_eventbuffer_max_alloc
       </code>
      </a>
      has been used. Any partially buffered epoch is buffered to
            completion even is usage exceeds 100%, but any new epochs
            received are discarded. This means that a gap has occurred
            in the event stream.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       COMPLETELY_DISCARDING
      </code>
      : No epochs are
            buffered.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       PARTIALLY_BUFFERING
      </code>
      : The buffer free
            percentage following the gap has risen to the threshold,
            which can be set in the
      <a class="link" href="mysql.html" title="6.5.1 mysql — The MySQL Command-Line Client">
       <span class="command">
        <strong>
         mysql
        </strong>
       </span>
      </a>
      client
            using the
      <a class="link" href="mysql-cluster-options-variables.html#sysvar_ndb_eventbuffer_free_percent">
       <code class="literal">
        ndb_eventbuffer_free_percent
       </code>
      </a>
      server system variable or in NDB API applications by calling
      <a class="ulink" href="/doc/ndbapi/en/ndb-ndb.html#ndb-ndb-set-eventbuffer-free-percent" target="_top">
       <code class="literal">
        set_eventbuffer_free_percent()
       </code>
      </a>
      .
            New epochs are buffered. Epochs that could not be completed
            due to the gap are discarded.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       COMPLETELY_BUFFERING
      </code>
      : All epochs received
            are being buffered, which means that there is sufficient
            event buffer memory. The gap in the event stream has been
            closed.
     </p>
    </li>
   </ul>
  </div>
 </div>
 <br/>
</div>
