From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Andrus <kobruleht2@hot.ee>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: How to prevent master server crash if hot standby stops
Date: Tue, 07 Apr 2020 09:12:25 +0200
Message-ID: <f2d2499b1d8dd8d585e046d26b1dbd4903c2ea00.camel@cybertec.at> (raw)
In-Reply-To: <0E181F52FD6449568F620E9C84427D10@dell2>
References: <5E2C91B46CEF42078CC7BEE1EDC10F0E@dell2>
<b23afcd4f436c3310f236086b9daa39304650874.camel@cybertec.at>
<0A8FE679886142EBABB0AC8102477904@dell2>
<d977eb1f8b4d178a001c5ab613bfa6ae3961426e.camel@cybertec.at>
<0E181F52FD6449568F620E9C84427D10@dell2>
On Tue, 2020-04-07 at 00:50 +0300, Andrus wrote:
> > If you prefer replication to fail silently, don't use replication
> > slots. Use "wal_keep_segments" instead.
>
> I desided to give 1 GB to wal. So I added
>
> wal_keep_segments=60
>
> After some time Postgres created 80 files with total size 1.3GB.
>
> How to fix this so that no more than 1 GB of disk space is used ?
> How to get information how may wal files are yet not processed by slave ?
> How to delete processed wal files so that 1 GB of disk space can used for some other purposes ?
"wal_keep_segments" is the number of old WAL segments the server keeps around
for the standby. But there are also some segments that are created for future
use (the minimum is governed by "min_wal_size").
All these limits are not hard limits, the server will try to keep them
more or less. Consider that WAL segments are created as needed, but only
removed during checkpoints.
So, about your first question, you cannot.
Always make sure that there is more disk space available.
About your second question, you also cannot do that.
The primary server has no idea which standby server needs which WAL information.
All you can tell is where the currently connected standby servers are:
SELECT pg_walfile_name(flush_lsn) FROM pg_stat_replication;
About your third question, you *never* manually mess with the files in pg_wal.
The server does that.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
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, kobruleht2@hot.ee
Subject: Re: How to prevent master server crash if hot standby stops
In-Reply-To: <f2d2499b1d8dd8d585e046d26b1dbd4903c2ea00.camel@cybertec.at>
References: <5E2C91B46CEF42078CC7BEE1EDC10F0E@dell2> <b23afcd4f436c3310f236086b9daa39304650874.camel@cybertec.at> <0A8FE679886142EBABB0AC8102477904@dell2> <d977eb1f8b4d178a001c5ab613bfa6ae3961426e.camel@cybertec.at> <0E181F52FD6449568F620E9C84427D10@dell2> <f2d2499b1d8dd8d585e046d26b1dbd4903c2ea00.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