Home Explore Blog CI



postgresql

8th chunk of `doc/src/sgml/ref/pg_createsubscriber.sgml`
17eed311b45ea9e696fefee75d6f98793ae0d755d7a60a33000000010000089c
 subscriptions as a replication start point.  It guarantees that no
      transaction will be lost.
     </para>
    </step>

    <step>
     <para>
      Write recovery parameters into the target data directory and restart the
      target server.  It specifies an LSN (<xref
      linkend="guc-recovery-target-lsn"/>) of the write-ahead log location up
      to which recovery will proceed.  It also specifies
      <literal>promote</literal> as the action that the server should take
      once the recovery target is reached.  Additional <link
      linkend="runtime-config-wal-recovery-target">recovery parameters</link>
      are added to avoid unexpected behavior during the recovery process such
      as end of the recovery as soon as a consistent state is reached (WAL
      should be applied until the replication start location) and multiple
      recovery targets that can cause a failure.  This step finishes once the
      server ends standby mode and is accepting read-write transactions.  If
      <option>--recovery-timeout</option> option is set,
      <application>pg_createsubscriber</application> terminates if recovery
      does not end until the given number of seconds.
     </para>
    </step>

    <step>
     <para>
      Create a subscription for each specified database on the target server.
      If the <option>--subscription</option> option is not specified, the
      subscription has the following name pattern:
      <quote><literal>pg_createsubscriber_%u_%x</literal></quote> (parameters:
      database <parameter>oid</parameter>, random <parameter>int</parameter>).
      It does not copy existing data from the source server.  It does not
      create a replication slot.  Instead, it uses the replication slot that
      was created in a previous step.  The subscription is created but it is
      not enabled yet.  The reason is the replication progress must be set to
      the replication start point before starting the replication.
     </para>
    </step>

    <step>
     <para>
      Drop publications on the target server that were replicated because they
      were created before the replication start location.  It has no use on
      the subscriber.

Title: pg_createsubscriber How It Works: Steps 5-7
Summary
This section details the later steps of `pg_createsubscriber`. It involves creating subscriptions on the target server for each database (with a customizable naming pattern if options are not specified), utilizing the replication slot created earlier and initializing the subscription in a disabled state to allow for replication progress to be set before enabling. The process then drops any publications on the target server that were replicated from the source server that were created before the replication start location to clean up replicated publications that have no use on the subscriber.