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 1u0Glq-00FWQ8-1A for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Apr 2025 09:21:58 +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 1u0Gln-005BzF-NN for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Apr 2025 09:21:55 +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 1u0Gln-005Bz7-DJ for pgsql-hackers@lists.postgresql.org; Thu, 03 Apr 2025 09:21:55 +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 1u0Glk-0038AU-16 for pgsql-hackers@lists.postgresql.org; Thu, 03 Apr 2025 09:21:55 +0000 Received: from [192.168.11.5] (p1696134-ipoe.ipoe.ocn.ne.jp [118.0.93.133]) by oss.nttdata.com (Postfix) with ESMTPSA id BE7FD61974; Thu, 3 Apr 2025 18:21:45 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at oss.nttdata.com Message-ID: <1fdfd020-a509-403c-bd8f-a04664aba148@oss.nttdata.com> Date: Thu, 3 Apr 2025 18:21:44 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Some codes refer slot()->{'slot_name'} but it is not defined To: "Hayato Kuroda (Fujitsu)" , "'pgsql-hackers@lists.postgresql.org'" References: Content-Language: en-US From: Fujii Masao In-Reply-To: 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/04/03 12:15, Hayato Kuroda (Fujitsu) wrote: > Dear hackers, > > Cluster.pm defines a function slot()which requires a slot_name as a key > and returns attributes of the given slot, as a hash-ref. ISTM, the hash > does not contain 'slot_name'. > > However, I found that some codes access it by using a key 'slot_name'. ISTM it always > becomes 'undef' thus any tests are meaningless. > > It looks like that existing codes want to check the existing of given logical slots. > So, it is enough to search with key 'plugin'. The valid value is set if exists, otherwise ''. > > How do you think? I think you're right. The patch looks good to me. -is($node_primary->slot('dropme_slot')->{'slot_name'}, - undef, 'logical slot was actually dropped on standby'); +is($node_primary->slot('dropme_slot')->{'plugin'}, + '', 'logical slot was actually dropped on standby'); This seems like a separate issue from what your patch is addressing, but since this test is meant to confirm that the slot was dropped on the standby, shouldn't node_primary be node_replica instead? Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION