]> granicus.if.org Git - postgresql/commit
Don't use on-disk snapshots for exported logical decoding snapshot.
authorAndres Freund <andres@anarazel.de>
Thu, 27 Apr 2017 22:28:24 +0000 (15:28 -0700)
committerAndres Freund <andres@anarazel.de>
Thu, 27 Apr 2017 22:29:15 +0000 (15:29 -0700)
commit56e19d938dd1457ae078304df1b9903509a0a2bf
tree65f1cf9d62360f12cb5066b1e7741c0426172eda
parent7834d20b57a4320308c3f8262fabf898f89e6a71
Don't use on-disk snapshots for exported logical decoding snapshot.

Logical decoding stores historical snapshots on disk, so that logical
decoding can restart without having to reconstruct a snapshot from
scratch (for which the resources are not guaranteed to be present
anymore).  These serialized snapshots were also used when creating a
new slot via the walsender interface, which can export a "full"
snapshot (i.e. one that can read all tables, not just catalog ones).

The problem is that the serialized snapshots are only useful for
catalogs and not for normal user tables.  Thus the use of such a
serialized snapshot could result in an inconsistent snapshot being
exported, which could lead to queries returning wrong data.  This
would only happen if logical slots are created while another logical
slot already exists.

Author: Petr Jelinek
Reviewed-By: Andres Freund
Discussion: https://postgr.es/m/f37e975c-908f-858e-707f-058d3b1eb214@2ndquadrant.com
Backport: 9.4, where logical decoding was introduced.
src/backend/replication/logical/logical.c
src/backend/replication/logical/snapbuild.c
src/include/replication/snapbuild.h