1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

Rename global variable backing DSA area

The global variable backing the DSA area for Memory Context stats
reporting had a too generic name, rename to be more descriptive.
Independently reported by Peter and Laurenz.

Author: Daniel Gustafsson <daniel@yesql.se>
Reported-by: Peter Eisentraut <peter@eisentraut.org>
Reported-by: Laurenz Albe <laurenz.albe@cybertec.at>
Discussion: https://postgr.es/m/d51172bd4e7f4b07a18a0288ca1b1c28a71a5f6a.camel@cybertec.at
Discussion: https://postgr.es/m/25095db5-b595-4b85-9100-d358907c25b5@eisentraut.org
This commit is contained in:
Daniel Gustafsson
2025-04-10 22:40:27 +02:00
parent 22cb6d2895
commit 55ef7abf88
3 changed files with 28 additions and 28 deletions

View File

@@ -533,21 +533,21 @@ pg_get_process_memory_contexts(PG_FUNCTION_ARGS)
*/
Assert(memCxtArea->memstats_dsa_handle != DSA_HANDLE_INVALID);
/* Attach to the dsa area if we have not already done so */
if (area == NULL)
if (MemoryStatsDsaArea == NULL)
{
MemoryContext oldcontext = CurrentMemoryContext;
MemoryContextSwitchTo(TopMemoryContext);
area = dsa_attach(memCxtArea->memstats_dsa_handle);
MemoryStatsDsaArea = dsa_attach(memCxtArea->memstats_dsa_handle);
MemoryContextSwitchTo(oldcontext);
dsa_pin_mapping(area);
dsa_pin_mapping(MemoryStatsDsaArea);
}
/*
* Backend has finished publishing the stats, project them.
*/
memcxt_info = (MemoryStatsEntry *)
dsa_get_address(area, memCxtState[procNumber].memstats_dsa_pointer);
dsa_get_address(MemoryStatsDsaArea, memCxtState[procNumber].memstats_dsa_pointer);
#define PG_GET_PROCESS_MEMORY_CONTEXTS_COLS 12
for (int i = 0; i < memCxtState[procNumber].total_stats; i++)
@@ -566,7 +566,7 @@ pg_get_process_memory_contexts(PG_FUNCTION_ARGS)
if (DsaPointerIsValid(memcxt_info[i].name))
{
name = (char *) dsa_get_address(area, memcxt_info[i].name);
name = (char *) dsa_get_address(MemoryStatsDsaArea, memcxt_info[i].name);
values[0] = CStringGetTextDatum(name);
}
else
@@ -574,7 +574,7 @@ pg_get_process_memory_contexts(PG_FUNCTION_ARGS)
if (DsaPointerIsValid(memcxt_info[i].ident))
{
ident = (char *) dsa_get_address(area, memcxt_info[i].ident);
ident = (char *) dsa_get_address(MemoryStatsDsaArea, memcxt_info[i].ident);
values[1] = CStringGetTextDatum(ident);
}
else
@@ -586,7 +586,7 @@ pg_get_process_memory_contexts(PG_FUNCTION_ARGS)
path_datum = (Datum *) palloc(path_length * sizeof(Datum));
if (DsaPointerIsValid(memcxt_info[i].path))
{
path_int = (int *) dsa_get_address(area, memcxt_info[i].path);
path_int = (int *) dsa_get_address(MemoryStatsDsaArea, memcxt_info[i].path);
for (int j = 0; j < path_length; j++)
path_datum[j] = Int32GetDatum(path_int[j]);
path_array = construct_array_builtin(path_datum, path_length, INT4OID);