On Mon, Oct 25, 2021 at 05:46:57PM +0530, Bharath Rupireddy wrote:
> StreamLog() isn't reached for create and drop slot cases, see [1]. I
> suggest to remove replication_slot != NULL and have Assert(slot_name)
> in GetSlotInformation():
> /*
> * Try to get the starting point from the slot. This is supported in
> * PostgreSQL 15 and up.
> */
> if (PQserverVersion(conn) >= 150000)
> {
> if (!GetSlotInformation(conn, replication_slot, &stream.startpos,
> &stream.timeline))
> {
> /* Error is logged by GetSlotInformation() */
> return;
> }
> }Please note that it is possible to use pg_receivewal without a slot, which is the default case, so we cannot do what you are suggesting here. An assertion on slot_name in GetSlotInformation() is not that helpful either in my opinion, as we would just crash a couple of lines down the road. I have changed the patch per Ronan's suggestion to have the version check out of GetSlotInformation(), addressed what you have reported, and the result looked good. So I have applied this part. What remains on this thread is the addition of new tests to make sure that pg_receivewal is able to follow a timeline switch. Now that we can restart from a slot that should be a bit easier to implemented as a test by creating a slot on a standby. Ronan, are you planning to send a new patch for this part? -- Michael
signature.asc
Description: PGP signature
