Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit781ec6b

Browse files
Further reductions in Hot Standby conflict processing. These
come from the realistion that HEAP2_CLEAN records don'talways remove user visible data, so conflict processing forthem can be skipped. Confirm validity using Assert checks,clarify circumstances under which we log heap_cleanup_inforecords. Tuning arises from bug fixing of earlier safetycheck failures.
1 parent95a777c commit781ec6b

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

‎src/backend/access/heap/heapam.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.288 2010/02/26 02:00:33 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.289 2010/04/22 02:15:45 sriggs Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -4106,7 +4106,7 @@ heap_xlog_cleanup_info(XLogRecPtr lsn, XLogRecord *record)
41064106
}
41074107

41084108
/*
4109-
* HandlesHEAP_CLEAN record type
4109+
* HandlesHEAP2_CLEAN record type
41104110
*/
41114111
staticvoid
41124112
heap_xlog_clean(XLogRecPtrlsn,XLogRecord*record)
@@ -4126,8 +4126,12 @@ heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record)
41264126
/*
41274127
* We're about to remove tuples. In Hot Standby mode, ensure that there's
41284128
* no queries running for which the removed tuples are still visible.
4129+
*
4130+
* Not all HEAP2_CLEAN records remove tuples with xids, so we only want
4131+
* to conflict on the records that cause MVCC failures for user queries.
4132+
* If latestRemovedXid is invalid, skip conflict processing.
41294133
*/
4130-
if (InHotStandby)
4134+
if (InHotStandby&&TransactionIdIsValid(xlrec->latestRemovedXid))
41314135
ResolveRecoveryConflictWithSnapshot(xlrec->latestRemovedXid,
41324136
xlrec->node);
41334137

‎src/backend/access/heap/pruneheap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/heap/pruneheap.c,v 1.23 2010/04/21 17:20:56 sriggs Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/heap/pruneheap.c,v 1.24 2010/04/22 02:15:45 sriggs Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -236,6 +236,7 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
236236
{
237237
XLogRecPtrrecptr;
238238

239+
Assert(TransactionIdIsValid(prstate.latestRemovedXid));
239240
recptr=log_heap_clean(relation,buffer,
240241
prstate.redirected,prstate.nredirected,
241242
prstate.nowdead,prstate.ndead,

‎src/backend/commands/vacuumlazy.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*
3030
*
3131
* IDENTIFICATION
32-
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.134 2010/04/21 19:53:24 sriggs Exp $
32+
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.135 2010/04/22 02:15:45 sriggs Exp $
3333
*
3434
*-------------------------------------------------------------------------
3535
*/
@@ -274,12 +274,11 @@ vacuum_log_cleanup_info(Relation rel, LVRelStats *vacrelstats)
274274
if (rel->rd_istemp|| !XLogIsNeeded())
275275
return;
276276

277-
if (vacrelstats->tuples_deleted>0)
278-
{
279-
Assert(TransactionIdIsValid(vacrelstats->latestRemovedXid));
280-
277+
/*
278+
* No need to write the record at all unless it contains a valid value
279+
*/
280+
if (TransactionIdIsValid(vacrelstats->latestRemovedXid))
281281
(void)log_heap_cleanup_info(rel->rd_node,vacrelstats->latestRemovedXid);
282-
}
283282
}
284283

285284
/*
@@ -687,7 +686,6 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
687686
* Forget the now-vacuumed tuples, and press on, but be careful
688687
* not to reset latestRemovedXid since we want that value to be valid.
689688
*/
690-
Assert(TransactionIdIsValid(vacrelstats->latestRemovedXid));
691689
vacrelstats->num_dead_tuples=0;
692690
vacuumed_pages++;
693691
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp