Home Explore Blog CI



postgresql

4th chunk of `doc/src/sgml/ref/pg_rewind.sgml`
7cc680cd9cc64348d88ecf1b2810efbcc53374a7281353620000000100000fb1
 will wait for all files
        to be written safely to disk.  This option causes
        <command>pg_rewind</command> to return without waiting, which is
        faster, but means that a subsequent operating system crash can leave
        the data directory corrupt.  Generally, this option is useful for
        testing but should not be used on a production
        installation.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-P</option></term>
      <term><option>--progress</option></term>
      <listitem>
       <para>
        Enables progress reporting. Turning this on will deliver an approximate
        progress report while copying data from the source cluster.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-c</option></term>
      <term><option>--restore-target-wal</option></term>
      <listitem>
       <para>
        Use <varname>restore_command</varname> defined in the target cluster
        configuration to retrieve WAL files from the WAL archive if these
        files are no longer available in the <filename>pg_wal</filename>
        directory.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>--config-file=<replaceable class="parameter">filename</replaceable></option></term>
      <listitem>
       <para>
        Use the specified main server configuration file for the target
        cluster. This affects <application>pg_rewind</application> when
        it uses internally the <application>postgres</application> command
        for the rewind operation on this cluster (when retrieving
        <varname>restore_command</varname> with the option
        <option>-c/--restore-target-wal</option> and when forcing a
        completion of crash recovery).
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>--debug</option></term>
      <listitem>
       <para>
        Print verbose debugging output that is mostly useful for developers
        debugging <application>pg_rewind</application>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>--no-ensure-shutdown</option></term>
      <listitem>
       <para>
        <application>pg_rewind</application> requires that the target server
        is cleanly shut down before rewinding. By default, if the target server
        is not shut down cleanly, <application>pg_rewind</application> starts
        the target server in single-user mode to complete crash recovery first,
        and stops it.
        By passing this option, <application>pg_rewind</application> skips
        this and errors out immediately if the server is not cleanly shut
        down. Users are expected to handle the situation themselves in that
        case.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>--sync-method=<replaceable class="parameter">method</replaceable></option></term>
      <listitem>
       <para>
        When set to <literal>fsync</literal>, which is the default,
        <command>pg_rewind</command> will recursively open and synchronize all
        files in the data directory.  The search for files will follow symbolic
        links for the WAL directory and each configured tablespace.
       </para>
       <para>
        On Linux, <literal>syncfs</literal> may be used instead to ask the
        operating system to synchronize the whole file systems that contain the
        data directory, the WAL files, and each tablespace.  See
        <xref linkend="guc-recovery-init-sync-method"/> for information about
        the caveats to be aware of when using <literal>syncfs</literal>.
       </para>
       <para>
        This option has no effect when <option>--no-sync</option> is used.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
      <term><option>-V</option></term>
      <term><option>--version</option></term>

Title: pg_rewind Options: WAL, Configuration, Debugging, and Synchronization
Summary
More pg_rewind options include: -P/--progress, enabling progress reporting; -c/--restore-target-wal, using restore_command for WAL retrieval. --config-file specifies the main server configuration file. --debug enables verbose debugging output. --no-ensure-shutdown skips crash recovery if the target isn't cleanly shut down. --sync-method specifies the method for synchronizing files (fsync or syncfs). These options control various aspects of the pg_rewind process, including WAL handling, configuration loading, debugging output, and synchronization methods.