public inbox for [email protected]
help / color / mirror / Atom feedpgsql: Replace BackendIds with 0-based ProcNumbers
5+ messages / 4 participants
[nested] [flat]
* pgsql: Replace BackendIds with 0-based ProcNumbers
@ 2024-03-03 17:39 Heikki Linnakangas <[email protected]>
0 siblings, 2 replies; 5+ messages in thread
From: Heikki Linnakangas @ 2024-03-03 17:39 UTC (permalink / raw)
To: [email protected]
Replace BackendIds with 0-based ProcNumbers
Now that BackendId was just another index into the proc array, it was
redundant with the 0-based proc numbers used in other places. Replace
all usage of backend IDs with proc numbers.
The only place where the term "backend id" remains is in a few pgstat
functions that expose backend IDs at the SQL level. Those IDs are now
in fact 0-based ProcNumbers too, but the documentation still calls
them "backend ids". That term still seems appropriate to describe what
the numbers are, so I let it be.
One user-visible effect is that pg_temp_0 is now a valid temp schema
name, for backend with ProcNumber 0.
Reviewed-by: Andres Freund
Discussion: https://www.postgresql.org/message-id/[email protected]
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/024c521117579a6d356050ad3d78fdc95e44eefa
Modified Files
--------------
doc/src/sgml/config.sgml | 2 +-
doc/src/sgml/monitoring.sgml | 18 ++---
doc/src/sgml/storage.sgml | 2 +-
doc/src/sgml/xact.sgml | 4 +-
src/backend/access/transam/README | 10 +--
src/backend/access/transam/clog.c | 18 ++---
src/backend/access/transam/multixact.c | 64 ++++++++--------
src/backend/access/transam/parallel.c | 10 +--
src/backend/access/transam/twophase.c | 43 ++++++-----
src/backend/access/transam/xact.c | 9 ++-
src/backend/access/transam/xlogprefetcher.c | 2 +-
src/backend/access/transam/xlogutils.c | 6 +-
src/backend/backup/basebackup_incremental.c | 2 +-
src/backend/catalog/catalog.c | 14 ++--
src/backend/catalog/namespace.c | 30 ++++----
src/backend/catalog/storage.c | 30 ++++----
src/backend/commands/async.c | 89 ++++++++++------------
src/backend/commands/dbcommands.c | 2 +-
src/backend/commands/indexcmds.c | 2 +-
src/backend/commands/sequence.c | 2 +-
src/backend/libpq/pqmq.c | 10 +--
src/backend/postmaster/pgarch.c | 12 +--
src/backend/postmaster/walsummarizer.c | 16 ++--
.../replication/logical/applyparallelworker.c | 4 +-
src/backend/replication/slot.c | 2 +-
src/backend/replication/walsender.c | 2 +-
src/backend/storage/buffer/buf_init.c | 2 +-
src/backend/storage/buffer/bufmgr.c | 30 ++++----
src/backend/storage/buffer/localbuf.c | 6 +-
src/backend/storage/ipc/procarray.c | 44 +++++------
src/backend/storage/ipc/procsignal.c | 36 ++++-----
src/backend/storage/ipc/sinvaladt.c | 45 +++++------
src/backend/storage/ipc/standby.c | 6 +-
src/backend/storage/lmgr/lmgr.c | 2 +-
src/backend/storage/lmgr/lock.c | 26 +++----
src/backend/storage/lmgr/predicate.c | 10 +--
src/backend/storage/lmgr/proc.c | 39 +++++-----
src/backend/storage/smgr/md.c | 4 +-
src/backend/storage/smgr/smgr.c | 2 +-
src/backend/utils/activity/backend_status.c | 50 ++++++------
src/backend/utils/adt/dbsize.c | 14 ++--
src/backend/utils/adt/lockfuncs.c | 13 ++--
src/backend/utils/adt/mcxtfuncs.c | 7 +-
src/backend/utils/adt/pgstatfuncs.c | 50 ++++++------
src/backend/utils/cache/inval.c | 4 +-
src/backend/utils/cache/relcache.c | 30 ++++----
src/backend/utils/error/csvlog.c | 4 +-
src/backend/utils/error/elog.c | 6 +-
src/backend/utils/error/jsonlog.c | 4 +-
src/backend/utils/init/globals.c | 6 +-
src/backend/utils/time/snapmgr.c | 6 +-
src/common/relpath.c | 24 +++---
src/include/access/twophase.h | 2 +-
src/include/catalog/namespace.h | 3 +-
src/include/common/relpath.h | 4 +-
src/include/libpq/pqmq.h | 2 +-
src/include/miscadmin.h | 5 --
src/include/postmaster/postmaster.h | 2 +-
src/include/storage/backendid.h | 41 ----------
src/include/storage/lock.h | 18 ++---
src/include/storage/proc.h | 36 ++++-----
src/include/storage/procarray.h | 8 +-
src/include/storage/proclist.h | 38 ++++-----
src/include/storage/proclist_types.h | 18 +++--
src/include/storage/procnumber.h | 43 +++++++++++
src/include/storage/procsignal.h | 4 +-
src/include/storage/relfilelocator.h | 29 +++----
src/include/storage/sinval.h | 4 +-
src/include/storage/smgr.h | 2 +-
src/include/utils/backend_status.h | 14 ++--
src/include/utils/rel.h | 2 +-
71 files changed, 571 insertions(+), 579 deletions(-)
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Replace BackendIds with 0-based ProcNumbers
@ 2024-07-09 18:10 Thomas Munro <[email protected]>
parent: Heikki Linnakangas <[email protected]>
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Munro @ 2024-07-09 18:10 UTC (permalink / raw)
To: Heikki Linnakangas <[email protected]>; +Cc: [email protected]
--- a/src/backend/libpq/pqmq.c
+++ b/src/backend/libpq/pqmq.c
@@ -26,7 +26,7 @@
static shm_mq_handle *pq_mq_handle;
static bool pq_mq_busy = false;
static pid_t pq_mq_parallel_leader_pid = 0;
-static pid_t pq_mq_parallel_leader_backend_id = InvalidBackendId;
+static pid_t pq_mq_parallel_leader_proc_number = INVALID_PROC_NUMBER;
I guess it was a historical mistake that this variable of type pid_t
instead of BackendId, but now it should be ProcNumber?
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Replace BackendIds with 0-based ProcNumbers
@ 2024-07-15 08:13 Heikki Linnakangas <[email protected]>
parent: Thomas Munro <[email protected]>
0 siblings, 0 replies; 5+ messages in thread
From: Heikki Linnakangas @ 2024-07-15 08:13 UTC (permalink / raw)
To: Thomas Munro <[email protected]>; Heikki Linnakangas <[email protected]>; +Cc: [email protected]
On 09/07/2024 21:10, Thomas Munro wrote:
> --- a/src/backend/libpq/pqmq.c
> +++ b/src/backend/libpq/pqmq.c
> @@ -26,7 +26,7 @@
> static shm_mq_handle *pq_mq_handle;
> static bool pq_mq_busy = false;
> static pid_t pq_mq_parallel_leader_pid = 0;
> -static pid_t pq_mq_parallel_leader_backend_id = InvalidBackendId;
> +static pid_t pq_mq_parallel_leader_proc_number = INVALID_PROC_NUMBER;
>
> I guess it was a historical mistake that this variable of type pid_t
> instead of BackendId, but now it should be ProcNumber?
Yep, fixed thanks!
--
Heikki Linnakangas
Neon (https://neon.tech)
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Replace BackendIds with 0-based ProcNumbers
@ 2024-12-29 17:43 Peter Eisentraut <[email protected]>
parent: Heikki Linnakangas <[email protected]>
1 sibling, 1 reply; 5+ messages in thread
From: Peter Eisentraut @ 2024-12-29 17:43 UTC (permalink / raw)
To: Heikki Linnakangas <[email protected]>; [email protected]
On 03.03.24 18:39, Heikki Linnakangas wrote:
> Replace BackendIds with 0-based ProcNumbers
There are a couple of declarations that are duplicated between
src/include/storage/proc.h and src/include/storage/procnumber.h, such as
MyProcNumber, ParallelLeaderProcNumber, and
ProcNumberForTempRelations(). Is that intentional, or should that be fixed?
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Replace BackendIds with 0-based ProcNumbers
@ 2025-01-01 21:57 Heikki Linnakangas <[email protected]>
parent: Peter Eisentraut <[email protected]>
0 siblings, 0 replies; 5+ messages in thread
From: Heikki Linnakangas @ 2025-01-01 21:57 UTC (permalink / raw)
To: Peter Eisentraut <[email protected]>; [email protected]
On 29/12/2024 19:43, Peter Eisentraut wrote:
> On 03.03.24 18:39, Heikki Linnakangas wrote:
>> Replace BackendIds with 0-based ProcNumbers
>
> There are a couple of declarations that are duplicated between src/
> include/storage/proc.h and src/include/storage/procnumber.h, such as
> MyProcNumber, ParallelLeaderProcNumber, and
> ProcNumberForTempRelations(). Is that intentional, or should that be
> fixed?
It was not intentional. At quick glance, I think we should keep the
declarations in procnumber.h and remove the duplicates from proc.h. I
will do that next week when I'm back from vacation. Or feel free to do
it yourself before that if you want. Thanks for noticing!
- Heikki
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2025-01-01 21:57 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-03-03 17:39 pgsql: Replace BackendIds with 0-based ProcNumbers Heikki Linnakangas <[email protected]>
2024-07-09 18:10 ` Thomas Munro <[email protected]>
2024-07-15 08:13 ` Heikki Linnakangas <[email protected]>
2024-12-29 17:43 ` Peter Eisentraut <[email protected]>
2025-01-01 21:57 ` Heikki Linnakangas <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox