mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Unite ReadBufferWithFork, ReadBufferWithStrategy, and ZeroOrReadBuffer
functions into one ReadBufferExtended function, that takes the strategy and mode as argument. There's three modes, RBM_NORMAL which is the default used by plain ReadBuffer(), RBM_ZERO, which replaces ZeroOrReadBuffer, and a new mode RBM_ZERO_ON_ERROR, which allows callers to read corrupt pages without throwing an error. The FSM needs the new mode to recover from corrupt pages, which could happend if we crash after extending an FSM file, and the new page is "torn". Add fork number to some error messages in bufmgr.c, that still lacked it.
This commit is contained in:
@ -29,7 +29,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.108 2008/09/30 10:52:12 heikki Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.109 2008/10/31 15:05:00 heikki Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -301,7 +301,8 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
|
||||
vacrelstats->num_index_scans++;
|
||||
}
|
||||
|
||||
buf = ReadBufferWithStrategy(onerel, blkno, vac_strategy);
|
||||
buf = ReadBufferExtended(onerel, MAIN_FORKNUM, blkno,
|
||||
RBM_NORMAL, vac_strategy);
|
||||
|
||||
/* We need buffer cleanup lock so that we can prune HOT chains. */
|
||||
LockBufferForCleanup(buf);
|
||||
@ -618,7 +619,8 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
|
||||
vacuum_delay_point();
|
||||
|
||||
tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples[tupindex]);
|
||||
buf = ReadBufferWithStrategy(onerel, tblk, vac_strategy);
|
||||
buf = ReadBufferExtended(onerel, MAIN_FORKNUM, tblk, RBM_NORMAL,
|
||||
vac_strategy);
|
||||
LockBufferForCleanup(buf);
|
||||
tupindex = lazy_vacuum_page(onerel, tblk, buf, tupindex, vacrelstats);
|
||||
|
||||
@ -880,7 +882,8 @@ count_nondeletable_pages(Relation onerel, LVRelStats *vacrelstats)
|
||||
|
||||
blkno--;
|
||||
|
||||
buf = ReadBufferWithStrategy(onerel, blkno, vac_strategy);
|
||||
buf = ReadBufferExtended(onerel, MAIN_FORKNUM, blkno,
|
||||
RBM_NORMAL, vac_strategy);
|
||||
|
||||
/* In this phase we only need shared access to the buffer */
|
||||
LockBuffer(buf, BUFFER_LOCK_SHARE);
|
||||
|
Reference in New Issue
Block a user