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

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

Cleaning up this area seems like a good idea.  Just FYI, one reason why
there are so many LastRec pointer variables is that the WAL record
format used to include a back-link to the previous record of the same
transaction, so we needed to track that location.  Since that's gone,
simplification is definitely possible.  A lot of the other behavior
you're looking at "just grew" as incremental optimizations added over
time.

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.

> .) 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.

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.
        regards, tom lane


pgsql-hackers by date:

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