Re: [PATCH] Lazy xid assingment V2 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] Lazy xid assingment V2
Date
Msg-id 5837.1188683130@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] Lazy xid assingment V2  ("Florian G. Pflug" <fgp@phlo.org>)
Responses Re: [PATCH] Lazy xid assingment V2
Re: [PATCH] Lazy xid assingment V2
List pgsql-hackers
"Florian G. Pflug" <fgp@phlo.org> writes:
> It might be even worse - I'm not sure that a rename is an atomic operation
> on most filesystems.

rename(2) is specified to be atomic by POSIX, but relinking a file into
a different directory can hardly be --- it's not even provided as a
single kernel call, is it?

And there's still the problem that changing the filename on-the-fly is
going to break tons of low-level stuff, most of which is not supposed to
know about transactions at all, notably bgwriter.

What I was thinking about was a "flag file" separate from the data file
itself, a bit like what we use for archiver signaling.  If nnnn is the
new data file, then "touch nnnn.new" to mark the file as needing to be
deleted on restart.  Remove these files just *before* commit.  This
leaves you with a narrow window between removing the flag file and
actually committing, but there's no risk of having to PANIC --- if the
remove fails, you just abort the transaction.

However, this has nonzero overhead compared to the current behavior.
I'm still dubious that we have a problem that needs solving ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Florian G. Pflug"
Date:
Subject: Re: [PATCH] Lazy xid assingment V2
Next
From: August Zajonc
Date:
Subject: Re: [PATCH] Lazy xid assingment V2