Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f81648c

Browse files
committed
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.
1 parent 3ad2c8e commit f81648c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/backend/access/heap/heapam.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,9 +2088,6 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
20882088
{
20892089
TransactionId xid = GetCurrentTransactionId();
20902090
HeapTuple *heaptuples;
2091-
Buffer buffer;
2092-
Buffer vmbuffer = InvalidBuffer;
2093-
bool all_visible_cleared = false;
20942091
int i;
20952092
int ndone;
20962093
char *scratch = NULL;
@@ -2128,6 +2125,9 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
21282125
ndone = 0;
21292126
while (ndone < ntuples)
21302127
{
2128+
Buffer buffer;
2129+
Buffer vmbuffer = InvalidBuffer;
2130+
bool all_visible_cleared = false;
21312131
int nthispage;
21322132

21332133
/*
@@ -5038,6 +5038,13 @@ heap_xlog_multi_insert(XLogRecPtr lsn, XLogRecord *record)
50385038
int i;
50395039
bool isinit = (record->xl_info & XLOG_HEAP_INIT_PAGE) != 0;
50405040

5041+
/*
5042+
* Insertion doesn't overwrite MVCC data, so no conflict processing is
5043+
* required.
5044+
*/
5045+
5046+
RestoreBkpBlocks(lsn, record, false);
5047+
50415048
xlrec = (xl_heap_multi_insert *) recdata;
50425049
recdata += SizeOfHeapMultiInsert;
50435050

0 commit comments

Comments
 (0)