Fix bugs in the COPY heap-insert batching patch.

Forgot to call RestoreBkpBlocks() in the redo-function, as pointed out by
Simon Riggs. In redo of a regular heap insert, it's taken care of in
heap_redo(), but this new record type uses the heap2 RM, and heap2_redo()
does not take care of that for you.

Also, failed to reset the vmbuffer and all_visibile_cleared local variables
after switching to a new buffer.
This commit is contained in:
Heikki Linnakangas 2011-11-09 21:24:26 +02:00
parent 3ad2c8e168
commit f81648cb1e

View File

@ -2088,9 +2088,6 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
{ {
TransactionId xid = GetCurrentTransactionId(); TransactionId xid = GetCurrentTransactionId();
HeapTuple *heaptuples; HeapTuple *heaptuples;
Buffer buffer;
Buffer vmbuffer = InvalidBuffer;
bool all_visible_cleared = false;
int i; int i;
int ndone; int ndone;
char *scratch = NULL; char *scratch = NULL;
@ -2128,6 +2125,9 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
ndone = 0; ndone = 0;
while (ndone < ntuples) while (ndone < ntuples)
{ {
Buffer buffer;
Buffer vmbuffer = InvalidBuffer;
bool all_visible_cleared = false;
int nthispage; int nthispage;
/* /*
@ -5038,6 +5038,13 @@ heap_xlog_multi_insert(XLogRecPtr lsn, XLogRecord *record)
int i; int i;
bool isinit = (record->xl_info & XLOG_HEAP_INIT_PAGE) != 0; bool isinit = (record->xl_info & XLOG_HEAP_INIT_PAGE) != 0;
/*
* Insertion doesn't overwrite MVCC data, so no conflict processing is
* required.
*/
RestoreBkpBlocks(lsn, record, false);
xlrec = (xl_heap_multi_insert *) recdata; xlrec = (xl_heap_multi_insert *) recdata;
recdata += SizeOfHeapMultiInsert; recdata += SizeOfHeapMultiInsert;