Re: optimizing CleanupTempFiles

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Simon Riggs <simon(at)2ndQuadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: optimizing CleanupTempFiles
Date: 2008-09-18 06:23:08
Message-ID: 48D1F3CC.2040001@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Alvaro Herrera <alvherre(at)commandprompt(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message ITAGAKI Takahiro 2008-09-18 06:57:55 Re: [HACKERS] 0x1A in control file on Windows
Previous Message Tom Lane 2008-09-18 04:48:34 Re: [HACKERS] 0x1A in control file on Windows