Re: Remove page-read callback from XLogReaderState.

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: hlinnaka(at)iki(dot)fi
Cc: andres(at)anarazel(dot)de, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Remove page-read callback from XLogReaderState.
Date: 2019-09-10 08:40:54
Message-ID: 20190910.174054.16391566.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Attached is new version:

- Rebased. Cleaned up

- Rebased to the current master

- Fixed a known bug in the first step patch. It caused
timeline-following failure on a standby of a promoted primary.

- Fixed confused naming and setting of the parameter
includes_paeg_header.

- Removed useless XLogNeedData call in
XLREAD_NEED_CONTINUATION. The first call to the function
ensures that all required data is loaded. Finally, every case
block has just one XLogNeedData call.

- Removed the label "again" in XLogReadRecord. It is now needed
only to repeat XLREAD_NEED_CONTINUATION state. It is naturally
writtable as a while loop.

- Ensure record == NULL when XLogReadRecord returns other than
XLREAD_SUCCESS. Previously the value was not changed in that
case and it was not intuitive behavior for callers.

- Renamed XLREAD_NEED_* to XLREAD_*.

- Removed global variables readOff, readLen, readSegNo. (0003)

Other similar variables like readFile/readSource are left alone
as they are not common states of page reader and not in
XLogReaderState.

The attched are the current status, it is separated to two
significant parts plus one for readability.

v6-0001-Move-callback-call-from-ReadPageInternal-to-XLogR.patch:

ReadPageInternal part of the patch. Moves callback calls from
ReadPageInternal up to XLogReadRecord. Rerorded commit message
and fixed the bug in v5.

v6-0002-Move-page-reader-out-of-XLogReadRecord.patch

The remaining part of the main work. Eliminates callback calls
from XLogReadRecord. Reworded commit message and fixed several
bugs.

v6-0003-Remove-globals-readSegNo-readOff-readLen.patch

Seprate patch to remove some globals that are duplicate with
members of XLogReaderState.

v6-0004-Change-policy-of-XLog-read-buffer-allocation.patch

Separate patch to move page buffer allocation from
XLogReaderAllocation from allers of XLogReadRecord.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
v6-0001-Move-callback-call-from-ReadPageInternal-to-XLogR.patch text/x-patch 28.7 KB
v6-0002-Move-page-reader-out-of-XLogReadRecord.patch text/x-patch 57.6 KB
v6-0003-Remove-globals-readSegNo-readOff-readLen.patch text/x-patch 8.3 KB
v6-0004-Change-policy-of-XLog-read-buffer-allocation.patch text/x-patch 6.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2019-09-10 08:58:58 Re: shared-memory based stats collector
Previous Message Antonin Houska 2019-09-10 08:31:48 Re: Pulling up direct-correlated ANY_SUBLINK