Re: Advice on MyXactMade* flags, MyLastRecPtr, pendingDeletes and lazy XID assignment - Mailing list pgsql-hackers

From Florian G. Pflug
Subject Re: Advice on MyXactMade* flags, MyLastRecPtr, pendingDeletes and lazy XID assignment
Date
Msg-id 46D5C322.7070304@phlo.org
Whole thread Raw
In response to Re: Advice on MyXactMade* flags, MyLastRecPtr, pendingDeletes and lazy XID assignment  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Advice on MyXactMade* flags, MyLastRecPtr, pendingDeletes and lazy XID assignment  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> "Florian G. Pflug" <fgp@phlo.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



pgsql-hackers by date:

Previous
From: "Florian G. Pflug"
Date:
Subject: Representation of ResourceOwnerIds (transient XIDs) in system views (lazy xid assignment)
Next
From: Greg Smith
Date:
Subject: Re: Contrib modules documentation online