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 1pL6tm-0005cp-IG for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Jan 2023 18:22:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pL6tl-0002sj-DY for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Jan 2023 18:22:57 +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 1pL6tk-0002ro-Se for pgsql-hackers@lists.postgresql.org; Thu, 26 Jan 2023 18:22:57 +0000 Received: from mail-io1-xd36.google.com ([2607:f8b0:4864:20::d36]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pL6td-0004h1-BW for pgsql-hackers@lists.postgresql.org; Thu, 26 Jan 2023 18:22:55 +0000 Received: by mail-io1-xd36.google.com with SMTP id p189so930921iod.0 for ; Thu, 26 Jan 2023 10:22:49 -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:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=9qbLaIHUTutNWMNkwjxMWo3KXIQ1V3DtEgnu/Eq8XWE=; b=d9Xp1PDjifXJ5EsoxDe+6TFKgxrHhqM3Qg9zbezisF60rk1NSEV8ULZudzZH7kdVAJ MIBER8N+KSXA/Px7kdGvuBwU3ZrIjP0abM5eksjbGBtrZuHSaVqCXpcWSO7yS+mRfjb7 yqKlbOtuIuWoPyfHEw9hmFT/FsK3913ijX9mAqwlbXBbOaUYqBNCBKL+ucK//Hi8Zeey ht+WTMaDehYME2+6DABMKSBIwmNFMGYOvh6vfCfGeKlCHeQgCoseHjMxV58GAS/66Kbp l0HBNI58DEb8qyzJSjhml9AhOQR2MTXT/k4IxTCxiQZ7PR+is2oXkVLAe4kbnXiPK5GW /+Yg== 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:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9qbLaIHUTutNWMNkwjxMWo3KXIQ1V3DtEgnu/Eq8XWE=; b=mZ2GVE34DA4391bbgI8JmkuBGrQSPq4NqngHCD4j/j/B1/yTbGAM1gfafgtlCXxyrz 4XNaZU8z+sa4pFs0KAb7jgPz8RuHw09krx1twbRVMI0P8QUIre+ydq9RsDrSi2fu2M+S Dbe260yqWob0PNMULwpH8Ou8mGUH3rI5n2B00G0qfH0/MnICaX9dEQlN5y+vtKAeMSVI Z2bRUbgNeaEmwSgSv0TRzRd2n5dvny/wg/WUbDxkF5/eRyXM6Asj0JRsMYLZ3hFqd4z/ muJy/OsHBqtIqUajBrr0pBHd8s7BBTCvrY3UhyDlA2mCtr+pQ7/OGd12l9QrpRG3dvNT IrjQ== X-Gm-Message-State: AFqh2ko8xZm5MUpkUxiOz2Na9eetrmr/gM2SxNs+mZ0paDfkSstFYWiG 5m1EXe9TbW2jyNFOclH1dSeN5w== X-Google-Smtp-Source: AMrXdXuIsldB5Rtgsu/QZvuegKGgseQUDRBuPQ+zHDnuSEFvCLaYibALYOh80YCq8ka2hB4jNhNcQw== X-Received: by 2002:a5e:8309:0:b0:6ec:9bf1:3050 with SMTP id x9-20020a5e8309000000b006ec9bf13050mr24546602iom.0.1674757368371; Thu, 26 Jan 2023 10:22:48 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id h19-20020a0566380f1300b003a22298d014sm687709jas.25.2023.01.26.10.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 10:22:47 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 23CD7800CA9; Thu, 26 Jan 2023 12:22:46 -0600 (CST) Date: Thu, 26 Jan 2023 12:22:45 -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: <20230126182245.GR22427@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4ZDVII-_kusch7xndcrTUt7OPSuQWQGX7n8rqp625Hdv6DijBjWZ38gjhxLSzPu8M_Dka-50eeKCiCU_dOdawwpv06dZtwGroYE9dHlIBLc=@pm.me> 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, Jan 25, 2023 at 07:57:18PM +0000, gkokolatos@pm.me wrote: > On Wednesday, January 25th, 2023 at 7:00 PM, Justin Pryzby wrote: > > While looking at this, I realized that commit 5e73a6048 introduced a > > regression: > > > > @@ -3740,19 +3762,24 @@ ReadHead(ArchiveHandle *AH) > > > > - if (AH->compression != 0) > > > > - pg_log_warning("archive is compressed, but this installation does not support compression -- no data will be available"); > > + if (AH->compression_spec.algorithm == PG_COMPRESSION_GZIP) > > > > + pg_fatal("archive is compressed, but this installation does not support compression"); > > > > Before, it was possible to restore non-data chunks of a dump file, even > > if the current build didn't support its compression. But that's now > > impossible - and it makes the code we're discussing in RestoreArchive() > > unreachable. On Thu, Jan 26, 2023 at 08:53:28PM +0900, Michael Paquier wrote: > On Thu, Jan 26, 2023 at 11:24:47AM +0000, gkokolatos@pm.me wrote: > > I gave this a little bit of thought. I think that ReadHead should not > > emit a warning, or at least not this warning as it is slightly misleading. > > It implies that it will automatically turn off data restoration, which is > > false. Further ahead, the code will fail with a conflicting error message > > stating that the compression is not available. > > > > Instead, it would be cleaner both for the user and the maintainer to > > move the check in RestoreArchive and make it the sole responsible for > > this logic. > > - pg_fatal("cannot restore from compressed archive (compression not supported in this installation)"); > + pg_fatal("cannot restore data from compressed archive (compression not supported in this installation)"); > Hmm. I don't mind changing this part as you suggest. > > -#ifndef HAVE_LIBZ > - if (AH->compression_spec.algorithm == PG_COMPRESSION_GZIP) > - pg_fatal("archive is compressed, but this installation does not support compression"); > -#endif > However I think that we'd better keep the warning, as it can offer a > hint when using pg_restore -l not built with compression support if > looking at a dump that has been compressed. Yeah. But the original log_warning text was better, and should be restored: - if (AH->compression != 0) - pg_log_warning("archive is compressed, but this installation does not support compression -- no data will be available"); 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()?) -- Justin