0008-Fix-compilation-failures-from-previous-comm-20250918.patch

application/x-patch

Filename: 0008-Fix-compilation-failures-from-previous-comm-20250918.patch
Type: application/x-patch
Part: 6
Message: Re: Changing shared_buffers without restart

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 0008
Subject: Fix compilation failures from previous commits
File+
src/backend/storage/buffer/buf_init.c 1 0
src/backend/storage/ipc/shmem.c 1 1
From 86ada56e8c48d8111b40d10cae8c96a3286d210a Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Date: Wed, 20 Aug 2025 11:35:20 +0530
Subject: [PATCH 08/16] Fix compilation failures from previous commits

shm_total_page_count is used unitialized. If this variable has a random
value to start with, the final sum would be wrong.

Also include pg_shmem.h where shared memory segment macros are used.

Author: Ashutosh Bapat
---
 src/backend/storage/buffer/buf_init.c | 1 +
 src/backend/storage/ipc/shmem.c       | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/backend/storage/buffer/buf_init.c b/src/backend/storage/buffer/buf_init.c
index 5383442e213..6d703e18f8b 100644
--- a/src/backend/storage/buffer/buf_init.c
+++ b/src/backend/storage/buffer/buf_init.c
@@ -16,6 +16,7 @@
 
 #include "storage/aio.h"
 #include "storage/buf_internals.h"
+#include "storage/pg_shmem.h"
 #include "storage/bufmgr.h"
 
 BufferDescPadded *BufferDescriptors;
diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c
index 9bb73f31052..e6cb919f0fc 100644
--- a/src/backend/storage/ipc/shmem.c
+++ b/src/backend/storage/ipc/shmem.c
@@ -649,7 +649,7 @@ pg_get_shmem_allocations_numa(PG_FUNCTION_ARGS)
 	Size		os_page_size;
 	void	  **page_ptrs;
 	int		   *pages_status;
-	uint64		shm_total_page_count,
+	uint64		shm_total_page_count = 0,
 				shm_ent_page_count,
 				max_nodes;
 	Size	   *nodes;
-- 
2.34.1