diff options
Diffstat (limited to 'src/backend/access/heap/heapam.c')
-rw-r--r-- | src/backend/access/heap/heapam.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 99165b1e487..ed8dbae0d24 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -2318,7 +2318,7 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples, HeapTuple *heaptuples; int i; int ndone; - char *scratch = NULL; + PGAlignedBlock scratch; Page page; bool needwal; Size saveFreeSpace; @@ -2336,14 +2336,6 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples, xid, cid, options); /* - * Allocate some memory to use for constructing the WAL record. Using - * palloc() within a critical section is not safe, so we allocate this - * beforehand. - */ - if (needwal) - scratch = palloc(BLCKSZ); - - /* * We're about to do the actual inserts -- but check for conflict first, * to minimize the possibility of having to roll back work we've just * done. @@ -2427,7 +2419,7 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples, uint8 info = XLOG_HEAP2_MULTI_INSERT; char *tupledata; int totaldatalen; - char *scratchptr = scratch; + char *scratchptr = scratch.data; bool init; /* @@ -2494,10 +2486,10 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples, log_heap_new_cid(relation, heaptup); } totaldatalen = scratchptr - tupledata; - Assert((scratchptr - scratch) < BLCKSZ); + Assert((scratchptr - scratch.data) < BLCKSZ); rdata[0].data = (char *) xlrec; - rdata[0].len = tupledata - scratch; + rdata[0].len = tupledata - scratch.data; rdata[0].buffer = InvalidBuffer; rdata[0].next = &rdata[1]; |