summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas2011-11-09 19:24:26 +0000
committerHeikki Linnakangas2011-11-09 19:28:25 +0000
commitf81648cb1ee5ce8d2e479a17db512046012c77e7 (patch)
tree3cd34c51ccf8dfff72b23d1e9cd69b3e465852b7
parent3ad2c8e1681ba34a7b764a356489fdc580dc553c (diff)
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.
-rw-r--r--src/backend/access/heap/heapam.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 72ed632538..9b49302c78 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -2088,9 +2088,6 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
{
TransactionId xid = GetCurrentTransactionId();
HeapTuple *heaptuples;
- Buffer buffer;
- Buffer vmbuffer = InvalidBuffer;
- bool all_visible_cleared = false;
int i;
int ndone;
char *scratch = NULL;
@@ -2128,6 +2125,9 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
ndone = 0;
while (ndone < ntuples)
{
+ Buffer buffer;
+ Buffer vmbuffer = InvalidBuffer;
+ bool all_visible_cleared = false;
int nthispage;
/*
@@ -5038,6 +5038,13 @@ heap_xlog_multi_insert(XLogRecPtr lsn, XLogRecord *record)
int i;
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;
recdata += SizeOfHeapMultiInsert;