Home Explore Blog CI



postgresql

4th chunk of `doc/src/sgml/ref/pg_resetwal.sgml`
a3af9b1c983852299a41756c49e78cc61443b8958434c4ed0000000100000fa0
 class="parameter">walfile</replaceable></option></term>
    <listitem>
     <para>
      Manually set the WAL starting location by specifying the name of the
      next WAL segment file.
     </para>

     <para>
      The name of next WAL segment file should be
      larger than any WAL segment file name currently existing in
      the directory <filename>pg_wal</filename> under the data directory.
      These names are also in hexadecimal and have three parts.  The first
      part is the <quote>timeline ID</quote> and should usually be kept the same.
      For example, if <filename>00000001000000320000004A</filename> is the
      largest entry in <filename>pg_wal</filename>, use <literal>-l 00000001000000320000004B</literal> or higher.
     </para>

     <para>
      Note that when using nondefault WAL segment sizes, the numbers in the WAL
      file names are different from the LSNs that are reported by system
      functions and system views.  This option takes a WAL file name, not an
      LSN.
     </para>

     <note>
      <para>
       <command>pg_resetwal</command> itself looks at the files in
       <filename>pg_wal</filename> and chooses a default <option>-l</option> setting
       beyond the last existing file name.  Therefore, manual adjustment of
       <option>-l</option> should only be needed if you are aware of WAL segment
       files that are not currently present in <filename>pg_wal</filename>, such as
       entries in an offline archive; or if the contents of
       <filename>pg_wal</filename> have been lost entirely.
      </para>
     </note>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><option>-m <replaceable class="parameter">mxid</replaceable>,<replaceable class="parameter">mxid</replaceable></option></term>
    <term><option>--multixact-ids=<replaceable class="parameter">mxid</replaceable>,<replaceable class="parameter">mxid</replaceable></option></term>
    <listitem>
     <para>
      Manually set the next and oldest multitransaction ID.
     </para>

     <para>
      A safe value for the next multitransaction ID (first part) can be
      determined by looking for the numerically largest file name in the
      directory <filename>pg_multixact/offsets</filename> under the data directory,
      adding one, and then multiplying by 65536 (0x10000).  Conversely, a safe
      value for the oldest multitransaction ID (second part of
      <option>-m</option>) can be determined by looking for the numerically smallest
      file name in the same directory and multiplying by 65536.  The file
      names are in hexadecimal, so the easiest way to do this is to specify
      the option value in hexadecimal and append four zeroes.
     </para>
     <!-- 65536 = SLRU_PAGES_PER_SEGMENT * BLCKSZ / sizeof(MultiXactOffset) -->
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><option>-o <replaceable class="parameter">oid</replaceable></option></term>
    <term><option>--next-oid=<replaceable class="parameter">oid</replaceable></option></term>
    <listitem>
     <para>
      Manually set the next OID.
     </para>

     <para>
      There is no comparably easy way to determine a next OID that's beyond
      the largest one in the database, but fortunately it is not critical to
      get the next-OID setting right.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><option>-O <replaceable class="parameter">mxoff</replaceable></option></term>
    <term><option>--multixact-offset=<replaceable class="parameter">mxoff</replaceable></option></term>
    <listitem>
     <para>
      Manually set the next multitransaction offset.
     </para>

     <para>
      A safe value can be determined by looking for the numerically largest
      file name in the directory <filename>pg_multixact/members</filename> under the
      data directory, adding one, and then multiplying by 52352 (0xCC80).
      The file names are in hexadecimal.  There is no simple recipe such as
  

Title: pg_resetwal: Options Continued (WAL file, Multitransaction IDs, OID, and Multitransaction Offset)
Summary
This section details more options for pg_resetwal, including manually setting the WAL starting location (-l/--next-wal-file), which requires the name of the next WAL segment file to be larger than existing files in the pg_wal directory. It also covers manually setting the next and oldest multitransaction ID (-m/--multixact-ids), the next OID (-o/--next-oid), and the next multitransaction offset (-O/--multixact-offset). The section provides instructions on how to determine safe values for these parameters by examining the contents of specific directories under the data directory.