[WIP] The relminxid addition, try 3 - Mailing list pgsql-patches

From Alvaro Herrera
Subject [WIP] The relminxid addition, try 3
Date
Msg-id 20060508025426.GB32110@surnet.cl
Whole thread Raw
Responses Re: [WIP] The relminxid addition, try 3  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [WIP] The relminxid addition, try 3  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-patches
This patch is not ready for application, but read below because I need
some input.

Here is a reworked relminxid patch.  I added XLOG operations for heap
unfreeze and database unfreeze.  The latter happens when someone
connects to a frozen database.  The former happens when a LockRelation()
is called on a frozen relation, and the lock is stronger than
AccessShare.

A database is only frozen when somebody calls VACUUM FREEZE in a
standalone backend.

A table is frozen when somebody calls VACUUM FREEZE on it, which
acquires ExclusiveLock.

I'm not too sure about the XLOG routines -- I don't understand very well
the business about attaching the changes to a buffer; I thought at first
that since all the changes go to a tuple, they all belong to the buffer,
so I assigned a single XLogRecData struct with all the info and the
buffer containing the tuple; but then on replay, I got "PANIC: invalid
xlog record length 0" So I went to read the code for that case and
noticed that it said that the test "is somewhat fishy" but none of the
callers used that case currently.  So I decided to review what others
routines are doing.  I thought that heap_insert should be doing more or
less the same that heap_unfreeze, since all the changes in the tuple go
into the buffer, right?  But for some reason it doesn't.  So I just
added a second XLogRecData, without any data but attached to the buffer,
and I removed the reference to the buffer in the first XLogRecData.

This is probably wrong, but I'd like to know why and what's the correct
way to do it :-)

The replay routines also appear to work, but I'm not too sure about
them -- backup blocks and stuff, I'm not sure what is really happening.
I appreciate any advice.


The patch is not complete because I need to fiddle with relvacuumxid so
that it follows the same behavior as relminxid.  That comes next.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

Attachment

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Question on win32 semaphore simulation
Next
From: Bruce Momjian
Date:
Subject: Re: pgstat: delayed write of stats file