standby server is complaining about missing wal file after switchover

From: Dhirendra Singh <dhirendraks(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: standby server is complaining about missing wal file after switchover
Date: 2022-10-13 13:42:43
Message-ID: CAEyh4sZtxm=f-BiakMy83WgEY8_woAb61EY0Jpc=61COKrLj8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,
My postgres version is 14.2
I have setup streaming replication between a primary and a standby using
replication slot and without archive.
I have created replication slot "slot1" on the primary.
I did switchover following below steps.
1. shutdown the primary server.
2. created replicated slot "slot1" on standby and promoted it to primary.
3. run pg_rewind on the old primary and made it standby.
4. started the old primary as new standby.

I got following error in the new standby. it is complaining about missing
wal file on the new primary.

2022-10-13 12:58:48.497 UTC [25] LOG: fetching timeline history file for
timeline 2 from primary server
2022-10-13 12:58:48.508 UTC [25] LOG: started streaming WAL from primary
at 0/B000000 on timeline 1
2022-10-13 12:58:48.508 UTC [25] FATAL: could not receive data from WAL
stream: ERROR: requested WAL segment 00000002000000000000000B has already
been removed
2022-10-13 12:58:48.509 UTC [21] LOG: new target timeline is 2
2022-10-13 12:58:48.580 UTC [28] LOG: started streaming WAL from primary
at 0/B000000 on timeline 2
2022-10-13 12:58:48.580 UTC [28] FATAL: could not receive data from WAL
stream: ERROR: requested WAL segment 00000002000000000000000B has already
been removed

why the new primary has removed the wal file even though i created
replication slot on it before promoting.
value of max_slot_wal_keep_size is -1 and wal_keep_size is 0

Thanks,
Dhirendra.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Holger Jakobs 2022-10-13 14:07:59 Re: Gui strange behaviour - trying to bring all rows
Previous Message Albin Ary 2022-10-13 13:41:28 Re: Gui strange behaviour - trying to bring all rows