diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-11-28 09:23:41 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-11-28 09:31:53 +0200 |
commit | afeacd274830d1e3d15ffc4e4d4b08a887f76abb (patch) | |
tree | 056d8a799e7ad9f5ed9fb32b75a00dddb496ca79 /src/backend/access/transam/xloginsert.c | |
parent | a5eb85eb6266c99f79144201f1162e5106969575 (diff) | |
download | postgresql-afeacd274830d1e3d15ffc4e4d4b08a887f76abb.tar.gz postgresql-afeacd274830d1e3d15ffc4e4d4b08a887f76abb.zip |
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
Diffstat (limited to 'src/backend/access/transam/xloginsert.c')
-rw-r--r-- | src/backend/access/transam/xloginsert.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/access/transam/xloginsert.c b/src/backend/access/transam/xloginsert.c index 34e44e4f235..f1bf728c3d2 100644 --- a/src/backend/access/transam/xloginsert.c +++ b/src/backend/access/transam/xloginsert.c @@ -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); } |