postgresql/src/backend
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
..
access Add GUC and storage parameter to set the maximum size of GIN pending list. 2014-11-11 21:08:21 +09:00
bootstrap Revert "Fix bogus %name-prefix option syntax in all our Bison files." 2014-05-28 19:21:01 -04:00
catalog Fix dependency searching for case where column is visited before table. 2014-11-11 17:00:11 -05:00
commands Use just one database connection in the "tablespace" test. 2014-11-12 07:33:17 -05:00
executor Ensure that RowExprs and whole-row Vars produce the expected column names. 2014-11-10 15:21:09 -05:00
foreign Implement IMPORT FOREIGN SCHEMA. 2014-07-10 15:01:43 -04:00
lib pgindent run for 9.4 2014-05-06 12:12:18 -04:00
libpq Message improvements 2014-11-11 20:02:30 -05:00
main Add a basic atomic ops API abstracting away platform/architecture details. 2014-09-25 23:49:05 +02:00
nodes Introduce custom path and scan providers. 2014-11-07 17:34:36 -05:00
optimizer Introduce custom path and scan providers. 2014-11-07 17:34:36 -05:00
parser Implement IF NOT EXIST for CREATE INDEX. 2014-11-06 18:48:33 +09:00
po Translation updates 2014-10-05 23:23:50 -04:00
port Add a basic atomic ops API abstracting away platform/architecture details. 2014-09-25 23:49:05 +02:00
postmaster Eliminate one background-worker-related flag variable. 2014-10-04 21:25:41 -04:00
regex Fix incorrect search for "x?" style matches in creviterdissect(). 2014-09-23 20:26:14 -04:00
replication Fix several weaknesses in slot and logical replication on-disk serialization. 2014-11-12 18:52:49 +01:00
rewrite Implement SKIP LOCKED for row-level locks 2014-10-07 17:23:34 -03:00
snowball Finish adding file version information to installed Windows binaries. 2014-08-18 22:59:53 -04:00
storage BRIN: Block Range Indexes 2014-11-07 16:38:14 -03:00
tcop Move the backup-block logic from XLogInsert to a new file, xloginsert.c. 2014-11-06 13:55:36 +02:00
tsearch Cope with more than 64K phrases in a thesaurus dictionary. 2014-11-06 20:52:40 -05:00
utils Message improvements 2014-11-11 20:02:30 -05:00
.gitignore Add gitignore for mingw/cygwin build outputs 2011-06-09 18:11:47 +02:00
Makefile Get rid of use of dlltool in Mingw builds. 2014-02-11 12:56:20 -05:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
nls.mk Add libpgcommon to backend gettext source files 2013-10-19 13:49:05 -04:00