Home Explore Blog CI



postgresql

79th chunk of `doc/src/sgml/monitoring.sgml`
012d17d3aa4ef74d4fd34d7af2a9875b034afe21cc3fec300000000100000fa7
 <entry>
       The WAL sender process is currently estimating the total amount
       of database files that will be streamed as a base backup.
      </entry>
     </row>
     <row>
      <entry><literal>streaming database files</literal></entry>
      <entry>
       The WAL sender process is currently streaming database files
       as a base backup.
      </entry>
     </row>
     <row>
      <entry><literal>waiting for wal archiving to finish</literal></entry>
      <entry>
       The WAL sender process is currently performing
       <function>pg_backup_stop</function> to finish the backup,
       and waiting for all the WAL files required for the base backup
       to be successfully archived.
       If either <literal>--wal-method=none</literal> or
       <literal>--wal-method=stream</literal> is specified in
       <application>pg_basebackup</application>, the backup will end
       when this phase is completed.
      </entry>
     </row>
     <row>
      <entry><literal>transferring wal files</literal></entry>
      <entry>
       The WAL sender process is currently transferring all WAL logs
       generated during the backup. This phase occurs after
       <literal>waiting for wal archiving to finish</literal> phase if
       <literal>--wal-method=fetch</literal> is specified in
       <application>pg_basebackup</application>. The backup will end
       when this phase is completed.
      </entry>
     </row>
    </tbody>
   </tgroup>
  </table>

 </sect2>

 </sect1>

 <sect1 id="dynamic-trace">
  <title>Dynamic Tracing</title>

 <indexterm zone="dynamic-trace">
  <primary>DTrace</primary>
 </indexterm>

  <para>
   <productname>PostgreSQL</productname> provides facilities to support
   dynamic tracing of the database server. This allows an external
   utility to be called at specific points in the code and thereby trace
   execution.
  </para>

  <para>
   A number of probes or trace points are already inserted into the source
   code. These probes are intended to be used by database developers and
   administrators. By default the probes are not compiled into
   <productname>PostgreSQL</productname>; the user needs to explicitly tell
   the configure script to make the probes available.
  </para>

  <para>
   Currently, the
   <ulink url="https://en.wikipedia.org/wiki/DTrace">DTrace</ulink>
   utility is supported, which, at the time of this writing, is available
   on Solaris, macOS, FreeBSD, NetBSD, and Oracle Linux.  The
   <ulink url="https://sourceware.org/systemtap/">SystemTap</ulink> project
   for Linux provides a DTrace equivalent and can also be used.  Supporting other dynamic
   tracing utilities is theoretically possible by changing the definitions for
   the macros in <filename>src/include/utils/probes.h</filename>.
  </para>

  <sect2 id="compiling-for-trace">
   <title>Compiling for Dynamic Tracing</title>

  <para>
   By default, probes are not available, so you will need to
   explicitly tell the configure script to make the probes available
   in <productname>PostgreSQL</productname>. To include DTrace support
   specify <option>--enable-dtrace</option> to configure.  See <xref
   linkend="configure-options-devel"/> for further information.
  </para>
  </sect2>

  <sect2 id="trace-points">
   <title>Built-in Probes</title>

  <para>
   A number of standard probes are provided in the source code,
   as shown in <xref linkend="dtrace-probe-point-table"/>;
   <xref linkend="typedefs-table"/>
   shows the types used in the probes.  More probes can certainly be
   added to enhance <productname>PostgreSQL</productname>'s observability.
  </para>

 <table id="dtrace-probe-point-table">
  <title>Built-in DTrace Probes</title>
  <tgroup cols="3">
   <colspec colname="col1" colwidth="2*"/>
   <colspec colname="col2" colwidth="3*"/>
   <colspec colname="col3" colwidth="3*"/>
   <thead>
    <row>
     <entry>Name</entry>
     <entry>Parameters</entry>
     <entry>Description</entry>
    </row>
   </thead>

   <tbody>

Title: Base Backup Phases and Dynamic Tracing in PostgreSQL
Summary
This section concludes the explanation of base backup phases in PostgreSQL, detailing the 'transferring WAL files' phase when using `--wal-method=fetch`. It then introduces dynamic tracing capabilities using DTrace and SystemTap, explaining how to compile PostgreSQL with dynamic tracing support and listing available built-in probes. Dynamic tracing helps in tracing execution for developers and administrators, providing observability into PostgreSQL's operations.