Remove page-read callback from XLogReaderState.

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Remove page-read callback from XLogReaderState.
Date: 2019-04-18 12:02:57
Message-ID: 20190418.210257.43726183.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello. As mentioned before [1], read_page callback in
XLogReaderState is a cause of headaches. Adding another
remote-controlling stuff to xlog readers makes things messier [2].

I refactored XLOG reading functions so that we don't need the
callback. In short, ReadRecrod now calls XLogPageRead directly
with the attached patch set.

| while (XLogReadRecord(xlogreader, RecPtr, &record, &errormsg)
| == XLREAD_NEED_DATA)
| XLogPageRead(xlogreader, fetching_ckpt, emode, randAccess);

On the other hand, XLogReadRecord became a bit complex. The patch
makes XLogReadRecord a state machine. I'm not confident that the
additional complexity is worth doing. Anyway I'll gegister this
to the next CF.

[1] https://www.postgresql.org/message-id/47215279-228d-f30d-35d1-16af695e53f3@iki.fi

[2] https://www.postgresql.org/message-id/20190412.122711.158276916.horiguchi.kyotaro@lab.ntt.co.jp

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
0001-Define-macros-to-make-XLogReadRecord-a-state-machine.patch text/x-patch 4.3 KB
0002-Make-ReadPageInternal-a-state-machine.patch text/x-patch 23.8 KB
0003-Change-interface-of-XLogReadRecord.patch text/x-patch 12.0 KB
0004-Make-XLogReadRecord-a-state-machine.patch text/x-patch 17.1 KB
0005-Make-XLogPageRead-not-use-callback-but-call-the-func.patch text/x-patch 4.7 KB
0006-Make-XlogReadTwoPhaseData-not-use-callback-but-call-.patch text/x-patch 4.0 KB
0007-Make-logical-rep-stuff-not-use-callback-but-call-the.patch text/x-patch 10.1 KB
0008-Make-pg_waldump-not-use-callback-but-call-the-functi.patch text/x-patch 5.9 KB
0009-Make-pg_rewind-not-use-callback-but-call-the-functio.patch text/x-patch 4.2 KB
0010-Remove-callback-entry-from-XLogReaderState.patch text/x-patch 7.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2019-04-18 13:10:06 Re: bug in update tuple routing with foreign partitions
Previous Message Andy Fan 2019-04-18 11:50:45 Question about the holdable cursor