Hi, On Tue, Jun 2, 2009 at 10:21 AM, Tom Lane <t...@sss.pgh.pa.us> wrote: > Fujii Masao <masao.fu...@gmail.com> writes: >> Yes, the old xlog itself is not used again. But, the *old file* might >> be recycled and used later. The case that I'm looking at is that the >> symlink to a temporary area is recycled. Am I missing something? > > Actually, I think the right fix for that would be to add defenses to > xlog.c to not try to "recycle" a file that is a symlink.
OK, I tweaked Aidan's patch. Thanks Aidan! http://archives.postgresql.org/message-id/20090601152736.gl15...@yugib.highrise.ca Changes are: - use lstat instead of stat - add #if HAVE_WORKING_LINK and #endif code Regards, -- Fujii Masao NIPPON TELEGRAPH AND TELEPHONE CORPORATION NTT Open Source Software Center
Index: src/backend/access/transam/xlog.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/backend/access/transam/xlog.c,v retrieving revision 1.341 diff -c -r1.341 xlog.c *** src/backend/access/transam/xlog.c 28 May 2009 11:02:16 -0000 1.341 --- src/backend/access/transam/xlog.c 2 Jun 2009 02:31:34 -0000 *************** *** 3006,3011 **** --- 3006,3012 ---- struct dirent *xlde; char lastoff[MAXFNAMELEN]; char path[MAXPGPATH]; + struct stat stat_buf; /* * Initialize info about where to try to recycle to. We allow recycling *************** *** 3047,3054 **** /* * Before deleting the file, see if it can be recycled as a * future log segment. */ ! if (InstallXLogFileSegment(&endlogId, &endlogSeg, path, true, &max_advance, true)) { --- 3048,3060 ---- /* * Before deleting the file, see if it can be recycled as a * future log segment. + * If it's a symlink, we don't recycle it. */ ! if ( ! #if HAVE_WORKING_LINK ! lstat(path, &stat_buf) == 0 && !S_ISLNK(stat_buf.st_mode) && ! #endif ! InstallXLogFileSegment(&endlogId, &endlogSeg, path, true, &max_advance, true)) {
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers