aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/parallel.c
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-03-03 19:38:22 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2024-03-03 19:38:22 +0200
commit024c521117579a6d356050ad3d78fdc95e44eefa (patch)
tree27a2d9588eefc43c4bc3ac7b31f8a6740a2de34b /src/backend/access/transam/parallel.c
parentab355e3a88de745607f6dd4c21f0119b5c68f2ad (diff)
downloadpostgresql-024c521117579a6d356050ad3d78fdc95e44eefa.tar.gz
postgresql-024c521117579a6d356050ad3d78fdc95e44eefa.zip
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/8171f1aa-496f-46a6-afc3-c46fe7a9b407@iki.fi
Diffstat (limited to 'src/backend/access/transam/parallel.c')
-rw-r--r--src/backend/access/transam/parallel.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/transam/parallel.c
index 849a03e4b65..cbfe6087da4 100644
--- a/src/backend/access/transam/parallel.c
+++ b/src/backend/access/transam/parallel.c
@@ -94,7 +94,7 @@ typedef struct FixedParallelState
bool is_superuser;
PGPROC *parallel_leader_pgproc;
pid_t parallel_leader_pid;
- BackendId parallel_leader_backend_id;
+ ProcNumber parallel_leader_proc_number;
TimestampTz xact_ts;
TimestampTz stmt_ts;
SerializableXactHandle serializable_xact_handle;
@@ -337,7 +337,7 @@ InitializeParallelDSM(ParallelContext *pcxt)
&fps->temp_toast_namespace_id);
fps->parallel_leader_pgproc = MyProc;
fps->parallel_leader_pid = MyProcPid;
- fps->parallel_leader_backend_id = MyBackendId;
+ fps->parallel_leader_proc_number = MyProcNumber;
fps->xact_ts = GetCurrentTransactionStartTimestamp();
fps->stmt_ts = GetCurrentStatementStartTimestamp();
fps->serializable_xact_handle = ShareSerializableXact();
@@ -1351,7 +1351,7 @@ ParallelWorkerMain(Datum main_arg)
/* Arrange to signal the leader if we exit. */
ParallelLeaderPid = fps->parallel_leader_pid;
- ParallelLeaderBackendId = fps->parallel_leader_backend_id;
+ ParallelLeaderProcNumber = fps->parallel_leader_proc_number;
before_shmem_exit(ParallelWorkerShutdown, PointerGetDatum(seg));
/*
@@ -1367,7 +1367,7 @@ ParallelWorkerMain(Datum main_arg)
mqh = shm_mq_attach(mq, seg, NULL);
pq_redirect_to_shm_mq(seg, mqh);
pq_set_parallel_leader(fps->parallel_leader_pid,
- fps->parallel_leader_backend_id);
+ fps->parallel_leader_proc_number);
/*
* Send a BackendKeyData message to the process that initiated parallelism
@@ -1594,7 +1594,7 @@ ParallelWorkerShutdown(int code, Datum arg)
{
SendProcSignal(ParallelLeaderPid,
PROCSIG_PARALLEL_MESSAGE,
- ParallelLeaderBackendId);
+ ParallelLeaderProcNumber);
dsm_detach((dsm_segment *) DatumGetPointer(arg));
}