pgsql: Adjust walsender usage of xlogreader, simplify APIs

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема pgsql: Adjust walsender usage of xlogreader, simplify APIs
Дата
Msg-id E1jYuCX-0003Gd-K0@gemulon.postgresql.org
обсуждение исходный текст
Список 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@alvh.no-ip.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(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Fujii Masao
Дата:
Сообщение: pgsql: Use proper GetDatum function in pg_stat_get_slru().
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Improve management of SLRU statistics collection.