[COMMITTERS] pgsql: Preserve required !catalog tuples while computing initialdecodi

Поиск
Список
Период
Сортировка
От Andres Freund
Тема [COMMITTERS] pgsql: Preserve required !catalog tuples while computing initialdecodi
Дата
Msg-id E1d3ppt-0006UA-GW@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Preserve required !catalog tuples while computing initial decoding snapshot.

The logical decoding machinery already preserved all the required
catalog tuples, which is sufficient in the course of normal logical
decoding, but did not guarantee that non-catalog tuples were preserved
during computation of the initial snapshot when creating a slot over
the replication protocol.

This could cause a corrupted initial snapshot being exported.  The
time window for issues is usually not terribly large, but on a busy
server it's perfectly possible to it hit it.  Ongoing decoding is not
affected by this bug.

To avoid increased overhead for the SQL API, only retain additional
tuples when a logical slot is being created over the replication
protocol.  To do so this commit changes the signature of
CreateInitDecodingContext(), but it seems unlikely that it's being
used in an extension, so that's probably ok.

In a drive-by fix, fix handling of
ReplicationSlotsComputeRequiredXmin's already_locked argument, which
should only apply to ProcArrayLock, not ReplicationSlotControlLock.

Reported-By: Erik Rijkers
Analyzed-By: Petr Jelinek
Author: Petr Jelinek, heavily editorialized by Andres Freund
Reviewed-By: Andres Freund
Discussion: https://postgr.es/m/9a897b86-46e1-9915-ee4c-da02e4ff6a95@2ndquadrant.com
Backport: 9.4, where logical decoding was introduced.

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5da64613875d387f6d3f60a383ec20189b84ff54

Modified Files
--------------
src/backend/replication/logical/logical.c   | 25 +++++++++++++++++--------
src/backend/replication/logical/snapbuild.c | 12 ++++++++++++
src/backend/replication/slot.c              | 25 +++++++++++++++++++++----
src/backend/replication/slotfuncs.c         |  4 ++--
src/backend/replication/walsender.c         |  1 +
src/backend/storage/ipc/procarray.c         | 14 +++++++++++---
src/include/replication/logical.h           |  1 +
src/include/storage/procarray.h             |  2 +-
8 files changed, 66 insertions(+), 18 deletions(-)


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

Предыдущее
От: Andres Freund
Дата:
Сообщение: [COMMITTERS] pgsql: Preserve required !catalog tuples while computing initialdecodi
Следующее
От: Tom Lane
Дата:
Сообщение: [COMMITTERS] pgsql: Cope with glibc too old to have epoll_create1().