[WIP] The relminxid addition, try 3

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: [WIP] The relminxid addition, try 3
Date: 2006-05-08 02:54:27
Message-ID: 20060508025426.GB32110@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
relminxid-3.patch text/plain 96.4 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2006-05-08 03:15:58 Re: pgstat: delayed write of stats file
Previous Message Bruce Momjian 2006-05-08 02:39:52 Re: [HACKERS] Question on win32 semaphore simulation