Re: How to recover from compressed wal archieve in windows - Mailing list pgsql-general

From Michael Paquier
Subject Re: How to recover from compressed wal archieve in windows
Date
Msg-id 20200521055833.GK2355@paquier.xyz
Whole thread Raw
In response to Re: How to recover from compressed wal archieve in windows  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-general
On Thu, May 21, 2020 at 01:38:11PM +0900, Kyotaro Horiguchi wrote:
> Difference from decompression by restore_command?
>
> A WAL (segment) file is filled with multiple WAL records. The "full
> page image", which is described to be compressed by the parameter, is
> a part of WAL record. A WAL file is filled with maybe-compressed WAL
> records and has the same size in the case where wal_compression is on.

Well, to be more precise, one or more full page images may be included
in a single record, and they may, or may actually not, have up to two
level of "compression" applied to them:
- A full page image may be logged without the hole in the middle of
the page, reducing its actually size logged.
- It would be reduced in size further more if wal_compression is
enabled.

So you actually have four possible cases for a full-page image:
- Logged with its full 8kB data, with its hole included.
- Logged without its hole.
- Logged with its 8kB data and its hole, compressed with pglz.
- Logged without its hole, and compressed with pglz.

When a page is logged, we register in the record if the hole of the
logged full-page image is included or not, and if the page is
compressed with pglz or not.  Then WAL replay looks at those flags,
and determines what to do by itself when the page image is needed.
--
Michael

Attachment

pgsql-general by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: How to recover from compressed wal archieve in windows
Next
From: "Andrus"
Date:
Subject: Re: How to recover from compressed wal archieve in windows