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 1pmOY7-00048R-OA for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Apr 2023 00:41:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pmOY5-0008OB-Lm for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Apr 2023 00:41:21 +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 1pmOY5-0008NH-3v for pgsql-hackers@lists.postgresql.org; Wed, 12 Apr 2023 00:41:21 +0000 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pmOXy-0001d3-5E for pgsql-hackers@lists.postgresql.org; Wed, 12 Apr 2023 00:41:19 +0000 Received: by mail-il1-x136.google.com with SMTP id j28so4488558ila.0 for ; Tue, 11 Apr 2023 17:41:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; t=1681260073; x=1683852073; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=tLaSvQUe2E0BvznoVFxNEU+JhSBhUvqDDu+HyM9YQM8=; b=h9EqP/vtAEDeUnHUvnZkzFplZI+HNWF942PTNjlHUf+gZHLvdnma16sTJT50s9xWPy QyyehAXKd03QssF8FnapN7fP2C5QnJKPFAqnYs9oYC8ctwRcAECzkZPr8wO2FlMJ67rR 0KaO1Kq2SEZdEK88NfMtE7YLBf7V7S1GkttrpmfFxDs1Ouqq9Sn8AF+/i9WHFiYg9qZ9 7g40x+OSUHwT8JJmj7y1mInb5WsKYw8G3eEFjmu2/sSanafEgZwMDyNLAzUtSrJn+ikT tmXP90DOhEPQjo2JI/fiq1yscqmsz8bJwAJft1c0JIHdbasyBmvxknAgceF6AS+757v+ alRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681260073; x=1683852073; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=tLaSvQUe2E0BvznoVFxNEU+JhSBhUvqDDu+HyM9YQM8=; b=oOODohxb+qAjlji6zhhiGqXh3uCOtJj3YYJofU9DOxlYeGxJQzj7EysQA4BBGTtZ6x 8T9Vr+hWrt11rgS7aafjzBwqKOtodYm36M8xTmqz8mgI/y1Y5Xec4s8Jm/9PuOQrbDWv gbM17arSiy3ZLkxD9rKQubAJLLt2GXSMKWuRU9W1FQYLo5rcgdXMqdhCRmKzaN9ezMT0 g2CGWePddPZd3zE0Z+SFa1lzEewBdS7pcyXQnc8VM9zbIqE6tsHzk0IUpJVWopyljDwz lX5ClkN10DnbDWonwDOR0ApKsj16ELIQkezyzag/rXcSSpNN1NhHLdFyJewoctr3QTGo 2QiA== X-Gm-Message-State: AAQBX9c2x+3V+KARzzqaT0T8YPwAZHOAuMUPXW2CFldGP9xqCi7pi+EE shAcA89aLqTMvTR4w5WTAS+alQ== X-Google-Smtp-Source: AKy350Y3GngTZDNMLupUZ/H4nYrQf8Aafmy7TkY3nWct4zdCNb6UUf6efMhmLtAezjogmcv8NL4ZRw== X-Received: by 2002:a92:c703:0:b0:326:3a39:89bd with SMTP id a3-20020a92c703000000b003263a3989bdmr7081380ilp.21.1681260073299; Tue, 11 Apr 2023 17:41:13 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id cl11-20020a0566383d0b00b003e9e5e1aacasm4465529jab.143.2023.04.11.17.41.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 17:41:12 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id D005B8001C9; Tue, 11 Apr 2023 19:41:11 -0500 (CDT) Date: Tue, 11 Apr 2023 19:41:11 -0500 From: Justin Pryzby To: Tomas Vondra , gkokolatos@pm.me Cc: Michael Paquier , shiy.fnst@fujitsu.com, pgsql-hackers@lists.postgresql.org, Rachel Heaton Subject: Re: Add LZ4 compression in pg_dump Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8ffd14fe-0278-7f8d-78d4-472816d06268@enterprisedb.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Feb 27, 2023 at 02:33:04PM +0000, gkokolatos@pm.me wrote: > > > - Finally, the "Nothing to do in the default case" comment comes from > > > Michael's commit 5e73a6048: > > > > > > + /* > > > + * Custom and directory formats are compressed by default with gzip when > > > + * available, not the others. > > > + / > > > + if ((archiveFormat == archCustom || archiveFormat == archDirectory) && > > > + !user_compression_defined) > > > { > > > #ifdef HAVE_LIBZ > > > - if (archiveFormat == archCustom || archiveFormat == archDirectory) > > > - compressLevel = Z_DEFAULT_COMPRESSION; > > > - else > > > + parse_compress_specification(PG_COMPRESSION_GZIP, NULL, > > > + &compression_spec); > > > +#else > > > + / Nothing to do in the default case */ > > > #endif > > > - compressLevel = 0; > > > } > > > > > > As the comment says: for -Fc and -Fd, the compression is set to zlib, if > > > enabled, and when not otherwise specified by the user. > > > > > > Before 5e73a6048, this set compressLevel=0 for -Fp and -Ft, and when > > > zlib was unavailable. > > > > > > But I'm not sure why there's now an empty "#else". I also don't know > > > what "the default case" refers to. > > > > > > Maybe the best thing here is to move the preprocessor #if, since it's no > > > longer in the middle of a runtime conditional: > > > > > > #ifdef HAVE_LIBZ > > > + if ((archiveFormat == archCustom || archiveFormat == archDirectory) && > > > + !user_compression_defined) > > > + parse_compress_specification(PG_COMPRESSION_GZIP, NULL, > > > + &compression_spec); > > > #endif > > > > > > ...but that elicits a warning about "variable set but not used"... > > > > > > Not sure, I need to think about this a bit. > /* Nothing to do for the default case when LIBZ is not available */ > is easier to understand. Maybe I would write it as: "if zlib is unavailable, default to no compression". But I think that's best done in the leading comment, and not inside an empty preprocessor #else. I was hoping Michael would comment on this. The placement and phrasing of the comment makes no sense to me. -- Justin