Re: Assertion failure in smgr.c when using pg_prewarm with partitioned tables

Masahiro Ikeda <ikedamsh@oss.nttdata.com>

From: Masahiro Ikeda <ikedamsh@oss.nttdata.com>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>, Richard Guo <guofenglinux@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-05-19T08:17:55Z
Lists: pgsql-hackers

Attachments

Thanks for your work and feedback!

I've updated the patches and added regular regression tests for
both pg_prewarm and amcheck.


On 2025-05-16 21:01, Fujii Masao wrote:
> Also, since the issue was introduced in v17, this patch should be
> back-patched to v17, right?

I agree with back-patching v3-0001. I was able to reproduce the issue
on the REL_17_STABLE branch. One concern is that this patch changes
the error message in production:

* v17.5 (without --enable-cassert)
> ERROR:  fork "main" does not exist for this relation

* REL_17_STABLE with the v3-0001 patch (without --enable-cassert)
> ERROR:  relation "test" does not have storage

However, I think preventing the assertion failure should take priority.

As for v3-0002, I think it's fine to apply it to the master branch only,
since it just makes a cosmetic improvement to the error message.

Regards,
-- 
Masahiro Ikeda
NTT DATA CORPORATION

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. amcheck: Improve error message for partitioned index target.

  2. Fix assertion failure in pg_prewarm() on objects without storage.

  3. Prevent assertion failure in contrib/pg_freespacemap.

  4. Don't try to open visibilitymap when analyzing a foreign table