Re: pgsql: Delay commit status checks until freezing executes.

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Peter Geoghegan <pg@bowt.ie>
Cc: Robert Haas <robertmhaas@gmail.com>, pgsql-hackers@postgresql.org
Date: 2023-01-04T18:41:10Z
Lists: pgsql-hackers
Hi,

On 2023-01-04 09:59:37 -0800, Peter Geoghegan wrote:
> On Wed, Jan 4, 2023 at 7:03 AM Robert Haas <robertmhaas@gmail.com> wrote:
> > and which functions return fully reliable results, I do
> > not think you should be committing your own patches in this area.
> 
> My mistake here had nothing to do with my own goals. I was trying to
> be diligent by hardening an existing check in passing, and it
> backfired.

When moving code around I strongly suggest to make as much of a diff to be
"move only". I find
  git diff --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
quite helpful for that.

Being able to see just the "really changed" lines makes it a lot easier to see
the crucial parts of a change.


> > There is probably a lot of potential benefit in improving the way this
> > stuff works, but there is also a heck of a lot of danger of creating
> > subtle data corrupting bugs that could easily take years to find.
> 
> It's currently possible for VACUUM to set the all-frozen bit while
> unsetting the all-visible bit, due to a race condition [1]. This is
> your long standing bug. So apparently nobody is qualified to commit
> patches in this area.

That's a non-sequitur. Bugs are a fact of programming.


> About a year ago, there was a massive argument over some earlier work
> in the same general area, by me. Being the subject of a pile-on on
> this mailing list is something that I find deeply upsetting and
> demoralizing. I just cannot take much more of it. At the same time,
> I've made quite an investment in the pending patches, and think that
> it's something that I have to see through.

I'm, genuinely!, sorry that you feel piled on. That wasn't, and isn't, my
goal. I think the area of code desperately needs work. I complained because I
didn't like the process and was afraid of the consequences and the perceived
need on my part to do post-commit reviews.

Greetings,

Andres Freund



Commits

  1. Improve TransactionIdDidAbort() documentation.

  2. Check that xmax didn't commit in freeze check.

  3. Delay commit status checks until freezing executes.

  4. Add page-level freezing to VACUUM.

  5. Set relfrozenxid to oldest extant XID seen by VACUUM.