XidEpoch++ if wraparound during checkpoint. If wal_level = hot_standby we update the checkpoint nextxid, though in the case where a wraparound occurred half-way through a checkpoint we would neglect updating the epoch also. Updating the nextxid is arguably the wrong thing to do, but changing that may introduce subtle bugs into hot standby startup, while updating the value doesn't cause any known bugs yet. Minimal fix now to HEAD and backbranches, wider fix later in HEAD.
XidEpoch++ if wraparound during checkpoint.
If wal_level = hot_standby we update the checkpoint nextxid,
though in the case where a wraparound occurred half-way through
a checkpoint we would neglect updating the epoch also. Updating
the nextxid is arguably the wrong thing to do, but changing that
may introduce subtle bugs into hot standby startup, while updating
the value doesn't cause any known bugs yet. Minimal fix now to
HEAD and backbranches, wider fix later in HEAD.

Bug reported in #6291 by Daniel Farina and slightly differently in

Cause analysis and recommended fixes from Tom Lane and Andres Freund.

Applied patch is minimal version of Andres Freund's work.

oberstet/postgres-xl,ashwinstar/gpdb,50wu/gpdb,jmcatamney/gpdb,techdragon/Postgres-XL,greenplum-db/gpdb,ashwinstar/gpdb,pavanvd/postgres-xl,50wu/gpdb,greenplum-db/gpdb,adam8157/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,oberstet/postgres-xl,greenplum-db/gpdb,greenplum-db/gpdb,xinzweb/gpdb,yazun/postgres-xl,xinzweb/gpdb,lisakowen/gpdb,techdragon/Postgres-XL,greenplum-db/gpdb,oberstet/postgres-xl,jmcatamney/gpdb,greenplum-db/gpdb,pavanvd/postgres-xl,jmcatamney/gpdb,Postgres-XL/Postgres-XL,ashwinstar/gpdb,yazun/postgres-xl,greenplum-db/gpdb,yazun/postgres-xl,adam8157/gpdb,xinzweb/gpdb,ovr/postgres-xl,xinzweb/gpdb,lisakowen/gpdb,ashwinstar/gpdb,lisakowen/gpdb,adam8157/gpdb,Postgres-XL/Postgres-XL,lisakowen/gpdb,ovr/postgres-xl,pavanvd/postgres-xl,pavanvd/postgres-xl,lisakowen/gpdb,zeroae/postgres-xl,techdragon/Postgres-XL,ashwinstar/gpdb,jmcatamney/gpdb,50wu/gpdb,ovr/postgres-xl,lisakowen/gpdb,50wu/gpdb,zeroae/postgres-xl,lisakowen/gpdb,xinzweb/gpdb,50wu/gpdb,adam8157/gpdb,ovr/postgres-xl,50wu/gpdb,techdragon/Postgres-XL,lisakowen/gpdb,yazun/postgres-xl,zeroae/postgres-xl,adam8157/gpdb,adam8157/gpdb,adam8157/gpdb,xinzweb/gpdb,ashwinstar/gpdb,xinzweb/gpdb,Postgres-XL/Postgres-XL,adam8157/gpdb,xinzweb/gpdb,zeroae/postgres-xl,50wu/gpdb,ashwinstar/gpdb,pavanvd/postgres-xl,techdragon/Postgres-XL,jmcatamney/gpdb,50wu/gpdb,yazun/postgres-xl,ovr/postgres-xl,jmcatamney/gpdb,oberstet/postgres-xl,jmcatamney/gpdb,zeroae/postgres-xl,Postgres-XL/Postgres-XL,greenplum-db/gpdb,oberstet/postgres-xl,Postgres-XL/Postgres-XL