pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Peter Geoghegan <pg@bowt.ie>
Cc: pgsql-hackers@postgresql.org
Subject: Re: pgsql: Delay commit status checks until freezing executes.
Date: Sat, 7 Jan 2023 13:47:56 -0800
Message-ID: <20230107214756.fyrk735xkeetkkby@awork3.anarazel.de> (raw)
In-Reply-To: <CAH2-Wzn4bEEqgmaUQL3aJ73yM9gAeK-wE4ngi7kjRjLztb+P0w@mail.gmail.com>
References: <20230104005433.k5aptjbqx75fksfm@awork3.anarazel.de>
	<CAH2-WzkM_uM3gArOPSkE=tn9to1tPicc0qM7mJUV=_BDamKamQ@mail.gmail.com>
	<CAH2-Wz=jYBAiDz1_vakdBUPseiau-Pexc9YtJ5yS7F80p_pqnw@mail.gmail.com>
	<20230104035636.hy5djyr2as4gbc4q@awork3.anarazel.de>
	<CAH2-WzmRTo_8_v=wkK3f08iVzuwVUQ3G=Ff00sFCK-Q+dPF2kg@mail.gmail.com>
	<20230104063325.32xq2gpnwlelhogo@awork3.anarazel.de>
	<CAH2-WzmYObiABaysh1SSNBgm0OPYm07DNzRq2vA1DgsOtrodFQ@mail.gmail.com>
	<20230104064740.6mnwcml6oqp3sxnr@awork3.anarazel.de>
	<CAH2-Wz=qKSEor8EHOzxhTDtxUacot0U=1hmnT=Rp8Q=OM4ggMw@mail.gmail.com>
	<CAH2-Wzn4bEEqgmaUQL3aJ73yM9gAeK-wE4ngi7kjRjLztb+P0w@mail.gmail.com>

Hi,

On 2023-01-06 11:16:00 -0800, Peter Geoghegan wrote:
> On Tue, Jan 3, 2023 at 10:52 PM Peter Geoghegan <pg@bowt.ie> wrote:
> > > And it'd make sense to have
> > > the explanation of why TransactionIdDidAbort() isn't the same as
> > > !TransactionIdDidCommit(), even for !TransactionIdIsInProgress() xacts, near
> > > the explanation for doing TransactionIdIsInProgress() first.
> >
> > I think that we should definitely have a comment directly over
> > TransactionIdDidAbort(). Though I wouldn't mind reorganizing these
> > other comments, or making the comment over TransactionIdDidAbort()
> > mostly just point to the other comments.
> 
> What do you think of the attached patch, which revises comments over
> TransactionIdDidAbort, and adds something about it to the top of
> heapam_visbility.c?

Mostly looks good to me.  I think it'd be good to add a reference to the
heapam_visbility.c? comment to the top of transam.c (or move it).


>   *		Assumes transaction identifier is valid and exists in clog.
> + *
> + *		Not all transactions that must be treated as aborted will be
> + *		explicitly marked as such in clog.  Transactions that were in
> + *		progress during a crash are never reported as aborted by us.
>   */
>  bool							/* true if given transaction aborted */
>  TransactionIdDidAbort(TransactionId transactionId)

I think it's currently very likely to be true, but I'd weaken the "never" a
bit nonetheless. I think it'd also be good to point to what to do instead. How
about:
  Note that TransactionIdDidAbort() returns true only for explicitly aborted
  transactions, as transactions implicitly aborted due to a crash will
  commonly still appear to be in-progress in the clog. Most of the time
  TransactionIdDidCommit(), with a preceding TransactionIdIsInProgress()
  check, should be used instead of TransactionIdDidAbort().

Greetings,

Andres Freund





view thread (24+ messages)  latest in thread

Message-ID: <20230107214756.fyrk735xkeetkkby@awork3.anarazel.de>
Permalink:  ../20230107214756.fyrk735xkeetkkby@awork3.anarazel.de/
Also on:    postgresql.org/message-id/20230107214756.fyrk735xkeetkkby@awork3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de, pg@bowt.ie, pgsql-hackers@postgresql.org
  Subject: Re: pgsql: Delay commit status checks until freezing executes.
  In-Reply-To: <20230107214756.fyrk735xkeetkkby@awork3.anarazel.de>
  References: <20230104005433.k5aptjbqx75fksfm@awork3.anarazel.de> <CAH2-WzkM_uM3gArOPSkE=tn9to1tPicc0qM7mJUV=_BDamKamQ@mail.gmail.com> <CAH2-Wz=jYBAiDz1_vakdBUPseiau-Pexc9YtJ5yS7F80p_pqnw@mail.gmail.com> <20230104035636.hy5djyr2as4gbc4q@awork3.anarazel.de> <CAH2-WzmRTo_8_v=wkK3f08iVzuwVUQ3G=Ff00sFCK-Q+dPF2kg@mail.gmail.com> <20230104063325.32xq2gpnwlelhogo@awork3.anarazel.de> <CAH2-WzmYObiABaysh1SSNBgm0OPYm07DNzRq2vA1DgsOtrodFQ@mail.gmail.com> <20230104064740.6mnwcml6oqp3sxnr@awork3.anarazel.de> <CAH2-Wz=qKSEor8EHOzxhTDtxUacot0U=1hmnT=Rp8Q=OM4ggMw@mail.gmail.com> <CAH2-Wzn4bEEqgmaUQL3aJ73yM9gAeK-wE4ngi7kjRjLztb+P0w@mail.gmail.com> <20230107214756.fyrk735xkeetkkby@awork3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox