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 1pbIcG-0005Wj-6h for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Mar 2023 10:07:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pbIcE-0003qx-0C for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Mar 2023 10:07:46 +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 1pbIcC-0003qo-QD for pgsql-hackers@lists.postgresql.org; Sun, 12 Mar 2023 10:07:45 +0000 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pbIc8-0007P3-FU for pgsql-hackers@lists.postgresql.org; Sun, 12 Mar 2023 10:07:43 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id C45CE2B06712; Sun, 12 Mar 2023 06:07:37 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 12 Mar 2023 06:07:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1678615657; x=1678622857; bh=LcFGm8kWGKwOpxfN6hsKk8QhYJA+5luYgPZ pXp/oUMA=; b=hOZyyUHwrbn+He4GsTOzb4zh88kWcTbCV6mQAe5yZXfenTroH1j 0pLgwPJOLKVYpDBQtlpiLLJqIRIyS3hHwZAZGiAUYEHooVsrgn729hhUlIUWtoDO cn4/AaFaWgcyfiG1OXdNQrM+3NNty3y3NtUKOI95tXT6DKJCaAUvA0U+5htBqIeE 8FeKLzfFMpi5gp8VrcVlJq7TtSqc2Anbf5SGyrz/OGg76RsbNUeeE+4L7je0+c6L NrUwbbSn1YF7PKuxueFsELxtzNcYo7ApAWfgR53p7WgUGFPPVUi6rznVbq9eiQIW yc1irxTcUaET1zjYIfk0Wvv8EWzmj0MmycQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddvvddguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpefrvght vghrucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvghnth gvrhhprhhishgvuggsrdgtohhmqeenucggtffrrghtthgvrhhnpefhjeduueelfeehuedt udefteejveegieeiueejueehfeektddtueeiieeitefhveenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhrrghu thesvghnthgvrhhprhhishgvuggsrdgtohhm X-ME-Proxy: Feedback-ID: i131946ab:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 12 Mar 2023 06:07:35 -0400 (EDT) Message-ID: <4336c6e7-df8b-1e96-5408-b16dbc6ca6e0@enterprisedb.com> Date: Sun, 12 Mar 2023 11:07:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: Add LZ4 compression in pg_dump Content-Language: en-US To: Alexander Lakhin , Tomas Vondra , gkokolatos@pm.me Cc: "shiy.fnst@fujitsu.com" , Michael Paquier , Justin Pryzby , "pgsql-hackers@lists.postgresql.org" , Rachel Heaton References: <7zu6GYFi72jByVk2SEe_nd8r1DHhwA35vSntAE9sAfiMX9Lfk6bwimkwmu7GDgYaEvL27SE4qF1uK4_LHWQM4H-SXOwkMAI-GV8PKGmED_E=@pm.me> <20230126062846.GO22427@telsasoft.com> <6YZqN2HEE4yJxxxXWiMl4QWwKzLon0SdKETTGVkT9zjWnXMftGZjLKHHjGFuwC_5I6xL2s8nMXdLQGA4vEFveYXSHbfD9K9pDQvEJF2y99o=@pm.me> <535565cd-b69f-c064-a845-15c0fc44db4a@enterprisedb.com> <22cb80ed-ec87-54c7-fd5b-cdcf79766bb1@enterprisedb.com> <8421f53d-c9f7-c02e-3278-9f9522a8e8f3@enterprisedb.com> <33496f7c-3449-1426-d568-63f6bca2ac1f@gmail.com> From: Peter Eisentraut In-Reply-To: <33496f7c-3449-1426-d568-63f6bca2ac1f@gmail.com> 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 11.03.23 07:00, Alexander Lakhin wrote: > Hello, > 23.02.2023 23:24, Tomas Vondra wrote: >> On 2/23/23 16:26, Tomas Vondra wrote: >>> Thanks for v30 with the updated commit messages. I've pushed 0001 after >>> fixing a comment typo and removing (I think) an unnecessary change in an >>> error message. >>> >>> I'll give the buildfarm a bit of time before pushing 0002 and 0003. >>> >> I've now pushed 0002 and 0003, after minor tweaks (a couple typos etc.), >> and marked the CF entry as committed. Thanks for the patch! >> >> I wonder how difficult would it be to add the zstd compression, so that >> we don't have the annoying "unsupported" cases. > > With the patch 0003 committed, a single warning -Wtype-limits appeared > in the > master branch: > $ CPPFLAGS="-Og -Wtype-limits" ./configure --with-lz4 -q && make -s -j8 > compress_lz4.c: In function ‘LZ4File_gets’: > compress_lz4.c:492:19: warning: comparison of unsigned expression in ‘< > 0’ is always false [-Wtype-limits] >   492 |         if (dsize < 0) >       | > (I wonder, is it accidental that there no other places that triggers > the warning, or some buildfarm animals had this check enabled before?) I think there is an underlying problem in this code that it dances back and forth between size_t and int in an unprincipled way. In the code that triggers the warning, dsize is size_t. dsize is the return from LZ4File_read_internal(), which is declared to return int. The variable that LZ4File_read_internal() returns in the success case is size_t, but in case of an error it returns -1. (So the code that is warning is meaning to catch this error case, but it won't ever work.) Further below LZ4File_read_internal() calls LZ4File_read_overflow(), which is declared to return int, but in some cases it returns fs->overflowlen, which is size_t. This should be cleaned up. AFAICT, the upstream API in lz4.h uses int for size values, but lz4frame.h uses size_t, so I don't know what the correct approach is.