Re: strange behavior of WAL files

From: Atul Kumar <akumar14871(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: strange behavior of WAL files
Date: 2021-06-04 16:06:49
Message-ID: CA+ONtZ7k=9sm4mBL3Gb5zRB88MZ6td58j9wj2RrCPZO-SXic6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi Tom,

Please check my findings below

older
-rw------- 1 enterprisedb enterprisedb 16777216 Jun 2 02:47
00000001000036CF000000A4
-rw------- 1 enterprisedb enterprisedb 16777216 Jun 2 02:45
00000001000036CF000000A3
-rw------- 1 enterprisedb enterprisedb 16777216 Jun 2 02:44
00000001000036CF000000A5

please note that above files are of June 2nd and once it is archived
it will be recycled with same name with current timestamp, check
below:

newer

-rw------- 1 enterprisedb enterprisedb 16777216 Jun 4 08:19
00000001000036CF000000A0
-rw------- 1 enterprisedb enterprisedb 16777216 Jun 4 08:20
00000001000036CF000000A1
-rw------- 1 enterprisedb enterprisedb 16777216 Jun 4 08:22
00000001000036CF000000A2
drwx------ 2 enterprisedb enterprisedb 311296 Jun 4 08:22 archive_status
-rw------- 1 enterprisedb enterprisedb 16777216 Jun 4 08:23
00000001000036CF000000A3
-rw------- 1 enterprisedb enterprisedb 16777216 Jun 4 08:23
00000001000036CF000000A4

the file names ending with A3 and A4 are the files that got generated
with same name with the latest timestamp.

So that's why I called it strange behavior, please suggest your opinion.

Regards,
Atul

On 6/4/21, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Atul Kumar <akumar14871(at)gmail(dot)com> writes:
>> once old WAL files of pg_xlog directory are archived in
>> '/nfslogs/wal/' directory then these WAL files are getting generated
>> with the same name in pg_xlog directory.
>
> Are you sure you are describing the behavior accurately?
>
> What I would expect to happen, once an old WAL file has been archived
> and the server knows its contents are no longer needed, is for the
> WAL file to be "recycled" by renaming it to have a name that's in-the-
> future in the WAL name series, whereupon it will wait its turn to be
> reused by future WAL writes. On most filesystems the rename as such
> doesn't change the file's mod time, so you'll see files that seem
> to be in-the-future according to their names, but have old timestamps.
>
> (There's a limit on how many future WAL files we'll tee up this way,
> so it's possible that an old one would just get deleted instead.
> But the steady-state behavior is to just rotate them around.)
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Frost 2021-06-04 16:34:01 Re: possible license violations
Previous Message Laurenz Albe 2021-06-04 16:04:31 Re: AW: [Extern] Re: autovacuum on pg_catalog tables