From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Adjust walsender usage of xlogreader, simplify APIs |
Date: | 2020-05-13 16:25:45 |
Message-ID: | E1jYuCX-0003Gd-K0@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Adjust walsender usage of xlogreader, simplify APIs
* Have both physical and logical walsender share a 'xlogreader' state
struct for tracking state. This replaces the existing globals sendSeg
and sendCxt.
* Change WALRead not to receive XLogReaderState->seg and ->segcxt as
separate arguments anymore; just use the ones from 'state'. This is
made possible by the above change.
* have the XLogReader segment_open contract require the callbacks to
install the file descriptor in the state struct themselves instead of
returning it. xlogreader was already ignoring any possible failed
return from the callbacks, relying solely on them never returning.
(This point is not altogether excellent, as it means the callbacks
have to know more of XLogReaderState; but to really improve on that
we would have to pass back error info from the callbacks to
xlogreader. And the complexity would not be saved but instead just
transferred to the callers of WALRead, which would have to learn how
to throw errors from the open_segment callback in addition of, as
currently, from pg_pread.)
* segment_open no longer receives the 'segcxt' as a separate argument,
since it's part of the XLogReaderState argument.
Per comments from Kyotaro Horiguchi.
Author: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Discussion: https://postgr.es/m/20200511203336.GA9913@alvherre.pgsql
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/850196b610d2a1802b4ed7f9f608153a949eda34
Modified Files
--------------
src/backend/access/transam/xlogreader.c | 35 ++++++------
src/backend/access/transam/xlogutils.c | 16 ++----
src/backend/replication/walsender.c | 98 ++++++++++++++++-----------------
src/bin/pg_waldump/pg_waldump.c | 16 ++----
src/include/access/xlogreader.h | 20 ++-----
src/include/access/xlogutils.h | 3 +-
6 files changed, 83 insertions(+), 105 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2020-05-13 17:08:42 | pgsql: Improve management of SLRU statistics collection. |
Previous Message | Alvaro Herrera | 2020-05-13 16:04:40 | Re: Add "-Wimplicit-fallthrough" to default flags |