aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/heap/heapam.c10
-rw-r--r--src/backend/access/heap/pruneheap.c3
-rw-r--r--src/backend/commands/vacuumlazy.c12
3 files changed, 14 insertions, 11 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 1f26faa2ee0..93848942c7f 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.288 2010/02/26 02:00:33 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.289 2010/04/22 02:15:45 sriggs Exp $
*
*
* INTERFACE ROUTINES
@@ -4106,7 +4106,7 @@ heap_xlog_cleanup_info(XLogRecPtr lsn, XLogRecord *record)
}
/*
- * Handles HEAP_CLEAN record type
+ * Handles HEAP2_CLEAN record type
*/
static void
heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record)
@@ -4126,8 +4126,12 @@ heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record)
/*
* We're about to remove tuples. In Hot Standby mode, ensure that there's
* no queries running for which the removed tuples are still visible.
+ *
+ * Not all HEAP2_CLEAN records remove tuples with xids, so we only want
+ * to conflict on the records that cause MVCC failures for user queries.
+ * If latestRemovedXid is invalid, skip conflict processing.
*/
- if (InHotStandby)
+ if (InHotStandby && TransactionIdIsValid(xlrec->latestRemovedXid))
ResolveRecoveryConflictWithSnapshot(xlrec->latestRemovedXid,
xlrec->node);
diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c
index 0fee2845d9f..713ee408996 100644
--- a/src/backend/access/heap/pruneheap.c
+++ b/src/backend/access/heap/pruneheap.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/pruneheap.c,v 1.23 2010/04/21 17:20:56 sriggs Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/pruneheap.c,v 1.24 2010/04/22 02:15:45 sriggs Exp $
*
*-------------------------------------------------------------------------
*/
@@ -236,6 +236,7 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
{
XLogRecPtr recptr;
+ Assert(TransactionIdIsValid(prstate.latestRemovedXid));
recptr = log_heap_clean(relation, buffer,
prstate.redirected, prstate.nredirected,
prstate.nowdead, prstate.ndead,
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index 0b4047657ea..8a135f34af5 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -29,7 +29,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.134 2010/04/21 19:53:24 sriggs Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.135 2010/04/22 02:15:45 sriggs Exp $
*
*-------------------------------------------------------------------------
*/
@@ -274,12 +274,11 @@ vacuum_log_cleanup_info(Relation rel, LVRelStats *vacrelstats)
if (rel->rd_istemp || !XLogIsNeeded())
return;
- if (vacrelstats->tuples_deleted > 0)
- {
- Assert(TransactionIdIsValid(vacrelstats->latestRemovedXid));
-
+ /*
+ * No need to write the record at all unless it contains a valid value
+ */
+ if (TransactionIdIsValid(vacrelstats->latestRemovedXid))
(void) log_heap_cleanup_info(rel->rd_node, vacrelstats->latestRemovedXid);
- }
}
/*
@@ -687,7 +686,6 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
* Forget the now-vacuumed tuples, and press on, but be careful
* not to reset latestRemovedXid since we want that value to be valid.
*/
- Assert(TransactionIdIsValid(vacrelstats->latestRemovedXid));
vacrelstats->num_dead_tuples = 0;
vacuumed_pages++;
}