pg_buffercache: Remove unused fields from BufferCacheNumaRec
authorMichael Paquier <[email protected]>
Sun, 23 Nov 2025 04:37:42 +0000 (13:37 +0900)
committerMichael Paquier <[email protected]>
Sun, 23 Nov 2025 04:37:42 +0000 (13:37 +0900)
These fields have been added in commit ba2a3c2302f, and have never been
used.  While on it, this commit moves a comment that was out of place,
improving it.

Author: Bertrand Drouvot <[email protected]>
Discussion: https://postgr.es/m/[email protected]

contrib/pg_buffercache/pg_buffercache_pages.c

index c29b784dfa1accc7fcda7c004623d87dd9d4b849..7c9ff24fa837cd99a4809a4fdcde41d8620b314c 100644 (file)
@@ -82,9 +82,6 @@ typedef struct
 typedef struct
 {
        TupleDesc       tupdesc;
-       int                     buffers_per_page;
-       int                     pages_per_buffer;
-       int                     os_page_size;
        BufferCacheNumaRec *record;
 } BufferCacheNumaContext;
 
@@ -368,7 +365,12 @@ pg_buffercache_numa_pages(PG_FUNCTION_ARGS)
                os_page_ptrs = palloc0(sizeof(void *) * os_page_count);
                os_page_status = palloc(sizeof(uint64) * os_page_count);
 
-               /* Fill pointers for all the memory pages. */
+               /*
+                * Fill pointers for all the memory pages.  This loop stores and
+                * touches (if needed) addresses into os_page_ptrs[] as input to one
+                * big move_pages(2) inquiry system call, as done in
+                * pg_numa_query_pages().
+                */
                idx = 0;
                for (char *ptr = startptr; ptr < endptr; ptr += os_page_size)
                {
@@ -449,10 +451,6 @@ pg_buffercache_numa_pages(PG_FUNCTION_ARGS)
                 * We don't hold the partition locks, so we don't get a consistent
                 * snapshot across all buffers, but we do grab the buffer header
                 * locks, so the information of each buffer is self-consistent.
-                *
-                * This loop touches and stores addresses into os_page_ptrs[] as input
-                * to one big move_pages(2) inquiry system call. Basically we ask for
-                * all memory pages for NBuffers.
                 */
                startptr = (char *) TYPEALIGN_DOWN(os_page_size, (char *) BufferGetBlock(1));
                idx = 0;