Apply 0017-Revert-changes-to-subtrans.c-and-slru.c.-Instead-cal.patch but with heavy modifications to fix a number of bugs and make associated changes. First, StartupSubtrans() positioned itself at oldestXid, so that when later running transactions complete they could find no page for them to update and crash. Second, ExtendClog() expected to be able to write WAL during recovery and so crashed after 32768 xids. This patch also extends the patch to cover the recently added support for starting Hot Standby from a shutdown checkpoint, which causes some refactoring. Various comments reworded, including allowing a lock overflow to cause a PENDING state, just as we do with subxid overflow. Another bug was also found, in that failing to make subtrans entries from the initial snapshot could lead to later abort records hanging because the topxid was not set. Code is now similar in all code paths. Sounds like a lot of changes, but mostly subtle changes rather than lengthy ones.