Re: Question About WAL filename and its time stamp

Suzuki Hironobu <hironobu@interdb.jp>

From: Suzuki Hironobu <hironobu@interdb.jp>
To: "ascot.moss@gmail.com" <ascot.moss@gmail.com>
Cc: pgsql-general general <pgsql-general@postgresql.org>
Date: 2013-09-06T02:17:16Z
Lists: pgsql-performance
Hi,


(13/09/05 22:19), ascot.moss@gmail.com wrote:
> Hi,
>
>  From the pg_xlog folder, I found some files with interesting time stamps: older file names with newer timestamps, can you please advise why?
>
> Set 1: How come 0000000400000F490000008D is 10 minutes newer than 0000000400000F490000008E?
> -rw------- 1 111 115 16777216 Sep  4 15:28 0000000400000F490000008C
> -rw------- 1 111 115 16777216 Sep  4 15:27 0000000400000F490000008D <===
> -rw------- 1 111 115 16777216 Sep  4 15:17 0000000400000F490000008E <====
> -rw------- 1 111 115 16777216 Sep  4 15:26 0000000400000F490000008F
> -rw------- 1 111 115 16777216 Sep  4 15:27 0000000400000F4900000090

WAL files will be recycled.
For example:

sampledb=# select pg_xlogfile_name(pg_current_xlog_location());
      pg_xlogfile_name
--------------------------
  000000010000000000000004
(1 row)

-rw-------.  1 postgres postgres 16777216 Sep  6 10:55 
000000010000000000000001
-rw-------.  1 postgres postgres 16777216 Sep  6 10:56 
000000010000000000000002
-rw-------.  1 postgres postgres 16777216 Sep  6 10:57 
000000010000000000000003
-rw-------.  1 postgres postgres 16777216 Sep  6 10:58 
000000010000000000000004  <--- current WAL

After a few minutes,

sampledb=# select pg_xlogfile_name(pg_current_xlog_location());
      pg_xlogfile_name
--------------------------
  000000010000000000000006
(1 row)

-rw-------.  1 postgres postgres 16777216 Sep  6 11:01 
000000010000000000000004 <-- Time of the last write.
-rw-------.  1 postgres postgres 16777216 Sep  6 11:02 
000000010000000000000005
-rw-------.  1 postgres postgres 16777216 Sep  6 11:02 
000000010000000000000006 <-- current WAL
-rw-------.  1 postgres postgres 16777216 Sep  6 10:55 
000000010000000000000007 <-- old name is 000000010000000000000001
-rw-------.  1 postgres postgres 16777216 Sep  6 10:56 
000000010000000000000008 <-- old name is 000000010000000000000002
-rw-------.  1 postgres postgres 16777216 Sep  6 10:57 
000000010000000000000009 <-- old name is 000000010000000000000003


Timing of recycling depends on the situation. If the time stamp of 
current WAL file is the most recent compared with other WAL files, there 
is no contradiction.
(I wonder that the time stamp of 0000000400000F490000008C is the most 
recent.)



> Set 2: why files,  0000000400000F48000000FD,  0000000400000F48000000FE and 0000000400000F4900000000, are not reused?
> 1) -rw------- 1 postgres postgres 16777216 Sep  4 23:07 0000000400000F48000000FA
> 2) -rw------- 1 postgres postgres 16777216 Sep  4 23:08 0000000400000F48000000FB
> 3) -rw------- 1 postgres postgres 16777216 Sep  4 23:09 0000000400000F48000000FC  <===
> 4) -rw------- 1 postgres postgres 16777216 Sep  4 14:47 0000000400000F48000000FD  <====
> 5) -rw------- 1 postgres postgres 16777216 Sep  4 14:46 0000000400000F48000000FE
> 6) -rw------- 1 postgres postgres 16777216 Sep  4 14:46 0000000400000F4900000000

This is the specification of WAL. This specification changes from 9.3.


regards