Re: Min Xid problem proposal - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Min Xid problem proposal
Date
Msg-id 1134217382.26373.19.camel@localhost.localdomain
Whole thread Raw
In response to Re: Min Xid problem proposal  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Min Xid problem proposal
List pgsql-hackers
On Fri, 2005-12-09 at 12:32 -0500, Tom Lane wrote:
> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > My proposal to solve that problem, is to make any transaction that
> > inserts or modifies tuples in a table that is marked as frozen, unfreeze
> > it first.  The problem I had last time was finding a good spot in the
> > code for doing so.  I'm now proposing to do it in the parser, in
> > setTargetTable().
> 
> My god, no.  Do you have any idea how many paths for updates you've missed?
> (Think about prepared plans for starters.)
> 
> Furthermore, you can't do this in the way you propose (non-WAL-logged
> update to pg_class).  What if the system crashes without ever having
> written this update to disk?  The inserted tuples might have made it ---
> whether they're committed or not doesn't matter, you've still blown it.
> 
> I don't see any very good argument for allowing this mechanism to set
> minxid = FrozenXid in the first place.  If there are only frozenXid in
> the table, set minxid = current XID.  That eliminates the entire problem
> at a stroke.
> 
> (Yes, I know what you are going to say.  The idea of freezing a table
> and then never having to vacuum it at all is NOT worth the cost of
> putting in a mechanism that would guarantee its safety.)

>From what's been said VACUUM FREEZE will not alter the fact that a
frozen table will need vacuuming again in the future and so cannot ever
be read-only. I can't really see any reason to run VACUUM FREEZE...

If you want to make a table read-only forever, we need a separate
command to do that, ISTM.

ALTER TABLE ... READONLY 
could set minXid = FrozenTransactionId, indicating no further VACUUMs
required, ever. We can then disallow INSERT/UPDATE/DELETE against the
table in the permissions layer.

Best Regards, Simon Riggs



pgsql-hackers by date:

Previous
From: Markus Schiltknecht
Date:
Subject: Re: Replication on the backend
Next
From: Simon Riggs
Date:
Subject: Re: Log of CREATE USER statement