Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uKgMv-0098U5-MX for pgsql-hackers@arkaria.postgresql.org; Thu, 29 May 2025 16:44:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uKgMu-00AchE-9t for pgsql-hackers@arkaria.postgresql.org; Thu, 29 May 2025 16:44:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uKgMu-00Acex-0G for pgsql-hackers@lists.postgresql.org; Thu, 29 May 2025 16:44:36 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uKgMq-000kTR-1V for pgsql-hackers@lists.postgresql.org; Thu, 29 May 2025 16:44:35 +0000 Received: from [192.168.11.9] (p1696134-ipoe.ipoe.ocn.ne.jp [118.0.93.133]) by oss.nttdata.com (Postfix) with ESMTPSA id 61ECD61B7D; Fri, 30 May 2025 01:44:26 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at oss.nttdata.com Message-ID: <23d5aea0-be92-4837-a5ee-1bdf0ebc49c5@oss.nttdata.com> Date: Fri, 30 May 2025 01:44:25 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Assertion failure in smgr.c when using pg_prewarm with partitioned tables To: Masahiro Ikeda Cc: Fujii Masao , Dilip Kumar , Richard Guo , PostgreSQL Hackers References: <1cf7a731-024b-4421-8f09-b67b5c25df93@email.android.com> <591e4384-87c1-46b6-a4f2-144738f24956@oss.nttdata.com> Content-Language: en-US From: Fujii Masao In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025/05/29 11:46, Masahiro Ikeda wrote: > Thanks for your feedback. I've attached the updated patches. I've pushed the 0001 patch. Thanks! > What do you think about adding new error messages specifically for partitioned > indexes? > > If the target is a partitioned index, the error messages would be: > >   ERROR:  expected index as targets for verification >   DETAIL:  This operation is not supported for partitioned indexes. > > If the target is an index, but its access method is not supported, the error > messages would be: > >   ERROR:  expected "btree" index as targets for verification >   DETAIL:  Relation "bttest_a_brin_idx" is a brin index. Thanks for considering this. The proposed messages look good to me. >> This is not directly relation to your proposal, but while reading >> the index_checkable() function, I noticed that ReleaseSysCache() >> is not called after SearchSysCache1(). Shouldn't we call >> ReleaseSysCache() here? Alternatively, we could use get_am_name() >> instead of SearchSysCache1(), which might be simpler. > > Agreed. I may have been mistaken earlier. Based on the comment in SearchSysCache(), the tuple returned by SearchSysCache1() is valid until the end of the transaction. Since index_checkable() raises an error and ends the transaction immediately after calling SearchSysCache1(), it seems safe to skip ReleaseSysCache() in this case. Using get_am_name() instead seems simpler, though. Thought? >> I also observed that the error code ERRCODE_FEATURE_NOT_SUPPORTED >> is used when the relation is not the expected type in index_checkable(). >> However, based on similar cases (e.g., pgstattuple), it seems that >> ERRCODE_WRONG_OBJECT_TYPE might be more appropriate in this situation. >> Thought? > > Agreed. I also change the error code to ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE > when the index is not valid. +1. Should we commit patch 0003 before 0002? Also, should we consider back-patching it? Regards, -- Fujii Masao NTT DATA Japan Corporation