Home Explore Blog CI



postgresql

35th chunk of `doc/src/sgml/protocol.sgml`
48a32767b27a75b7f5a0d39774d3b3c11f0abca37fe0a4b60000000100000fa6
 </listitem>
       </varlistentry>
      </variablelist>

     </listitem>
    </varlistentry>

    <varlistentry id="protocol-replication-read-replication-slot">
     <term><literal>READ_REPLICATION_SLOT</literal> <replaceable class="parameter">slot_name</replaceable>
      <indexterm><primary>READ_REPLICATION_SLOT</primary></indexterm>
     </term>
     <listitem>
      <para>
       Read some information associated with a replication slot. Returns a tuple
       with <literal>NULL</literal> values if the replication slot does not
       exist. This command is currently only supported for physical replication
       slots.
      </para>

      <para>
       In response to this command, the server will return a one-row result set,
       containing the following fields:
       <variablelist>
        <varlistentry>
         <term><literal>slot_type</literal> (<type>text</type>)</term>
         <listitem>
          <para>
           The replication slot's type, either <literal>physical</literal> or
           <literal>NULL</literal>.
          </para>
         </listitem>
        </varlistentry>

        <varlistentry>
         <term><literal>restart_lsn</literal> (<type>text</type>)</term>
         <listitem>
          <para>
           The replication slot's <literal>restart_lsn</literal>.
          </para>
         </listitem>
        </varlistentry>

        <varlistentry>
         <term><literal>restart_tli</literal> (<type>int8</type>)</term>
         <listitem>
          <para>
           The timeline ID associated with <literal>restart_lsn</literal>,
           following the current timeline history.
          </para>
         </listitem>
        </varlistentry>
       </variablelist>
      </para>
     </listitem>
    </varlistentry>

    <varlistentry id="protocol-replication-start-replication">
     <term><literal>START_REPLICATION</literal> [ <literal>SLOT</literal> <replaceable class="parameter">slot_name</replaceable> ] [ <literal>PHYSICAL</literal> ] <replaceable class="parameter">XXX/XXX</replaceable> [ <literal>TIMELINE</literal> <replaceable class="parameter">tli</replaceable> ]
      <indexterm><primary>START_REPLICATION</primary></indexterm>
     </term>
     <listitem>
      <para>
       Instructs server to start streaming WAL, starting at
       WAL location <replaceable class="parameter">XXX/XXX</replaceable>.
       If <literal>TIMELINE</literal> option is specified,
       streaming starts on timeline <replaceable class="parameter">tli</replaceable>;
       otherwise, the server's current timeline is selected. The server can
       reply with an error, for example if the requested section of WAL has already
       been recycled. On success, the server responds with a CopyBothResponse
       message, and then starts to stream WAL to the frontend.
      </para>

      <para>
       If a slot's name is provided
       via <replaceable class="parameter">slot_name</replaceable>, it will be updated
       as replication progresses so that the server knows which WAL segments,
       and if <varname>hot_standby_feedback</varname> is on which transactions,
       are still needed by the standby.
      </para>

      <para>
       If the client requests a timeline that's not the latest but is part of
       the history of the server, the server will stream all the WAL on that
       timeline starting from the requested start point up to the point where
       the server switched to another timeline. If the client requests
       streaming at exactly the end of an old timeline, the server skips COPY
       mode entirely.
      </para>

      <para>
       After streaming all the WAL on a timeline that is not the latest one,
       the server will end streaming by exiting the COPY mode. When the client
       acknowledges this by also exiting COPY mode, the server sends a result
       set with one row and two columns, indicating the next timeline in this
       server's history. The first column is the next timeline's

Title: Replication Control Commands
Summary
The document describes commands for controlling replication, including READ_REPLICATION_SLOT for reading slot information, and START_REPLICATION for instructing the server to start streaming WAL, with options for specifying the slot name, timeline, and start location, and details on the server's response and behavior.