Re: Patch to address creation of PgStat* contexts with null parent context

reid.thompson@crunchydata.com

From: Reid Thompson <reid.thompson@crunchydata.com>
To: pgsql-hackers@lists.postgresql.org
Cc: reid.thompson@crunchydata.com
Date: 2022-08-04T17:12:32Z
Lists: pgsql-hackers

Attachments

On Fri, 2022-07-29 at 11:53 +0900, Kyotaro Horiguchi wrote:
> 
> That makes the memorycontext-tree structure unstable because
> CacheMemoryContext can be created on-the-fly.
> 
> Honestly I don't like to call CreateCacheMemoryContext in the two
> functions on-the-fly.  Since every process that calls
> pgstat_initialize() necessarily calls pgstat_setup_memcxt() at latest
> at process termination, I think we can create at least
> CacheMemoryContext in pgstat_initialize(). 

Attached is a patch creating CacheMemoryContext() in pgstat_initialize()
rather than the two previous patch locations.

> Or couldn't we create the
> all three contexts in the function, instead of calling
> pgstat_setup_memcxt() on-the fly?

You note that that pgstat_setup_memcxt() is called at latest at process
termination -- was the intent to hold off on requesting memory for these
two contexts until it was needed?

> regards.
> 
> -- 
> Kyotaro Horiguchi
> NTT Open Source Software Center


-- 
Reid Thompson
Senior Software Engineer
Crunchy Data, Inc.

reid.thompson@crunchydata.com
www.crunchydata.com



Commits

  1. pgstat: Create memory contexts below TopMemoryContext