Re: oldest WAL files not removed

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: o(dot)lepretre(at)gmail(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: oldest WAL files not removed
Date: 2021-09-02 02:40:33
Message-ID: 20210902.114033.943185538249014089.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

At Wed, 1 Sep 2021 12:48:51 +0200, <o(dot)lepretre(at)gmail(dot)com> wrote in
> 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,

It would be very helpful you gave us the name of the files. Due to
WAL file recycling, timestamps are frequently shuffled aginst names.

In any case, no WAL files ought to be manually removed. If you don't
need the recycled-for-future files that much, consider reducing
min_wal_size.

If you looked the files only in timestamp order, with a high odds, the
"oldest" file is a recycled file to be used in future, and the
"newest" file is the currently written one. If so, the reason that
the oldest-in-timestamp file is still there is it is still waiting to
be used. Even if you removed the to-be-used-in-future files, such
files would increase to the same extent according to the setting of
min_wal_size.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Atul Kumar 2021-09-02 05:11:30 Re: vacuumlo
Previous Message Matthew Tice 2021-09-01 22:01:28 Re: datfrozenxid not dropping after vacuum