Re: Why copy_relation_data only use wal whenWALarchivingis enabled

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Jacky Leng <lengjianquan(at)163(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why copy_relation_data only use wal whenWALarchivingis enabled
Date: 2007-10-17 16:58:53
Message-ID: 7757.1192640333@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Heikki Linnakangas <heikki(at)enterprisedb(dot)com> writes:
> I don't think you still quite understand what's happening. GetNewOid()
> is not interesting here, look at GetNewRelFileNode() instead. And
> neither are snapshots or MVCC visibility rules.

Simon has a legitimate objection; not that there's no bug, but that the
probability of getting bitten is exceedingly small. The test script you
showed cheats six-ways-from-Sunday to cause an OID collision that would
never happen in practice. The only case where it would really happen
is if a table that has existed for a long time (~ 2^32 OID creations)
gets dropped and then you're unlucky enough to recycle that exact OID
before the next checkpoint --- and then crash before the checkpoint.

I think we should think about ways to fix this, but I don't feel a need
to try to backpatch a solution.

I tend to agree that truncating the file, and extending the fsync
request mechanism to actually delete it after the next checkpoint,
is the most reasonable route to a fix.

I think the objection about leaking files on crash is wrong. We'd
have the replay of the deletion to fix things up --- it could probably
delete the file immediately, and if not could certainly put it back
on the fsync request queue.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2007-10-17 17:04:48 Re: Why copy_relation_data only use wal whenWALarchivingis enabled
Previous Message Dave Page 2007-10-17 16:47:26 Re: rolcanlogin vs. the flat password file

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2007-10-17 17:04:48 Re: Why copy_relation_data only use wal whenWALarchivingis enabled
Previous Message Heikki Linnakangas 2007-10-17 16:36:48 Re: Why copy_relation_data only use wal whenWALarchivingis enabled