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 1lGVAn-00059K-V3 for pgsql-hackers@arkaria.postgresql.org; Sun, 28 Feb 2021 23: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 1lGVAm-0005ts-Ir for pgsql-hackers@arkaria.postgresql.org; Sun, 28 Feb 2021 23: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 1lGVAm-0005tl-C8 for pgsql-hackers@lists.postgresql.org; Sun, 28 Feb 2021 23:08:24 +0000 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lGVAj-0007FB-E0 for pgsql-hackers@postgresql.org; Sun, 28 Feb 2021 23:08:24 +0000 Received: by mail-il1-x130.google.com with SMTP id h18so13072014ils.2 for ; Sun, 28 Feb 2021 15:08:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ULqvA66vNcaXEN0+Cz5fCExpjRD76hHqskWdMFB9HVA=; b=Ttg8XdLRgbDRxd3HUlS2xelH3ALLtI3Lu9Gon1bdUr+TREoLaOHc5OdTYNPABJh/oM Y49odcK56DTbSy+jnkvNdLlz9KPEdLTsQ6IL+uawfyTpLafAdxSems0rme/RUl/yztgy nrrjZ8vAlQiehRAP/EUbjzvR07InnhnaI5RC67rsYoXEuHimcZnX8OIrlyagw2qsDZGb b5Ci1LDq6mfKC8w+quxEnSCzdQCU9qcQnTpr7FJuzAfWjOIAQzkD13jmTy1WBLokvtip wNQzg3Ki/b9FhaTPcXVj5Ek+YHCo4VwpmuC7So0DwlvNUdKyNoHyXkOQl+MPmroqs00I vPkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ULqvA66vNcaXEN0+Cz5fCExpjRD76hHqskWdMFB9HVA=; b=abuwhgrEMr/cNd7EOImy6KBROYd5sSRP66QoNg8AVpCryJcBwjUeoG9p/y/zku3fQO fiY7jbP9Owf3nhofG9HKpW6wGWYOBVJi4F3Wyzd413PfR0aF+rn6/ET2ofy3ZNuBMTpz rjp047KdajQ+XJCaK7/HMpGxJgD9WsUHinjl/6ptZIQ9JezYd0YR0G3WERlEX+vgqEyG MDX7ncFU2koMtejfGfiysPXdl30q4QHwuJJiqJod+BFl/MC9Bb0SXnKdgm3T3Usu7l0n iFd0oAgt58Lz7O7ZLDrqepdrUpUO/tG86Q7DlOW4lt2QA3Dqah7l1chgqTKrGKak8Jpt qSsA== X-Gm-Message-State: AOAM533etGnl9J00rM2oXfnx0+TpuvMdG8Pzn0JPOoRuJKniVi3jtbII pP+1DaT3effrc4OgK7/+kTCJdAbyWbTyeQ== X-Google-Smtp-Source: ABdhPJxaT0VIhn+Vxa0F7XlB7xCD96+CG8DZPixYhzx2nrBfmG/6Om1MGNobfDVqx5MLhCU5YMDVLA== X-Received: by 2002:a92:b50e:: with SMTP id f14mr10323468ile.77.1614553699595; Sun, 28 Feb 2021 15:08:19 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id e12sm8198418ilm.85.2021.02.28.15.08.18 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Feb 2021 15:08:18 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id B6975800A1A; Sun, 28 Feb 2021 17:08:17 -0600 (CST) Date: Sun, 28 Feb 2021 17:08:17 -0600 From: Justin Pryzby To: Andrey Borodin Cc: pgsql-hackers@postgresql.org Subject: Re: Different compression methods for FPI Message-ID: <20210228230817.GE20769@telsasoft.com> References: <3037310D-ECB7-4BF1-AF20-01C10BB33A33@yandex-team.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3037310D-ECB7-4BF1-AF20-01C10BB33A33@yandex-team.ru> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, Feb 27, 2021 at 12:43:52PM +0500, Andrey Borodin wrote: > So I think it worth to propose a patch to make wal_compression_method = {"pglz", "lz4", "zlib"}. Probably, "zstd" can be added to the list. > Attached is a draft taking CompressionId from "custom compression methods" patch and adding zlib to it. Thanks for submitting it. Does this need to patch ./configure{,.ac} and Solution.pm for HAVE_LIBLZ4 ? I suggest to also include an 0002 patch (not for commit) which changes to use a non-default compression, to exercise this on the CIs - linux and bsd environments now have liblz4 installed, and for windows you can keep "undef". Daniil had a patch to add src/common/z_stream.c: https://github.com/postgrespro/libpq_compression/blob/0a9c70d582cd4b1ef60ff39f8d535f6e800bd7d4/src/common/z_stream.c https://www.postgresql.org/message-id/470E411E-681D-46A2-A1E9-6DE11B5F59F3@yandex-team.ru Your patch looks fine, but I wonder if we should first implement a generic compression API. Then, the callers don't need to have a bunch of #ifdef. If someone calls zs_create() for an algorithm which isn't enabled at compile time, it throws the error at a lower level. That also allows a central place to do things like handle options (compression level, and things like zstd --long, --rsyncable, etc). In some cases there's an argument that the compression ID should be globally defined constant, not like a dynamic "plugable" OID. That may be true for the libpq compression, WAL compression, and pg_dump, since there's separate "producer" and "consumer". I think if there's "pluggable" compression (like the TOAST patch), then it may have to map between the static or dynamic OIDs and the global compression ID. -- Justin