pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove unnecessary GetTransactionSnapshot() calls
Date: Mon, 23 Dec 2024 10:44:34 +0000
Message-ID: <E1tPfvO-000v3U-F6@gemulon.postgresql.org> (raw)

Remove unnecessary GetTransactionSnapshot() calls

In get_database_list() and get_subscription_list(), the
GetTransactionSnapshot() call is not required because the catalog
table scans use the catalog snapshot, which is held until the end of
the scan. See table_beginscan_catalog(), which calls
RegisterSnapshot(GetCatalogSnapshot(relid)).

In InitPostgres, it's a little less obvious that it's not required,
but still true I believe. All the catalog lookups in InitPostgres()
also use the catalog snapshot, and the looked up values are copied
while still holding the snapshot.

Furthermore, as the removed FIXME comments said, calling
GetTransactionSnapshot() didn't really prevent MyProc->xmin from being
reset anyway.

Discussion: https://www.postgresql.org/message-id/7c56f180-b9e1-481e-8c1d-efa63de3ecbb@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/952365cded635e54c4177399c0280cb7a5e34c11

Modified Files
--------------
src/backend/postmaster/autovacuum.c        | 11 +----------
src/backend/replication/logical/launcher.c | 11 +----------
src/backend/utils/init/postinit.c          | 13 +------------
3 files changed, 3 insertions(+), 32 deletions(-)



Message-ID: <E1tPfvO-000v3U-F6@gemulon.postgresql.org>
Permalink:  ../E1tPfvO-000v3U-F6@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tPfvO-000v3U-F6@gemulon.postgresql.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Remove unnecessary GetTransactionSnapshot() calls
  In-Reply-To: <E1tPfvO-000v3U-F6@gemulon.postgresql.org>

* 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