Rework XLogReader callback system
Alvaro Herrera <alvherre@alvh.no-ip.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/transam/twophase.c | modified | +4 −1 |
| src/backend/access/transam/xlog.c | modified | +7 −3 |
| src/backend/access/transam/xlogreader.c | modified | +29 −22 |
| src/backend/access/transam/xlogutils.c | modified | +17 −7 |
| src/backend/replication/logical/logical.c | modified | +12 −8 |
| src/backend/replication/logical/logicalfuncs.c | modified | +3 −1 |
| src/backend/replication/slotfuncs.c | modified | +7 −3 |
| src/backend/replication/walsender.c | modified | +24 −12 |
| src/bin/pg_rewind/parsexlog.c | modified | +6 −3 |
| src/bin/pg_waldump/pg_waldump.c | modified | +23 −7 |
| src/include/access/xlogreader.h | modified | +75 −44 |
| src/include/access/xlogutils.h | modified | +5 −0 |
| src/include/replication/logical.h | modified | +2 −2 |
Discussion
- 2pc leaks fds 23 messages · 2020-04-06 → 2020-05-11