Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m2tgW-0004dI-BR for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Jul 2021 11:01:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m2tgT-0003mF-Kj for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Jul 2021 11:01:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m2tgT-0003lg-Cr for pgsql-hackers@lists.postgresql.org; Mon, 12 Jul 2021 11:01:09 +0000 Received: from 6.mo68.mail-out.ovh.net ([46.105.63.100]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m2tgM-0006rp-Cr for pgsql-hackers@lists.postgresql.org; Mon, 12 Jul 2021 11:01:08 +0000 Received: from player756.ha.ovh.net (unknown [10.110.208.131]) by mo68.mail-out.ovh.net (Postfix) with ESMTP id 2FB0D1A13C4 for ; Mon, 12 Jul 2021 13:00:57 +0200 (CEST) Received: from darold.net (lfbn-lyo-1-1368-22.w86-207.abo.wanadoo.fr [86.207.177.22]) (Authenticated sender: gilles@darold.net) by player756.ha.ovh.net (Postfix) with ESMTPSA id F3F3A1F5529C4; Mon, 12 Jul 2021 11:00:54 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-97G002aa7eb3f5-e391-4e38-9040-27871cd603e7, FEEA11D908A9CAA79C6E767E2B173E9E1A8FE455) smtp.auth=gilles@darold.net X-OVh-ClientIp: 86.207.177.22 To: gkokolatos@pm.me Cc: Michael Paquier , PostgreSQL Hackers References: <07BK3Mk5aEOsTwGaY77qBVyf9GjoEzn8TMgHLyPGfEFPIpTEmoQuP2P4c7teesjSg-LPeUafsp1flnPeQYINMSMB_UpggJDoduB5EDYBqaQ=@protonmail.com> From: Gilles Darold Subject: Re: Introduce pg_receivewal gzip compression tests Message-ID: <3543bfcd-e07e-129e-ff3c-5daf99aa182a@darold.net> Date: Mon, 12 Jul 2021 13:00:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-Ovh-Tracer-Id: 2371426682734354102 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvtddruddvgdefgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefvfhfhuffkffgfgggjtgfgsehtqhertddtfeejnecuhfhrohhmpefiihhllhgvshcuffgrrhholhguuceoghhilhhlvghssegurghrohhlugdrnhgvtheqnecuggftrfgrthhtvghrnhepgfejvddvtefghfejueegteefueekgfekieejfeelteetlefgudeivdfhveejhfdtnecuffhomhgrihhnpegurghrohhlugdrnhgvthenucfkpheptddrtddrtddrtddpkeeirddvtdejrddujeejrddvvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehplhgrhigvrhejheeirdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepghhilhhlvghssegurghrohhlugdrnhgvthdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Le 12/07/2021 =C3=A0 12:27, gkokolatos@pm.me a =C3=A9crit=C2=A0: >>>> >>>> Shouldn't this be coded as a loop going through @gzip_wals? >>> I would hope that there is only one gz file created. There is a line >>> >>> further up that tests exactly that. >>> >>> - is (scalar(@gzip_wals), 1, "one gzip compressed WAL was created")= ; >> Let me amend that. The line should be instead: >> >> is (scalar(keys @gzip_wals), 1, "one gzip compressed WAL was created")= ; >> >> To properly test that there is one entry. >> >> Let me provide with v2 to fix this. The following tests are not correct in Perl even if Perl returns the right value. +=C2=A0=C2=A0=C2=A0 is (scalar(keys @gzip_wals), 1, "one gzip compressed = WAL was created"); +=C2=A0=C2=A0=C2=A0 is (scalar(keys @gzip_partial_wals), 1, +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 "one partial gzip compressed WAL w= as created"); Function keys or values are used only with hashes but here you are using arrays. To obtain the length of the array you can just use the scalar function as Perl returns the length of the array when it is called in a scalar context. Please use the following instead: +=C2=A0=C2=A0=C2=A0 is (scalar(@gzip_wals), 1, "one gzip compressed WAL w= as created"); +=C2=A0=C2=A0=C2=A0 is (scalar(@gzip_partial_wals), 1, +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 "one partial gzip compressed WAL w= as created"); --=20 Gilles Darold http://www.darold.net/