pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Preserve required !catalog tuples while computing initial decodi
4+ messages / 1 participants
[nested] [flat]

* pgsql: Preserve required !catalog tuples while computing initial decodi
@ 2017-04-27 20:16 Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 4+ messages in thread

From: Andres Freund @ 2017-04-27 20:16 UTC (permalink / raw)
  To: 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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2bef06d51646058c6bb480fcdbffb1f0cc914fed

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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Preserve required !catalog tuples while computing initial decodi
@ 2017-04-27 20:16 Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 4+ messages in thread

From: Andres Freund @ 2017-04-27 20:16 UTC (permalink / raw)
  To: 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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Preserve required !catalog tuples while computing initial decodi
@ 2017-04-27 20:16 Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 4+ messages in thread

From: Andres Freund @ 2017-04-27 20:16 UTC (permalink / raw)
  To: 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_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/47f896b5c2ec255d457830945d5801bfc1c67b2f

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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Preserve required !catalog tuples while computing initial decodi
@ 2017-04-27 20:16 Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 4+ messages in thread

From: Andres Freund @ 2017-04-27 20:16 UTC (permalink / raw)
  To: 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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2017-04-27 20:16 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-04-27 20:16 pgsql: Preserve required !catalog tuples while computing initial decodi Andres Freund <andres@anarazel.de>
2017-04-27 20:16 pgsql: Preserve required !catalog tuples while computing initial decodi Andres Freund <andres@anarazel.de>
2017-04-27 20:16 pgsql: Preserve required !catalog tuples while computing initial decodi Andres Freund <andres@anarazel.de>
2017-04-27 20:16 pgsql: Preserve required !catalog tuples while computing initial decodi Andres Freund <andres@anarazel.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox