Re: Assertion failure in smgr.c when using pg_prewarm with partitioned tables
Dilip Kumar <dilipbalaut@gmail.com>
From: Dilip Kumar <dilipbalaut@gmail.com>
To: Masahiro Ikeda <ikedamsh@oss.nttdata.com>
Cc: Richard Guo <guofenglinux@gmail.com>,
Fujii Masao <masao.fujii@oss.nttdata.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-05-16T06:33:22Z
Lists: pgsql-hackers
On Fri, May 16, 2025 at 11:51 AM Masahiro Ikeda <ikedamsh@oss.nttdata.com> wrote: > > Thank you for your comments! > > I updated the patch to use RELKIND_HAS_STORAGE() as done in > commit 4623d7144. Please see the v2-0001 patch for the changes. > > On 2025-05-15 19:57, Richard Guo wrote: > > +1. FWIW, not long ago we fixed a similar Assert failure in > > contrib/pg_freespacemap by verifying RELKIND_HAS_STORAGE() before > > trying to access the storage (see 4623d7144). Wondering if there are > > other similar issues elsewhere in contrib ... > > I tested all contrib functions that take regclass arguments (see > attached test.sql and test_result.txt). The result shows that only > pg_prewarm() can lead to the assertion failure. Right, even while I was searching, I see this is used in 3 contrib modules, amcheck, autoprewarm, and pg_prewarm. amcheck is already checking for AM type, and Autoprewarm is identifying the relation by block, so there is no chance of getting the relation which do not have storage. > > However, I found that amcheck's error messages can be misleading > when run on partitioned indexes. > > For example, on the master branch, amcheck (e.g., bt_index_check > function) > shows this error: > > > ERROR: expected "btree" index as targets for verification > > DETAIL: Relation "pgbench_accounts_pkey" is a btree index. > > This message says it expects a "btree" index, yet also states the > relation > is a "btree" index, which can seem contradictory. The actual issue is > that > the index is a btree partitioned index, but this detail is missing, > causing > possible confusion. Yes, I found the error message confusing during testing as well, so it makes sense to improve it. -- Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
amcheck: Improve error message for partitioned index target.
- 88a658a42e1b 19 (unreleased) landed
-
Fix assertion failure in pg_prewarm() on objects without storage.
- b64c585fde77 17.6 landed
- 3c4d7557e03b 18.0 landed
-
Prevent assertion failure in contrib/pg_freespacemap.
- 4623d71443de 18.0 cited
-
Don't try to open visibilitymap when analyzing a foreign table
- 049ef3398d05 17.0 cited