Fix and enhance the assertion of no palloc's in a critical section.
Heikki Linnakangas <heikki.linnakangas@iki.fi>
Fix and enhance the assertion of no palloc's in a critical section. The assertion failed if WAL_DEBUG or LWLOCK_STATS was enabled; fix that by using separate memory contexts for the allocations made within those code blocks. This patch introduces a mechanism for marking any memory context as allowed in a critical section. Previously ErrorContext was exempt as a special case. Instead of a blanket exception of the checkpointer process, only exempt the memory context used for the pending ops hash table.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/transam/xlog.c | modified | +27 −2 |
| src/backend/postmaster/checkpointer.c | modified | +15 −15 |
| src/backend/storage/lmgr/lwlock.c | modified | +44 −12 |
| src/backend/storage/lmgr/proc.c | modified | +2 −1 |
| src/backend/storage/smgr/md.c | modified | +21 −4 |
| src/backend/utils/mmgr/mcxt.c | modified | +32 −8 |
| src/include/nodes/memnodes.h | modified | +3 −0 |
| src/include/storage/lwlock.h | modified | +1 −0 |
| src/include/utils/memutils.h | modified | +2 −0 |