From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Dilip Kumar <dilipbalaut@gmail.com>
To: Masahiro Ikeda <ikedamsh@oss.nttdata.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Assertion failure in smgr.c when using pg_prewarm with partitioned tables
Date: Thu, 15 May 2025 18:44:29 +0900
Message-ID: <7fde0acf-2395-44d8-b081-bfa0e10097dc@oss.nttdata.com> (raw)
In-Reply-To: <CAFiTN-tKxhMG0QNO1V3VNsfnhtkS=hrOJNj5Kxs6cGKtujdyhg@mail.gmail.com>
References: <e082e6027610fd0a4091ae6d033aa117@oss.nttdata.com>
<CAFiTN-tKxhMG0QNO1V3VNsfnhtkS=hrOJNj5Kxs6cGKtujdyhg@mail.gmail.com>
On 2025/05/15 18:20, Dilip Kumar wrote:
> On Thu, May 15, 2025 at 2:22 PM Masahiro Ikeda <ikedamsh@oss.nttdata.com> wrote:
>>
>> Hi,
>>
>> I encountered an assertion failure when a partitioned table is specified
>> as an argument to pg_prewarm. Below are the steps to reproduce the
>> issue:
Thanks for the report!
This assertion failure can also occur when pg_prewarm() is run on objects like
foreign tables, plain views, or other relations that don't have storage - not just
partitioned tables.
>> $ pgbench -i -s 1 --partitions=3
>> $ psql <<EOF
>> CREATE EXTENSION pg_prewarm;
>> SELECT pg_prewarm('pgbench_accounts');
>> EOF
>>
>> The following assertion failure occurs:
>>
>> TRAP: failed Assert("RelFileNumberIsValid(rlocator.relNumber)"), File:
>> "smgr.c", Line: 246, PID: 1246282
>> postgres: ikeda postgres [local]
>> SELECT(ExceptionalCondition+0xbb)[0x55edd16725c1]
>> postgres: ikeda postgres [local] SELECT(smgropen+0x5e)[0x55edd145c1ff]
>>
>>
>> It looks like this may have been overlooked in commit 049ef33.
>> What do you think?
>
> Yeah, this should be fixed, don't you think that instead of checking
> the relnumber is valid,
+1
How about adding a check to see whether the target relation has storage,
using something like RELKIND_HAS_STORAGE()?
Regards,
--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: masao.fujii@oss.nttdata.com, dilipbalaut@gmail.com, ikedamsh@oss.nttdata.com
Subject: Re: Assertion failure in smgr.c when using pg_prewarm with partitioned tables
In-Reply-To: <7fde0acf-2395-44d8-b081-bfa0e10097dc@oss.nttdata.com>
References: <e082e6027610fd0a4091ae6d033aa117@oss.nttdata.com> <CAFiTN-tKxhMG0QNO1V3VNsfnhtkS=hrOJNj5Kxs6cGKtujdyhg@mail.gmail.com> <7fde0acf-2395-44d8-b081-bfa0e10097dc@oss.nttdata.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox