Skip to content

Commit 9d3ebba

Browse files
committed
pgstat: Create memory contexts below TopMemoryContext
So far they were created below CacheMemoryContext. However, that's not guaranteed to exist in all situations, leading to memory contexts created as top-level contexts. There isn't actually a good reason anymore to create them below CacheMemoryContext, so just creating them below TopMemoryContext seems the best approach. Reported-by: Reid Thompson <reid.thompson@crunchydata.com> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Reviewed-by: Andres Freund <andres@anarazel.de> Author: "Drouvot, Bertrand" <bdrouvot@amazon.com> Discussion: https://postgr.es/m/b948b729-42fe-f88c-2f4a-0e65d84c049b@amazon.com Backpatch: 15-
1 parent fdd8937 commit 9d3ebba

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/backend/utils/activity/pgstat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ pgstat_prep_pending_entry(PgStat_Kind kind, Oid dboid, Oid objoid, bool *created
10691069
if (unlikely(!pgStatPendingContext))
10701070
{
10711071
pgStatPendingContext =
1072-
AllocSetContextCreate(CacheMemoryContext,
1072+
AllocSetContextCreate(TopMemoryContext,
10731073
"PgStat Pending",
10741074
ALLOCSET_SMALL_SIZES);
10751075
}

src/backend/utils/activity/pgstat_shmem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,12 +992,12 @@ pgstat_setup_memcxt(void)
992992
{
993993
if (unlikely(!pgStatSharedRefContext))
994994
pgStatSharedRefContext =
995-
AllocSetContextCreate(CacheMemoryContext,
995+
AllocSetContextCreate(TopMemoryContext,
996996
"PgStat Shared Ref",
997997
ALLOCSET_SMALL_SIZES);
998998
if (unlikely(!pgStatEntryRefHashContext))
999999
pgStatEntryRefHashContext =
1000-
AllocSetContextCreate(CacheMemoryContext,
1000+
AllocSetContextCreate(TopMemoryContext,
10011001
"PgStat Shared Ref Hash",
10021002
ALLOCSET_SMALL_SIZES);
10031003
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy