Re: logical decoding and replication of sequences

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Petr Jelinek <petr(dot)jelinek(at)enterprisedb(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: logical decoding and replication of sequences
Date: 2022-08-29 21:42:02
Message-ID: CA+hUKG+7z9L-xHwbZWvWkZcrn0KFdtfV5w3LsPdSJN1TrV9N6Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 30, 2022 at 6:04 AM Tomas Vondra
<tomas(dot)vondra(at)enterprisedb(dot)com> wrote:
> On 8/29/22 12:21, Thomas Munro wrote:
> > 0001: Instead of figuring out when to invalidate the cache, let's
> > just invalidate it before every read attempt. It is only marked valid
> > after success (ie state->readLen > 0). No need to worry about error
> > cases.
>
> Maybe I misunderstand how all this works, but won't this have a really
> bad performance impact. If not, why do we need the cache at all?

It's a bit confusing because there are several levels of "read". The
cache remains valid as long as the caller of ReadPageInternal() keeps
asking for data that is in range (see early return after comment "/*
check whether we have all the requested data already */"). As soon as
the caller asks for something not in range, this patch marks the cache
invalid before calling the page_read() callback (= XLogPageRead()).
It is only marked valid again after that succeeds. Here's a new
version with no code change, just a better commit message to try to
explain that more clearly.

Attachment Content-Type Size
v2-0001-Fix-cache-invalidation-in-rare-recovery_prefetch-.patch text/x-patch 2.5 KB
v2-0002-Improve-xlogrecovery.c-xlogreader.c-boundary.patch text/x-patch 2.5 KB
v2-0003-Don-t-retry-inside-XLogPageRead-if-reading-ahead.patch text/x-patch 1.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2022-08-29 21:48:26 Re: SQL/JSON features for v15
Previous Message Peter Geoghegan 2022-08-29 20:27:42 Re: New strategies for freezing, advancing relfrozenxid early