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 1pXPwH-0001V2-OS for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Mar 2023 17:08:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pXPwG-0006zm-CF for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Mar 2023 17:08:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXPwF-0006zd-W9 for pgsql-hackers@lists.postgresql.org; Wed, 01 Mar 2023 17:08:24 +0000 Received: from mail-qt1-x82a.google.com ([2607:f8b0:4864:20::82a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pXPwD-0003ec-3e for pgsql-hackers@lists.postgresql.org; Wed, 01 Mar 2023 17:08:23 +0000 Received: by mail-qt1-x82a.google.com with SMTP id d7so14979273qtr.12 for ; Wed, 01 Mar 2023 09:08:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; t=1677690499; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=/zXLIhOOZkZDOhG9nWQTniwH7NSfBvA7pDV4mxKYZ3Y=; b=xrjH0F85i2vTtxFzvVMF6kqrrax76CDw8KcbuLywQu8owaWNzDOjNnzG59k1D1B6Wz 9PPXBa/+jNjxC1n1OXBbgrQ73c+O7Fa4CoLx6WWkX95w4A0BXdsllf4IsFUwpmtwbwdr FoN8QcwO/+cU8qIoItIKN9E8SN49SCpD7/hCgB9mh3SVtJeyvk3GhwCiNgnJgWvtFYuC XmINydy7m0fCtommtxe6WF+LgcZfdf2uUZypNg3f1TzsOCt6nCedAweoqiBRSmdW6G/u JilNx/TDHoYbv1rGv6asblKs+9WgveNfUOHLZmD9TAwDo6Ph3lf4LRWsGQIghTIZuowh WXtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677690499; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/zXLIhOOZkZDOhG9nWQTniwH7NSfBvA7pDV4mxKYZ3Y=; b=MDN3htppjHVJDR5rznrcLpigZJYO0GmOIrIIGY900dx/i29ImU/IDNWpY6fKhCpUuJ UGwHk58UbBtuRabegvGAb12pErE7lnU+hLLWBuwBuoVURexzBaYBjvxM6JXkQgLy+N4G RLASLDpaRt1FCY3WM6NXI4aQyRopikHv8cZlXq529ldr1n0qEjfFmPTT1PoWXhlDL1+S hB4UQi7nGRJGyASDfuUMIXpf6ia2g36jnEz4AOpNgGyOqLDMe5aYDs7kAxMTPLcw4f0D +Cuukbkk4UQcxjsWT+flCosJwi7EdG0CG5kPkv8K5k7iB3dm0/fRbCR4Gy0nidFSSnBE Th5g== X-Gm-Message-State: AO0yUKUuVYsL74DPw35vCcKy1bagOd4Ke+SxTz64NjneRltL39963XLr Q8zqyWZkqiM5HMsm7w6Tb1Cjyg== X-Google-Smtp-Source: AK7set/z0Y0pmALnUP7XwAkbqyJ/5x7erpQa/X0Xqvkg0gAUz2TU0baaWKwMrjD3qR1SutkknLNGQQ== X-Received: by 2002:ac8:5a91:0:b0:3b8:6d3a:5ec7 with SMTP id c17-20020ac85a91000000b003b86d3a5ec7mr11342844qtc.22.1677690499315; Wed, 01 Mar 2023 09:08:19 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id h10-20020ac8776a000000b003b9b8ec742csm8652620qtu.14.2023.03.01.09.08.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 09:08:18 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id D926E800BC8; Wed, 1 Mar 2023 11:08:17 -0600 (CST) Date: Wed, 1 Mar 2023 11:08:17 -0600 From: Justin Pryzby To: gkokolatos@pm.me Cc: Tomas Vondra , shiy.fnst@fujitsu.com, Michael Paquier , pgsql-hackers@lists.postgresql.org, Rachel Heaton Subject: Re: Add LZ4 compression in pg_dump Message-ID: <20230301170817.GA4268@telsasoft.com> References: <20230126062846.GO22427@telsasoft.com> <535565cd-b69f-c064-a845-15c0fc44db4a@enterprisedb.com> <22cb80ed-ec87-54c7-fd5b-cdcf79766bb1@enterprisedb.com> <8421f53d-c9f7-c02e-3278-9f9522a8e8f3@enterprisedb.com> <20230228235834.GC30529@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Mar 01, 2023 at 01:39:14PM +0000, gkokolatos@pm.me wrote: > On Wednesday, March 1st, 2023 at 12:58 AM, Justin Pryzby wrote: > > > The current function order avoids 3 lines of declarations, but it's > > obviously pretty useful to be able to run that diff command. I already > > argued for not calling the functions "Gzip" on the grounds that the name > > was inaccurate. > > I have no idea why we are back on the naming issue. I stand by the name > because in my humble opinion helps the code reader. There is a certain > uniformity when the compression_spec.algorithm and the compressor > functions match as the following code sample shows. I mentioned that it's because this allows usefully running "diff" against the previous commits. > if (compression_spec.algorithm == PG_COMPRESSION_NONE) > InitCompressorNone(cs, compression_spec); > else if (compression_spec.algorithm == PG_COMPRESSION_GZIP) > InitCompressorGzip(cs, compression_spec); > else if (compression_spec.algorithm == PG_COMPRESSION_LZ4) > InitCompressorLZ4(cs, compression_spec); > > When the reader wants to see what happens when the PG_COMPRESSION_XXX > is set, has to simply search for the XXX part. I think that this is > justification enough for the use of the names. You're right about that. But (with the exception of InitCompressorGzip), I'm referring to the naming of internal functions, static to gzip.c, so renaming can't be said to cause a loss of clarity. > > I'd want to create an empty large object in src/test/sql/largeobject.sql > > to exercise this tested during pgupgrade. But unfortunately that > > doesn't use -Fc, so this isn't hit. Empty input is an important enough > > test case to justify a tap test, if there's no better way. > > Please find in the attached a test case that exercises this codepath. Thanks for writing it. This patch could be an opportunity to improve the "diff" output, without renaming anything. The old order of functions was: -InitCompressorZlib -EndCompressorZlib -DeflateCompressorZlib -WriteDataToArchiveZlib -ReadDataFromArchiveZlib If you put DeflateCompressorEnd immediately after DeflateCompressorInit, diff works nicely. You'll have to add at least one declaration, which seems very worth it. -- Justin