mirror of
https://github.com/postgres/postgres.git
synced 2026-06-13 18:50:17 -04:00
Revert the assertion of no palloc's in critical section.
Per discussion, it still fires too often to be safe to enable in production. Keep it in master, so that we find the issues, but disable it in the stable branch.
This commit is contained in:
parent
3130b8505f
commit
d27d493a4e
1 changed files with 0 additions and 24 deletions
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "miscadmin.h"
|
||||
#include "utils/memdebug.h"
|
||||
#include "utils/memutils.h"
|
||||
|
||||
|
|
@ -56,19 +55,6 @@ MemoryContext PortalContext = NULL;
|
|||
|
||||
static void MemoryContextStatsInternal(MemoryContext context, int level);
|
||||
|
||||
/*
|
||||
* You should not do memory allocations within a critical section, because
|
||||
* an out-of-memory error will be escalated to a PANIC. To enforce that
|
||||
* rule, the allocation functions Assert that.
|
||||
*
|
||||
* There are a two exceptions: 1) error recovery uses ErrorContext, which
|
||||
* has some memory set aside so that you don't run out. And 2) checkpointer
|
||||
* currently just hopes for the best, which is wrong and ought to be fixed,
|
||||
* but it's a known issue so let's not complain about in the meanwhile.
|
||||
*/
|
||||
#define AssertNotInCriticalSection(context) \
|
||||
Assert(CritSectionCount == 0 || (context) == ErrorContext || \
|
||||
AmCheckpointerProcess())
|
||||
|
||||
/*****************************************************************************
|
||||
* EXPORTED ROUTINES *
|
||||
|
|
@ -533,8 +519,6 @@ MemoryContextCreate(NodeTag tag, Size size,
|
|||
MemoryContext node;
|
||||
Size needed = size + strlen(name) + 1;
|
||||
|
||||
Assert(CritSectionCount == 0);
|
||||
|
||||
/* Get space for node and name */
|
||||
if (TopMemoryContext != NULL)
|
||||
{
|
||||
|
|
@ -591,7 +575,6 @@ MemoryContextAlloc(MemoryContext context, Size size)
|
|||
void *ret;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
AssertNotInCriticalSection(context);
|
||||
|
||||
if (!AllocSizeIsValid(size))
|
||||
elog(ERROR, "invalid memory alloc request size %zu", size);
|
||||
|
|
@ -617,7 +600,6 @@ MemoryContextAllocZero(MemoryContext context, Size size)
|
|||
void *ret;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
AssertNotInCriticalSection(context);
|
||||
|
||||
if (!AllocSizeIsValid(size))
|
||||
elog(ERROR, "invalid memory alloc request size %zu", size);
|
||||
|
|
@ -645,7 +627,6 @@ MemoryContextAllocZeroAligned(MemoryContext context, Size size)
|
|||
void *ret;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
AssertNotInCriticalSection(context);
|
||||
|
||||
if (!AllocSizeIsValid(size))
|
||||
elog(ERROR, "invalid memory alloc request size %zu", size);
|
||||
|
|
@ -667,7 +648,6 @@ palloc(Size size)
|
|||
void *ret;
|
||||
|
||||
AssertArg(MemoryContextIsValid(CurrentMemoryContext));
|
||||
AssertNotInCriticalSection(CurrentMemoryContext);
|
||||
|
||||
if (!AllocSizeIsValid(size))
|
||||
elog(ERROR, "invalid memory alloc request size %zu", size);
|
||||
|
|
@ -687,7 +667,6 @@ palloc0(Size size)
|
|||
void *ret;
|
||||
|
||||
AssertArg(MemoryContextIsValid(CurrentMemoryContext));
|
||||
AssertNotInCriticalSection(CurrentMemoryContext);
|
||||
|
||||
if (!AllocSizeIsValid(size))
|
||||
elog(ERROR, "invalid memory alloc request size %zu", size);
|
||||
|
|
@ -759,7 +738,6 @@ repalloc(void *pointer, Size size)
|
|||
((char *) pointer - STANDARDCHUNKHEADERSIZE))->context;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
AssertNotInCriticalSection(context);
|
||||
|
||||
/* isReset must be false already */
|
||||
Assert(!context->isReset);
|
||||
|
|
@ -782,7 +760,6 @@ MemoryContextAllocHuge(MemoryContext context, Size size)
|
|||
void *ret;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
AssertNotInCriticalSection(context);
|
||||
|
||||
if (!AllocHugeSizeIsValid(size))
|
||||
elog(ERROR, "invalid memory alloc request size %zu", size);
|
||||
|
|
@ -824,7 +801,6 @@ repalloc_huge(void *pointer, Size size)
|
|||
((char *) pointer - STANDARDCHUNKHEADERSIZE))->context;
|
||||
|
||||
AssertArg(MemoryContextIsValid(context));
|
||||
AssertNotInCriticalSection(context);
|
||||
|
||||
/* isReset must be false already */
|
||||
Assert(!context->isReset);
|
||||
|
|
|
|||
Loading…
Reference in a new issue