Re: allow online change primary_conninfo - Mailing list pgsql-hackers

From Sergei Kornilov
Subject Re: allow online change primary_conninfo
Date
Msg-id 27578091564654191@myt6-1dca55ddeee8.qloud-c.yandex.net
Whole thread Raw
In response to Re: allow online change primary_conninfo  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
Hello

> It has been some time, and I am finally catching up with this patch.

Thank you!

> + <para>
> + WAL receiver will be restarted after <varname>primary_slot_name</varname>
> + was changed.
>           </para>
> The sentence sounds strange. Here is a suggestion:
> The WAL receiver is restarted after an update of primary_slot_name (or
> primary_conninfo).
>
> The comment at the top of the call of ProcessStartupSigHup() in
> HandleStartupProcInterrupts() needs to be updated as it mentions a
> configuration file re-read, but that's not the case anymore.

I agree. But I want to know if this is an acceptable idea in general, before spending a few more months polishing the
texton something we don’t want.
 

> pendingRestartSource's name does not represent what it does, as it is
> only associated with the restart of a WAL receiver when in streaming
> state, and that's a no-op for the archive mode and the local mode.

Currently we have only one source with such operation, so I can name variable pendingRestartWalreceiver and replace
correspondingswitch to compact condition. If someday we need additional actions for another wal source - we can replace
thiscode. Looks like some form of premature optimization from me
 

> However, if the restart of
> the WAL receiver is planned because of an update of primary_conninfo
> (or slot), shouldn't the follow-up mode be XLOG_FROM_STREAM without
> waiting for wal_retrieve_retry_interval ms for extra WAL to become
> available?

Hmm. Standby with log_min_messages = debug2 and default wal_retrieve_retry_interval = 5s gives me:

2019-08-01 12:38:31.255 MSK 15707 @ from  [vxid: txid:0] [] DEBUG:  sendtime 2019-08-01 12:38:31.254905+03 receipttime
2019-08-0112:38:31.254986+03 replication apply delay 0 ms transfer latency 0 ms
 
2019-08-01 12:38:31.255 MSK 15707 @ from  [vxid: txid:0] [] DEBUG:  sending write 0/3023FA8 flush 0/3023F38 apply
0/3023F38
2019-08-01 12:38:31.262 MSK 15707 @ from  [vxid: txid:0] [] DEBUG:  sending write 0/3023FA8 flush 0/3023FA8 apply
0/3023F38
2019-08-01 12:38:31.262 MSK 15707 @ from  [vxid: txid:0] [] DEBUG:  sending write 0/3023FA8 flush 0/3023FA8 apply
0/3023FA8
2019-08-01 12:38:31.457 MSK 15699 @ from  [vxid: txid:0] [] LOG:  received SIGHUP, reloading configuration files
2019-08-01 12:38:31.458 MSK 15699 @ from  [vxid: txid:0] [] LOG:  parameter "primary_conninfo" changed to " host='/tmp'
port=5555"
2019-08-01 12:38:31.459 MSK 15700 @ from  [vxid:1/0 txid:0] [] LOG:  The WAL receiver is going to be restarted due to
changeof primary_conninfo
 
2019-08-01 12:38:31.459 MSK 15703 @ from  [vxid: txid:0] [] DEBUG:  checkpointer updated shared memory configuration
values
2019-08-01 12:38:31.459 MSK 15707 @ from  [vxid: txid:0] [] FATAL:  terminating walreceiver process due to
administratorcommand
 
2019-08-01 12:38:31.463 MSK 15724 @ from  [vxid: txid:0] [] LOG:  started streaming WAL from primary at 0/3000000 on
timeline1
 
2019-08-01 12:38:31.464 MSK 15724 @ from  [vxid: txid:0] [] DEBUG:  sendtime 2019-08-01 12:38:31.463954+03 receipttime
2019-08-0112:38:31.464228+03 replication apply delay 0 ms transfer latency 0 ms
 
2019-08-01 12:38:31.464 MSK 15724 @ from  [vxid: txid:0] [] DEBUG:  sendtime 2019-08-01 12:38:31.464068+03 receipttime
2019-08-0112:38:31.464375+03 replication apply delay 0 ms transfer latency 0 ms
 
2019-08-01 12:38:31.464 MSK 15724 @ from  [vxid: txid:0] [] DEBUG:  sending write 0/3023FA8 flush 0/3023FA8 apply
0/3023FA8

No source switch, no wal_retrieve_retry_interval waiting. (wal writes on primary by \watch 0.3 query)
RequestXLogStreaming set walRcvState to WALRCV_STARTING - correct state for WalRcvStreaming and therefore we have no
lastSourceFailed.

regards, Sergei



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: idea: log_statement_sample_rate - bottom limit for sampling
Next
From: Julien Rouhaud
Date:
Subject: Re: Avoid full GIN index scan when possible