Skip to content

Geo: WAL keep segments may need to be increased for pg_basebackup

ZD: https://gitlab.zendesk.com/agent/tickets/82358

Customer attempted to run the replication, but it failed after some time:

* Stopping PostgreSQL and all GitLab services 
Enter the password for gitlab_replicator@10.16.3.176: 
* Checking for replication slot x_x_com 
* Backing up postgresql.conf 
* Moving old data directory to '/var/opt/gitlab/postgresql/data.1505481439' 
* Starting base backup as the replicator user (gitlab_replicator) 
pg_basebackup: initiating base backup, waiting for checkpoint to complete 
pg_basebackup: checkpoint completed 
transaction log start point: 1EE/C0000028 on timeline 1 
42010/42010 kB (100%), 1/1 tablespace 
pg_basebackup: could not get transaction log end position from server: ERROR: requested WAL segment 00000001000001EE000000C0 has already been removed

pg_basebackup: initiating base backup, waiting for checkpoint to complete 
pg_basebackup: checkpoint completed 
transaction log start point: 1EE/C0000028 on timeline 1 
42010/42010 kB (100%), 1/1 tablespace 
pg_basebackup: could not get transaction log end position from server: ERROR: requested WAL segment 00000001000001EE000000C0 has already been removed 
[ERROR] Failed to execute: PGPASSFILE=/var/opt/gitlab/postgresql/.pgpass /opt/gitlab/embedded/bin/pg_basebackup -h 10.16.3.176 -p 5432 -D /var/opt/gitlab/postgresql/data -U gitlab_replicator -v -x -P -- be sure to run this command as root

Customer increased WAL keep segments to 50, and it finally worked. Perhaps we need to increase the default value?