pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Forum Writer <forumwriter007@gmail.com>
To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: WAL-files is not removing authomaticaly
Date: Wed, 10 Mar 2021 18:40:58 +0100
Message-ID: <7eee13c535a2f1de6e8dece0791531f3dc7f2c0e.camel@cybertec.at> (raw)
In-Reply-To: <CAHAzDi=7s2UpiFKQyQb+yNqFLaL3jrH=n2z=f52U8fc=QXbc7Q@mail.gmail.com>
References: <CAHAzDi=7s2UpiFKQyQb+yNqFLaL3jrH=n2z=f52U8fc=QXbc7Q@mail.gmail.com>

On Wed, 2021-03-10 at 14:34 +0200, Forum Writer wrote:
> Have Streaming replica with 2 hosts, master and slave with PostgreSQL 10.6.
>  Replica works fine and data from master copying to slave without any problem,
> but on slave have a problem: wal-files in catalog ${PGDATA}/pg_wal is not
>  removing authomaticaly and may be collects over some years.
>
> Both, master (1.1.1.1) and slave (2.2.2.2), have simmilar replication slots:
> 
> master=# select * from pg_replication_slots;
>       slot_name      | plugin | slot_type | datoid | database | temporary | active | active_pid | xmin | catalog_xmin | restart_lsn | confirmed_flush_lsn 
> ---------------------+--------+-----------+--------+----------+-----------+--------+------------+------+--------------+-------------+---------------------
>  standby_slot |        | physical  |        |          | f         | t      |       1184 |      |              | 8/1C16C508  | 
> (1 row)
> 
> and seted in ${PGDATA}/recovery.conf on slave:
> 
> standby_mode = 'on'
> primary_conninfo = 'user=pgadmin host=2.2.2.2 port=5432 user=pgadmin sslmode=prefer sslcompression=1'
> recovery_target_timeline = 'latest'
> trigger_file = 'failover'
> restore_command = 'cp /opt/archivelog/%f %p'
> archive_cleanup_command = '/usr/pgsql-10/bin/pg_archivecleanup /opt/archivelog %r'
> primary_slot_name = 'standby_slot'
> 
> In ${PGDATA}/postgresql.conf on both hosts sets:
> 
> max_wal_size = 8GB
> wal_keep_segments = 32
> 
> But yesterday pg_wal was 16G and had 1018 files inside, thats why there was no other
>  way except deleting its manualy, but not of all,
> just 6 hundreds files, which had modification time before September 2020 except
>  000000010000000000000034.00000028.backup.
> Trying to rebuild slave from master with: making pg_start_backup, copying ${PGDATA}
>  files from master to slave (without removing on slave any files in ${PGDATA}),
> pg_stop_backup, tunning settings on slave and run it again had no any success,
>  wal-files still is not removing automaticaly.
> Does anybody knows how to fix it ?

Never, ever, remove WAL files manually.
A crash might render your database unrecoverable.

You'll have to figure out what is blocking WAL removal.

Are there archive failures reported in "pg_stat_archiver" and the log?

You say that replication is working fine, but try

  SELECT pg_current_wal_lsn();

on the primary and compare that with the "restart_lsn" of the replication slot.

Look for strange messages in the log file on both servers.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com






view thread (18+ messages)  latest in thread

Message-ID: <7eee13c535a2f1de6e8dece0791531f3dc7f2c0e.camel@cybertec.at>
Permalink:  ../7eee13c535a2f1de6e8dece0791531f3dc7f2c0e.camel@cybertec.at/
Also on:    postgresql.org/message-id/7eee13c535a2f1de6e8dece0791531f3dc7f2c0e.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, forumwriter007@gmail.com
  Subject: Re: WAL-files is not removing authomaticaly
  In-Reply-To: <7eee13c535a2f1de6e8dece0791531f3dc7f2c0e.camel@cybertec.at>
  References: <CAHAzDi=7s2UpiFKQyQb+yNqFLaL3jrH=n2z=f52U8fc=QXbc7Q@mail.gmail.com> <7eee13c535a2f1de6e8dece0791531f3dc7f2c0e.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox