Re: WIP: WAL prefetch (another approach)

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Andres Freund <andres(at)anarazel(dot)de>, Jakub Wartak <Jakub(dot)Wartak(at)tomtom(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, David Steele <david(at)pgmasters(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP: WAL prefetch (another approach)
Date: 2021-04-07 11:24:25
Message-ID: CA+hUKGLsF8sEE+n3qoaV6+XjmYEwYoFVDbLPbYTGz7oGkL=iZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here's rebase, on top of Horiguchi-san's v19 patch set. My patches
start at 0007. Previously, there was a "nowait" flag that was passed
into all the callbacks so that XLogReader could wait for new WAL in
some cases but not others. This new version uses the proposed
XLREAD_NEED_DATA protocol, and the caller deals with waiting for data
to arrive when appropriate. This seems tidier to me.

I made one other simplifying change: previously, the prefetch module
would read the WAL up to the "written" LSN (so, allowing itself to
read data that had been written but not yet flushed to disk by the
walreceiver), though it still waited until a record's LSN was
"flushed" before replaying. That allowed prefetching to happen
concurrently with the WAL flush, which was nice, but it felt a little
too "special". I decided to remove that part for now, and I plan to
look into making standbys work more like primary servers, using WAL
buffers, the WAL writer and optionally the standard log-before-data
rule.

Attachment Content-Type Size
v17-0001-Move-callback-call-from-ReadPageInternal-to-XLog.patch text/x-patch 28.3 KB
v17-0002-Move-page-reader-out-of-XLogReadRecord.patch text/x-patch 64.7 KB
v17-0003-Remove-globals-readOff-readLen-and-readSegNo.patch text/x-patch 7.9 KB
v17-0004-Make-XLogFindNextRecord-not-use-callback-functio.patch text/x-patch 15.1 KB
v17-0005-Split-readLen-and-reqLen-of-XLogReaderState.patch text/x-patch 12.2 KB
v17-0006-fixup.patch text/x-patch 1.1 KB
v17-0007-Add-circular-WAL-decoding-buffer.patch text/x-patch 60.6 KB
v17-0008-Prefetch-referenced-blocks-during-recovery.patch text/x-patch 67.0 KB
v17-0009-Provide-ReadRecentBuffer-to-re-pin-buffers-by-ID.patch text/x-patch 3.0 KB
v17-0010-Avoid-extra-buffer-lookup-when-prefetching-WAL-b.patch text/x-patch 8.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2021-04-07 11:32:37 Re: hba.c:3160:18: warning: comparison of unsigned enum expression
Previous Message Magnus Hagander 2021-04-07 11:24:01 Re: hba.c:3160:18: warning: comparison of unsigned enum expression