diff options
Diffstat (limited to 'src/backend/access')
-rw-r--r-- | src/backend/access/heap/visibilitymap.c | 5 | ||||
-rw-r--r-- | src/backend/access/transam/slru.c | 25 | ||||
-rw-r--r-- | src/backend/access/transam/xlogrecovery.c | 6 |
3 files changed, 20 insertions, 16 deletions
diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c index 953ad4a4843..7306c16f05c 100644 --- a/src/backend/access/heap/visibilitymap.c +++ b/src/backend/access/heap/visibilitymap.c @@ -255,7 +255,8 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf, uint8 status; #ifdef TRACE_VISIBILITYMAP - elog(DEBUG1, "vm_set %s %d", RelationGetRelationName(rel), heapBlk); + elog(DEBUG1, "vm_set flags 0x%02X for %s %d", + flags, RelationGetRelationName(rel), heapBlk); #endif Assert(InRecovery || XLogRecPtrIsInvalid(recptr)); @@ -269,6 +270,8 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf, if (BufferIsValid(heapBuf) && BufferGetBlockNumber(heapBuf) != heapBlk) elog(ERROR, "wrong heap buffer passed to visibilitymap_set"); + Assert(!BufferIsValid(heapBuf) || BufferIsExclusiveLocked(heapBuf)); + /* Check that we have the right VM page pinned */ if (!BufferIsValid(vmBuf) || BufferGetBlockNumber(vmBuf) != mapBlock) elog(ERROR, "wrong VM buffer passed to visibilitymap_set"); diff --git a/src/backend/access/transam/slru.c b/src/backend/access/transam/slru.c index 10ec259f382..5d3fcd62c94 100644 --- a/src/backend/access/transam/slru.c +++ b/src/backend/access/transam/slru.c @@ -246,6 +246,7 @@ SimpleLruAutotuneBuffers(int divisor, int max) * buffer_tranche_id: tranche ID to use for the SLRU's per-buffer LWLocks. * bank_tranche_id: tranche ID to use for the bank LWLocks. * sync_handler: which set of functions to use to handle sync requests + * long_segment_names: use short or long segment names */ void SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns, @@ -400,15 +401,15 @@ SimpleLruZeroPage(SlruCtl ctl, int64 pageno) /* * Assume this page is now the latest active page. * - * Note that because both this routine and SlruSelectLRUPage run with - * ControlLock held, it is not possible for this to be zeroing a page that - * SlruSelectLRUPage is going to evict simultaneously. Therefore, there's - * no memory barrier here. + * Note that because both this routine and SlruSelectLRUPage run with a + * SLRU bank lock held, it is not possible for this to be zeroing a page + * that SlruSelectLRUPage is going to evict simultaneously. Therefore, + * there's no memory barrier here. */ pg_atomic_write_u64(&shared->latest_page_number, pageno); /* update the stats counter of zeroed pages */ - pgstat_count_slru_page_zeroed(shared->slru_stats_idx); + pgstat_count_slru_blocks_zeroed(shared->slru_stats_idx); return slotno; } @@ -437,7 +438,7 @@ SimpleLruZeroLSNs(SlruCtl ctl, int slotno) * This is a convenience wrapper for the common case of zeroing a page and * immediately flushing it to disk. * - * Control lock is acquired and released here. + * SLRU bank lock is acquired and released here. */ void SimpleLruZeroAndWritePage(SlruCtl ctl, int64 pageno) @@ -560,7 +561,7 @@ SimpleLruReadPage(SlruCtl ctl, int64 pageno, bool write_ok, SlruRecentlyUsed(shared, slotno); /* update the stats counter of pages found in the SLRU */ - pgstat_count_slru_page_hit(shared->slru_stats_idx); + pgstat_count_slru_blocks_hit(shared->slru_stats_idx); return slotno; } @@ -605,7 +606,7 @@ SimpleLruReadPage(SlruCtl ctl, int64 pageno, bool write_ok, SlruRecentlyUsed(shared, slotno); /* update the stats counter of pages not found in SLRU */ - pgstat_count_slru_page_read(shared->slru_stats_idx); + pgstat_count_slru_blocks_read(shared->slru_stats_idx); return slotno; } @@ -644,11 +645,11 @@ SimpleLruReadPage_ReadOnly(SlruCtl ctl, int64 pageno, TransactionId xid) shared->page_number[slotno] == pageno && shared->page_status[slotno] != SLRU_PAGE_READ_IN_PROGRESS) { - /* See comments for SlruRecentlyUsed macro */ + /* See comments for SlruRecentlyUsed() */ SlruRecentlyUsed(shared, slotno); /* update the stats counter of pages found in the SLRU */ - pgstat_count_slru_page_hit(shared->slru_stats_idx); + pgstat_count_slru_blocks_hit(shared->slru_stats_idx); return slotno; } @@ -778,7 +779,7 @@ SimpleLruDoesPhysicalPageExist(SlruCtl ctl, int64 pageno) off_t endpos; /* update the stats counter of checked pages */ - pgstat_count_slru_page_exists(ctl->shared->slru_stats_idx); + pgstat_count_slru_blocks_exists(ctl->shared->slru_stats_idx); SlruFileName(ctl, path, segno); @@ -907,7 +908,7 @@ SlruPhysicalWritePage(SlruCtl ctl, int64 pageno, int slotno, SlruWriteAll fdata) int fd = -1; /* update the stats counter of written pages */ - pgstat_count_slru_page_written(shared->slru_stats_idx); + pgstat_count_slru_blocks_written(shared->slru_stats_idx); /* * Honor the write-WAL-before-data rule, if appropriate, so that we do not diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c index f23ec8969c2..346319338a0 100644 --- a/src/backend/access/transam/xlogrecovery.c +++ b/src/backend/access/transam/xlogrecovery.c @@ -4834,10 +4834,10 @@ check_recovery_target_lsn(char **newval, void **extra, GucSource source) { XLogRecPtr lsn; XLogRecPtr *myextra; - bool have_error = false; + ErrorSaveContext escontext = {T_ErrorSaveContext}; - lsn = pg_lsn_in_internal(*newval, &have_error); - if (have_error) + lsn = pg_lsn_in_safe(*newval, (Node *) &escontext); + if (escontext.error_occurred) return false; myextra = (XLogRecPtr *) guc_malloc(LOG, sizeof(XLogRecPtr)); |