postgresql/src
Andres Freund ec5896aed3 Fix several weaknesses in slot and logical replication on-disk serialization.
Heikki noticed in 544E23C0.8090605@vmware.com that slot.c and
snapbuild.c were missing the FIN_CRC32 call when computing/checking
checksums of on disk files. That doesn't lower the the error detection
capabilities of the checksum, but is inconsistent with other usages.

In a followup mail Heikki also noticed that, contrary to a comment,
the 'version' and 'length' struct fields of replication slot's on disk
data where not covered by the checksum. That's not likely to lead to
actually missed corruption as those fields are cross checked with the
expected version and the actual file length. But it's wrong
nonetheless.

As fixing these issues makes existing on disk files unreadable, bump
the expected versions of on disk files for both slots and logical
decoding historic catalog snapshots.  This means that loading old
files will fail with
ERROR: "replication slot file ... has unsupported version 1"
and
ERROR: "snapbuild state file ... has unsupported version 1 instead of
2" respectively. Given the low likelihood of anybody already using
these new features in a production setup that seems acceptable.

Fixing these issues made me notice that there's no regression test
covering the loading of historic snapshot from disk - so add one.

Backpatch to 9.4 where these features were introduced.
2014-11-12 18:52:49 +01:00
..
backend Fix several weaknesses in slot and logical replication on-disk serialization. 2014-11-12 18:52:49 +01:00
bin Add GUC and storage parameter to set the maximum size of GIN pending list. 2014-11-11 21:08:21 +09:00
common Small message fixes 2014-08-09 00:07:00 -04:00
include Add generate_series(numeric, numeric). 2014-11-11 21:44:46 +09:00
interfaces Make ECPG test programs depend on "ecpg$(X)", not "ecpg". 2014-11-02 21:43:25 -05:00
makefiles MinGW: Use -static-libgcc when linking a DLL. 2014-10-21 22:55:47 -04:00
pl Re-remove dependency on the DLL of pythonxx.def file. 2014-11-02 21:43:30 -05:00
port Fix win32setlocale.c const-related warnings. 2014-11-02 21:43:20 -05:00
template Remove Alpha and Tru64 support. 2014-06-28 21:46:15 +02:00
test Use just one database connection in the "tablespace" test. 2014-11-12 07:33:17 -05:00
timezone Support timezone abbreviations that sometimes change. 2014-10-16 15:22:10 -04:00
tools Add valgrind suppression for padding bytes in twophase records. 2014-09-01 15:59:44 +02:00
tutorial Adjust blank lines around PG_MODULE_MAGIC defines, for consistency 2014-07-10 14:02:08 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in Add configure --enable-tap-tests option 2014-11-02 09:17:26 -05:00
Makefile.shlib Clarify .def file comments. 2014-11-02 21:43:33 -05:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
nls-global.mk Setup error context callback for transaction lock waits 2014-03-19 15:10:36 -03:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00