Re: WAL-files is not removing authomaticaly

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Andrew Anderson <forumwriter007(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: WAL-files is not removing authomaticaly
Date: 2021-03-11 09:18:07
Message-ID: 8824049ee9e1f6476cf65ebb156c71fb2b44fa87.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2021-03-11 at 09:43 +0200, Andrew Anderson wrote:
> > Never, ever, remove WAL files manually.
> > A crash might render your database unrecoverable.
> You're right, it's not a good idea.
>
> > You'll have to figure out what is blocking WAL removal.
> This is my favorite dream!
>
> > Are there archive failures reported in "pg_stat_archiver" and the log?
> master=# select * from pg_stat_archiver;
> archived_count | last_archived_wal | last_archived_time | failed_count | last_failed_wal | last_failed_time | stats_reset
> ----------------+--------------------------+-------------------------------+--------------+-----------------+------------------+------------------------------
> 3021 | 000000010000000B000000C9 | 2021-03-11 08:53:56.133796+02 | 0 | | | 2021-01-06 14:33:40.70147+02
> (1 row)
>
> In today's logs there is no any errors:
> $ grep "FATAL\|WARNING" /opt/pglogs/master.log
> $
>
> $ grep "FATAL\|WARNING" /opt/pglogs/slave.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.
>
> It parameters is differ:
> master=# SELECT pg_current_wal_lsn();
> pg_current_wal_lsn
> --------------------
> B/CB099398
> (1 row)
>
> 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 | 2631806 | | | B/CB0AC068 |
> (1 row)
>
> But when I add new data to the table on master, it apears on slave.
>
> > Look for strange messages in the log file on both servers.
> Looking for strange messages gives nothing, in today's logs there is no any strange messages, just about connects of applications.

All that looks fine.

If that happens again, set "log_min_messages" to "debug2".
Then the log file will contain information abotu the WAL segments that
PostgreSQL is trying to remove. That might give you some insight.

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Valeria Kaplan 2021-03-11 10:03:56 Re: Code of Conduct Russian Translation - Revised March 5, 2021
Previous Message Sandeep Saxena 2021-03-11 08:50:48 Re: pgAgent for multiple databases in same instance