From: | "Regina Obe" <lr(at)pcorp(dot)us> |
---|---|
To: | <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | MemoryContextCreate change in PG 11 how should contexts be created |
Date: | 2017-12-19 08:24:56 |
Message-ID: | 000001d378a2$db3d5060$91b7f120$@pcorp.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On December 13th this change to context creation was committed, which broke
PostGIS trunk compile against PostgreSQL 11 head.
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=9fa6f00b1308d
d10da4eca2f31ccbfc7b35bb461
Ticketed in PostGIS here:
https://trac.osgeo.org/postgis/ticket/3946
It's been broken for a couple of months
https://trac.osgeo.org/postgis/ticket/3904 with just core dumping but at
least it used to compile before December 13th.
In going thru the changes I see that MemoryContextCreate was changed to not
return a context anymore and to take in pointer to the context that should
be returned among other changes.
I also notice that MemoryContextCreate seems to be rarely used in PostgreSQL
code in places I would expect and instead AllocSetContextCreateExtended is
used.
So is the preferred approach to not use MemoryContextCreate in extensions
and instead for PG < 11 use AllocSetContextCreate and PG >= use
AllocSetContextCreateExtended?
Sorry if my questions don't make any sense. Still trying to grapple with
all these memory context functions and how each is different from the other.
For reference, one of the slices of code we have in place that broke looks
something like this and we've got I think at least 5 more such instances
sprinkled in PostGIS code base.
https://git.osgeo.org/gitea/postgis/postgis/src/branch/svn-trunk/libpgcommon
/lwgeom_transform.c#L550
MemoryContext PJMemoryContext;
POSTGIS_DEBUGF(3, "adding SRID %d with proj4text \"%s\" to query
cache at index %d", srid, proj_str, PROJ4Cache->PROJ4SRSCacheCount);
PJMemoryContext = MemoryContextCreate(T_AllocSetContext, 8192,
&PROJ4SRSCacheContextMethods,
PROJ4Cache->PROJ4SRSCacheContext,
"PostGIS PROJ4 PJ Memory
Context");
Thanks,
Regina
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro HORIGUCHI | 2017-12-19 08:31:38 | Re: Protect syscache from bloating with negative cache entries |
Previous Message | David Rowley | 2017-12-19 05:42:58 | Re: [HACKERS] path toward faster partition pruning |