Re: Proposed doc-patch: Identifying the Current WAL file
От | Jeff Frost |
---|---|
Тема | Re: Proposed doc-patch: Identifying the Current WAL file |
Дата | |
Msg-id | Pine.LNX.4.64.0604151029490.9581@discord.dyndns.org обсуждение исходный текст |
Ответ на | Re: Proposed doc-patch: Identifying the Current WAL file (Bruce Momjian <pgman@candle.pha.pa.us>) |
Ответы |
Re: Proposed doc-patch: Identifying the Current WAL file
|
Список | pgsql-docs |
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 > that directory, do we? > > 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. The -p shows forward slashes after directories and the \| acts as an or and the / following that just lets us filter directories out. I added that because I used to find the archive_status directory winning the ls -t from time to time. Now about your what if question. I don't know if there is a way to get past the mtime granularity. If I understand your scenario correctly, you indicate that the previous log is written to and the new log is switched in during the same mtime second. I did a quick test on linux to see how that operates: touch AA AB This yields both files with the same mtime. ls -tp |head -1 yields AA as you suggested it would. The following seems to do the trick if we can rely on alphabetizing to properly decide the winner of a tie: ls -tp | head -2 | sort -r | head -1 So, with my previous example, it would look like: ls -tp /pg_xlog/ | grep -v "backup\|/" | head -2 | sort -r | head -1 -- Jeff Frost, Owner <jeff@frostconsultingllc.com> Frost Consulting, LLC http://www.frostconsultingllc.com/ Phone: 650-780-7908 FAX: 650-649-1954
В списке pgsql-docs по дате отправления: