Re: [PATCHES] Cleaning up unreferenced table files

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] Cleaning up unreferenced table files
Date: 2005-05-07 21:08:43
Message-ID: Pine.OSF.4.61.0505072341360.217863@kosh.hut.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Sat, 7 May 2005, Tom Lane wrote:

> Heikki Linnakangas <hlinnaka(at)iki(dot)fi> writes:
>> Maybe we should take a different approach to the problem:
>> 1. Create new file with an extension to mark that it's not
>> yet committed (eg. 1234.notcommitted)
>
> This is pushing the problem into the wrong place, viz the lowest-level
> file access routines, which will now all have to know about
> .notcommitted status. It also creates race conditions --- think about
> backend A trying to commit file 1234 at about the same time that
> backend B is trying to flush some dirty buffers belonging to that file.

True. With the rename variant, it might indeed get messy.

Consider the variant with extra marker files. In that case, backend B
doesn't have to know about the .notcommitted status to flush the buffers.

> But most importantly, it doesn't handle the file-deletion case.

File-deletions are easy to handle. Just write the list of pending
deletions to WAL on commit.

To recap, we have 2 slightly different scenarios:

a) Delete a file, write commit record, crash
b) Create a file, crash

Just WAL logging the deletions on commit would take care of A. The
.notcommitted mechanism would take care of B.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Hansen 2005-05-07 21:54:45 Re: Patch for collation using ICU
Previous Message Robert Treat 2005-05-07 21:02:01 Re: pgFoundry

Browse pgsql-patches by date

  From Date Subject
Next Message Josh Berkus 2005-05-07 23:44:56 Fix PID file location?
Previous Message Tom Lane 2005-05-07 20:37:39 Re: [PATCHES] Cleaning up unreferenced table files