Обсуждение: pgsql: Rework XLogReader callback system

Поиск
Список
Период
Сортировка

pgsql: Rework XLogReader callback system

От
Alvaro Herrera
Дата:
Rework XLogReader callback system

Code review for 0dc8ead46363, prompted by a bug closed by 91c40548d5f7.

XLogReader's system for opening and closing segments had gotten too
complicated, with callbacks being passed at both the XLogReaderAllocate
level (read_page) as well as at the WALRead level (segment_open).  This
was confusing and hard to follow, so restructure things so that these
callbacks are passed together at XLogReaderAllocate time, and add
another callback to the set (segment_close) to make it a coherent whole.
Also, ensure XLogReaderState is an argument to all the callbacks, so
that they can grab at the ->private data if necessary.

Document the whole arrangement more clearly.

Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/20200422175754.GA19858@alvherre.pgsql

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b060dbe0001a1d6bf26cd294710f3cb203868d46

Modified Files
--------------
src/backend/access/transam/twophase.c          |   5 +-
src/backend/access/transam/xlog.c              |  10 ++-
src/backend/access/transam/xlogreader.c        |  51 ++++++-----
src/backend/access/transam/xlogutils.c         |  24 +++--
src/backend/replication/logical/logical.c      |  20 +++--
src/backend/replication/logical/logicalfuncs.c |   4 +-
src/backend/replication/slotfuncs.c            |  10 ++-
src/backend/replication/walsender.c            |  36 +++++---
src/bin/pg_rewind/parsexlog.c                  |   9 +-
src/bin/pg_waldump/pg_waldump.c                |  30 +++++--
src/include/access/xlogreader.h                | 119 ++++++++++++++++---------
src/include/access/xlogutils.h                 |   5 ++
src/include/replication/logical.h              |   4 +-
13 files changed, 214 insertions(+), 113 deletions(-)


Re: pgsql: Rework XLogReader callback system

От
Alvaro Herrera
Дата:
Hello,

On 2020-May-08, Alvaro Herrera wrote:

> Rework XLogReader callback system

I think this commit is causing buildfarm members bowerbird to crash, but
it's not getting any backtrace.  Is it perchance possible to enable
whatever buildfarm feature it is that reports backtraces from crashes?
That would be very helpful.

(Andrew CCed because bowerbird is his animal.)

Thanks,

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services