agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: takashi.menjo@gmail.com, Craig Ringer <craig@2ndquadrant.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: takashi.menjou.vg@hco.ntt.co.jp
Subject: Re: Remove page-read callback from XLogReaderState.
Date: Tue, 6 Apr 2021 19:18:50 -0400
Message-ID: <20210406231850.GA15722@alvherre.pgsql> (raw)
In-Reply-To: <CA+hUKGJqBq_1D4100PYyjUTkRti35+fUYdZaA1AigQAcBR70pw@mail.gmail.com>

On 2021-Apr-07, Thomas Munro wrote:

> I wonder if it would be better to have the client code access these
> values through functions (even if they just access the variables in a
> static inline function), to create a bit more separation?  Something
> like XLogReaderGetWanted(&page_lsn, &bytes_wanted), and then
> XLogReaderSetAvailable(state, 42)?  Just an idea.

I think more opacity is good in this area, generally speaking.  There
are way too many globals, and they interact in nontrivial ways across
the codebase.  Just look at the ThisTimeLineID recent disaster.  I
don't have this patch sufficiently paged-in to say that bytes_wanted/
bytes_available is precisely the thing we need, but if it makes for a
cleaner interface, I'm for it.  This module keeps some state inside
itself, and others part of the state is in its users; that's not good,
and any cleanup on that is welcome.

BTRW it's funny that after these patches, "xlogreader" no longer reads
anything.  It's more an "xlog interpreter" -- the piece of code that
splits individual WAL records from a stream of WAL bytes that's caller's
responsibility to obtain somehow.  But (and, again, I haven't read this
patch recently) it still offers pieces that support a reader, in
addition to its main interface as the interpreter.  Maybe it's not a
totally stupid idea to split it in even more different files.

-- 
Álvaro Herrera                            39°49'30"S 73°17'W





view thread (58+ messages)  latest in thread

Message-ID: <20210406231850.GA15722@alvherre.pgsql>
Permalink:  ../20210406231850.GA15722@alvherre.pgsql/
Also on:    postgresql.org/message-id/20210406231850.GA15722@alvherre.pgsql

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@2ndquadrant.com, thomas.munro@gmail.com, horikyota.ntt@gmail.com, craig@2ndquadrant.com, hlinnaka@iki.fi, andres@anarazel.de, takashi.menjou.vg@hco.ntt.co.jp
  Subject: Re: Remove page-read callback from XLogReaderState.
  In-Reply-To: <20210406231850.GA15722@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox