[11.6] WALs recovery ordering with Restore Command - timelines - Mailing list pgsql-general

From Pavel Suderevsky
Subject [11.6] WALs recovery ordering with Restore Command - timelines
Date
Msg-id CAEBTBzt9Enh8UJYAWWHj4CVj6YgW87mdWwW9pEEXjhzSW3cupg@mail.gmail.com
Whole thread Raw
Responses Re: [11.6] WALs recovery ordering with Restore Command - timelines  (Pavel Suderevsky <psuderevsky@gmail.com>)
List pgsql-general
Hi,

PostgreSQL 11.6
Centos 7.6
pgBackrest 2.19


Case:
Master is on timeline 15 while Standby that should be synchronized with Master as a hot standby is on timeline 13. WALs to be obtained from archive.

recovery.conf:
>primary_conninfo = 'user=usename host=10.10.10.3 port=5432 sslmode=prefer application_name=pg2'
>recovery_target_timeline = 'latest'
>restore_command = '/usr/bin/pgbackrest --stanza=platform archive-get %f "%p" --log-level-console info'
>standby_mode = 'on'

Standby recovery is done like that:
1. try restore 0000000F00000A27000000E5
2. unable to find 0000000F00000A27000000E5 in the archive
3. try restore 0000000E00000A27000000E5
4. found 0000000E00000A27000000E5 in the archive
-- trying next WAL for BOTH timelines
1. try restore 0000000F00000A27000000E6
2. unable to find 0000000F00000A27000000E6 in the archive
3. try restore 0000000E00000A27000000E6
4. found 0000000E00000A27000000E6 in the archive

Why does Postgres restore WALs not in a timelines order? First 13, then 14, then 15. Up to timeline switch position. WALs it try to restore for the latest timeline are deliberately not yet exist. It leads to terrible recovery performance because of long "unable to find" operations.

pgsql-general by date:

Previous
From: Bob Jolliffe
Date:
Subject: Re: casting Bangla characters to NUMERIC
Next
From: Yessica Brinkmann
Date:
Subject: Re: I think that my data is saved correctly, but when printing again,other data appears