Opened 2 years ago

Closed 2 years ago

Last modified 20 months ago

#5257 closed defect (fixed)

PG16 doesn't load against 3.4.0 (master) - MemoryContextContains removed in PG16

Reported by: robe Owned by: robe
Priority: blocker Milestone: PostGIS 3.4.0
Component: postgis Version: master
Keywords: PG16 Cc:

Description

I was hoping to test strk's postgresql wildcard patch against PostGIS, but sadly they broke out code again.

I confirmed debbie has the same issue

ignore the version 3.3, it's testing master, just had that hard-coded in the paths

ERROR:  could not load library "/var/lib/jenkins/workspace/postgis/regress_pgdev/branches/3.3/regress/00-regress-install/lib/postgis-3.so": /var/lib/jenkins/workspace/postgis/regress_pgdev/branches/3.3/regress/00-regress-install/lib/postgis-3.so: undefined symbol: MemoryContextContains

Issue seems to be here:

shared_gserialized.o shared_gserialized.c
shared_gserialized.c: In function ‘shared_gserialized_ref’:
shared_gserialized.c:50:6: warning: implicit declaration of function ‘MemoryContextContains’; did you mean ‘MemoryContextStats’? [-Wimplicit-function-declaration]
   50 |  if (MemoryContextContains(PostgisCacheContext(fcinfo), ref))
      |      ^~~~~~~~~~~~~~~~~~~~~
      |      MemoryContextStats
gcc-ar rs libpgcommon.a gserialized_gist.o lwgeom_transform.o lwgeom_cache.o lwgeom_pg.o shared_gserialized.o
/usr/bin/ar: creating libpgcommon.a

Also seeing these lovely warnings which I don't recall seeing in PG15

gserialized_spgist_2d.c: In function ‘gserialized_spgist_picksplit_2d’:
gserialized_spgist_2d.c:375:34: warning: passing argument 1 of ‘BoxPGetDatum’ from incompatible pointer type [-Wincompatible-pointer-types]
  375 |  out->prefixDatum = BoxPGetDatum(centroid);
      |                                  ^~~~~~~~
      |                                  |
      |                                  BOX2DF *
In file included from ../libpgcommon/lwgeom_pg.h:22,
                 from gserialized_spgist_2d.c:81:
/var/lib/jenkins/workspace/pg/rel/pg16w64/include/postgresql/server/utils/geo_decls.h:239:25: note: expected ‘const BOX *’ but argument is of type ‘BOX2DF *’
  239 | BoxPGetDatum(const BOX *X)
      |              ~~~~~~~~~~~^
gserialized_spgist_2d.c: In function ‘gserialized_spgist_leaf_consistent_2d’:
gserialized_spgist_2d.c:567:22: warning: passing argument 1 of ‘DatumGetPointer’ makes integer from pointer without a cast [-Wint-conversion]
  567 |  if (DatumGetPointer(key) == NULL)
      |                      ^~~
      |                      |
      |                      BOX2DF *
In file included from gserialized_spgist_2d.c:73:
/var/lib/jenkins/workspace/pg/rel/pg16w64/include/postgresql/server/postgres.h:660:23: note: expected ‘Datum’ {aka ‘long unsigned int’} but argument is of type ‘BOX2DF *’
  660 | DatumGetPointer(Datum X)
      |                 ~~~~~~^
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O2 -fPIC -fvisibility=hidden -I../liblwgeom -I../liblwgeom -std=gnu99 -g -O2 -fno-math-errno -fno-signed-zeros -Wall -I../libpgcommon -I../deps/flatgeobuf -I../deps/wagyu -I../deps/uthash/include  -I/var/lib/jenkins/workspace/geos/rel-3.8w64/include   -I/usr/include/libxml2 -I/usr/include -I/usr/include/json-c  -DNDEBUG   -fPIC -DPIC -I. -I./ -I/var/lib/jenkins/workspace/pg/rel/pg16w64/include/postgresql/server -I/var/lib/jenkins/workspace/pg/rel/pg16w64/include/postgresql/internal  -D_GNU_SOURCE   -c -o gserialized_spgist_3d.o gserialized_spgist_3d.c
gserialized_spgist_3d.c: In function ‘gserialized_spgist_picksplit_3d’:
gserialized_spgist_3d.c:439:10: warning: declaration of ‘box’ shadows a previous local [-Wshadow=compatible-local]
  439 |   BOX3D *box = DatumGetBox3DP(in->datums[i]);

Change History (4)

comment:1 by robe, 2 years ago

Smoking commit - https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=9543eff5e015b6f6f832da2d95d659629a2022f3

Remove MemoryContextContains().

MemoryContextContains is no longer reliable in the wake of c6e0fe1f2,
because there's no longer very much redundancy in chunk headers.
(It wasn't *completely* reliable even before that, as there was a
chance of a false positive if you passed it something that didn't
point to an mcxt chunk at all.  But it was generally good enough.)

Hence, remove it.  There is no remaining core code that requires it.
Extensions that have been using it might be able to substitute a
test like "GetMemoryChunkContext(ptr) == context", recognizing that
this explicitly requires that the pointer point to some chunk.

Tom Lane and David Rowley

comment:2 by robe, 2 years ago

Summary: PG16 doesn't load against 3.4.0 (master)PG16 doesn't load against 3.4.0 (master) - MemoryContextContains removed in PG16

comment:3 by Regina Obe <lr@…>, 2 years ago

Resolution: fixed
Status: assignedclosed

In b49f566/git:

Remove MemoryContextContains use for PG16
Closes #5257 for PostGIS 3.4.0

comment:4 by Regina Obe <lr@…>, 20 months ago

In 76f44de/git:

Support build on Pg16devel for PostGIS 3.3.3

Closes #5257
Closes #5261
Closes #5277
Closes #5308
Closes #5374
Closes https://github.com/postgis/postgis/pull/716

Note: See TracTickets for help on using tickets.