Re: speed up a logical replica setup
От | Euler Taveira |
---|---|
Тема | Re: speed up a logical replica setup |
Дата | |
Msg-id | d4268f63-c8b7-4de0-885f-91f868131326@app.fastmail.com обсуждение исходный текст |
Ответ на | Re: speed up a logical replica setup (vignesh C <vignesh21@gmail.com>) |
Список | pgsql-hackers |
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 incase of pg_dump too, else we will do double conversion, convert usingatoi and again to string while forming the connection string:+ case 'p':+ if ((opt.sub_port = atoi(optarg)) <= 0)+ pg_fatal("invalid subscriberport 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 someunexpected 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 logicalreplication. If there is+ * not, we would fail anyway.+ */+ pg_log_error("no publisher connection string specified");+ pg_log_error_hint("Try \"%s --help\" for moreinformation.", 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 setit 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 onconsole, we could have a few of them printed irrespective of verboseor not like the following:a) creating publicationb) creating replication slotc) waiting for the target server to reach the consistent stated) If pg_createsubscriber fails after this point, you must recreatethe 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 theconsistent state":+#define NUM_CONN_ATTEMPTS 5++ pg_log_info("waiting the target server to reach the consistent state");++ conn = connect_database(conninfo, true);
Fixed.
В списке pgsql-hackers по дате отправления: