Re: oldest WAL files not removed

From: Ninad Shah <nshah(dot)postgres(at)gmail(dot)com>
To: o(dot)lepretre(at)gmail(dot)com
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: oldest WAL files not removed
Date: 2021-09-02 13:24:03
Message-ID: CAOFEiBfPRw4YdCHYmTXMZxx1yU1rz1v_sHfiNCQrohUZsedezw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear Oliver,

Kindly do not remove any WAL file from pg_wal. You should consider checking
out following settings in the postgresql.conf file.

1) wal_keep_segments
- This setting enable retention of last this number of files. e.g. if this
parameter is set to 256, last 256 files will not be deleted.

2) min_wal_size and max_wal_size
- Files beyond max_wal_size limit can be removed. e.g. if max_wal_size is
set to 1GB, last few files that collectively sizes 1GB will be retained.

In any case, if files are still preserved in spite of they are eligible to
get removed, kindly execute "CHECKPOINT" command or wait for next
checkpoint to occur.

Regards,
Ninad Shah

On Wed, 1 Sept 2021 at 16:19, <o(dot)lepretre(at)gmail(dot)com> wrote:

> Hi,
>
>
>
> Looking at WAL folder after a crash, I noticed that new files after
> restarting overwrite the more recent files before the crash and not the
> oldest, which was what I expected.
>
> Is that normal ? I got only one file marked .deleted. Does that happens
> when a WAL file hase been completed updated in the database and if then
> while all oldest files aren’t marked .deleted after restarting ?
>
>
>
> Example :
>
> Crash occurs Aug 31 22:03 which is the more recent Wal file, the oldest
> file is Aug 30 17:20 (and 105 files between those two)
>
> After restarting Aug 30 17:20 is still there, Aug 31 22:03 disappeared,
> one new file is Sep 1 12:15 marked .deleted (restarting date) and one new
> Sep 1 12:36 which I guess is normal. Right now, I see an new wal file and
> the previous one marked .deleted which is ok.
>
>
>
> Why are the oldest wal files still there ?? Can I remove them ?
>
>
>
> Hope I’m clear enough and thanks for explanations,
>
>
>
> Olivier
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ninad Shah 2021-09-02 13:28:03 Re: Issue with a query while running on a remote host
Previous Message Alvaro Herrera 2021-09-02 13:13:39 Re: datfrozenxid not dropping after vacuum