PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID15323
PG Version9.6.10
OSDebian Stretch
Opened2018-08-13 14:37:00+00
Reported byPhil Endecott
StatusOpen

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      15323
Logged by:          Phil Endecott
Email address:      (redacted)
PostgreSQL version: 9.6.10
Operating system:   Debian Stretch
Description:        

I have set up a replication system that uses a combination of WAL segment
archiving and streaming.
If the slave goes down for a period, when it restarts it will initially
fetch WAL segment files from the archive using restore_command.  After
fetching the last of these it will start streaming directly from the
master.
It seems that the WAL segment files may have a small empty space at the end
due presumably to the size of the records.  In my case, the last archived
WAL segment ended at offset 0xFFF088.  The slave therefore tried to start
streaming at that position.  But the master had already archived that
segment and recycled it, because I had not set wal_keep_segments and it
defaults to 0.  Streaming therefore failed to start.
It seems to me that wal_keep_segments must always be >= 1 for the
combination of WAL archiving and streaming to work.
If this understanding is correct, the fix could be some combination of:
(a) Make the default for wal_keep_segments 1.
(b) Make the default for wal_keep_segments 1 if archiving is enabled.
(c) Make the WAL restore process skip over this end-of-segment gap and start
streaming at the start of the master's current segment.
(d) Document that wal_keep_segments must be >= 1 in this case.  (The current
docs in section 2.26.5 say that "if you set up a WAL archive that's
accessible from the standby, these solutions [meaning wal_keep_segments and
replication slots] are not required".)

See also:
https://www.postgresql.org/message-id/flat/1534100972118%40dmwebmail.dmwebmail.chezphil.org

Thanks, Phil.

Messages

DateAuthorSubject
2018-08-13 14:37:00+00=?utf-8?q?PG_Bug_reporting_form?=BUG #15323: wal_keep_segments must be >= 1 for WAL archiving + streaming to work
2018-08-13 14:45:34+00Andres FreundRe: BUG #15323: wal_keep_segments must be >= 1 for WAL archiving + streaming to work
2018-08-13 14:59:32+00"Phil Endecott"Re: BUG #15323: wal_keep_segments must be >= 1 for WAL archiving + streaming to work
2018-08-13 15:02:00+00Andres FreundRe: BUG #15323: wal_keep_segments must be >= 1 for WAL archiving + streaming to work
2018-08-13 15:22:11+00Stephen FrostRe: BUG #15323: wal_keep_segments must be >= 1 for WAL archiving + streaming to work
2018-08-13 15:27:12+00Andres FreundRe: BUG #15323: wal_keep_segments must be >= 1 for WAL archiving + streaming to work
2018-08-13 15:42:47+00Stephen FrostRe: BUG #15323: wal_keep_segments must be >= 1 for WAL archiving + streaming to work
2018-08-13 15:55:45+00Andres FreundRe: BUG #15323: wal_keep_segments must be >= 1 for WAL archiving + streaming to work
2018-08-13 16:01:36+00Andres FreundRe: BUG #15323: wal_keep_segments must be >= 1 for WAL archiving + streaming to work
2018-08-13 16:19:04+00Stephen FrostRe: BUG #15323: wal_keep_segments must be >= 1 for WAL archiving + streaming to work