stats_ext test fails with -DCATCACHE_FORCE_RELEASE - Mailing list pgsql-hackers

From Amit Langote
Subject stats_ext test fails with -DCATCACHE_FORCE_RELEASE
Date
Msg-id 1349aabb-3a1f-6675-9fc0-65e2ce7491dd@lab.ntt.co.jp
Whole thread Raw
Responses Re: stats_ext test fails with -DCATCACHE_FORCE_RELEASE
List pgsql-hackers
Hi.

While playing around with a -DCATCACHE_FORCE_RELEASE build, I noticed that
stats_ext test failed with errors for multiple statements that looked like
this:

ERROR:  invalid ndistinct magic 7f7f7f7f (expected a352bfa4)

I figured it's because statext_dependencies_load() and
statext_ndistinct_build() both return a pointer that points directly into
a pg_statistics_ext tuple obtained by using SearchSysCache1 that has
uncertain lifetime after subsequent call to ReleaseSysCache before returning.

I think we should be calling statext_dependencies_deserialize() and
statext_ndistinct_deserialize(), respectively, *before* we perform
ReleaseSysCache on the tuple.  Attached patch does that.

Thanks,
Amit

Attachment

pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: A few warnings on Windows
Next
From: "Liran's Lab"
Date:
Subject: Protecting sensitive data over NetApp