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 1pXmZe-0002tt-T5 for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Mar 2023 17:18:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pXmZc-0005xD-Fz for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Mar 2023 17:18:32 +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 1pXmZc-0005rx-2q for pgsql-hackers@lists.postgresql.org; Thu, 02 Mar 2023 17:18:32 +0000 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pXmZY-0000PK-KT for pgsql-hackers@lists.postgresql.org; Thu, 02 Mar 2023 17:18:31 +0000 Received: by mail-oi1-x22b.google.com with SMTP id bg11so14108087oib.5 for ; Thu, 02 Mar 2023 09:18:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; t=1677777506; 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=lZhYino7yfQxfhR9iNFL7ouniQWJj50Gaa5n3k5ixp4=; b=S0LmLdT7GRhy2nQTROVi7AJM6JjrelywDKZ+MpEWnbEygIr8bzfvK6AQVKO6V39ki3 es+sGiRgPAyq8uZbkSM6vqy08ouZWltcmdsSuGWjapE6N98IRfGQ6ILeGWXQoJONhQSY M4ZgCM3hR7hjyRwDqIB3VeiYdU1xNiIkG57I8zamsleM8HUdKV4NvQixuTb4njbpz58m 4aRhpFdhInP03/3zlAchbCA8xXEd5FtjgarzelWvh6+K1MBsY1Mw47C+L+gaktR8DJ3N fG1NDiN/BQABnlf4QAx5YoSBVyHoLN82wAn6AmwVEhCHcWByZehOaEODd5YYNZZdyUV7 j8UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677777506; 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=lZhYino7yfQxfhR9iNFL7ouniQWJj50Gaa5n3k5ixp4=; b=ODf6+9ZYb4LxZkzYi7EcN3F79zr2hDYfZkG0anuY6L6+6kmwKQfGpNxKqIvlvDR0hX ShdCerrLTFaFavEM97w9bPGnYys9fCp9X5/nxyuvCoTPar5fU4M8mtFd23zDkyg+ftl8 eJCXc18703do2ZhYYcBhe0Bt5YzfJwxqCPrmYHyBK4B3ARpNol+kV6ENzanzF1wm9r9D dnJFqRn8CXdkzr5Eiv94PiGDI2209EyoZhnc3Joa4aJyjeDId1YyUo+Jv1jP+GvOf55m 5Gkvb00ElaW6969rUzOhu2Vk/1Oku2cMwb2vyduInQZnnNbqKh1DrLQrrSxj7DQA2AUB /kgQ== X-Gm-Message-State: AO0yUKXidv0+LEeNhV3lRW+OPyRZWmYPyjDksnbdS/WDA12ey+w+8pwm cOsg2N4+I6KyR5v1cF8+50/q5A== X-Google-Smtp-Source: AK7set96mUTWjzpNR6cZhJyhAlXzpWvPVv3ai+tuGXcqE0oAsfpf84oieXQj/DHVH+20m/isBx3i3g== X-Received: by 2002:a05:6808:8cc:b0:377:f784:3332 with SMTP id k12-20020a05680808cc00b00377f7843332mr1578303oij.24.1677777505928; Thu, 02 Mar 2023 09:18:25 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id l189-20020acabbc6000000b0037b6f5d6309sm4223732oif.2.2023.03.02.09.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 09:18:25 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 41BAE800A27; Thu, 2 Mar 2023 11:18:24 -0600 (CST) Date: Thu, 2 Mar 2023 11:18:24 -0600 From: Justin Pryzby To: Tomas Vondra Cc: gkokolatos@pm.me, Michael Paquier , shiy.fnst@fujitsu.com, pgsql-hackers@lists.postgresql.org, Rachel Heaton Subject: Re: Add LZ4 compression in pg_dump Message-ID: <20230302171824.GE4268@telsasoft.com> References: <535565cd-b69f-c064-a845-15c0fc44db4a@enterprisedb.com> <22cb80ed-ec87-54c7-fd5b-cdcf79766bb1@enterprisedb.com> <8421f53d-c9f7-c02e-3278-9f9522a8e8f3@enterprisedb.com> <20230224015115.GS1653@telsasoft.com> <20230225050214.GH1653@telsasoft.com> <20230225140553.GI1653@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 05:20:05PM +0100, Tomas Vondra wrote: > On 2/25/23 15:05, Justin Pryzby wrote: > > On Fri, Feb 24, 2023 at 11:02:14PM -0600, Justin Pryzby wrote: > >> I have some fixes (attached) and questions while polishing the patch for > >> zstd compression. The fixes are small and could be integrated with the > >> patch for zstd, but could be applied independently. > > > > One more - WriteDataToArchiveGzip() says: > > > > + if (cs->compression_spec.level == 0) > > + pg_fatal("requested to compress the archive yet no level was specified"); > > > > That was added at e9960732a. > > > > But if you specify gzip:0, the compression level is already enforced by > > validate_compress_specification(), before hitting gzip.c: > > > > | pg_dump: error: invalid compression specification: compression algorithm "gzip" expects a compression level between 1 and 9 (default at -1) > > > > 5e73a6048 intended that to work as before, and you *can* specify -Z0: > > > > The change is backward-compatible, hence specifying only an integer > > leads to no compression for a level of 0 and gzip compression when the > > level is greater than 0. > > > > $ time ./src/bin/pg_dump/pg_dump -h /tmp regression -t int8_tbl -Fp --compress 0 |file - > > /dev/stdin: ASCII text > > FWIW I agree we should make this backwards-compatible - accept "0" and > treat it as no compression. > > Georgios, can you prepare a patch doing that? I think maybe Tomas misunderstood. What I was trying to say is that -Z 0 *is* accepted to mean no compression. This part wasn't quoted, but I said: > Right now, I think that pg_fatal in gzip.c is dead code - that was first > added in the patch version sent on 21 Dec 2022. If you run the diff command that I've been talking about, you'll see that InitCompressorZlib was almost unchanged - e9960732 is essentially a refactoring. I don't think it's desirable to add a pg_fatal() in a function that's otherwise nearly-unchanged. The fact that it's nearly-unchanged is a good thing: it simplifies reading of what changed. If someone wants to add a pg_fatal() in that code path, it'd be better done in its own commit, with a separate message explaining the change. If you insist on changing anything here, you might add an assertion (as you said earlier) along with a comment like /* -Z 0 uses the "None" compressor rather than zlib with no compression */ -- Justin