From: | "Florian G(dot) Pflug" <fgp(at)phlo(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Postgresql-Hackers <pgsql-hackers(at)postgresql(dot)org>, Simon Riggs <simon(at)2ndquadrant(dot)com> |
Subject: | Re: Advice on MyXactMade* flags, MyLastRecPtr, pendingDeletes and lazy XID assignment |
Date: | 2007-08-29 19:04:02 |
Message-ID: | 46D5C322.7070304@phlo.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> "Florian G. Pflug" <fgp(at)phlo(dot)org> writes:
>> I propose to do the following in my lazy XID assignment patch - can
>> anyone see a hole in that?
>
> One comment is that at the time we make an entry into smgr's
> pending-deletes list, I think we might not have acquired an XID yet
> --- if I understand your patch correctly, a CREATE TABLE would acquire
> an XID when it makes its first catalog insertion, and that happens
> after creating the on-disk table file. So it seems like a good idea
> for smgr itself to trigger acquisition of an XID before it makes a
> pending-deletes entry. This ensures that you can't have a situation
> where you have deletes to record and no XID; otherwise, an elog
> between smgr insertion and catalog insertion would lead to just that.
I wonder a bit about the whole special-casing
of COMMITs/ABORTs with pending delete, though. A crash might always leave
stray file around, so there ought to be a way to clean them up anyway.
Still, for now I'll go with your suggestion, and force XID assignment
in the smgr.
>> .) Rename ProcLastRecEnd to XactLastRecEnd, and reset when starting
>> a new toplevel transaction.
>
> I'm not very happy with that name for the variable, because it looks
> like it might refer to the last transaction-controlled record we
> emitted, rather than the last record of any type. Don't have a really
> good suggestion though --- CurXactLastRecEnd is the best I can do.
Hm.. don't have a good suggestion, either - the reason I want to rename
it is that ProcLastRecEnd doesn't sound like it's be reset at transaction
start.
> One thought here is that it's not clear that we really need a concept of
> transaction-controlled vs not-transaction-controlled xlog records
> anymore. In CVS HEAD, the *only* difference no_tran makes is whether
> to set MyLastRecPtr, and you propose removing that variable. This
> seems sane to me --- the reason for having the distinction at all was
> Vadim's plan to implement transaction UNDO by scanning its xlog records
> backwards, and that idea is as dead as a doornail. So we could simplify
> matters conceptually if we got rid of any reference to such a
> distinction.
I've thinking about keeping XLOG_NO_TRAN, and doing
if (!no_tran)
Assert(TransactionIdIsValid(GetCurrentTransactionIdIfAny())
in xlog.c as a safety measure. We can't make that assertion
unconditionally, I think, because nextval() won't force XID
assigment, but might do XLogInsert.
greetings, Florian Pflug
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Smith | 2007-08-29 19:04:31 | Re: Contrib modules documentation online |
Previous Message | Florian G. Pflug | 2007-08-29 18:42:54 | Representation of ResourceOwnerIds (transient XIDs) in system views (lazy xid assignment) |