In the checkpoint written at the end of archive recovery, the WAL page header was incorrectly initialized with timeline ID 0. That rendered the WAL page unrecoverable, making a subsequent archive recovery stop at that point. ThisTimeLineID needs to be initialized before calling AdvanceXLInsertBuffer().
In the checkpoint written at the end of archive recovery, the WAL page header
was incorrectly initialized with timeline ID 0. That rendered the WAL page
unrecoverable, making a subsequent archive recovery stop at that point.
ThisTimeLineID needs to be initialized before calling AdvanceXLInsertBuffer().

This fixes bug #5011 reported by James Bardin. Backpatch to 8.4, as the bug
was introduced by the changes to use of bgwriter for writing the
end-of-archive-recovery checkpoint. Patch by Tom Lane.

xinzweb/gpdb,50wu/gpdb,xinzweb/gpdb,yazun/postgres-xl,snaga/postgres-xl,lisakowen/gpdb,ashwinstar/gpdb,zeroae/postgres-xl,zeroae/postgres-xl,techdragon/Postgres-XL,yazun/postgres-xl,yazun/postgres-xl,postmind-net/postgres-xl,adam8157/gpdb,arcivanov/postgres-xl,adam8157/gpdb,kmjungersen/PostgresXL,jmcatamney/gpdb,techdragon/Postgres-XL,greenplum-db/gpdb,jmcatamney/gpdb,postmind-net/postgres-xl,snaga/postgres-xl,jmcatamney/gpdb,greenplum-db/gpdb,50wu/gpdb,yazun/postgres-xl,lisakowen/gpdb,arcivanov/postgres-xl,oberstet/postgres-xl,techdragon/Postgres-XL,jmcatamney/gpdb,postmind-net/postgres-xl,kmjungersen/PostgresXL,lisakowen/gpdb,50wu/gpdb,arcivanov/postgres-xl,50wu/gpdb,Postgres-XL/Postgres-XL,zeroae/postgres-xl,jmcatamney/gpdb,arcivanov/postgres-xl,xinzweb/gpdb,tpostgres-projects/tPostgres,ashwinstar/gpdb,lisakowen/gpdb,tpostgres-projects/tPostgres,ashwinstar/gpdb,pavanvd/postgres-xl,jmcatamney/gpdb,50wu/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,50wu/gpdb,tpostgres-projects/tPostgres,oberstet/postgres-xl,pavanvd/postgres-xl,Postgres-XL/Postgres-XL,kmjungersen/PostgresXL,xinzweb/gpdb,adam8157/gpdb,greenplum-db/gpdb,snaga/postgres-xl,arcivanov/postgres-xl,pavanvd/postgres-xl,ovr/postgres-xl,greenplum-db/gpdb,snaga/postgres-xl,ashwinstar/gpdb,Postgres-XL/Postgres-XL,pavanvd/postgres-xl,lisakowen/gpdb,Postgres-XL/Postgres-XL,Postgres-XL/Postgres-XL,zeroae/postgres-xl,50wu/gpdb,xinzweb/gpdb,ovr/postgres-xl,postmind-net/postgres-xl,lisakowen/gpdb,adam8157/gpdb,pavanvd/postgres-xl,techdragon/Postgres-XL,ovr/postgres-xl,kmjungersen/PostgresXL,oberstet/postgres-xl,adam8157/gpdb,lisakowen/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,oberstet/postgres-xl,kmjungersen/PostgresXL,greenplum-db/gpdb,jmcatamney/gpdb,xinzweb/gpdb,tpostgres-projects/tPostgres,zeroae/postgres-xl,postmind-net/postgres-xl,greenplum-db/gpdb,adam8157/gpdb,ovr/postgres-xl,arcivanov/postgres-xl,yazun/postgres-xl,xinzweb/gpdb,lisakowen/gpdb,snaga/postgres-xl,greenplum-db/gpdb,xinzweb/gpdb,tpostgres-projects/tPostgres,adam8157/gpdb,ovr/postgres-xl,ashwinstar/gpdb,techdragon/Postgres-XL,ashwinstar/gpdb,adam8157/gpdb,50wu/gpdb,oberstet/postgres-xl