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 1oU5Gc-00005x-Ss for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Sep 2022 11:55: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 1oU5Ga-0001Du-3i for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Sep 2022 11:55:20 +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 1oU5GZ-0001Dl-My for pgsql-hackers@lists.postgresql.org; Fri, 02 Sep 2022 11:55:19 +0000 Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oU5GU-0002Oe-HV for pgsql-hackers@postgresql.org; Fri, 02 Sep 2022 11:55:18 +0000 Received: by mail-io1-xd2e.google.com with SMTP id c4so1396219iof.3 for ; Fri, 02 Sep 2022 04:55:14 -0700 (PDT) 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; bh=wzMhw5R7SzHQEALucS7t1QmA4O4TneIoeD1BlhPTS8Q=; b=d3e+5t5hfYbCYEBOsVck5I0323EDBBeGOLqWVoR/eQecIPgqso7rvCY6ef739DuqDZ lRHk+PA3uDyuItLBrNfveMbX/cFmYUuRSsk8mDVSICOu96vndUVmNOCX6D4s7PVfAjj+ TAD1FNrGsZz5aCWW3ooJe2j8+rD111WRBBOIKAftxOe5cxg1tbZoLXCDPKECPssxuYxI gFELu8aWilZsIE0Q69r+v7MkDraxnxtt1i9WFUoNKS2qC+onCIcitC4KORyKSbrFxvXm xFVuU7xLPIjuhaCt3PHcUS03tKzq2590qwlT0qrkcW80CMx0FJyxzxJ9ZV94H35QI7wb DkWQ== 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; bh=wzMhw5R7SzHQEALucS7t1QmA4O4TneIoeD1BlhPTS8Q=; b=OtqgBc57XCSTBQdVhLtbu+TPG7+70lKDRP9FJgukGGFmtx7MJeA1BZQGofs7ud0t67 pCBNN1CJf5LfAnhhATTP1WIHT27CTthlFfrGT8eLTcJ/Vxt3IBTNA18syj/tUom5Fiym HyQazVY0Og5yaC3dSUa10TFxaiP3J2542n00H6F1GKKQ8u/+3LX0Epu/xAR/rzgAXdLN MdDjQHwpXcQk1plispXcDt4BjLAQgNQ+Mf+1FPNhA5lqsSnO90EaFGGWZds9UM+yhBZa in0codbB32/kRZnPWmr+7Foq1bt1NIaZ/T4yN++npc+d09vmUITXo9XXq7+YIBD7rJKi Ejtw== X-Gm-Message-State: ACgBeo2LdOt7bqb+UNVW5iq8LEWEv0SVK03JGbHxc9YjCmNsA+7MLhfH Yfg8Qkt5SP2k4UZwmtjCuCk1VQ== X-Google-Smtp-Source: AA6agR6Ddxhnw67akC63vF5TTCgm+eyxIKEll5jlCNJErn9h6wg81rm+K9S7IWkVmd5/V5qIoZej6A== X-Received: by 2002:a6b:6709:0:b0:68e:9aa7:74a7 with SMTP id b9-20020a6b6709000000b0068e9aa774a7mr4181397ioc.71.1662119713438; Fri, 02 Sep 2022 04:55:13 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id ck12-20020a0566383f0c00b0034fdf8771b3sm69429jab.31.2022.09.02.04.55.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Sep 2022 04:55:12 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 7FF83800DDD; Fri, 2 Sep 2022 06:55:11 -0500 (CDT) Date: Fri, 2 Sep 2022 06:55:11 -0500 From: Justin Pryzby To: Michael Paquier Cc: Andrey Borodin , pgsql-hackers@postgresql.org, Thomas Munro , Peter Geoghegan , Andres Freund Subject: Re: Different compression methods for FPI Message-ID: <20220902115511.GY31833@telsasoft.com> References: <20210315180918.GW29463@telsasoft.com> <20210321193004.GA4203@telsasoft.com> <20210519030618.GS373@telsasoft.com> <20210525044444.GV3676@telsasoft.com> <3252174C-C21D-4711-A038-5230DE465BAE@yandex-team.ru> <20210614012412.GA31772@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="um2V5WpqCyd73IVb" Content-Disposition: inline In-Reply-To: <20210614012412.GA31772@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 --um2V5WpqCyd73IVb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Jun 13, 2021 at 08:24:12PM -0500, Justin Pryzby wrote: > In this patch series, I added compression information to the errcontext from > xlog_block_info(), and allow specifying compression levels like zlib-2. I'll > rearrange that commit earlier if we decide that's desirable to include. 4035cd5d4 added wal_compress=lz4 and e9537321a added wal_compress=zstd Since 4035cd5d4, pg_waldump has shown compression info (and walinspect shows the same since 2258e76f9). But if you try to replay WAL on a server which wasn't compiled with support for the requisite compression methods, it's a bit crummy that it doesn't include in the error message the reason *why* it failed to restore the image, if that's caused by the missing compression method. This hunk was from my patch in June, 2021, but wasn't included in the final patches. This would include the compression info algorithm: 1) when failing to apply WAL in rm_redo_error_callback(); and, 2) in wal_debug. < 2022-08-31 21:37:53.325 CDT >FATAL: failed to restore block image < 2022-08-31 21:37:53.325 CDT >CONTEXT: WAL redo at 1201/1B931F50 for XLOG/FPI_FOR_HINT: ; blkref #0: rel 1663/16888/164320567, blk 8186 FPW, compression method: zstd In addition to cases where someone re/compiles postgres locally, I guess this would also improve the situation for PITR and standbys, which might reasonably be run on a different OS, with different OS packages, or with postgres compiled separately. > diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c > index 17eeff0720..1ccc51575a 100644 > --- a/src/backend/access/transam/xlog.c > +++ b/src/backend/access/transam/xlog.c > @@ -10470,7 +10470,17 @@ xlog_block_info(StringInfo buf, XLogReaderState *record) > rnode.spcNode, rnode.dbNode, rnode.relNode, > blk); > if (XLogRecHasBlockImage(record, block_id)) > - appendStringInfoString(buf, " FPW"); > + { > + int compression = > + BKPIMAGE_IS_COMPRESSED(record->blocks[block_id].bimg_info) ? > + BKPIMAGE_COMPRESSION(record->blocks[block_id].bimg_info) : -1; > + if (compression == -1) > + appendStringInfoString(buf, " FPW"); > + else > + appendStringInfo(buf, " FPW, compression method %d/%s", > + compression, wal_compression_name(compression)); > + } > + --um2V5WpqCyd73IVb Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-xlog_block_info-show-compression-method.patch" From ce76fbaa0c0c9126a8b233891b9b32001b07129b Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Sat, 19 Feb 2022 11:35:53 -0600 Subject: [PATCH] xlog_block_info: show compression method --- src/backend/access/transam/xlogrecovery.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c index 4ad145dd167..75a72b47f78 100644 --- a/src/backend/access/transam/xlogrecovery.c +++ b/src/backend/access/transam/xlogrecovery.c @@ -2238,7 +2238,20 @@ xlog_block_info(StringInfo buf, XLogReaderState *record) rlocator.relNumber, blk); if (XLogRecHasBlockImage(record, block_id)) - appendStringInfoString(buf, " FPW"); + { + if (!BKPIMAGE_COMPRESSED(record->blocks[block_id].bimg_info)) + appendStringInfoString(buf, " FPW"); + else + { + uint8 info = record->blocks[block_id].bimg_info; + char *compression = + (BKPIMAGE_COMPRESS_PGLZ & info) ? "pglz" : + (BKPIMAGE_COMPRESS_LZ4 & info) ? "lz4" : + (BKPIMAGE_COMPRESS_ZSTD & info) ? "zstd" : "unknown"; + + appendStringInfo(buf, " FPW, compression method: %s", compression); + } + } } } -- 2.17.1 --um2V5WpqCyd73IVb--