<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="innodb-buffer-pool-in-core-file">
      </a>
      17.8.3.7 Excluding or Including Buffer Pool Pages from Core Files
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045162873840">
  </a>
  <a class="indexterm" name="idm46045162872352">
  </a>
  <a class="indexterm" name="idm46045162871280">
  </a>
  <a class="indexterm" name="idm46045162870240">
  </a>
  <p>
   A core file records the status and memory image of a running
        process. Because the buffer pool resides in main memory, and the
        memory image of a running process is dumped to the core file,
        systems with large buffer pools can produce large core files
        when the
   <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
    <span class="command">
     <strong>
      mysqld
     </strong>
    </span>
   </a>
   process dies.
  </p>
  <p>
   Large core files can be problematic for a number of reasons
        including the time it takes to write them, the amount of disk
        space they consume, and the challenges associated with
        transferring large files.
  </p>
  <p>
   Excluding buffer pool pages may also be desirable from a
        security perspective if you have concerns about dumping database
        pages to core files that may be shared inside or outside of your
        organization for debugging purposes.
  </p>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    Access to the data present in buffer pool pages at the time
          the
    <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
     <span class="command">
      <strong>
       mysqld
      </strong>
     </span>
    </a>
    process died may be beneficial
          in some debugging scenarios. If in doubt whether to include or
          exclude buffer pool pages, consult MySQL Support.
   </p>
  </div>
  <p>
   The
   <a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_in_core_file">
    <code class="literal">
     innodb_buffer_pool_in_core_file
    </code>
   </a>
   option is only relevant if the
   <a class="link" href="server-system-variables.html#sysvar_core_file">
    <code class="literal">
     core_file
    </code>
   </a>
   variable is enabled
        and the operating system supports the
   <code class="literal">
    MADV_DONTDUMP
   </code>
   non-POSIX extension to the
   <a class="ulink" href="http://man7.org/linux/man-pages/man2/madvise.2.html" target="_blank">
    madvise()
   </a>
   system call, which is supported in Linux 3.4 and later. The
   <code class="literal">
    MADV_DONTDUMP
   </code>
   extension causes pages in a
        specified range to be excluded from core dumps. The
   <a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_in_core_file">
    <code class="literal">
     innodb_buffer_pool_in_core_file
    </code>
   </a>
   option is disabled by default on systems that support
        MADV_DONTDUMP, otherwise it defaults to ON.
  </p>
  <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
   <div class="admon-title">
    Note
   </div>
   <p>
    Before MySQL 8.4,
    <a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_in_core_file">
     <code class="literal">
      innodb_buffer_pool_in_core_file
     </code>
    </a>
    was enabled by default instead of disabled.
   </p>
  </div>
  <p>
   To generate core files with buffer pool pages, start the server
        with the
   <a class="link" href="server-options.html#option_mysqld_core-file">
    <code class="option">
     --core-file
    </code>
   </a>
   and
   <a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_in_core_file">
    <code class="literal">
     --innodb-buffer-pool-in-core-file=ON
    </code>
   </a>
   options.
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-terminal"><div class="docs-select-all right" id="sa52196881"><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-terminal"><span class="token prompt">$&gt; </span><span class="token command">mysqld</span> <span class="token property">--core-file</span> <span class="token constant">--innodb-buffer-pool-in-core-file</span><span class="token attr-value"><span class="token punctuation">=</span>ON</span></code></pre>
  </div>
  <p>
   The
   <a class="link" href="server-system-variables.html#sysvar_core_file">
    <code class="literal">
     core_file
    </code>
   </a>
   variable is
        read-only and disabled by default. It is enabled by specifying
        the
   <a class="link" href="server-options.html#option_mysqld_core-file">
    <code class="option">
     --core-file
    </code>
   </a>
   option at
        startup. The
   <a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_in_core_file">
    <code class="literal">
     innodb_buffer_pool_in_core_file
    </code>
   </a>
   variable is dynamic. It can be specified at startup or
        configured at runtime using a
   <a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
    <code class="literal">
     SET
    </code>
   </a>
   statement.
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa35446095"><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-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> innodb_buffer_pool_in_core_file<span class="token operator">=</span><span class="token keyword">OFF</span><span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   If the
   <a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_in_core_file">
    <code class="literal">
     innodb_buffer_pool_in_core_file
    </code>
   </a>
   variable is disabled but
   <code class="literal">
    MADV_DONTDUMP
   </code>
   is not
        supported by the operating system, or an
   <code class="literal">
    madvise()
   </code>
   failure occurs, a warning is
        written to the MySQL server error log and the
   <a class="link" href="server-system-variables.html#sysvar_core_file">
    <code class="literal">
     core_file
    </code>
   </a>
   variable is disabled
        to prevent writing core files that unintentionally include
        buffer pool pages. If the read-only
   <a class="link" href="server-system-variables.html#sysvar_core_file">
    <code class="literal">
     core_file
    </code>
   </a>
   variable becomes
        disabled, the server must be restarted to enable it again.
  </p>
  <p>
   The following table shows configuration and
   <code class="literal">
    MADV_DONTDUMP
   </code>
   support scenarios that
        determine whether core files are generated and whether they
        include buffer pool pages.
  </p>
  <div class="table">
   <a name="innodb-buffer-pool-in-core-file-configuration-scenarios">
   </a>
   <p class="title">
    <b>
     Table 17.4 Core File Configuration Scenarios
    </b>
   </p>
   <div class="table-contents">
    <table summary="Core file configuration and         MADV_DONTDUMP support scenarios.">
     <colgroup>
      <col style="width: 20%"/>
      <col style="width: 20%"/>
      <col style="width: 20%"/>
      <col style="width: 40%"/>
     </colgroup>
     <thead>
      <tr>
       <th scope="col">
        <a class="link" href="server-system-variables.html#sysvar_core_file">
         <code class="literal">
          core_file
         </code>
        </a>
        variable
       </th>
       <th scope="col">
        <a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_in_core_file">
         <code class="literal">
          innodb_buffer_pool_in_core_file
         </code>
        </a>
        variable
       </th>
       <th scope="col">
        madvise() MADV_DONTDUMP Support
       </th>
       <th scope="col">
        Outcome
       </th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <th scope="row">
        OFF (default)
       </th>
       <td>
        Not relevant to outcome
       </td>
       <td>
        Not relevant to outcome
       </td>
       <td>
        Core file is not generated
       </td>
      </tr>
      <tr>
       <th scope="row">
        ON
       </th>
       <td>
        ON (default on systems without
        <code class="literal">
         MADV_DONTDUMP
        </code>
        support)
       </td>
       <td>
        Not relevant to outcome
       </td>
       <td>
        Core file is generated with buffer pool pages
       </td>
      </tr>
      <tr>
       <th scope="row">
        ON
       </th>
       <td>
        OFF (default on systems with
        <code class="literal">
         MADV_DONTDUMP
        </code>
        support)
       </td>
       <td>
        Yes
       </td>
       <td>
        Core file is generated without buffer pool pages
       </td>
      </tr>
      <tr>
       <th scope="row">
        ON
       </th>
       <td>
        OFF
       </td>
       <td>
        No
       </td>
       <td>
        Core file is not generated,
        <a class="link" href="server-system-variables.html#sysvar_core_file">
         <code class="literal">
          core_file
         </code>
        </a>
        is disabled, and a warning is written to the server error
              log
       </td>
      </tr>
     </tbody>
    </table>
   </div>
  </div>
  <br class="table-break"/>
  <p>
   The reduction in core file size achieved by disabling the
   <a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_in_core_file">
    <code class="literal">
     innodb_buffer_pool_in_core_file
    </code>
   </a>
   variable depends on the size of the buffer pool, but it is also
        affected by the
   <code class="literal">
    InnoDB
   </code>
   page size. A smaller
        page size means more pages are required for the same amount of
        data, and more pages means more page metadata. The following
        table provides size reduction examples that you might see for a
        1GB buffer pool with different pages sizes.
  </p>
  <div class="table">
   <a name="innodb-buffer-pool-in-core-file-size-examples">
   </a>
   <p class="title">
    <b>
     Table 17.5 Core File Size with Buffer Pool Pages Included and Excluded
    </b>
   </p>
   <div class="table-contents">
    <table summary="Core file size reduction examples for different pages sizes.">
     <colgroup>
      <col style="width: 20%"/>
      <col style="width: 20%"/>
      <col style="width: 20%"/>
     </colgroup>
     <thead>
      <tr>
       <th scope="col">
        <a class="link" href="innodb-parameters.html#sysvar_innodb_page_size">
         <code class="literal">
          innodb_page_size
         </code>
        </a>
        Setting
       </th>
       <th scope="col">
        Buffer Pool Pages Included
              (
        <a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_in_core_file">
         <code class="literal">
          innodb_buffer_pool_in_core_file=ON
         </code>
        </a>
        )
       </th>
       <th scope="col">
        Buffer Pool Pages Excluded
              (
        <a class="link" href="innodb-parameters.html#sysvar_innodb_buffer_pool_in_core_file">
         <code class="literal">
          innodb_buffer_pool_in_core_file=OFF
         </code>
        </a>
        )
       </th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <th scope="row">
        4KB
       </th>
       <td>
        2.1GB
       </td>
       <td>
        0.9GB
       </td>
      </tr>
      <tr>
       <th scope="row">
        64KB
       </th>
       <td>
        1.7GB
       </td>
       <td>
        0.7GB
       </td>
      </tr>
     </tbody>
    </table>
   </div>
  </div>
  <br class="table-break"/>
 </div>
 <br/>
</div>
