diff options
author | Thomas Munro <tmunro@postgresql.org> | 2021-12-16 12:40:15 +1300 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2021-12-16 15:56:03 +1300 |
commit | a13db0e16404ae532fe037071c7fe2576a1f8890 (patch) | |
tree | dc19c338b46532e1f8a5b7688c2ac53a39738677 /src/include/storage/buf_internals.h | |
parent | bbc227e951ecc59a29205be4952a623e7d1dd534 (diff) | |
download | postgresql-a13db0e16404ae532fe037071c7fe2576a1f8890.tar.gz postgresql-a13db0e16404ae532fe037071c7fe2576a1f8890.zip |
Change ProcSendSignal() to take pgprocno.
Instead of referring to target backends by pid, use pgprocno. This
means that we don't have to scan the ProcArray and we can drop some
special case code for dealing with the startup process.
Discussion: https://postgr.es/m/CA%2BhUKGLYRyDaneEwz5Uya_OgFLMx5BgJfkQSD%3Dq9HmwsfRRb-w%40mail.gmail.com
Reviewed-by: Soumyadeep Chakraborty <soumyadeep2007@gmail.com>
Reviewed-by: Ashwin Agrawal <ashwinstar@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Diffstat (limited to 'src/include/storage/buf_internals.h')
-rw-r--r-- | src/include/storage/buf_internals.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h index 33fcaf5c9a8..7c6653311a5 100644 --- a/src/include/storage/buf_internals.h +++ b/src/include/storage/buf_internals.h @@ -136,7 +136,7 @@ typedef struct buftag * BufferDesc -- shared descriptor/state data for a single shared buffer. * * Note: Buffer header lock (BM_LOCKED flag) must be held to examine or change - * the tag, state or wait_backend_pid fields. In general, buffer header lock + * tag, state or wait_backend_pgprocno fields. In general, buffer header lock * is a spinlock which is combined with flags, refcount and usagecount into * single atomic variable. This layout allow us to do some operations in a * single atomic operation, without actually acquiring and releasing spinlock; @@ -161,8 +161,8 @@ typedef struct buftag * * We can't physically remove items from a disk page if another backend has * the buffer pinned. Hence, a backend may need to wait for all other pins - * to go away. This is signaled by storing its own PID into - * wait_backend_pid and setting flag bit BM_PIN_COUNT_WAITER. At present, + * to go away. This is signaled by storing its own pgprocno into + * wait_backend_pgprocno and setting flag bit BM_PIN_COUNT_WAITER. At present, * there can be only one such waiter per buffer. * * We use this same struct for local buffer headers, but the locks are not @@ -187,7 +187,7 @@ typedef struct BufferDesc /* state of the tag, containing flags, refcount and usagecount */ pg_atomic_uint32 state; - int wait_backend_pid; /* backend PID of pin-count waiter */ + int wait_backend_pgprocno; /* backend of pin-count waiter */ int freeNext; /* link in freelist chain */ LWLock content_lock; /* to lock access to buffer contents */ } BufferDesc; |