Re: optimizing CleanupTempFiles - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: optimizing CleanupTempFiles
Date
Msg-id 48D1F3CC.2040001@enterprisedb.com
Whole thread Raw
In response to Re: optimizing CleanupTempFiles  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: optimizing CleanupTempFiles  (Simon Riggs <simon@2ndQuadrant.com>)
Re: optimizing CleanupTempFiles  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Alvaro Herrera <alvherre@commandprompt.com> writes:
>> BTW in testing this patch I was surprised by the fact that temp tables
>> files are removed at checkpoint time,
> 
> [ blink... ]  Doesn't look like that should happen.  What is your
> test case?

Hmph, must be because of the patch from last winter to prevent 
relfilenode reuse until next checkpoint. Looks like we didn't make an 
exception for temporary tables. Although it's harmless, we could put an 
isTempOrToastNamespace() test in there:

*** md.c    11 Aug 2008 11:05:11 -0000    1.139
--- md.c    18 Sep 2008 06:22:13 -0000
***************
*** 19,24 ****
--- 19,25 ----  #include <sys/file.h>
  #include "catalog/catalog.h"
+ #include "catalog/namespace.h"  #include "miscadmin.h"  #include "postmaster/bgwriter.h"  #include "storage/fd.h"
***************
*** 324,330 ****      /*       * Delete or truncate the first segment.       */
!     if (isRedo || forkNum != MAIN_FORKNUM)          ret = unlink(path);      else      {
--- 325,331 ----      /*       * Delete or truncate the first segment.       */
!     if (isRedo || forkNum != MAIN_FORKNUM || 
isTempOrToastNamespace(rnode.spcNode))          ret = unlink(path);      else      {

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: 0x1A in control file on Windows
Next
From: ITAGAKI Takahiro
Date:
Subject: Re: 0x1A in control file on Windows