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 <[email protected]> Reviewed-by: Kyotaro Horiguchi <[email protected]> Discussion: https://postgr.es/m/[email protected] 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(-)
