1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-12 21:01:52 +03:00

Fix assertion failure at end of PITR.

InitXLogInsert() cannot be called in a critical section, because it
allocates memory. But CreateCheckPoint() did that, when called for the
end-of-recovery checkpoint by the startup process.

In the passing, fix the scratch space allocation in InitXLogInsert to go to
the right memory context. Also update the comment at InitXLOGAccess, which
hasn't been totally accurate since hot standby was introduced (in a hot
standby backend, InitXLOGAccess isn't called at backend startup).

Reported by Michael Paquier
This commit is contained in:
Heikki Linnakangas
2014-11-28 09:23:41 +02:00
parent a5eb85eb62
commit afeacd2748
2 changed files with 15 additions and 5 deletions

View File

@ -891,5 +891,6 @@ InitXLogInsert(void)
* Allocate a buffer to hold the header information for a WAL record.
*/
if (hdr_scratch == NULL)
hdr_scratch = palloc0(HEADER_SCRATCH_SIZE);
hdr_scratch = MemoryContextAllocZero(xloginsert_cxt,
HEADER_SCRATCH_SIZE);
}