Re: speed up a logical replica setup
Euler Taveira <euler@eulerto.com>
Commits
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
pg_createsubscriber: Remove obsolete comment
- 71795d1cb41b 17.0 landed
- 1330843bb78e 18.0 landed
-
pg_createsubscriber: Fix an unpredictable recovery wait time.
- e5ba6a5ab62c 17.0 landed
- 03b08c8f5f3e 18.0 landed
-
Fix unstable test in 040_pg_createsubscriber.
- ae4e072bad5f 17.0 landed
- 9fd8b331dfe1 18.0 landed
-
Fix the testcase introduced in commit 81d20fbf7a.
- ae395f0f7edb 18.0 landed
- 14387ab06503 17.0 landed
-
Further weaken new pg_createsubscriber test on Windows.
- 55c309fc5b08 17.0 landed
- a1333ec048fb 18.0 landed
-
Temporarily(?) weaken new pg_createsubscriber test on Windows.
- 54508209178b 17.0 landed
-
Make pg_createsubscriber warn if publisher has two-phase commit enabled.
- 917754557cc0 17.0 landed
-
Make pg_createsubscriber more wary about quoting connection parameters.
- b3f5ccebd79d 17.0 landed
-
pg_createsubscriber: Remove failover replication slots on subscriber
- 81d20fbf7a03 17.0 landed
-
pg_createsubscriber: Remove replication slot check on primary
- b96391382626 17.0 landed
-
pg_createsubscriber: Only --recovery-timeout controls the end of recovery process
- 04c8634c0c4d 17.0 landed
-
pg_createsubscriber: creates a new logical replica from a standby server
- d44032d01463 17.0 landed
-
Add some const decorations
- 48018f1d8c12 17.0 landed
-
Add option force_initdb to PostgreSQL::Test::Cluster:init()
- ff9e1e764fcc 17.0 cited
-
Remove MSVC scripts
- 1301c80b2167 17.0 cited
On Wed, Mar 6, 2024, at 8:24 AM, vignesh C wrote:
> Few comments:
Thanks for your review. Some changes are included in v26.
> 1) Can we use strdup here instead of atoi, as we do similarly in
> case of pg_dump too, else we will do double conversion, convert using
> atoi and again to string while forming the connection string:
> + case 'p':
> + if ((opt.sub_port = atoi(optarg)) <= 0)
> + pg_fatal("invalid subscriber
> port number");
> + break;
I don't have a strong preference but decided to provide a patch for it. See
v26-0003.
> 2) We can have some valid range for this, else we will end up in some
> unexpected values when a higher number is specified:
> + case 't':
> + opt.recovery_timeout = atoi(optarg);
> + break;
I wouldn't like to add an arbitrary value. Suggestions?
> 3) Now that we have addressed most of the items, can we handle this TODO:
> + /*
> + * TODO use primary_conninfo (if available) from subscriber and
> + * extract publisher connection string. Assume that there are
> + * identical entries for physical and logical
> replication. If there is
> + * not, we would fail anyway.
> + */
> + pg_log_error("no publisher connection string specified");
> + pg_log_error_hint("Try \"%s --help\" for more
> information.", progname);
> + exit(1);
It is not in my top priority at the moment.
> 4) By default the log level as info here, I was not sure how to set
> it to debug level to get these error messages:
> + pg_log_debug("publisher(%d): connection string: %s",
> i, dbinfo[i].pubconninfo);
> + pg_log_debug("subscriber(%d): connection string: %s",
> i, dbinfo[i].subconninfo);
<term><option>-v</option></term>
<term><option>--verbose</option></term>
<listitem>
<para>
Enables verbose mode. This will cause
<application>pg_createsubscriber</application> to output progress messages
and detailed information about each step to standard error.
Repeating the option causes additional debug-level messages to appear on
standard error.
</para>
> 5) Currently in non verbose mode there are no messages printed on
> console, we could have a few of them printed irrespective of verbose
> or not like the following:
> a) creating publication
> b) creating replication slot
> c) waiting for the target server to reach the consistent state
> d) If pg_createsubscriber fails after this point, you must recreate
> the physical replica before continuing.
> e) creating subscription
That's the idea. Quiet mode by default.
> 6) The message should be "waiting for the target server to reach the
> consistent state":
> +#define NUM_CONN_ATTEMPTS 5
> +
> + pg_log_info("waiting the target server to reach the consistent state");
> +
> + conn = connect_database(conninfo, true);
Fixed.
--
Euler Taveira
EDB https://www.enterprisedb.com/