MemoryContextCreate change in PG 11 how should contexts be created

Поиск
Список
Период
Сортировка
От Regina Obe
Тема MemoryContextCreate change in PG 11 how should contexts be created
Дата
Msg-id 000001d378a2$db3d5060$91b7f120$@pcorp.us
обсуждение исходный текст
Ответы Re: MemoryContextCreate change in PG 11 how should contexts be created  (Paul Ramsey <pramsey@cleverelephant.ca>)
Список 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: [HACKERS] path toward faster partition pruning
Следующее
От: Kyotaro HORIGUCHI
Дата:
Сообщение: Re: Protect syscache from bloating with negative cache entries