From 9f1c04c156a65f31c9036d242295bd3e11c00e98 Mon Sep 17 00:00:00 2001 From: Rahila Syed Date: Tue, 29 Apr 2025 14:20:32 +0530 Subject: [PATCH] Fix typos and modify few comments. Add a missing null termination. --- doc/src/sgml/func.sgml | 5 ++--- src/backend/utils/mmgr/mcxt.c | 11 +++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 574a544d9fa..af3d056b992 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -28780,8 +28780,7 @@ acl | {postgres=arwdDxtm/postgres,foo=r/postgres} indicate the number aggregated child contexts. When summary is false, the num_agg_contexts value is 1, - indicating that individual statistics are being displayed. The levels - are limited to the first 100 contexts. + indicating that individual statistics are being displayed. Busy processes can delay reporting memory context statistics, @@ -28796,7 +28795,7 @@ acl | {postgres=arwdDxtm/postgres,foo=r/postgres} statistics are aggregated and a cumulative total is displayed. The num_agg_contexts column indicates the number of contexts aggregated in the displayed statistics. When - num_agg_contexts is 1 is means + num_agg_contexts is 1 it means that the context statistics are displayed separately. diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c index 506f2902986..63c53c1552a 100644 --- a/src/backend/utils/mmgr/mcxt.c +++ b/src/backend/utils/mmgr/mcxt.c @@ -1494,7 +1494,7 @@ ProcessGetMemoryContextInterrupt(void) /* * Create a DSA and send handle to the client process after storing the * context statistics. If number of contexts exceed a predefined - * limit(8MB), a cumulative total is stored for such contexts. + * limit (1MB), a cumulative total is stored for such contexts. */ if (memCxtArea->memstats_dsa_handle == DSA_HANDLE_INVALID) { @@ -1512,8 +1512,10 @@ ProcessGetMemoryContextInterrupt(void) /* * Pin the DSA area, this is to make sure the area remains attachable - * even if current backend exits. This is done so that the statistics - * are published even if the process exits while a client is waiting. + * even if the backend that created it exits. This is done so that + * the statistics are published even if the process exits while a + * client is waiting. Also, other processes that publish statistics + * will use the same area. */ dsa_pin(MemoryStatsDsaArea); @@ -1609,9 +1611,9 @@ ProcessGetMemoryContextInterrupt(void) } memCxtState[idx].total_stats = cxt_id; + /* Notify waiting backends and return */ end_memorycontext_reporting(); - /* Notify waiting backends and return */ hash_destroy(context_id_lookup); return; @@ -1663,6 +1665,7 @@ ProcessGetMemoryContextInterrupt(void) meminfo[max_stats - 1].name = dsa_allocate(MemoryStatsDsaArea, namelen + 1); nameptr = dsa_get_address(MemoryStatsDsaArea, meminfo[max_stats - 1].name); strncpy(nameptr, "Remaining Totals", namelen); + nameptr[namelen] = '\0'; meminfo[max_stats - 1].ident = InvalidDsaPointer; meminfo[max_stats - 1].path = InvalidDsaPointer; meminfo[max_stats - 1].type = 0; -- 2.34.1