From 024c521117579a6d356050ad3d78fdc95e44eefa Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Sun, 3 Mar 2024 19:38:22 +0200 Subject: 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 --- doc/src/sgml/config.sgml | 2 +- doc/src/sgml/monitoring.sgml | 18 +++++++++--------- doc/src/sgml/storage.sgml | 2 +- doc/src/sgml/xact.sgml | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 43b1a132a2c..b38cbd714aa 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -7495,7 +7495,7 @@ local0.* /var/log/postgresql %v - Virtual transaction ID (backendID/localXID); see + Virtual transaction ID (procNumber/localXID); see no diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 4b8b38b70ef..8aca08140ea 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -4940,7 +4940,7 @@ description | Waiting for a newly initialized WAL file to reach durable storage access functions can be used; these are shown in . These access functions use the session's backend ID number, which is a - small positive integer that is distinct from the backend ID of any + small integer (>= 0) that is distinct from the backend ID of any concurrent session, although a session's ID can be recycled as soon as it exits. The backend ID is used, among other things, to identify the session's temporary schema if it has one. @@ -6813,7 +6813,7 @@ FROM pg_stat_get_backend_idset() AS backendid; arg0 contains the fork to be extended. arg1, arg2, and arg3 contain the tablespace, database, and relation OIDs identifying the relation. arg4 is the ID of the backend which created the temporary relation for a - local buffer, or InvalidBackendId (-1) for a shared + local buffer, or INVALID_PROC_NUMBER (-1) for a shared buffer. arg5 is the number of blocks the caller would like to extend by. @@ -6824,7 +6824,7 @@ FROM pg_stat_get_backend_idset() AS backendid; arg0 contains the fork to be extended. arg1, arg2, and arg3 contain the tablespace, database, and relation OIDs identifying the relation. arg4 is the ID of the backend which created the temporary relation for a - local buffer, or InvalidBackendId (-1) for a shared + local buffer, or INVALID_PROC_NUMBER (-1) for a shared buffer. arg5 is the number of blocks the relation was extended by, this can be less than the number in the buffer-extend-start due to resource @@ -6839,7 +6839,7 @@ FROM pg_stat_get_backend_idset() AS backendid; arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs identifying the relation. arg5 is the ID of the backend which created the temporary relation for a - local buffer, or InvalidBackendId (-1) for a shared buffer. + local buffer, or INVALID_PROC_NUMBER (-1) for a shared buffer. @@ -6850,7 +6850,7 @@ FROM pg_stat_get_backend_idset() AS backendid; arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs identifying the relation. arg5 is the ID of the backend which created the temporary relation for a - local buffer, or InvalidBackendId (-1) for a shared buffer. + local buffer, or INVALID_PROC_NUMBER (-1) for a shared buffer. arg6 is true if the buffer was found in the pool, false if not. @@ -6903,7 +6903,7 @@ FROM pg_stat_get_backend_idset() AS backendid; arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs identifying the relation. arg5 is the ID of the backend which created the temporary relation for a - local buffer, or InvalidBackendId (-1) for a shared buffer. + local buffer, or INVALID_PROC_NUMBER (-1) for a shared buffer. smgr-md-read-done @@ -6913,7 +6913,7 @@ FROM pg_stat_get_backend_idset() AS backendid; arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs identifying the relation. arg5 is the ID of the backend which created the temporary relation for a - local buffer, or InvalidBackendId (-1) for a shared buffer. + local buffer, or INVALID_PROC_NUMBER (-1) for a shared buffer. arg6 is the number of bytes actually read, while arg7 is the number requested (if these are different it indicates a short read). @@ -6925,7 +6925,7 @@ FROM pg_stat_get_backend_idset() AS backendid; arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs identifying the relation. arg5 is the ID of the backend which created the temporary relation for a - local buffer, or InvalidBackendId (-1) for a shared buffer. + local buffer, or INVALID_PROC_NUMBER (-1) for a shared buffer. smgr-md-write-done @@ -6935,7 +6935,7 @@ FROM pg_stat_get_backend_idset() AS backendid; arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs identifying the relation. arg5 is the ID of the backend which created the temporary relation for a - local buffer, or InvalidBackendId (-1) for a shared buffer. + local buffer, or INVALID_PROC_NUMBER (-1) for a shared buffer. arg6 is the number of bytes actually written, while arg7 is the number requested (if these are different it indicates a short write). diff --git a/doc/src/sgml/storage.sgml b/doc/src/sgml/storage.sgml index 3ea4e5526df..652946db7d7 100644 --- a/doc/src/sgml/storage.sgml +++ b/doc/src/sgml/storage.sgml @@ -202,7 +202,7 @@ these files are named after the table or index's filenode which can be found in pg_class.relfilenode. But for temporary relations, the file name is of the form tBBB_FFF, where BBB -is the backend ID of the backend which created the file, and FFF +is the process number of the backend which created the file, and FFF is the filenode number. In either case, in addition to the main file (a/k/a main fork), each table and index has a free space map (see ), which stores information about free space available in diff --git a/doc/src/sgml/xact.sgml b/doc/src/sgml/xact.sgml index 07b94b11329..3aa7ee1383e 100644 --- a/doc/src/sgml/xact.sgml +++ b/doc/src/sgml/xact.sgml @@ -26,10 +26,10 @@ Every transaction is identified by a unique VirtualTransactionId (also called virtualXID or vxid), which - is comprised of a backend ID (or backendID) + is comprised of a backend's process number (or procNumber) and a sequentially-assigned number local to each backend, known as localXID. For example, the virtual transaction - ID 4/12532 has a backendID + ID 4/12532 has a procNumber of 4 and a localXID of 12532. -- cgit v1.2.3