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

Поиск
Список
Период
Сортировка
От Andres Freund
Тема [COMMITTERS] pgsql: Preserve required !catalog tuples while computing initialdecodi
Дата
Msg-id E1d3ppr-0006TQ-4m@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_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/28afff347a5db51a02b269fa13677d6924a88e78

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
Следующее
От: Andres Freund
Дата:
Сообщение: [COMMITTERS] pgsql: Preserve required !catalog tuples while computing initialdecodi