From: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
---|---|
To: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
Cc: | takashi(dot)menjo(at)gmail(dot)com, Craig Ringer <craig(at)2ndquadrant(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, takashi(dot)menjou(dot)vg(at)hco(dot)ntt(dot)co(dot)jp |
Subject: | Re: Remove page-read callback from XLogReaderState. |
Date: | 2021-04-06 22:57:04 |
Message-ID: | CA+hUKGJqBq_1D4100PYyjUTkRti35+fUYdZaA1AigQAcBR70pw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Apr 7, 2021 at 5:09 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> 0001 + 0002 get rid of the callback interface and replace it with a
> state machine, making it the client's problem to supply data when it
> returns XLREAD_NEED_DATA. I found this interface nicer to work with,
> for my WAL decoding buffer patch (CF 2410), and I understand that the
> encryption patch set can also benefit from it. Certainly when I
> rebased my project on this patch set, I prefered the result.
+ state->readLen = pageHeaderSize;
This variable is used for the XLogPageReader to say how much data it
wants, but also for the caller to indicate how much data is loaded.
Wouldn't it be better to split this into two variables: bytesWanted
and bytesAvailable? (I admit that I spent a whole afternoon debugging
after confusing myself about that, when rebasing my WAL readahead
patch recently).
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2021-04-06 23:09:55 | Re: Remove page-read callback from XLogReaderState. |
Previous Message | Fujii Masao | 2021-04-06 22:50:11 | Re: Stronger safeguard for archive recovery not to miss data |