Re: [HACKERS] Why copy_relation_data only use wal whenWALarchivingis enabled

From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Simon Riggs" <simon(at)2ndquadrant(dot)com>, "Jacky Leng" <lengjianquan(at)163(dot)com>, "Patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] Why copy_relation_data only use wal whenWALarchivingis enabled
Date: 2007-10-18 21:13:22
Message-ID: 4717CC72.6060001@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Heikki Linnakangas <heikki(at)enterprisedb(dot)com> writes:
>> The best I can think of is to rename the obsolete file to
>> <relfilenode>.stale, when it's scheduled for deletion at next
>> checkpoint, and check for .stale-suffixed files in GetNewRelFileNode,
>> and delete them immediately in DropTableSpace.
>
> This is getting too Rube Goldbergian for my tastes. What if we just
> make DROP TABLESPACE force a checkpoint before proceeding?

Patch attached.

The scenario we're preventing is still possible if for some reason the
latest checkpoint record is damaged, and we start recovery from the
previous checkpoint record. I think the probability of that happening,
together with the OID wrap-around and hitting the relfilenode of a
recently deleted file with a new one, is low enough to not worry about.
If we cared, we could fix it by letting the files to linger for two
checkpoint cycles instead of one.

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

Attachment Content-Type Size
avoid-premature-relfilenode-reuse-1.patch text/x-diff 13.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-10-18 21:35:08 Re: I've discovered an error with the tcl pgmail function
Previous Message Merlin Moncure 2007-10-18 20:33:06 Re: Proposal: generate_iterator functions

Browse pgsql-patches by date

  From Date Subject
Next Message Jorge Godoy 2007-10-18 23:02:54 Re: Crosstab Problems
Previous Message Joe Conway 2007-10-18 18:37:59 Re: Crosstab Problems