From: | Jeff Frost <jeff(at)frostconsultingllc(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Richard Huxton <dev(at)archonet(dot)com>, pgsql-docs(at)postgresql(dot)org |
Subject: | Re: Proposed doc-patch: Identifying the Current WAL file |
Date: | 2006-04-15 18:19:47 |
Message-ID: | Pine.LNX.4.64.0604151103100.9581@discord.dyndns.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs pgsql-patches |
On Sat, 15 Apr 2006, Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
>> Also, what happens if the log switch happens, and some data change is
>> written to the new WAL file in the first second, but nothing happens to
>> the database after that for a minute? Your test would still show the
>> old log file.
>
> You seem to be assuming that ls will sort on the basis of the truncated
> mtime that it displays, which is not the actual behavior of ls AFAIK.
I believe you're correct, at least with the ls I have here on my linux system.
I created two files quickly with touch. Here is the stat output:
File: `AA'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 802h/2050d Inode: 2736263 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 26/postgres) Gid: ( 26/postgres)
Access: 2006-04-15 11:02:46.000000000 -0700
Modify: 2006-04-15 11:02:46.000000000 -0700
Change: 2006-04-15 11:02:46.000000000 -0700
File: `AB'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 802h/2050d Inode: 2736264 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 26/postgres) Gid: ( 26/postgres)
Access: 2006-04-15 11:02:48.000000000 -0700
Modify: 2006-04-15 11:02:48.000000000 -0700
Change: 2006-04-15 11:02:48.000000000 -0700
ls -t | head -1
AB
So it looks like the original was correct all along, but with Tom's regex it's
much cleaner. Too bad grep's regex engine doesn't support {24}.
I'll change all my scripts to use the following:
ls -t /pg_xlog/ | grep '^[0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F]$' | head -1
Thanks Tom!
--
Jeff Frost, Owner <jeff(at)frostconsultingllc(dot)com>
Frost Consulting, LLC http://www.frostconsultingllc.com/
Phone: 650-780-7908 FAX: 650-649-1954
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Frost | 2006-04-15 18:21:00 | Re: Proposed doc-patch: Identifying the Current WAL file |
Previous Message | Bruce Momjian | 2006-04-15 18:09:06 | Re: Proposed doc-patch: Identifying the Current WAL file |
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Frost | 2006-04-15 18:21:00 | Re: Proposed doc-patch: Identifying the Current WAL file |
Previous Message | Bruce Momjian | 2006-04-15 18:13:54 | Re: pg_dump insert transactions |