v25-0007-fix-remaining-outstanding-issues-from-Sunday.patch
application/octet-stream
Filename: v25-0007-fix-remaining-outstanding-issues-from-Sunday.patch
Type: application/octet-stream
Part: 6
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v25-0007
Subject: fix remaining outstanding issues from Sunday
| File | + | − |
|---|---|---|
| contrib/pg_buffercache/pg_buffercache--1.5--1.6.sql | 1 | 1 |
| contrib/pg_buffercache/pg_buffercache_pages.c | 3 | 3 |
| doc/src/sgml/pgbuffercache.sgml | 2 | 2 |
| src/backend/storage/ipc/shmem.c | 7 | 1 |
From 094207663855318891ab23ca927e84ddd37f23b7 Mon Sep 17 00:00:00 2001
From: Jakub Wartak <jakub.wartak@enterprisedb.com>
Date: Mon, 7 Apr 2025 10:06:38 +0200
Subject: [PATCH v25 7/7] fix remaining outstanding issues from Sunday
---
contrib/pg_buffercache/pg_buffercache--1.5--1.6.sql | 2 +-
contrib/pg_buffercache/pg_buffercache_pages.c | 6 +++---
doc/src/sgml/pgbuffercache.sgml | 4 ++--
src/backend/storage/ipc/shmem.c | 8 +++++++-
4 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/contrib/pg_buffercache/pg_buffercache--1.5--1.6.sql b/contrib/pg_buffercache/pg_buffercache--1.5--1.6.sql
index e3b145a1687..998289790b7 100644
--- a/contrib/pg_buffercache/pg_buffercache--1.5--1.6.sql
+++ b/contrib/pg_buffercache/pg_buffercache--1.5--1.6.sql
@@ -12,7 +12,7 @@ LANGUAGE C PARALLEL SAFE;
-- Create a view for convenient access.
CREATE VIEW pg_buffercache_numa AS
SELECT P.* FROM pg_buffercache_numa_pages() AS P
- (bufferid integer, page_num int4, node_id int4);
+ (bufferid integer, ospageid int4, nodeid int4);
-- Don't want these to be available to public.
REVOKE ALL ON FUNCTION pg_buffercache_numa_pages() FROM PUBLIC;
diff --git a/contrib/pg_buffercache/pg_buffercache_pages.c b/contrib/pg_buffercache/pg_buffercache_pages.c
index df94cc6ef7d..bf96d4cea89 100644
--- a/contrib/pg_buffercache/pg_buffercache_pages.c
+++ b/contrib/pg_buffercache/pg_buffercache_pages.c
@@ -385,9 +385,9 @@ pg_buffercache_numa_pages(PG_FUNCTION_ARGS)
tupledesc = CreateTemplateTupleDesc(expected_tupledesc->natts);
TupleDescInitEntry(tupledesc, (AttrNumber) 1, "bufferid",
INT4OID, -1, 0);
- TupleDescInitEntry(tupledesc, (AttrNumber) 2, "page_num",
+ TupleDescInitEntry(tupledesc, (AttrNumber) 2, "ospageid",
INT4OID, -1, 0);
- TupleDescInitEntry(tupledesc, (AttrNumber) 3, "node_id",
+ TupleDescInitEntry(tupledesc, (AttrNumber) 3, "nodeid",
INT4OID, -1, 0);
fctx->tupdesc = BlessTupleDesc(tupledesc);
@@ -430,7 +430,7 @@ pg_buffercache_numa_pages(PG_FUNCTION_ARGS)
* to one big big move_pages(2) inquiry system call. Basically we ask
* for all memory pages for NBuffers.
*/
- startptr = (char *) BufferGetBlock(1);
+ startptr = (char *) TYPEALIGN_DOWN(os_page_size, (char *) BufferGetBlock(1));
idx = 0;
for (i = 0; i < NBuffers; i++)
{
diff --git a/doc/src/sgml/pgbuffercache.sgml b/doc/src/sgml/pgbuffercache.sgml
index b01f8e71357..b39c9849362 100644
--- a/doc/src/sgml/pgbuffercache.sgml
+++ b/doc/src/sgml/pgbuffercache.sgml
@@ -244,7 +244,7 @@
<row>
<entry role="catalog_table_entry"><para role="column_definition">
- <structfield>page_num</structfield> <type>int</type>
+ <structfield>ospageid</structfield> <type>int</type>
</para>
<para>
number of OS memory page for this buffer
@@ -253,7 +253,7 @@
<row>
<entry role="catalog_table_entry"><para role="column_definition">
- <structfield>node_id</structfield> <type>int</type>
+ <structfield>nodeid</structfield> <type>int</type>
</para>
<para>
ID of <acronym>NUMA</acronym> node
diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c
index 4a9a9606f2e..75cce5ca8a5 100644
--- a/src/backend/storage/ipc/shmem.c
+++ b/src/backend/storage/ipc/shmem.c
@@ -572,7 +572,13 @@ pg_get_shmem_allocations(PG_FUNCTION_ARGS)
return (Datum) 0;
}
-/* SQL SRF showing NUMA memory nodes for allocated shared memory */
+/*
+ * SQL SRF showing NUMA memory nodes for allocated shared memory
+ *
+ * Contrary to above one - pg_get_shmem_allocations() - in this function
+ * we don't output information aobut shared anonymous allocations and
+ * unused memory.
+ */
Datum
pg_get_shmem_allocations_numa(PG_FUNCTION_ARGS)
{
--
2.39.5