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 1pLSRn-0007gp-9C for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Jan 2023 17:23:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pLSRm-0002j8-0i for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Jan 2023 17:23:30 +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 1pLSRl-0002g4-I3 for pgsql-hackers@lists.postgresql.org; Fri, 27 Jan 2023 17:23:29 +0000 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pLSRf-0000CQ-Pl for pgsql-hackers@lists.postgresql.org; Fri, 27 Jan 2023 17:23:28 +0000 Received: by mail-il1-x135.google.com with SMTP id h10so2563227ilq.6 for ; Fri, 27 Jan 2023 09:23:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; 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=9jGZ+NqVrqVJ3P+EGSbxww1iNMWJacKzx6KrTyI6KKw=; b=YC1lOjspP2PJdCICSxs89uk4y7K36azQhL96WJUMnvDDgbFqOv4pgLpsoti/zD04+O lPb5yy1eQ2oj3CHVWKqzBM+vXPPL8hN8IWE+UjGwFthQ1gzpTqCLxIHZFWbtI8OZQziE ELOntaWv/4tp+EjjtHpUm8Be2csleK2XfiEQEg0dzSdWLIidOvq9HqfbM0Lieif8s+Ud sFASufOo7gsV4xGWbmrxJB2Arkxd7Qt9KFeVCnrg/otG85fg61gVE1U5Hs7hotJh9tgI uwyH/dtJSLyouyKYZb4K8WZ666BGLMZUzGhKzar5D3Lin90ATCKXfWtEkT4+LwD7Q8VE sB7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=9jGZ+NqVrqVJ3P+EGSbxww1iNMWJacKzx6KrTyI6KKw=; b=bkR7EVzNHPo3R8JbRthz9fd9CAPOiURy0Ky4xTddIsxF77q63430gYx1gZbj833y4j 6oLBqG6DAg9VM1L/PFlt35Pc+84zi9oZ4Fzg1uYXpHSP6ozg9pkSP/Sf55nxboQjTaRu 5PN6X/aFk+o5eFPUqnQ+wP7UO7HbxSAbI5TfyyshaFugLADrmXqDsfle8Gt8M754YU4A c//6eO6gUaaji3yb3m51YJoRm3+otT96Jc8Q8np/La0F/GKSVP9DXbcxp8QTCVqxJStU FQrzJMrY+gof7fTv1V5XalGs931E3onRD3clvAVU1BEh8wZnAqUiBeK/NPf0cTlvLIZd fc5A== X-Gm-Message-State: AO0yUKWXGerUu8t8s1QSIrpvf4q+kgV7HZQ7Xg3YBkzzEeBiTMeNu9eL nmxOv2VX8zZw2lTgCnHAxS6Lbw== X-Google-Smtp-Source: AK7set+qFsGQ17gxHpDm5ZDMWGv4dBVcHnOAHg3HJcFpxTduQ+QDMdVW+BkPsQV4VrjnY6EvsDxC2g== X-Received: by 2002:a05:6e02:214a:b0:310:b8ff:d77d with SMTP id d10-20020a056e02214a00b00310b8ffd77dmr4532619ilv.1.1674840202929; Fri, 27 Jan 2023 09:23:22 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id k4-20020a02c764000000b0039e98b2fe5dsm1628583jao.179.2023.01.27.09.23.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 09:23:22 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id D244A800676; Fri, 27 Jan 2023 11:23:20 -0600 (CST) Date: Fri, 27 Jan 2023 11:23:20 -0600 From: Justin Pryzby To: gkokolatos@pm.me Cc: Michael Paquier , Tomas Vondra , pgsql-hackers@lists.postgresql.org, Rachel Heaton Subject: Re: Add LZ4 compression in pg_dump Message-ID: <20230127172320.GZ22427@telsasoft.com> References: <4ZDVII-_kusch7xndcrTUt7OPSuQWQGX7n8rqp625Hdv6DijBjWZ38gjhxLSzPu8M_Dka-50eeKCiCU_dOdawwpv06dZtwGroYE9dHlIBLc=@pm.me> <20230126182245.GR22427@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230126182245.GR22427@telsasoft.com> 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 Thu, Jan 26, 2023 at 12:22:45PM -0600, Justin Pryzby wrote: > That commit also added this to pg-dump.c: > > + case PG_COMPRESSION_ZSTD: > + pg_fatal("compression with %s is not yet supported", "ZSTD"); > + break; > + case PG_COMPRESSION_LZ4: > + pg_fatal("compression with %s is not yet supported", "LZ4"); > + break; > > In 002, that could be simplified by re-using the supports_compression() > function. (And maybe the same in WriteDataToArchive()?) The first patch aims to minimize references to ".gz" and "GZIP" and ZLIB. pg_backup_directory.c comments still refers to ".gz". I think the patch should ideally change to refer to "the compressed file extension" (similar to compress_io.c), avoiding the need to update it later. I think the file extension stuff could be generalized, so it doesn't need to be updated in multiple places (pg_backup_directory.c and compress_io.c). Maybe it's useful to add a function to return the extension of a given compression method. It could go in compression.c, and be useful in basebackup. For the 2nd patch: I might be in the minority, but I still think some references to "gzip" should say "zlib": +} GzipCompressorState; + +/* Private routines that support gzip compressed data I/O */ +static void +DeflateCompressorGzip(ArchiveHandle *AH, CompressorState *cs, bool flush) In my mind, three things here are misleading, because it doesn't use gzip headers: | GzipCompressorState, DeflateCompressorGzip, "gzip compressed". This comment is about exactly that: * underlying stream. The second API is a wrapper around fopen/gzopen and * friends, providing an interface similar to those, but abstracts away * the possible compression. Both APIs use libz for the compression, but * the second API uses gzip headers, so the resulting files can be easily * manipulated with the gzip utility. AIUI, Michael says that it's fine that the user-facing command-line options use "-Z gzip" (even though the "custom" format doesn't use gzip headers). I'm okay with that, as long as that's discussed/understood. -- Justin