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 1uZRuD-003mqX-BQ for pgsql-bugs@arkaria.postgresql.org; Wed, 09 Jul 2025 10:20:01 +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 1uZRuA-00F4ia-QI for pgsql-bugs@arkaria.postgresql.org; Wed, 09 Jul 2025 10:19:59 +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 1uZRuA-00F4iS-HR for pgsql-bugs@lists.postgresql.org; Wed, 09 Jul 2025 10:19:59 +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 1uZRu7-006clD-2V for pgsql-bugs@lists.postgresql.org; Wed, 09 Jul 2025 10:19:58 +0000 Received: from [192.168.11.2] (p1696134-ipoe.ipoe.ocn.ne.jp [118.0.93.133]) by oss.nttdata.com (Postfix) with ESMTPSA id D62FC60A1A; Wed, 9 Jul 2025 19:19:47 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at oss.nttdata.com Message-ID: <49b70ae1-acbe-41ec-9d2d-8284b3462fc1@oss.nttdata.com> Date: Wed, 9 Jul 2025 19:19:44 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Unexpected behavior when setting "idle_replication_slot_timeout" To: Laurenz Albe , "Hayato Kuroda (Fujitsu)" , Amit Kapila Cc: Tom Lane , "David G. Johnston" , Nisha Moond , Gunnar Morling , "pgsql-bugs@lists.postgresql.org" References: <30e91649-06dd-453e-8658-5f4acd03a3bd@oss.nttdata.com> <686577f2379e4b978803e72746dcf0dd7baf3937.camel@cybertec.at> <70b183fb-f66e-40d8-b0de-be8c1052fa93@oss.nttdata.com> <472687.1751731008@sss.pgh.pa.us> <474268.1751731988@sss.pgh.pa.us> <1cea80b2ed4f355ae6a68e36f56a1410b59ea4a8.camel@cybertec.at> <2dcea297694d9ab8eafd1db70d385ec0b49e3d27.camel@cybertec.at> Content-Language: en-US From: Fujii Masao In-Reply-To: <2dcea297694d9ab8eafd1db70d385ec0b49e3d27.camel@cybertec.at> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025/07/09 18:21, Laurenz Albe wrote: > On Wed, 2025-07-09 at 07:24 +0000, Hayato Kuroda (Fujitsu) wrote: >>>> +# Wait a bit for the replication slots to become invalid >>>> +$node->safe_psql('postgres', "SELECT pg_sleep(2)"); >>>> >>>> Is it a good idea to add 2s to 'make check-world' for one particular test? >>> >>> That is debatable. I thought that adding two seconds would be worth the >>> advantage of removing the injection point that only fakes the timeout. >>> We'd get better test coverage. >>> >>> But if the people who run the regression tests dozens of times every day >>> object to the two seconds, I won't insist on this part of the patch. >> >> I can understand both concerns. One benefit not to use the injection point is >> that any machines can run the test. Currently some BF machines do not enable >> the injection point, thus the feature has not been verified on these env. >> However, unconditional sleep makes the test longer. >> >> Based on that, I want to propose the hybrid approach; use injection_point_attach() >> if possible, otherwise wait few seconds. One concern is that the test code may be >> bit complex, but below codes was enough on my environment. >> >> ``` >> # Check if the 'injection_points' extension is available, as it may be >> # possible that this script is run with installcheck, where the module >> # would not be installed by default. >> if ($node->check_extension('injection_points')) >> { >> # Register an injection point on the node to forcibly cause a slot >> # invalidation due to idle_timeout >> $node->safe_psql('postgres', 'CREATE EXTENSION injection_points;'); >> >> $node->safe_psql('postgres', >> "SELECT injection_points_attach('slot-timeout-inval', 'error');"); >> } >> else >> { >> # Otherwise wait a bit for the replication slots to become invalid >> $node->safe_psql('postgres', "SELECT pg_sleep(2)"); >> } >> ``` >> >> Attached patch implements the idea, which can be applied atop v2. How do you think? > > I have no objections. So the purpose of this "hybrid approach" is to test idle_replication_slot_timeout even in environments where the injection point isn't available? Do we really need this additional test? It seems to me that the test using the injection point is sufficient. Regards, -- Fujii Masao NTT DATA Japan Corporation