Re: [DOCS] Proposed doc-patch: Identifying the Current WAL file

2006-04-15 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian writes: > > Richard Huxton wrote: > >> To identify the current, partially-filled WAL segment, sort first by > >> mtime and second by file name. That is, take the latest mtime among the > >> properly-named files, breaking ties by taking the higher filename. > > > I

Re: [DOCS] Proposed doc-patch: Identifying the Current WAL file

2006-04-15 Thread Tom Lane
Bruce Momjian writes: > In the first case, x2 is current, having be just switched to from x1, > while in the second case, x1 is current. In BSD, you can use ls -ltT to > see the seconds, but in Linux it is something different, and I am sure > there are some operating systems that don't allow you

Re: [DOCS] Proposed doc-patch: Identifying the Current WAL file

2006-04-15 Thread Jeff Frost
On Sat, 15 Apr 2006, Tom Lane wrote: For a command-line solution it's probably sufficient to sort by mtime, ie ls -t | head -1 A while back when I was trying to work this out on the admin list, I believe we came up with the following: ls -tp /pg_xlog/ | grep -v "backup\|/" | head -1

Re: [DOCS] Proposed doc-patch: Identifying the Current WAL file

2006-04-15 Thread Bruce Momjian
Jeff Frost wrote: > On Sat, 15 Apr 2006, Tom Lane wrote: > > > For a command-line solution it's probably sufficient to sort by mtime, > > ie > > ls -t | head -1 > > A while back when I was trying to work this out on the admin list, I believe > we came up with the following: > > ls -tp /pg_x

Re: [DOCS] Proposed doc-patch: Identifying the Current WAL file

2006-04-15 Thread Jeff Frost
On Sat, 15 Apr 2006, Bruce Momjian wrote: ls -tp /pg_xlog/ | grep -v "backup\|/" | head -1 which seems to work fairly well. Looks like that thread is here: http://archives.postgresql.org/pgsql-admin/2005-10/msg00173.php What does the -p and \| pipe check do? We don't have named pipes in th

Re: [DOCS] Proposed doc-patch: Identifying the Current WAL file

2006-04-15 Thread Tom Lane
Jeff Frost <[EMAIL PROTECTED]> writes: >>> ls -tp /pg_xlog/ | grep -v "backup\|/" | head -1 >> >> What does the -p and \| pipe check do? We don't have named pipes in >> that directory, do we? > The -p shows forward slashes after directories and the \| acts as an or and > the / following that jus

Re: [DOCS] Proposed doc-patch: Identifying the Current WAL file

2006-04-15 Thread Tom Lane
Bruce Momjian 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

Re: [DOCS] Proposed doc-patch: Identifying the Current WAL file

2006-04-15 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian 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

Re: [DOCS] Proposed doc-patch: Identifying the Current WAL file

2006-04-15 Thread Jeff Frost
On Sat, 15 Apr 2006, Tom Lane wrote: Bruce Momjian 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 see

Re: [DOCS] Proposed doc-patch: Identifying the Current WAL file

2006-04-15 Thread Jeff Frost
On Sat, 15 Apr 2006, Bruce Momjian wrote: Tom Lane wrote: No, I am not: $ touch x1 x2; touch x2 $ sleep 2; ls -lt total 0 -rw-r--r-- 1 root postgres 0 Apr 15 14:04 x1 -rw-r--r-- 1 root postgres 0 Apr 15 14:04 x2 If the write to x2 happens in the f

Re: [DOCS] Proposed doc-patch: Identifying the Current WAL file

2006-04-15 Thread Bruce Momjian
Jeff Frost wrote: > On Sat, 15 Apr 2006, Bruce Momjian wrote: > > > Tom Lane wrote: > > > > No, I am not: > > > > $ touch x1 x2; touch x2 > > $ sleep 2; ls -lt > > total 0 > > -rw-r--r-- 1 root postgres 0 Apr 15 14:04 x1 > > -rw-r--r-- 1 root postgres 0 Apr 15 14:04 x2 >

Re: [DOCS] Proposed doc-patch: Identifying the Current WAL file

2006-04-15 Thread Jeff Frost
On Sat, 15 Apr 2006, Bruce Momjian wrote: And I tried it on Fedora Core 2: Device: 11h/17d Inode: 24707338Links: 1 Access: (0644/-rw-r--r--) Uid: ( 7078/bmomjian) Gid: ( 100/ users) Access: 2006-04-15 11:41:53.0 -0700 Modify: 2006-04-15 11:41:53

Re: [DOCS] Proposed doc-patch: Identifying the Current WAL file

2006-04-15 Thread Tom Lane
Bruce Momjian writes: > The point is that the test does not have a > one-second window of showing the wrong answer, meaning I could wait for > 60 seconds, and still see the wrong WAL file at the top. Oh, I see your point: you can lose at most one second's worth of data, but that second could be a

Re: [DOCS] Proposed doc-patch: Identifying the Current WAL file

2006-04-15 Thread Simon Riggs
On Sat, 2006-04-15 at 12:24 -0400, Bruce Momjian wrote: > And if we can't provide one, should we supply an SQL function > to return the current WAL name? I'll do this. Just give me a few days to get my feet under the new desk. I know its well past time I sorted this and a few other things out. --

Re: [DOCS] Proposed doc-patch: Identifying the Current WAL file

2006-04-15 Thread Bruce Momjian
Simon Riggs wrote: > On Sat, 2006-04-15 at 12:24 -0400, Bruce Momjian wrote: > > And if we can't provide one, should we supply an SQL function > > to return the current WAL name? > > I'll do this. Just give me a few days to get my feet under the new desk. > I know its well past time I sorted this