|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <sys/file.h>#include <unistd.h>#include "access/tableam.h"#include "access/xloginsert.h"#include "access/xlogutils.h"#include "catalog/storage.h"#include "catalog/storage_xlog.h"#include "common/hashfn.h"#include "executor/instrument.h"#include "lib/binaryheap.h"#include "miscadmin.h"#include "pg_trace.h"#include "pgstat.h"#include "postmaster/bgwriter.h"#include "storage/aio.h"#include "storage/buf_internals.h"#include "storage/bufmgr.h"#include "storage/fd.h"#include "storage/ipc.h"#include "storage/lmgr.h"#include "storage/proc.h"#include "storage/proclist.h"#include "storage/procsignal.h"#include "storage/read_stream.h"#include "storage/smgr.h"#include "storage/standby.h"#include "utils/memdebug.h"#include "utils/ps_status.h"#include "utils/rel.h"#include "utils/resowner.h"#include "utils/timestamp.h"#include "utils/wait_event.h"#include "lib/simplehash.h"#include "lib/sort_template.h"
Go to the source code of this file.
Data Structures | |
| struct | PrivateRefCountData |
| struct | PrivateRefCountEntry |
| struct | CkptTsStatus |
| struct | SMgrSortArray |
Typedefs | |
| typedef struct PrivateRefCountData | PrivateRefCountData |
| typedef struct PrivateRefCountEntry | PrivateRefCountEntry |
| typedef struct CkptTsStatus | CkptTsStatus |
| typedef struct SMgrSortArray | SMgrSortArray |
| #define BufferGetLSN | ( | bufHdr | ) | (PageGetLSN(BufHdrGetBlock(bufHdr))) |
| #define LocalBufHdrGetBlock | ( | bufHdr | ) | LocalBufferBlockPointers[-((bufHdr)->buf_id + 2)] |
| #define READV_COUNT_BITS 7 |
| #define READV_COUNT_MASK ((1 << READV_COUNT_BITS) - 1) |
| #define SH_ELEMENT_TYPE PrivateRefCountEntry |
| #define SH_HASH_KEY | ( | tb, | |
| key | |||
| ) | murmurhash32((uint32) (key)) |
| #define ST_ELEMENT_TYPE CkptSortItem |
| #define ST_ELEMENT_TYPE PendingWriteback |
| #define ST_SORT sort_checkpoint_bufferids |
| #define ST_SORT sort_pending_writebacks |
| typedef struct CkptTsStatus CkptTsStatus |
| typedef struct SMgrSortArray SMgrSortArray |
Definition at line 7469 of file bufmgr.c.
References Assert, BM_DIRTY, BM_IO_ERROR, BM_IO_IN_PROGRESS, BM_TAG_VALID, BM_VALID, PrivateRefCountEntry::buffer, BufTagGetForkNum(), BufTagGetRelFileLocator(), ereport, errcode(), errdetail(), errmsg, fb(), GetBufferDescriptor(), LockBufHdr(), relpathperm, TerminateBufferIO(), UnlockBufHdr(), and WARNING.
Referenced by ResOwnerReleaseBufferIO().
|
static |
Definition at line 1938 of file bufmgr.c.
References Assert, BUFFER_IO_ALREADY_DONE, BUFFER_IO_IN_PROGRESS, BUFFER_IO_READY_FOR_IO, BufferGetBlock(), BufferGetBlockNumber(), CurrentResourceOwner, fb(), i, ignore_checksum_failure, IOCONTEXT_NORMAL, IOContextForStrategy(), IOOBJECT_RELATION, IOOBJECT_TEMP_RELATION, IOOP_READ, BufferUsage::local_blks_read, MAX_IO_COMBINE_LIMIT, operation, PGAIO_HCB_LOCAL_BUFFER_READV, PGAIO_HCB_SHARED_BUFFER_READV, PGAIO_HF_REFERENCES_LOCAL, PGAIO_HF_SYNCHRONOUS, pgaio_io_acquire(), pgaio_io_acquire_nb(), pgaio_io_get_wref(), pgaio_io_register_callbacks(), pgaio_io_release(), pgaio_io_set_flag(), pgaio_io_set_handle_data_32(), pgaio_submit_staged(), pgaio_wref_clear(), pgaio_wref_valid(), pgBufferUsage, pgstat_count_io_op_time(), pgstat_prepare_io_time(), pgstat_prepare_report_checksum_failure(), READ_BUFFERS_IGNORE_CHECKSUM_FAILURES, READ_BUFFERS_SYNCHRONOUSLY, READ_BUFFERS_ZERO_ON_ERROR, BufferUsage::shared_blks_read, smgrstartreadv(), StartBufferIO(), PrivateRefCountEntry::status, track_io_timing, TrackBufferHit(), unlikely, VacuumCostActive, VacuumCostBalance, VacuumCostPageMiss, and zero_damaged_pages.
Referenced by StartReadBuffersImpl(), and WaitReadBuffers().
Definition at line 4222 of file bufmgr.c.
References Assert, AtEOXact_LocalBuffers(), CheckForBufferLeaks(), fb(), and PrivateRefCountOverflowed.
Referenced by AbortTransaction(), AutoVacLauncherMain(), BackgroundWriterMain(), CheckpointerMain(), CommitTransaction(), PrepareTransaction(), and WalWriterMain().
Definition at line 4268 of file bufmgr.c.
References AtProcExit_LocalBuffers(), CheckForBufferLeaks(), and UnlockBuffers().
Referenced by InitBufferManagerAccess().
| bool BgBufferSync | ( | WritebackContext * | wb_context | ) |
Definition at line 3854 of file bufmgr.c.
References Assert, bgwriter_lru_maxpages, bgwriter_lru_multiplier, BgWriterDelay, PgStat_BgWriterStats::buf_alloc, BUF_REUSABLE, BUF_WRITTEN, PgStat_BgWriterStats::buf_written_clean, DEBUG1, DEBUG2, elog, fb(), PgStat_BgWriterStats::maxwritten_clean, NBuffers, PendingBgWriterStats, StrategySyncStart(), and SyncOneBuffer().
Referenced by BackgroundWriterMain().
|
static |
Definition at line 8725 of file bufmgr.c.
References Assert, buf, buffer_readv_complete_one(), buffer_readv_encode_error(), BufferIsValid(), RelFileLocator::dbOid, DEBUG1, fb(), PgAioTargetData::is_temp, MyProcNumber, pgaio_io_get_handle_data(), pgaio_io_get_owner(), pgaio_io_get_target_data(), pgaio_result_report(), PGAIO_RS_ERROR, pgstat_report_checksum_failures_in_db(), result, PgAioTargetData::rlocator, and PgAioTargetData::smgr.
Referenced by local_buffer_readv_complete(), and shared_buffer_readv_complete().
|
static |
Definition at line 8574 of file bufmgr.c.
References Assert, buftag::blockNum, BM_DIRTY, BM_IO_ERROR, BM_IO_IN_PROGRESS, BM_TAG_VALID, BM_VALID, PrivateRefCountEntry::buffer, buffer_readv_encode_error(), BufferGetBlock(), BufferIsPinned, buftag::dbOid, fb(), buftag::forkNum, GetBufferDescriptor(), GetLocalBufferDescriptor(), INVALID_PROC_NUMBER, LOG_SERVER_ONLY, MyProcNumber, PageIsVerified(), pg_atomic_read_u64(), pgaio_result_report(), PIV_IGNORE_CHECKSUM_FAILURE, PIV_LOG_LOG, PIV_ZERO_BUFFERS_ON_ERROR, READ_BUFFERS_IGNORE_CHECKSUM_FAILURES, READ_BUFFERS_ZERO_ON_ERROR, buftag::relNumber, buftag::spcOid, TerminateBufferIO(), TerminateLocalBufferIO(), VALGRIND_MAKE_MEM_DEFINED, and VALGRIND_MAKE_MEM_NOACCESS.
Referenced by buffer_readv_complete().
|
inlinestatic |
Definition at line 8437 of file bufmgr.c.
References fb(), READV_COUNT_BITS, READV_COUNT_MASK, and result.
Referenced by buffer_readv_encode_error(), buffer_readv_report(), and shared_buffer_readv_complete_local().
|
inlinestatic |
Definition at line 8479 of file bufmgr.c.
References Assert, buffer_readv_decode_error(), fb(), PG_IOV_MAX, PGAIO_HCB_LOCAL_BUFFER_READV, PGAIO_HCB_SHARED_BUFFER_READV, PGAIO_RESULT_ERROR_BITS, PGAIO_RS_ERROR, PGAIO_RS_WARNING, READV_COUNT_BITS, result, and StaticAssertDecl.
Referenced by buffer_readv_complete(), and buffer_readv_complete_one().
|
static |
Definition at line 8828 of file bufmgr.c.
References _, Assert, PgAioTargetData::blockNum, buffer_readv_decode_error(), ereport, errcode(), ERRCODE_DATA_CORRUPTED, errdetail(), errdetail_internal(), errhint_internal(), errhint_plural(), errmsg, errmsg_internal(), fb(), PgAioTargetData::forkNum, INVALID_PROC_NUMBER, PgAioTargetData::is_temp, MyProcNumber, PgAioTargetData::nblocks, pg_unreachable, PGAIO_RS_ERROR, relpathbackend, result, PgAioTargetData::rlocator, PgAioTargetData::smgr, and RelPathStr::str.
|
static |
Definition at line 8330 of file bufmgr.c.
References Assert, BM_DIRTY, BM_IO_IN_PROGRESS, BM_TAG_VALID, BM_VALID, BUF_REFCOUNT_ONE, BUF_STATE_GET_REFCOUNT, PrivateRefCountEntry::buffer, BufferLockDisown(), BufferLockHeldByMe(), CurrentResourceOwner, fb(), GetBufferDescriptor(), GetLocalBufferDescriptor(), i, LockBufHdr(), pg_atomic_read_u64(), pg_atomic_unlocked_write_u64(), PG_USED_FOR_ASSERTS_ONLY, pgaio_io_get_handle_data(), pgaio_io_get_wref(), ResourceOwnerForgetBufferIO(), and UnlockBufHdrExt().
Referenced by local_buffer_readv_stage(), and shared_buffer_readv_stage().
|
inlinestatic |
Definition at line 2197 of file bufmgr.c.
References Assert, BM_DIRTY, BM_IO_IN_PROGRESS, BM_PERMANENT, BM_TAG_VALID, BM_VALID, buf, BUF_STATE_GET_REFCOUNT, BUF_USAGECOUNT_ONE, BufMappingPartitionLock(), BufTableHashCode(), BufTableInsert(), BufTableLookup(), CurrentResourceOwner, fb(), GetBufferDescriptor(), GetVictimBuffer(), INIT_FORKNUM, InitBufferTag(), RelFileLocatorBackend::locator, LockBufHdr(), LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), PinBuffer(), ReservePrivateRefCountEntry(), ResourceOwnerEnlarge(), SMgrRelationData::smgr_rlocator, UnlockBufHdrExt(), and UnpinBuffer().
Referenced by PinBufferForBlock().
Definition at line 7091 of file bufmgr.c.
References PrivateRefCountEntry::buffer, BufferIsLocal, fb(), GetBufferDescriptor(), and SharedBufferBeginSetHintBits().
Referenced by _bt_check_unique(), _bt_killitems(), _hash_kill_items(), fsm_search_avail(), fsm_vacuum_page(), gistkillitems(), and SetHintBitsExt().
Definition at line 7119 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_SHARE_EXCLUSIVE, BufferIsLocal, BufferIsLockedByMeInMode(), fb(), and MarkBufferDirtyHint().
Referenced by _bt_check_unique(), _bt_killitems(), _hash_kill_items(), fsm_search_avail(), fsm_vacuum_page(), gistkillitems(), and HeapTupleSatisfiesMVCCBatch().
| BlockNumber BufferGetBlockNumber | ( | Buffer | buffer | ) |
Definition at line 4469 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BufferIsLocal, BufferIsPinned, fb(), GetBufferDescriptor(), and GetLocalBufferDescriptor().
Referenced by _bt_binsrch_insert(), _bt_bottomupdel_pass(), _bt_check_unique(), _bt_checkpage(), _bt_delitems_delete(), _bt_delitems_vacuum(), _bt_doinsert(), _bt_finish_split(), _bt_getroot(), _bt_insert_parent(), _bt_insertonpg(), _bt_mark_page_halfdead(), _bt_moveright(), _bt_newlevel(), _bt_pagedel(), _bt_readpage(), _bt_relandgetbuf(), _bt_restore_meta(), _bt_search(), _bt_simpledel_pass(), _bt_split(), _bt_unlink_halfdead_page(), _hash_addovflpage(), _hash_checkpage(), _hash_doinsert(), _hash_first(), _hash_freeovflpage(), _hash_getnewbuf(), _hash_readnext(), _hash_readpage(), _hash_splitbucket(), allocNewBuffer(), AsyncReadBuffers(), BitmapHeapScanNextBlock(), blinsert(), BloomInitMetapage(), brin_doinsert(), brin_doupdate(), brin_getinsertbuffer(), brin_initialize_empty_new_buffer(), brin_page_cleanup(), brin_xlog_insert_update(), brinbuild(), brinGetTupleForHeapBlock(), btvacuumpage(), check_index_page(), CheckReadBuffersOperation(), collect_corrupt_items(), collectMatchBitmap(), createPostingTree(), dataBeginPlaceToPageLeaf(), dataPrepareDownlink(), doPickSplit(), entryPrepareDownlink(), fill_seq_fork_with_data(), ginDeletePostingPage(), ginEntryInsert(), ginFindParents(), ginFinishSplit(), ginPlaceToPage(), ginRedoDeleteListPages(), ginRedoUpdateMetapage(), gistbufferinginserttuples(), gistbuild(), gistcheckpage(), gistdeletepage(), gistformdownlink(), gistinserttuples(), gistMemorizeAllDownlinks(), gistplacetopage(), gistRelocateBuildBuffersOnSplit(), gistScanPage(), gistvacuumpage(), hash_xlog_add_ovfl_page(), heap_delete(), heap_fetch_next_buffer(), heap_hot_search_buffer(), heap_insert(), heap_multi_insert(), heap_page_prune_opt(), heap_page_would_be_all_visible(), heap_prepare_pagescan(), heap_update(), heap_xlog_confirm(), heap_xlog_lock(), heapam_index_fetch_tuple(), heapam_scan_analyze_next_block(), heapgettup(), heapgettup_pagemode(), index_compute_xid_horizon_for_tuples(), lazy_scan_heap(), lazy_scan_noprune(), lazy_scan_prune(), lazy_vacuum_heap_rel(), makeSublist(), moveLeafs(), moveRightIfItNeeded(), pgstathashindex(), prune_freeze_setup(), read_buffers(), read_stream_start_pending_read(), ReadBufferBI(), RelationAddBlocks(), RelationCopyStorageUsingBuffer(), RelationGetBufferForTuple(), RelationPutHeapTuple(), revmap_get_buffer(), revmap_physical_extend(), ScanSourceDatabasePgClassPage(), spgAddNodeAction(), spgbuild(), spgdoinsert(), SpGistSetLastUsedPage(), spgSplitNodeAction(), spgvacuumpage(), spgWalk(), StartReadBuffersImpl(), startScanEntry(), statapprox_heap(), terminate_brin_buildstate(), vacuumLeafPage(), verify_heapam(), visibilitymap_clear(), visibilitymap_get_status(), visibilitymap_pin(), visibilitymap_pin_ok(), and visibilitymap_set().
| XLogRecPtr BufferGetLSNAtomic | ( | Buffer | buffer | ) |
Definition at line 4736 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BufferGetPage(), BufferIsLocal, BufferIsPinned, BufferIsValid(), fb(), GetBufferDescriptor(), LockBufHdr(), PageGetLSN(), UnlockBufHdr(), and XLogHintBitIsNeeded.
Referenced by _bt_drop_lock_and_maybe_pin(), _bt_killitems(), gistdoinsert(), gistFindPath(), gistkillitems(), gistScanPage(), and SetHintBitsExt().
| void BufferGetTag | ( | Buffer | buffer, |
| RelFileLocator * | rlocator, | ||
| ForkNumber * | forknum, | ||
| BlockNumber * | blknum | ||
| ) |
Definition at line 4490 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BufferIsLocal, BufferIsPinned, BufTagGetForkNum(), BufTagGetRelFileLocator(), fb(), GetBufferDescriptor(), and GetLocalBufferDescriptor().
Referenced by fsm_search_avail(), ginRedoInsertEntry(), heap_inplace_update_and_unlock(), log_newpage_buffer(), ResolveCminCmaxDuringDecoding(), and XLogRegisterBuffer().
Definition at line 3137 of file bufmgr.c.
References Assert, BM_DIRTY, PrivateRefCountEntry::buffer, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_SHARE_EXCLUSIVE, BufferIsLocal, BufferIsLockedByMeInMode(), BufferIsPinned, fb(), GetBufferDescriptor(), GetLocalBufferDescriptor(), and pg_atomic_read_u64().
Referenced by heap_multi_insert(), heap_page_will_set_vm(), heap_xlog_multi_insert(), heap_xlog_prune_freeze(), log_heap_prune_and_freeze(), XLogRegisterBuffer(), and XLogSaveBufferForHint().
Definition at line 3084 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BufferIsLocal, BufferIsPinned, BufferLockHeldByMe(), fb(), and GetBufferDescriptor().
Referenced by FlushOneBuffer().
| bool BufferIsLockedByMeInMode | ( | Buffer | buffer, |
| BufferLockMode | mode | ||
| ) |
Definition at line 3110 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BufferIsLocal, BufferIsPinned, BufferLockHeldByMeInMode(), fb(), GetBufferDescriptor(), and mode.
Referenced by BufferFinishSetHintBits(), BufferIsDirty(), heap_page_fix_vm_corruption(), HeapTupleSetHintBits(), IsBufferCleanupOK(), MarkBufferDirty(), visibilitymap_set(), and XLogRegisterBuffer().
Definition at line 4700 of file bufmgr.c.
References Assert, BM_PERMANENT, PrivateRefCountEntry::buffer, BufferIsLocal, BufferIsPinned, BufferIsValid(), fb(), GetBufferDescriptor(), and pg_atomic_read_u64().
Referenced by SetHintBitsExt().
|
inlinestatic |
Definition at line 5921 of file bufmgr.c.
References Assert, BM_LOCK_WAKE_IN_PROGRESS, PrivateRefCountEntry::buffer, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_SHARE, BUFFER_LOCK_SHARE_EXCLUSIVE, BUFFER_LOCK_UNLOCK, BufferLockAttempt(), BufferLockDequeueSelf(), BufferLockQueueSelf(), PrivateRefCountEntry::data, fb(), GetPrivateRefCountEntry(), HOLD_INTERRUPTS, likely, PrivateRefCountData::lockmode, LW_WS_NOT_WAITING, PGPROC::lwWaiting, mode, MyProc, pg_atomic_fetch_and_u64(), pg_unreachable, PGSemaphoreLock(), PGSemaphoreUnlock(), pgstat_report_wait_end(), pgstat_report_wait_start(), PGPROC::sem, and unlikely.
Referenced by FlushUnlockedBuffer(), LockBufferInternal(), and MarkDirtyUnpinnedBufferInternal().
|
inlinestatic |
Definition at line 6119 of file bufmgr.c.
References BM_LOCK_MASK, BM_LOCK_VAL_EXCLUSIVE, BM_LOCK_VAL_SHARE_EXCLUSIVE, BM_LOCK_VAL_SHARED, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_SHARE_EXCLUSIVE, fb(), likely, mode, pg_atomic_compare_exchange_u64(), pg_atomic_read_u64(), and pg_unreachable.
Referenced by BufferLockAcquire(), and BufferLockConditional().
|
static |
Definition at line 6073 of file bufmgr.c.
References PrivateRefCountEntry::buffer, BUFFER_LOCK_UNLOCK, BufferLockAttempt(), PrivateRefCountEntry::data, fb(), GetPrivateRefCountEntry(), HOLD_INTERRUPTS, PrivateRefCountData::lockmode, mode, and RESUME_INTERRUPTS.
Referenced by ConditionalLockBuffer(), and GetVictimBuffer().
|
static |
Definition at line 6226 of file bufmgr.c.
References BM_LOCK_HAS_WAITERS, BM_LOCK_WAKE_IN_PROGRESS, fb(), LockBufHdr(), LW_WS_NOT_WAITING, LW_WS_WAITING, PGPROC::lwWaiting, MyProc, MyProcNumber, pg_atomic_fetch_and_u64(), pg_atomic_read_u64(), PGSemaphoreLock(), PGSemaphoreUnlock(), proclist_delete, proclist_is_empty(), PGPROC::sem, and UnlockBufHdr().
Referenced by BufferLockAcquire().
|
inlinestatic |
Definition at line 6294 of file bufmgr.c.
References PrivateRefCountEntry::buffer, BufferLockDisownInternal(), fb(), and RESUME_INTERRUPTS.
Referenced by buffer_stage_common().
|
inlinestatic |
Definition at line 6308 of file bufmgr.c.
References PrivateRefCountEntry::buffer, BUFFER_LOCK_UNLOCK, elog, ERROR, fb(), GetPrivateRefCountEntry(), and mode.
Referenced by BufferLockDisown(), BufferLockUnlock(), and UnlockReleaseBuffer().
|
static |
Definition at line 6566 of file bufmgr.c.
References BUFFER_LOCK_UNLOCK, BufferDescriptorGetBuffer(), PrivateRefCountEntry::data, fb(), GetPrivateRefCountEntry(), and PrivateRefCountData::lockmode.
Referenced by buffer_stage_common(), BufferIsLockedByMe(), and UnpinBufferNoOwner().
|
static |
Definition at line 6548 of file bufmgr.c.
References BufferDescriptorGetBuffer(), PrivateRefCountEntry::data, fb(), GetPrivateRefCountEntry(), PrivateRefCountData::lockmode, and mode.
Referenced by BufferIsLockedByMeInMode(), FlushBuffer(), and MarkSharedBufferDirtyHint().
|
static |
Definition at line 6493 of file bufmgr.c.
References Assert, BM_LOCK_HAS_WAITERS, BM_LOCK_MASK, BM_LOCK_VAL_EXCLUSIVE, BM_LOCK_WAKE_IN_PROGRESS, BUFFER_LOCK_SHARE_EXCLUSIVE, BufferLockWakeup(), fb(), and mode.
Referenced by BufferLockUnlock(), and UnlockReleaseBuffer().
|
static |
Definition at line 6186 of file bufmgr.c.
References BM_LOCK_HAS_WAITERS, elog, fb(), LockBufHdr(), LW_WS_NOT_WAITING, LW_WS_WAITING, PGPROC::lwWaiting, PGPROC::lwWaitMode, mode, MyProc, MyProcNumber, PANIC, pg_atomic_fetch_or_u64(), proclist_push_tail, and UnlockBufHdr().
Referenced by BufferLockAcquire().
|
inlinestatic |
Definition at line 6464 of file bufmgr.c.
References Assert, BM_LOCK_VAL_EXCLUSIVE, BM_LOCK_VAL_SHARE_EXCLUSIVE, BM_LOCK_VAL_SHARED, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_SHARE, BUFFER_LOCK_SHARE_EXCLUSIVE, and mode.
Referenced by BufferLockUnlock(), and UnlockReleaseBuffer().
|
static |
Definition at line 6037 of file bufmgr.c.
References PrivateRefCountEntry::buffer, BufferLockDisownInternal(), BufferLockProcessRelease(), BufferLockReleaseSub(), fb(), mode, pg_atomic_sub_fetch_u64(), and RESUME_INTERRUPTS.
Referenced by FlushUnlockedBuffer(), MarkDirtyUnpinnedBufferInternal(), ResOwnerReleaseBuffer(), and UnlockBuffer().
|
static |
Definition at line 6328 of file bufmgr.c.
References Assert, BM_LOCK_HAS_WAITERS, BM_LOCK_WAKE_IN_PROGRESS, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_SHARE, BUFFER_LOCK_SHARE_EXCLUSIVE, proclist_mutable_iter::cur, fb(), GetPGProcByNumber, LockBufHdr(), LW_WS_NOT_WAITING, LW_WS_PENDING_WAKEUP, LW_WS_WAITING, PGPROC::lwWaiting, PGPROC::lwWaitMode, pg_atomic_compare_exchange_u64(), pg_atomic_read_u64(), pg_write_barrier, PGSemaphoreUnlock(), proclist_delete, proclist_foreach_modify, proclist_init(), proclist_is_empty(), proclist_push_tail, PGPROC::sem, and wakeup.
Referenced by BufferLockProcessRelease().
Definition at line 7142 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BufferGetPage(), BufferIsLocal, fb(), GetBufferDescriptor(), MarkLocalBufferDirty(), MarkSharedBufferDirtyHint(), SharedBufferBeginSetHintBits(), and val.
Referenced by SetHintBitsExt().
Definition at line 3575 of file bufmgr.c.
References Assert, binaryheap_add_unordered(), binaryheap_allocate(), binaryheap_build(), binaryheap_empty, binaryheap_first(), binaryheap_free(), binaryheap_remove_first(), binaryheap_replace_first(), CkptSortItem::blockNum, BM_CHECKPOINT_NEEDED, BM_DIRTY, BM_PERMANENT, CkptSortItem::buf_id, BUF_WRITTEN, PgStat_CheckpointerStats::buffers_written, BufTagGetForkNum(), BufTagGetRelNumber(), CHECKPOINT_END_OF_RECOVERY, checkpoint_flush_after, CHECKPOINT_FLUSH_UNLOGGED, CHECKPOINT_IS_SHUTDOWN, CheckpointStats, CheckpointWriteDelay(), CheckpointStatsData::ckpt_bufs_written, CkptBufferIds, DatumGetPointer(), fb(), CkptSortItem::forkNum, GetBufferDescriptor(), i, CkptTsStatus::index, InvalidOid, IOCONTEXT_NORMAL, IssuePendingWritebacks(), LockBufHdr(), NBuffers, CkptTsStatus::num_to_scan, palloc(), PendingCheckpointerStats, pfree(), pg_atomic_read_u64(), PointerGetDatum, ProcessProcSignalBarrier(), ProcSignalBarrierPending, CkptTsStatus::progress_slice, CkptSortItem::relNumber, repalloc(), SyncOneBuffer(), ts_ckpt_progress_comparator(), CkptTsStatus::tsId, CkptSortItem::tsId, UnlockBufHdrExt(), and WritebackContextInit().
Referenced by CheckPointBuffers().
Definition at line 7639 of file bufmgr.c.
References BufTagGetForkNum(), BufTagGetRelFileLocator(), fb(), and rlocator_comparator().
Definition at line 6660 of file bufmgr.c.
References PrivateRefCountEntry::buffer, BufferIsLocal, elog, ERROR, GetPrivateRefCount(), and LocalRefCount.
Referenced by GetVictimBuffer(), lazy_scan_heap(), and LockBufferForCleanup().
Definition at line 4286 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, DebugPrintBufferRefcount(), elog, fb(), i, InvalidBuffer, pfree(), PrivateRefCountArray, PrivateRefCountArrayKeys, PrivateRefCountHash, PrivateRefCountOverflowed, REFCOUNT_ARRAY_ENTRIES, and WARNING.
Referenced by AtEOXact_Buffers(), and AtProcExit_Buffers().
Definition at line 4455 of file bufmgr.c.
References BufferSync().
Referenced by CheckPointGuts().
|
static |
Definition at line 1656 of file bufmgr.c.
References Assert, BM_TAG_VALID, BM_VALID, PrivateRefCountEntry::buffer, BufferGetBlockNumber(), BufferIsLocal, fb(), GetBufferDescriptor(), GetLocalBufferDescriptor(), i, operation, and pg_atomic_read_u64().
Referenced by StartReadBuffersImpl(), and WaitReadBuffers().
|
inlinestatic |
Definition at line 7673 of file bufmgr.c.
Definition at line 6640 of file bufmgr.c.
References Assert, buf, PrivateRefCountEntry::buffer, BUFFER_LOCK_EXCLUSIVE, BufferIsLocal, BufferIsPinned, BufferLockConditional(), and GetBufferDescriptor().
Referenced by _bt_conditionallockbuf(), BloomNewBuffer(), ConditionalLockBufferForCleanup(), GinNewBuffer(), gistNewBuffer(), RelationGetBufferForTuple(), spgdoinsert(), SpGistGetBuffer(), SpGistNewBuffer(), and SpGistUpdateMetaPage().
Definition at line 6892 of file bufmgr.c.
References Assert, BUF_STATE_GET_REFCOUNT, PrivateRefCountEntry::buffer, BUFFER_LOCK_UNLOCK, BufferIsLocal, BufferIsValid(), ConditionalLockBuffer(), fb(), GetBufferDescriptor(), GetPrivateRefCount(), LocalRefCount, LockBuffer(), LockBufHdr(), and UnlockBufHdr().
Referenced by _hash_finish_split(), _hash_getbuf_with_condlock_cleanup(), heap_page_prune_opt(), and lazy_scan_heap().
| void CreateAndCopyRelationData | ( | RelFileLocator | src_rlocator, |
| RelFileLocator | dst_rlocator, | ||
| bool | permanent | ||
| ) |
Definition at line 5485 of file bufmgr.c.
References fb(), INIT_FORKNUM, INVALID_PROC_NUMBER, log_smgrcreate(), MAIN_FORKNUM, MAX_FORKNUM, RelationCopyStorageUsingBuffer(), RelationCreateStorage(), smgrcreate(), smgrexists(), and smgropen().
Referenced by CreateDatabaseUsingWalLog().
Definition at line 4412 of file bufmgr.c.
References Assert, buf, BUF_FLAG_MASK, BUF_STATE_GET_REFCOUNT, PrivateRefCountEntry::buffer, BufferIsLocal, BufferIsValid(), BufTagGetForkNum(), BufTagGetRelFileLocator(), fb(), GetBufferDescriptor(), GetLocalBufferDescriptor(), GetPrivateRefCount(), INVALID_PROC_NUMBER, LocalRefCount, MyProcNumber, pg_atomic_read_u64(), psprintf(), relpathbackend, and result.
Referenced by buffer_call_start_io(), buffer_call_terminate_io(), CheckForBufferLeaks(), CheckForLocalBufferLeaks(), and ResOwnerPrintBuffer().
Definition at line 5138 of file bufmgr.c.
References fb(), GetBufferDescriptor(), i, InvalidateBuffer(), LockBufHdr(), NBuffers, and UnlockBufHdr().
Referenced by createdb_failure_callback(), dbase_redo(), dropdb(), and movedb().
| void DropRelationBuffers | ( | SMgrRelation | smgr_reln, |
| ForkNumber * | forkNum, | ||
| int | nforks, | ||
| BlockNumber * | firstDelBlock | ||
| ) |
Definition at line 4788 of file bufmgr.c.
References RelFileLocatorBackend::backend, BlockNumberIsValid(), BUF_DROP_FULL_SCAN_THRESHOLD, BufTagGetForkNum(), BufTagMatchesRelFileLocator(), DropRelationLocalBuffers(), fb(), FindAndDropRelationBuffers(), GetBufferDescriptor(), i, InvalidateBuffer(), InvalidBlockNumber, j, RelFileLocatorBackend::locator, LockBufHdr(), MAX_FORKNUM, MyProcNumber, NBuffers, RelFileLocatorBackendIsTemp, smgrnblocks_cached(), and UnlockBufHdr().
Referenced by smgrtruncate().
| void DropRelationsAllBuffers | ( | SMgrRelation * | smgr_reln, |
| int | nlocators | ||
| ) |
Definition at line 4908 of file bufmgr.c.
References BlockNumberIsValid(), BUF_DROP_FULL_SCAN_THRESHOLD, BufTagGetRelFileLocator(), BufTagMatchesRelFileLocator(), DropRelationAllLocalBuffers(), fb(), FindAndDropRelationBuffers(), GetBufferDescriptor(), i, InvalidateBuffer(), InvalidBlockNumber, j, LockBufHdr(), MAX_FORKNUM, MyProcNumber, NBuffers, palloc(), palloc_array, pfree(), qsort, RelFileLocatorBackendIsTemp, RELS_BSEARCH_THRESHOLD, rlocator_comparator(), smgrexists(), smgrnblocks_cached(), and UnlockBufHdr().
Referenced by smgrdounlinkall().
| void EvictAllUnpinnedBuffers | ( | int32 * | buffers_evicted, |
| int32 * | buffers_flushed, | ||
| int32 * | buffers_skipped | ||
| ) |
Definition at line 8031 of file bufmgr.c.
References BM_VALID, buf, CHECK_FOR_INTERRUPTS, CurrentResourceOwner, EvictUnpinnedBufferInternal(), fb(), GetBufferDescriptor(), LockBufHdr(), NBuffers, pg_atomic_read_u64(), ReservePrivateRefCountEntry(), ResourceOwnerEnlarge(), and BufferDesc::state.
Referenced by pg_buffercache_evict_all().
| void EvictRelUnpinnedBuffers | ( | Relation | rel, |
| int32 * | buffers_evicted, | ||
| int32 * | buffers_flushed, | ||
| int32 * | buffers_skipped | ||
| ) |
Definition at line 8081 of file bufmgr.c.
References Assert, BM_VALID, buf, BufTagMatchesRelFileLocator(), CHECK_FOR_INTERRUPTS, CurrentResourceOwner, EvictUnpinnedBufferInternal(), fb(), GetBufferDescriptor(), LockBufHdr(), NBuffers, pg_atomic_read_u64(), RelationData::rd_locator, RelationUsesLocalBuffers, ReservePrivateRefCountEntry(), ResourceOwnerEnlarge(), BufferDesc::state, BufferDesc::tag, and UnlockBufHdr().
Referenced by evict_rel(), and pg_buffercache_evict_relation().
Definition at line 8002 of file bufmgr.c.
References Assert, buf, BufferIsLocal, BufferIsValid(), CurrentResourceOwner, EvictUnpinnedBufferInternal(), fb(), GetBufferDescriptor(), LockBufHdr(), ReservePrivateRefCountEntry(), and ResourceOwnerEnlarge().
Referenced by invalidate_one_block(), modify_rel_block(), and pg_buffercache_evict().
|
static |
Definition at line 7940 of file bufmgr.c.
References Assert, BM_DIRTY, BM_LOCKED, BM_VALID, BUF_STATE_GET_REFCOUNT, fb(), FlushUnlockedBuffer(), InvalidateVictimBuffer(), IOCONTEXT_NORMAL, IOOBJECT_RELATION, pg_atomic_read_u64(), PinBuffer_Locked(), result, BufferDesc::state, UnlockBufHdr(), and UnpinBuffer().
Referenced by EvictAllUnpinnedBuffers(), EvictRelUnpinnedBuffers(), and EvictUnpinnedBuffer().
| Buffer ExtendBufferedRel | ( | BufferManagerRelation | bmr, |
| ForkNumber | forkNum, | ||
| BufferAccessStrategy | strategy, | ||
| uint32 | flags | ||
| ) |
Definition at line 970 of file bufmgr.c.
References buf, ExtendBufferedRelBy(), and fb().
Referenced by _bt_allocbuf(), _hash_getnewbuf(), BloomNewBuffer(), brinbuild(), brinbuildempty(), fill_seq_fork_with_data(), ginbuildempty(), GinNewBuffer(), gistbuildempty(), gistNewBuffer(), ReadBuffer_common(), revmap_physical_extend(), and SpGistNewBuffer().
| BlockNumber ExtendBufferedRelBy | ( | BufferManagerRelation | bmr, |
| ForkNumber | fork, | ||
| BufferAccessStrategy | strategy, | ||
| uint32 | flags, | ||
| uint32 | extend_by, | ||
| Buffer * | buffers, | ||
| uint32 * | extended_by | ||
| ) |
Definition at line 1002 of file bufmgr.c.
References Assert, ExtendBufferedRelCommon(), fb(), and InvalidBlockNumber.
Referenced by ExtendBufferedRel(), grow_rel(), and RelationAddBlocks().
|
static |
Definition at line 2751 of file bufmgr.c.
References BMR_GET_SMGR, ereport, errcode(), errmsg, ERROR, ExtendBufferedRelLocal(), ExtendBufferedRelShared(), fb(), and RELATION_IS_OTHER_TEMP.
Referenced by ExtendBufferedRelBy(), and ExtendBufferedRelTo().
|
static |
Definition at line 2809 of file bufmgr.c.
References Assert, BM_DIRTY, BM_PERMANENT, BM_TAG_VALID, BM_VALID, BMR_GET_SMGR, buf, BUF_STATE_GET_REFCOUNT, BUF_USAGECOUNT_ONE, BUFFER_IO_ALREADY_DONE, BUFFER_LOCK_EXCLUSIVE, BufferDescriptorGetBuffer(), BufHdrGetBlock, BufMappingPartitionLock(), BufTableHashCode(), BufTableInsert(), CurrentResourceOwner, EB_CLEAR_SIZE_CACHE, EB_LOCK_FIRST, EB_LOCK_TARGET, EB_SKIP_EXTENSION_LOCK, ereport, errcode(), errmsg, ERROR, ExclusiveLock, fb(), GetBufferDescriptor(), GetVictimBuffer(), hash(), i, INIT_FORKNUM, InitBufferTag(), InvalidBlockNumber, IOContextForStrategy(), IOOBJECT_RELATION, IOOP_EXTEND, LimitAdditionalPins(), LockBuffer(), LockBufHdr(), LockRelationForExtension(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MaxBlockNumber, MemSet, PageIsNew(), pg_atomic_fetch_and_u64(), pgBufferUsage, pgstat_count_io_op_time(), pgstat_prepare_io_time(), PinBuffer(), relpath, ReservePrivateRefCountEntry(), ResourceOwnerEnlarge(), BufferUsage::shared_blks_written, smgrnblocks(), smgrzeroextend(), StartSharedBufferIO(), str, TerminateBufferIO(), track_io_timing, UnlockBufHdrExt(), UnlockRelationForExtension(), and UnpinBuffer().
Referenced by ExtendBufferedRelCommon().
| Buffer ExtendBufferedRelTo | ( | BufferManagerRelation | bmr, |
| ForkNumber | fork, | ||
| BufferAccessStrategy | strategy, | ||
| uint32 | flags, | ||
| BlockNumber | extend_to, | ||
| ReadBufferMode | mode | ||
| ) |
Definition at line 1031 of file bufmgr.c.
References Assert, BMR_GET_SMGR, PrivateRefCountEntry::buffer, current_size, EB_CLEAR_SIZE_CACHE, EB_CREATE_FORK_IF_NEEDED, EB_LOCK_TARGET, EB_PERFORMING_RECOVERY, ExclusiveLock, ExtendBufferedRelCommon(), fb(), i, InvalidBlockNumber, InvalidBuffer, lengthof, LockRelationForExtension(), mode, RBM_ZERO_AND_CLEANUP_LOCK, RBM_ZERO_AND_LOCK, ReadBuffer_common(), ReleaseBuffer(), smgrcreate(), smgrexists(), smgrnblocks(), and UnlockRelationForExtension().
Referenced by fsm_extend(), vm_extend(), and XLogReadBufferExtended().
|
static |
Definition at line 5078 of file bufmgr.c.
References BufMappingPartitionLock(), BufTableHashCode(), BufTableLookup(), BufTagGetForkNum(), BufTagMatchesRelFileLocator(), fb(), GetBufferDescriptor(), InitBufferTag(), InvalidateBuffer(), LockBufHdr(), LW_SHARED, LWLockAcquire(), LWLockRelease(), and UnlockBufHdr().
Referenced by DropRelationBuffers(), and DropRelationsAllBuffers().
|
static |
Definition at line 4526 of file bufmgr.c.
References ErrorContextCallback::arg, Assert, BM_PERMANENT, buf, BUFFER_IO_ALREADY_DONE, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_SHARE_EXCLUSIVE, BufferGetLSN, BufferLockHeldByMeInMode(), BufHdrGetBlock, BufTagGetForkNum(), BufTagGetRelFileLocator(), ErrorContextCallback::callback, error_context_stack, fb(), INVALID_PROC_NUMBER, IOOP_WRITE, PageSetChecksum(), pg_atomic_read_u64(), pgBufferUsage, pgstat_count_io_op_time(), pgstat_prepare_io_time(), ErrorContextCallback::previous, BufferUsage::shared_blks_written, shared_buffer_write_error_callback(), smgropen(), smgrwrite(), StartSharedBufferIO(), TerminateBufferIO(), track_io_timing, and XLogFlush().
Referenced by FlushOneBuffer(), FlushUnlockedBuffer(), and GetVictimBuffer().
Definition at line 5549 of file bufmgr.c.
References BM_DIRTY, BM_VALID, CurrentResourceOwner, fb(), FlushUnlockedBuffer(), GetBufferDescriptor(), i, IOCONTEXT_NORMAL, IOOBJECT_RELATION, LockBufHdr(), NBuffers, PinBuffer_Locked(), ReservePrivateRefCountEntry(), ResourceOwnerEnlarge(), UnlockBufHdr(), and UnpinBuffer().
Referenced by dbase_redo().
Definition at line 5589 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BufferIsLocal, BufferIsLockedByMe(), BufferIsPinned, fb(), FlushBuffer(), GetBufferDescriptor(), IOCONTEXT_NORMAL, and IOOBJECT_RELATION.
Referenced by invalidate_one_block(), XLogFlushBufferForRedoIfInit(), and XLogReadBufferForRedoExtended().
Definition at line 5185 of file bufmgr.c.
References ErrorContextCallback::arg, BM_DIRTY, BM_VALID, BufferDescriptorGetBuffer(), BufTagMatchesRelFileLocator(), ErrorContextCallback::callback, CurrentResourceOwner, error_context_stack, fb(), FlushLocalBuffer(), FlushUnlockedBuffer(), GetBufferDescriptor(), GetLocalBufferDescriptor(), i, IOCONTEXT_NORMAL, IOOBJECT_RELATION, local_buffer_write_error_callback(), LockBufHdr(), NBuffers, NLocBuffer, pg_atomic_read_u64(), PinBuffer_Locked(), PinLocalBuffer(), ErrorContextCallback::previous, RelationData::rd_locator, RelationGetSmgr(), RelationUsesLocalBuffers, ReservePrivateRefCountEntry(), ResourceOwnerEnlarge(), UnlockBufHdr(), UnpinBuffer(), and UnpinLocalBuffer().
Referenced by fill_seq_with_data(), heapam_relation_copy_data(), and index_copy_data().
| void FlushRelationsAllBuffers | ( | SMgrRelation * | smgrs, |
| int | nrels | ||
| ) |
Definition at line 5273 of file bufmgr.c.
References Assert, BM_DIRTY, BM_VALID, BufTagGetRelFileLocator(), BufTagMatchesRelFileLocator(), CurrentResourceOwner, fb(), FlushUnlockedBuffer(), GetBufferDescriptor(), i, IOCONTEXT_NORMAL, IOOBJECT_RELATION, j, LockBufHdr(), NBuffers, palloc_array, pfree(), PinBuffer_Locked(), qsort, RelFileLocatorBackendIsTemp, RELS_BSEARCH_THRESHOLD, ReservePrivateRefCountEntry(), ResourceOwnerEnlarge(), rlocator_comparator(), UnlockBufHdr(), and UnpinBuffer().
Referenced by smgrdosyncall().
|
static |
Definition at line 4649 of file bufmgr.c.
References buf, PrivateRefCountEntry::buffer, BUFFER_LOCK_SHARE_EXCLUSIVE, BufferDescriptorGetBuffer(), BufferLockAcquire(), BufferLockUnlock(), fb(), and FlushBuffer().
Referenced by EvictUnpinnedBufferInternal(), FlushDatabaseBuffers(), FlushRelationBuffers(), FlushRelationsAllBuffers(), and SyncOneBuffer().
|
static |
Definition at line 565 of file bufmgr.c.
References Assert, BUFFER_LOCK_UNLOCK, fb(), InvalidBuffer, PrivateRefCountArray, PrivateRefCountArrayKeys, PrivateRefCountHash, PrivateRefCountOverflowed, REFCOUNT_ARRAY_ENTRIES, and ReservedRefCountSlot.
Referenced by UnlockReleaseBuffer(), and UnpinBufferNoOwner().
Definition at line 2707 of file bufmgr.c.
References fb(), MaxProportionalPins, PrivateRefCountOverflowed, and REFCOUNT_ARRAY_ENTRIES.
Referenced by LimitAdditionalPins(), and read_stream_start_pending_read().
Definition at line 2695 of file bufmgr.c.
References MaxProportionalPins.
Referenced by GetAccessStrategy(), and read_stream_begin_impl().
Definition at line 542 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BufferIsLocal, BufferIsValid(), fb(), and GetPrivateRefCountEntry().
Referenced by CheckBufferIsPinnedOnce(), ConditionalLockBufferForCleanup(), DebugPrintBufferRefcount(), HoldingBufferPinThatDelaysRecovery(), InvalidateBuffer(), InvalidateVictimBuffer(), IsBufferCleanupOK(), and MarkSharedBufferDirtyHint().
|
inlinestatic |
Definition at line 507 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BufferIsLocal, BufferIsValid(), fb(), GetPrivateRefCountEntrySlow(), likely, PrivateRefCountArray, and PrivateRefCountEntryLast.
Referenced by BufferLockAcquire(), BufferLockConditional(), BufferLockDisownInternal(), BufferLockHeldByMe(), BufferLockHeldByMeInMode(), GetPrivateRefCount(), IncrBufferRefCount(), PinBuffer(), PinBuffer_Locked(), ResOwnerReleaseBuffer(), SharedBufferBeginSetHintBits(), UnlockReleaseBuffer(), and UnpinBufferNoOwner().
|
static |
Definition at line 419 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, PrivateRefCountEntry::data, data, fb(), free, i, InvalidBuffer, likely, PrivateRefCountArray, PrivateRefCountArrayKeys, PrivateRefCountEntryLast, PrivateRefCountHash, PrivateRefCountOverflowed, REFCOUNT_ARRAY_ENTRIES, ReservedRefCountSlot, and ReservePrivateRefCountEntry().
Referenced by GetPrivateRefCountEntry().
|
static |
Definition at line 2548 of file bufmgr.c.
References Assert, BackendWritebackContext, BM_DIRTY, BM_PERMANENT, BM_TAG_VALID, BM_VALID, buf, BUF_STATE_GET_REFCOUNT, BUFFER_LOCK_SHARE_EXCLUSIVE, BUFFER_LOCK_UNLOCK, BufferDescriptorGetBuffer(), BufferGetLSN, BufferLockConditional(), CheckBufferIsPinnedOnce(), CurrentResourceOwner, fb(), FlushBuffer(), InvalidateVictimBuffer(), IOOBJECT_RELATION, IOOP_EVICT, IOOP_REUSE, LockBuffer(), pg_atomic_read_u64(), pgstat_count_io_op(), ReservePrivateRefCountEntry(), ResourceOwnerEnlarge(), ScheduleBufferTagForWriteback(), StrategyGetBuffer(), StrategyRejectBuffer(), UnlockReleaseBuffer(), UnpinBuffer(), and XLogNeedsFlush().
Referenced by BufferAlloc(), and ExtendBufferedRelShared().
Definition at line 6866 of file bufmgr.c.
References fb(), GetPrivateRefCount(), and GetStartupBufferPinWaitBufId().
Referenced by CheckRecoveryConflictDeadlock(), and ProcessRecoveryConflictInterrupt().
Definition at line 5693 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BufferIsLocal, BufferIsPinned, CurrentResourceOwner, fb(), GetPrivateRefCountEntry(), LocalRefCount, ResourceOwnerEnlarge(), and ResourceOwnerRememberBuffer().
Referenced by _bt_steppage(), btrestrpos(), entryLoadMoreItems(), ReadBufferBI(), RelationAddBlocks(), scanPostingTree(), startScanEntry(), and tts_buffer_heap_store_tuple().
Definition at line 4239 of file bufmgr.c.
References Assert, AtProcExit_Buffers(), CurrentMemoryContext, fb(), MaxBackends, MaxProportionalPins, MyProc, NBuffers, NUM_AUXILIARY_PROCS, on_shmem_exit(), PrivateRefCountArray, PrivateRefCountArrayKeys, and PrivateRefCountHash.
Referenced by BaseInit().
|
static |
Definition at line 2370 of file bufmgr.c.
References Assert, BM_LOCK_WAKE_IN_PROGRESS, BM_TAG_VALID, buf, BUF_FLAG_MASK, BUF_STATE_GET_REFCOUNT, BUF_USAGECOUNT_MASK, BufferDescriptorGetBuffer(), BufferTagsEqual(), BufMappingPartitionLock(), BufTableDelete(), BufTableHashCode(), ClearBufferTag(), elog, ERROR, fb(), GetPrivateRefCount(), LockBufHdr(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), UnlockBufHdr(), UnlockBufHdrExt(), and WaitIO().
Referenced by DropDatabaseBuffers(), DropRelationBuffers(), DropRelationsAllBuffers(), and FindAndDropRelationBuffers().
|
static |
Definition at line 2471 of file bufmgr.c.
References Assert, BM_DIRTY, BM_LOCK_WAKE_IN_PROGRESS, BM_TAG_VALID, BM_VALID, BUF_FLAG_MASK, BUF_STATE_GET_REFCOUNT, BUF_USAGECOUNT_MASK, BufferDescriptorGetBuffer(), BufferTagsEqual(), BufMappingPartitionLock(), BufTableDelete(), BufTableHashCode(), ClearBufferTag(), fb(), GetPrivateRefCount(), hash(), LockBufHdr(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), pg_atomic_read_u64(), UnlockBufHdr(), and UnlockBufHdrExt().
Referenced by EvictUnpinnedBufferInternal(), and GetVictimBuffer().
Definition at line 6950 of file bufmgr.c.
References Assert, BUF_STATE_GET_REFCOUNT, PrivateRefCountEntry::buffer, BUFFER_LOCK_EXCLUSIVE, BufferIsLocal, BufferIsLockedByMeInMode(), BufferIsValid(), fb(), GetBufferDescriptor(), GetPrivateRefCount(), LocalRefCount, LockBufHdr(), and UnlockBufHdr().
Referenced by _hash_doinsert(), _hash_expandtable(), _hash_splitbucket(), and hashbucketcleanup().
| void IssuePendingWritebacks | ( | WritebackContext * | wb_context, |
| IOContext | io_context | ||
| ) |
Definition at line 7789 of file bufmgr.c.
References buftag::blockNum, BufTagGetForkNum(), BufTagGetRelFileLocator(), cur, fb(), i, INVALID_PROC_NUMBER, IOOBJECT_RELATION, IOOP_WRITEBACK, next, pgstat_count_io_op_time(), pgstat_prepare_io_time(), RelFileLocatorEquals, smgropen(), smgrwriteback(), and track_io_timing.
Referenced by BufferSync(), and ScheduleBufferTagForWriteback().
Definition at line 2733 of file bufmgr.c.
References fb(), GetAdditionalPinLimit(), and Max.
Referenced by ExtendBufferedRelShared().
|
static |
Definition at line 8980 of file bufmgr.c.
References buffer_readv_complete(), and fb().
|
static |
Definition at line 8974 of file bufmgr.c.
References buffer_stage_common(), and fb().
Definition at line 7524 of file bufmgr.c.
References arg, BufTagGetForkNum(), BufTagGetRelFileLocator(), errcontext, fb(), MyProcNumber, and relpathbackend.
Referenced by FlushRelationBuffers().
Definition at line 6693 of file bufmgr.c.
References Assert, BM_PIN_COUNT_WAITER, BUF_STATE_GET_REFCOUNT, PrivateRefCountEntry::buffer, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_UNLOCK, BufferIsLocal, BufferIsPinned, CheckBufferIsPinnedOnce(), DeadlockTimeout, elog, ERROR, fb(), GetBufferDescriptor(), GetCurrentTimestamp(), InHotStandby, LockBuffer(), LockBufHdr(), log_recovery_conflict_waits, LogRecoveryConflict(), MyProcNumber, now(), pg_atomic_fetch_or_u64(), pg_atomic_read_u64(), PinCountWaitBuf, ProcWaitForSignal(), RECOVERY_CONFLICT_BUFFERPIN, ResolveRecoveryConflictWithBufferPin(), set_ps_display_remove_suffix(), set_ps_display_suffix(), SetStartupBufferPinWaitBufId(), TimestampDifferenceExceeds(), UnlockBufHdr(), UnlockBufHdrExt(), and waiting.
Referenced by _bt_upgradelockbufcleanup(), ginVacuumPostingTree(), hashbulkdelete(), heap_force_common(), lazy_scan_heap(), XLogReadBufferForRedoExtended(), and ZeroAndLockBuffer().
| void LockBufferInternal | ( | Buffer | buffer, |
| BufferLockMode | mode | ||
| ) |
Definition at line 6597 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_SHARE, BUFFER_LOCK_SHARE_EXCLUSIVE, BUFFER_LOCK_UNLOCK, BufferIsLocal, BufferIsPinned, BufferLockAcquire(), elog, ERROR, fb(), GetBufferDescriptor(), IsUnderPostmaster, mode, and MyProc.
Referenced by LockBuffer().
| uint64 LockBufHdr | ( | BufferDesc * | desc | ) |
Definition at line 7567 of file bufmgr.c.
References Assert, BM_LOCKED, BufferDescriptorGetBuffer(), BufferIsLocal, fb(), finish_spin_delay(), init_local_spin_delay, likely, perform_spin_delay(), pg_atomic_fetch_or_u64(), pg_atomic_read_u64(), and BufferDesc::state.
Referenced by AbortBufferIO(), apw_dump_now(), buffer_stage_common(), BufferAlloc(), BufferGetLSNAtomic(), BufferLockDequeueSelf(), BufferLockQueueSelf(), BufferLockWakeup(), BufferSync(), ConditionalLockBufferForCleanup(), create_toy_buffer(), DropDatabaseBuffers(), DropRelationBuffers(), DropRelationsAllBuffers(), EvictAllUnpinnedBuffers(), EvictRelUnpinnedBuffers(), EvictUnpinnedBuffer(), ExtendBufferedRelShared(), FindAndDropRelationBuffers(), FlushDatabaseBuffers(), FlushRelationBuffers(), FlushRelationsAllBuffers(), InvalidateBuffer(), InvalidateVictimBuffer(), IsBufferCleanupOK(), LockBufferForCleanup(), MarkDirtyAllUnpinnedBuffers(), MarkDirtyRelUnpinnedBuffers(), MarkDirtyUnpinnedBuffer(), MarkSharedBufferDirtyHint(), pg_buffercache_os_pages_internal(), pg_buffercache_pages(), StartSharedBufferIO(), SyncOneBuffer(), TerminateBufferIO(), UnlockBuffers(), WaitIO(), and WakePinCountWaiter().
Definition at line 3170 of file bufmgr.c.
References Assert, BM_DIRTY, BM_LOCKED, BUF_STATE_GET_REFCOUNT, PrivateRefCountEntry::buffer, BUFFER_LOCK_EXCLUSIVE, BufferIsLocal, BufferIsLockedByMeInMode(), BufferIsPinned, BufferIsValid(), elog, ERROR, fb(), GetBufferDescriptor(), MarkLocalBufferDirty(), pg_atomic_compare_exchange_u64(), pg_atomic_read_u64(), pgBufferUsage, BufferUsage::shared_blks_dirtied, VacuumCostActive, VacuumCostBalance, VacuumCostPageDirty, and WaitBufHdrUnlocked().
Referenced by _bt_clear_incomplete_split(), _bt_dedup_pass(), _bt_delitems_delete(), _bt_delitems_vacuum(), _bt_getroot(), _bt_insertonpg(), _bt_mark_page_halfdead(), _bt_newlevel(), _bt_restore_meta(), _bt_set_cleanup_info(), _bt_split(), _bt_unlink_halfdead_page(), _hash_addovflpage(), _hash_doinsert(), _hash_expandtable(), _hash_freeovflpage(), _hash_init(), _hash_splitbucket(), _hash_squeezebucket(), _hash_vacuum_one_page(), addLeafTuple(), brin_doinsert(), brin_doupdate(), brin_initialize_empty_new_buffer(), brin_xlog_createidx(), brin_xlog_desummarize_page(), brin_xlog_insert_update(), brin_xlog_revmap_extend(), brin_xlog_samepage_update(), brin_xlog_update(), brinbuild(), brinbuildempty(), brinRevmapDesummarizeRange(), btree_xlog_dedup(), btree_xlog_delete(), btree_xlog_insert(), btree_xlog_mark_page_halfdead(), btree_xlog_newroot(), btree_xlog_split(), btree_xlog_unlink_page(), btree_xlog_vacuum(), createPostingTree(), dataExecPlaceToPageInternal(), dataExecPlaceToPageLeaf(), doPickSplit(), entryExecPlaceToPage(), fill_seq_fork_with_data(), FreeSpaceMapPrepareTruncateRel(), generic_redo(), GenericXLogFinish(), ginbuild(), ginbuildempty(), ginbulkdelete(), ginDeletePostingPage(), ginHeapTupleFastInsert(), ginPlaceToPage(), ginRedoClearIncompleteSplit(), ginRedoCreatePTree(), ginRedoDeleteListPages(), ginRedoDeletePage(), ginRedoInsert(), ginRedoInsertListPage(), ginRedoUpdateMetapage(), ginRedoVacuumDataLeafPage(), ginUpdateStats(), ginVacuumPostingTreeLeaf(), gistbuild(), gistbuildempty(), gistdeletepage(), gistplacetopage(), gistprunepage(), gistRedoClearFollowRight(), gistRedoDeleteRecord(), gistRedoPageDelete(), gistRedoPageSplitRecord(), gistRedoPageUpdateRecord(), gistvacuumpage(), hash_xlog_add_ovfl_page(), hash_xlog_delete(), hash_xlog_init_bitmap_page(), hash_xlog_init_meta_page(), hash_xlog_insert(), hash_xlog_move_page_contents(), hash_xlog_split_allocate_page(), hash_xlog_split_cleanup(), hash_xlog_split_complete(), hash_xlog_squeeze_page(), hash_xlog_update_meta_page(), hash_xlog_vacuum_one_page(), hashbucketcleanup(), hashbulkdelete(), heap_abort_speculative(), heap_delete(), heap_finish_speculative(), heap_force_common(), heap_inplace_update_and_unlock(), heap_insert(), heap_lock_tuple(), heap_lock_updated_tuple_rec(), heap_multi_insert(), heap_page_prune_and_freeze(), heap_update(), heap_xlog_confirm(), heap_xlog_delete(), heap_xlog_inplace(), heap_xlog_insert(), heap_xlog_lock(), heap_xlog_lock_updated(), heap_xlog_multi_insert(), heap_xlog_prune_freeze(), heap_xlog_update(), lazy_scan_new_or_empty(), lazy_vacuum_heap_page(), log_newpage_range(), MarkDirtyUnpinnedBufferInternal(), moveLeafs(), nextval_internal(), ProcessSingleRelationFork(), RelationAddBlocks(), RelationCopyStorageUsingBuffer(), RelationGetBufferForTuple(), revmap_physical_extend(), saveNodeLink(), seq_redo(), SetSequence(), shiftList(), spgAddNodeAction(), spgbuild(), SpGistUpdateMetaPage(), spgRedoAddLeaf(), spgRedoAddNode(), spgRedoMoveLeafs(), spgRedoPickSplit(), spgRedoSplitTuple(), spgRedoVacuumLeaf(), spgRedoVacuumRedirect(), spgRedoVacuumRoot(), spgSplitNodeAction(), vacuumLeafPage(), vacuumLeafRoot(), vacuumRedirectAndPlaceholder(), visibilitymap_clear(), visibilitymap_prepare_truncate(), visibilitymap_set(), writeListPage(), XLogReadBufferForRedoExtended(), and XLogRecordPageWithFreeSpace().
Definition at line 5844 of file bufmgr.c.
References PrivateRefCountEntry::buffer, BufferIsLocal, BufferIsValid(), elog, ERROR, fb(), GetBufferDescriptor(), MarkLocalBufferDirty(), MarkSharedBufferDirtyHint(), and pg_atomic_read_u64().
Referenced by brin_start_evacuating_page(), btvacuumpage(), BufferFinishSetHintBits(), fsm_search(), fsm_search_avail(), fsm_set_and_search(), fsm_vacuum_page(), heap_page_fix_vm_corruption(), heap_page_prune_and_freeze(), prune_freeze_fast_path(), and read_seq_tuple().
| void MarkDirtyAllUnpinnedBuffers | ( | int32 * | buffers_dirtied, |
| int32 * | buffers_already_dirty, | ||
| int32 * | buffers_skipped | ||
| ) |
Definition at line 8281 of file bufmgr.c.
References BM_VALID, buf, CHECK_FOR_INTERRUPTS, CurrentResourceOwner, fb(), GetBufferDescriptor(), LockBufHdr(), MarkDirtyUnpinnedBufferInternal(), NBuffers, pg_atomic_read_u64(), ReservePrivateRefCountEntry(), ResourceOwnerEnlarge(), and BufferDesc::state.
Referenced by pg_buffercache_mark_dirty_all().
| void MarkDirtyRelUnpinnedBuffers | ( | Relation | rel, |
| int32 * | buffers_dirtied, | ||
| int32 * | buffers_already_dirty, | ||
| int32 * | buffers_skipped | ||
| ) |
Definition at line 8224 of file bufmgr.c.
References Assert, BM_VALID, buf, BufTagMatchesRelFileLocator(), CHECK_FOR_INTERRUPTS, CurrentResourceOwner, fb(), GetBufferDescriptor(), LockBufHdr(), MarkDirtyUnpinnedBufferInternal(), NBuffers, pg_atomic_read_u64(), RelationData::rd_locator, RelationUsesLocalBuffers, ReservePrivateRefCountEntry(), ResourceOwnerEnlarge(), BufferDesc::state, BufferDesc::tag, and UnlockBufHdr().
Referenced by pg_buffercache_mark_dirty_relation().
Definition at line 8188 of file bufmgr.c.
References Assert, buf, BufferIsLocal, CurrentResourceOwner, fb(), GetBufferDescriptor(), LockBufHdr(), MarkDirtyUnpinnedBufferInternal(), ReservePrivateRefCountEntry(), and ResourceOwnerEnlarge().
Referenced by pg_buffercache_mark_dirty().
|
static |
Definition at line 8132 of file bufmgr.c.
References Assert, BM_DIRTY, BM_LOCKED, BM_VALID, buf, BUF_STATE_GET_REFCOUNT, BUFFER_LOCK_EXCLUSIVE, BufferLockAcquire(), BufferLockUnlock(), fb(), MarkBufferDirty(), pg_atomic_read_u64(), PinBuffer_Locked(), result, BufferDesc::state, UnlockBufHdr(), and UnpinBuffer().
Referenced by MarkDirtyAllUnpinnedBuffers(), MarkDirtyRelUnpinnedBuffers(), and MarkDirtyUnpinnedBuffer().
|
inlinestatic |
Definition at line 5719 of file bufmgr.c.
References Assert, BM_DIRTY, BM_PERMANENT, BUF_STATE_GET_REFCOUNT, PrivateRefCountEntry::buffer, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_SHARE_EXCLUSIVE, BufferGetPage(), BufferLockHeldByMeInMode(), BufTagGetRelFileLocator(), fb(), GetPrivateRefCount(), InvalidXLogRecPtr, LockBufHdr(), PageSetLSN(), pgBufferUsage, RecoveryInProgress(), RelFileLocatorSkippingWAL(), BufferUsage::shared_blks_dirtied, unlikely, UnlockBufHdr(), UnlockBufHdrExt(), VacuumCostActive, VacuumCostBalance, VacuumCostPageDirty, XLogHintBitIsNeeded, XLogRecPtrIsValid, and XLogSaveBufferForHint().
Referenced by BufferSetHintBits16(), and MarkBufferDirtyHint().
|
static |
Definition at line 388 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BUFFER_LOCK_UNLOCK, PrivateRefCountEntry::data, PrivateRefCountData::lockmode, PrivateRefCountArray, PrivateRefCountArrayKeys, PrivateRefCountEntryLast, PrivateRefCountData::refcount, and ReservedRefCountSlot.
Referenced by TrackNewBufferPin().
|
static |
Definition at line 3295 of file bufmgr.c.
References Assert, b, BM_LOCKED, BM_MAX_USAGE_COUNT, BM_VALID, buf, BUF_REFCOUNT_ONE, BUF_STATE_GET_USAGECOUNT, BUF_USAGECOUNT_ONE, BufferDescriptorGetBuffer(), BufferIsLocal, CurrentResourceOwner, fb(), GetPrivateRefCountEntry(), pg_atomic_compare_exchange_u64(), pg_atomic_read_u64(), ReservedRefCountSlot, ResourceOwnerRememberBuffer(), result, TrackNewBufferPin(), unlikely, and WaitBufHdrUnlocked().
Referenced by BufferAlloc(), ExtendBufferedRelShared(), and ReadRecentBuffer().
|
static |
Definition at line 3411 of file bufmgr.c.
References Assert, buf, BufferDescriptorGetBuffer(), fb(), GetPrivateRefCountEntry(), pg_atomic_read_u64(), TrackNewBufferPin(), and UnlockBufHdrExt().
Referenced by EvictUnpinnedBufferInternal(), FlushDatabaseBuffers(), FlushRelationBuffers(), FlushRelationsAllBuffers(), MarkDirtyUnpinnedBufferInternal(), and SyncOneBuffer().
|
static |
Definition at line 1223 of file bufmgr.c.
References Assert, RelFileLocatorBackend::backend, BufferAlloc(), BufferDescriptorGetBuffer(), RelFileLocator::dbOid, fb(), LocalBufferAlloc(), RelFileLocatorBackend::locator, P_NEW, pgstat_count_buffer_read, RelFileLocator::relNumber, SMgrRelationData::smgr_rlocator, RelFileLocator::spcOid, and TrackBufferHit().
Referenced by ReadBuffer_common(), and StartReadBuffersImpl().
| PrefetchBufferResult PrefetchBuffer | ( | Relation | reln, |
| ForkNumber | forkNum, | ||
| BlockNumber | blockNum | ||
| ) |
Definition at line 787 of file bufmgr.c.
References Assert, BlockNumberIsValid(), ereport, errcode(), errmsg, ERROR, fb(), PrefetchLocalBuffer(), PrefetchSharedBuffer(), RELATION_IS_OTHER_TEMP, RelationGetSmgr(), RelationIsValid, and RelationUsesLocalBuffers.
Referenced by count_nondeletable_pages(), invalidate_one_block(), and pg_prewarm().
| PrefetchBufferResult PrefetchSharedBuffer | ( | SMgrRelation | smgr_reln, |
| ForkNumber | forkNum, | ||
| BlockNumber | blockNum | ||
| ) |
Definition at line 697 of file bufmgr.c.
References Assert, BlockNumberIsValid(), BufMappingPartitionLock(), BufTableHashCode(), BufTableLookup(), fb(), InitBufferTag(), InvalidBuffer, IO_DIRECT_DATA, io_direct_flags, LW_SHARED, LWLockAcquire(), LWLockRelease(), result, and smgrprefetch().
Referenced by PrefetchBuffer(), and XLogPrefetcherNextBlock().
|
static |
Definition at line 1714 of file bufmgr.c.
References Assert, DEBUG1, DEBUG3, elog, ERROR, fb(), likely, MAX_IO_COMBINE_LIMIT, operation, pgaio_result_report(), PGAIO_RS_ERROR, PGAIO_RS_PARTIAL, PGAIO_RS_UNKNOWN, PGAIO_RS_WARNING, pgaio_wref_valid(), PgAioReturn::result, PgAioResult::status, and WARNING.
Referenced by WaitReadBuffers().
| Buffer ReadBuffer | ( | Relation | reln, |
| BlockNumber | blockNum | ||
| ) |
Definition at line 879 of file bufmgr.c.
References fb(), MAIN_FORKNUM, RBM_NORMAL, and ReadBufferExtended().
Referenced by _bt_allocbuf(), _bt_getbuf(), _bt_relandgetbuf(), _bt_search_insert(), _hash_getbuf(), _hash_getbuf_with_condlock_cleanup(), blbulkdelete(), blinsert(), BloomNewBuffer(), brin_getinsertbuffer(), brinGetStats(), brinGetTupleForHeapBlock(), brinRevmapDesummarizeRange(), brinRevmapInitialize(), bt_metap(), bt_multi_page_stats(), bt_page_items_internal(), bt_page_stats_internal(), ginFindLeafPage(), ginFindParents(), ginGetStats(), ginHeapTupleFastInsert(), ginInsertCleanup(), GinNewBuffer(), ginStepRight(), ginUpdateStats(), gistBufferingFindCorrectParent(), gistbufferinginserttuples(), gistdoinsert(), gistFindCorrectParent(), gistFindPath(), gistfixsplit(), gistGetMaxLevel(), gistkillitems(), gistNewBuffer(), gistProcessItup(), gistScanPage(), heap_abort_speculative(), heap_delete(), heap_fetch(), heap_finish_speculative(), heap_force_common(), heap_get_latest_tid(), heap_index_delete_tuples(), heap_lock_tuple(), heap_update(), heapam_index_fetch_tuple(), initBloomState(), pg_visibility(), pgstatginindex_internal(), read_seq_tuple(), RelationGetBufferForTuple(), ReleaseAndReadBuffer(), revmap_get_buffer(), revmap_physical_extend(), scanGetCandidate(), scanPendingInsert(), shiftList(), spgdoinsert(), spgGetCache(), SpGistGetBuffer(), SpGistNewBuffer(), SpGistUpdateMetaPage(), and spgWalk().
|
static |
Definition at line 1276 of file bufmgr.c.
References BMR_REL, PrivateRefCountEntry::buffer, EB_LOCK_FIRST, EB_SKIP_EXTENSION_LOCK, ereport, errcode(), errmsg, ERROR, ExtendBufferedRel(), fb(), IOCONTEXT_NORMAL, IOContextForStrategy(), IOOBJECT_RELATION, IOOBJECT_TEMP_RELATION, mode, operation, P_NEW, PinBufferForBlock(), RBM_ZERO_AND_CLEANUP_LOCK, RBM_ZERO_AND_LOCK, RBM_ZERO_ON_ERROR, RelationData::rd_rel, READ_BUFFERS_SYNCHRONOUSLY, READ_BUFFERS_ZERO_ON_ERROR, RELATION_IS_OTHER_TEMP, StartReadBuffer(), unlikely, WaitReadBuffers(), and ZeroAndLockBuffer().
Referenced by ExtendBufferedRelTo(), ReadBufferExtended(), and ReadBufferWithoutRelcache().
|
inline |
Definition at line 926 of file bufmgr.c.
References buf, fb(), mode, ReadBuffer_common(), and RelationGetSmgr().
Referenced by _hash_getbuf_with_strategy(), _hash_getinitbuf(), _hash_getnewbuf(), BloomInitMetapage(), bt_recheck_sibling_links(), btvacuumpage(), count_nondeletable_pages(), create_toy_buffer(), fsm_readbuf(), get_raw_page_internal(), gin_check_parent_keys_consistency(), gin_check_posting_tree_parent_keys_consistency(), gin_refind_parent(), ginbulkdelete(), ginScanPostingTreeToDelete(), ginVacuumPostingTree(), ginVacuumPostingTreeLeaves(), gistvacuum_delete_empty_pages(), gistvacuumpage(), heapam_scan_sample_next_block(), log_newpage_range(), modify_rel_block(), palloc_btree_page(), pgstat_btree_page(), pgstat_gist_page(), pgstat_hash_page(), pgstat_heap(), pgstatindex_impl(), ProcessSingleRelationFork(), ReadBuffer(), ReadBufferBI(), spgprocesspending(), and vm_readbuf().
| Buffer ReadBufferWithoutRelcache | ( | RelFileLocator | rlocator, |
| ForkNumber | forkNum, | ||
| BlockNumber | blockNum, | ||
| ReadBufferMode | mode, | ||
| BufferAccessStrategy | strategy, | ||
| bool | permanent | ||
| ) |
Definition at line 954 of file bufmgr.c.
References fb(), INVALID_PROC_NUMBER, mode, ReadBuffer_common(), and smgropen().
Referenced by RelationCopyStorageUsingBuffer(), ScanSourceDatabasePgClass(), and XLogReadBufferExtended().
| bool ReadRecentBuffer | ( | RelFileLocator | rlocator, |
| ForkNumber | forkNum, | ||
| BlockNumber | blockNum, | ||
| Buffer | recent_buffer | ||
| ) |
Definition at line 818 of file bufmgr.c.
References Assert, b, BM_VALID, BufferIsLocal, BufferIsValid(), BufferTagsEqual(), CurrentResourceOwner, fb(), GetBufferDescriptor(), GetLocalBufferDescriptor(), InitBufferTag(), BufferUsage::local_blks_hit, pg_atomic_read_u64(), pgBufferUsage, PinBuffer(), PinLocalBuffer(), ReservePrivateRefCountEntry(), ResourceOwnerEnlarge(), BufferUsage::shared_blks_hit, and UnpinBuffer().
Referenced by invalidate_one_block(), and XLogReadBufferExtended().
|
static |
Definition at line 5371 of file bufmgr.c.
References Assert, BAS_BULKREAD, BAS_BULKWRITE, block_range_read_stream_cb(), buf, BUFFER_LOCK_SHARE, BufferGetBlockNumber(), BufferGetPage(), CHECK_FOR_INTERRUPTS, BlockRangeReadStreamPrivate::current_blocknum, END_CRIT_SECTION, fb(), FreeAccessStrategy(), GetAccessStrategy(), INIT_FORKNUM, INVALID_PROC_NUMBER, InvalidBuffer, BlockRangeReadStreamPrivate::last_exclusive, LockBuffer(), log_newpage_buffer(), MarkBufferDirty(), memcpy(), RBM_ZERO_AND_LOCK, read_stream_begin_smgr_relation(), read_stream_end(), READ_STREAM_FULL, read_stream_next_buffer(), READ_STREAM_USE_BATCHING, ReadBufferWithoutRelcache(), smgrextend(), smgrnblocks(), smgropen(), START_CRIT_SECTION, UnlockReleaseBuffer(), and XLogIsNeeded.
Referenced by CreateAndCopyRelationData().
| BlockNumber RelationGetNumberOfBlocksInFork | ( | Relation | relation, |
| ForkNumber | forkNum | ||
| ) |
Definition at line 4668 of file bufmgr.c.
References Assert, fb(), RelationData::rd_rel, RelationGetSmgr(), smgrnblocks(), and table_relation_size().
Referenced by _hash_getnewbuf(), _hash_init(), autoprewarm_database_main(), get_raw_page_internal(), pg_prewarm(), and ProcessSingleRelationFork().
| Buffer ReleaseAndReadBuffer | ( | Buffer | buffer, |
| Relation | relation, | ||
| BlockNumber | blockNum | ||
| ) |
Definition at line 3235 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BufferIsLocal, BufferIsPinned, BufferIsValid(), BufTagGetForkNum(), BufTagMatchesRelFileLocator(), fb(), GetBufferDescriptor(), GetLocalBufferDescriptor(), MAIN_FORKNUM, RelationData::rd_locator, ReadBuffer(), UnpinBuffer(), and UnpinLocalBuffer().
Referenced by ginFindLeafPage().
Definition at line 5609 of file bufmgr.c.
References PrivateRefCountEntry::buffer, BufferIsLocal, BufferIsValid(), elog, ERROR, GetBufferDescriptor(), UnpinBuffer(), and UnpinLocalBuffer().
Referenced by _bt_allocbuf(), _bt_pagedel(), _bt_search_insert(), _bt_unlink_halfdead_page(), _hash_dropbuf(), _hash_getbuf_with_condlock_cleanup(), autoprewarm_database_main(), BitmapHeapScanNextBlock(), blinsert(), BloomNewBuffer(), brin_getinsertbuffer(), brin_vacuum_scan(), bringetbitmap(), brinGetTupleForHeapBlock(), brininsert(), brinRevmapTerminate(), brinsummarize(), buffer_create_toy(), collect_corrupt_items(), collect_visibility_data(), entryLoadMoreItems(), ExecEndIndexOnlyScan(), ExtendBufferedRelTo(), FreeBulkInsertState(), freeGinBtreeStack(), fsm_search(), get_actual_variable_endpoint(), GetRecordedFreeSpace(), ginFindParents(), ginFinishSplit(), ginFreeScanKeys(), ginInsertCleanup(), GinNewBuffer(), gistdoinsert(), gistFindCorrectParent(), gistNewBuffer(), gistvacuum_delete_empty_pages(), grow_rel(), heap_abort_speculative(), heap_delete(), heap_endscan(), heap_fetch(), heap_fetch_next_buffer(), heap_force_common(), heap_insert(), heap_lock_tuple(), heap_lock_updated_tuple_rec(), heap_multi_insert(), heap_rescan(), heap_update(), heap_vac_scan_next_block(), heap_xlog_delete(), heap_xlog_insert(), heap_xlog_lock(), heap_xlog_lock_updated(), heap_xlog_multi_insert(), heap_xlog_update(), heapam_index_fetch_end(), heapam_index_fetch_tuple(), heapam_scan_sample_next_block(), heapam_tuple_lock(), heapgettup(), heapgettup_pagemode(), lazy_scan_heap(), lazy_vacuum_heap_rel(), pg_prewarm(), pg_visibility(), pg_visibility_map(), pgstatindex_impl(), read_buffers(), read_rel_block_ll(), read_stream_for_blocks(), read_stream_reset(), ReadBufferBI(), RelationAddBlocks(), ReleaseBulkInsertStatePin(), revmap_get_buffer(), spgdoinsert(), SpGistGetBuffer(), SpGistNewBuffer(), SpGistUpdateMetaPage(), statapprox_heap(), summarize_range(), terminate_brin_buildstate(), tts_buffer_heap_clear(), tts_buffer_heap_materialize(), tts_buffer_heap_store_tuple(), verify_heapam(), visibilitymap_count(), visibilitymap_get_status(), visibilitymap_pin(), and XLogReadBufferExtended().
Definition at line 309 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BUFFER_LOCK_UNLOCK, fb(), i, InvalidBuffer, PrivateRefCountArray, PrivateRefCountArrayKeys, PrivateRefCountClock, PrivateRefCountHash, PrivateRefCountOverflowed, REFCOUNT_ARRAY_ENTRIES, and ReservedRefCountSlot.
Referenced by BufferAlloc(), EvictAllUnpinnedBuffers(), EvictRelUnpinnedBuffers(), EvictUnpinnedBuffer(), ExtendBufferedRelShared(), FlushDatabaseBuffers(), FlushRelationBuffers(), FlushRelationsAllBuffers(), GetPrivateRefCountEntrySlow(), GetVictimBuffer(), MarkDirtyAllUnpinnedBuffers(), MarkDirtyRelUnpinnedBuffers(), MarkDirtyUnpinnedBuffer(), ReadRecentBuffer(), and SyncOneBuffer().
Definition at line 7930 of file bufmgr.c.
References DatumGetInt32(), and DebugPrintBufferRefcount().
Definition at line 7880 of file bufmgr.c.
References PrivateRefCountEntry::buffer, DatumGetInt32(), and psprintf().
Definition at line 7894 of file bufmgr.c.
References Assert, buf, PrivateRefCountEntry::buffer, BUFFER_LOCK_UNLOCK, BufferIsLocal, BufferIsValid(), BufferLockUnlock(), DatumGetInt32(), elog, ERROR, fb(), GetBufferDescriptor(), GetPrivateRefCountEntry(), HOLD_INTERRUPTS, UnpinBufferNoOwner(), and UnpinLocalBufferNoOwner().
Definition at line 7872 of file bufmgr.c.
References AbortBufferIO(), PrivateRefCountEntry::buffer, and DatumGetInt32().
Definition at line 7540 of file bufmgr.c.
References fb().
Referenced by buffertag_comparator(), DropRelationsAllBuffers(), and FlushRelationsAllBuffers().
| void ScheduleBufferTagForWriteback | ( | WritebackContext * | wb_context, |
| IOContext | io_context, | ||
| BufferTag * | tag | ||
| ) |
Definition at line 7739 of file bufmgr.c.
References Assert, enableFsync, fb(), IO_DIRECT_DATA, io_direct_flags, IssuePendingWritebacks(), PendingWriteback::tag, and WRITEBACK_MAX_PENDING_FLUSHES.
Referenced by GetVictimBuffer(), and SyncOneBuffer().
|
static |
Definition at line 8929 of file bufmgr.c.
References buffer_readv_complete(), and fb().
|
static |
Definition at line 8943 of file bufmgr.c.
References buffer_readv_decode_error(), RelFileLocator::dbOid, fb(), pgaio_io_get_target_data(), PGAIO_RS_OK, pgstat_report_checksum_failures_in_db(), PgAioTargetData::rlocator, and PgAioTargetData::smgr.
|
static |
Definition at line 8923 of file bufmgr.c.
References buffer_stage_common(), and fb().
Definition at line 7508 of file bufmgr.c.
References arg, BufTagGetForkNum(), BufTagGetRelFileLocator(), errcontext, fb(), and relpathperm.
Referenced by FlushBuffer().
|
inlinestatic |
Definition at line 7000 of file bufmgr.c.
References Assert, BM_LOCK_VAL_EXCLUSIVE, BM_LOCK_VAL_SHARE_EXCLUSIVE, BM_LOCK_VAL_SHARED, PrivateRefCountEntry::buffer, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_SHARE, BUFFER_LOCK_SHARE_EXCLUSIVE, BUFFER_LOCK_UNLOCK, elog, ERROR, fb(), GetPrivateRefCountEntry(), likely, mode, pg_atomic_compare_exchange_u64(), pg_atomic_read_u64(), and unlikely.
Referenced by BufferBeginSetHintBits(), and BufferSetHintBits16().
| StartBufferIOResult StartBufferIO | ( | Buffer | buffer, |
| bool | forInput, | ||
| bool | wait, | ||
| PgAioWaitRef * | io_wref | ||
| ) |
Definition at line 7370 of file bufmgr.c.
References PrivateRefCountEntry::buffer, BufferIsLocal, fb(), GetBufferDescriptor(), GetLocalBufferDescriptor(), StartLocalBufferIO(), and StartSharedBufferIO().
Referenced by AsyncReadBuffers().
| bool StartReadBuffer | ( | ReadBuffersOperation * | operation, |
| Buffer * | buffer, | ||
| BlockNumber | blocknum, | ||
| int | flags | ||
| ) |
Definition at line 1637 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, operation, result, and StartReadBuffersImpl().
Referenced by read_stream_next_buffer(), and ReadBuffer_common().
| bool StartReadBuffers | ( | ReadBuffersOperation * | operation, |
| Buffer * | buffers, | ||
| BlockNumber | blockNum, | ||
| int * | nblocks, | ||
| int | flags | ||
| ) |
Definition at line 1618 of file bufmgr.c.
References operation, and StartReadBuffersImpl().
Referenced by read_buffers(), and read_stream_start_pending_read().
|
static |
Definition at line 1371 of file bufmgr.c.
References Assert, AsyncReadBuffers(), BM_TAG_VALID, BM_VALID, BufferGetBlockNumber(), BufferIsLocal, CheckReadBuffersOperation(), DEBUG2, elog, ereport, errcode(), errmsg, ERROR, fb(), GetBufferDescriptor(), GetLocalBufferDescriptor(), i, InvalidBuffer, io_method, IOCONTEXT_NORMAL, IOContextForStrategy(), IOMETHOD_SYNC, IOOBJECT_RELATION, IOOBJECT_TEMP_RELATION, MAX_IO_COMBINE_LIMIT, operation, pg_atomic_read_u64(), pgaio_wref_clear(), PinBufferForBlock(), READ_BUFFERS_ISSUE_ADVICE, READ_BUFFERS_SYNCHRONOUSLY, RELATION_IS_OTHER_TEMP, smgrmaxcombine(), smgrprefetch(), and unlikely.
Referenced by StartReadBuffer(), and StartReadBuffers().
| StartBufferIOResult StartSharedBufferIO | ( | BufferDesc * | buf, |
| bool | forInput, | ||
| bool | wait, | ||
| PgAioWaitRef * | io_wref | ||
| ) |
Definition at line 7290 of file bufmgr.c.
References BM_DIRTY, BM_IO_IN_PROGRESS, BM_VALID, buf, BUFFER_IO_ALREADY_DONE, BUFFER_IO_IN_PROGRESS, BUFFER_IO_READY_FOR_IO, BufferDescriptorGetBuffer(), CurrentResourceOwner, fb(), LockBufHdr(), pgaio_submit_staged(), pgaio_wref_valid(), ResourceOwnerEnlarge(), ResourceOwnerRememberBufferIO(), UnlockBufHdr(), UnlockBufHdrExt(), and WaitIO().
Referenced by buffer_call_start_io(), ExtendBufferedRelShared(), FlushBuffer(), read_rel_block_ll(), StartBufferIO(), and ZeroAndLockBuffer().
|
static |
Definition at line 4152 of file bufmgr.c.
References BM_DIRTY, BM_VALID, BUF_REUSABLE, BUF_STATE_GET_REFCOUNT, BUF_STATE_GET_USAGECOUNT, BUF_WRITTEN, CurrentResourceOwner, fb(), FlushUnlockedBuffer(), GetBufferDescriptor(), IOCONTEXT_NORMAL, IOOBJECT_RELATION, LockBufHdr(), PinBuffer_Locked(), ReservePrivateRefCountEntry(), ResourceOwnerEnlarge(), result, ScheduleBufferTagForWriteback(), UnlockBufHdr(), and UnpinBuffer().
Referenced by BgBufferSync(), and BufferSync().
| void TerminateBufferIO | ( | BufferDesc * | buf, |
| bool | clear_dirty, | ||
| uint64 | set_flag_bits, | ||
| bool | forget_owner, | ||
| bool | release_aio | ||
| ) |
Definition at line 7407 of file bufmgr.c.
References Assert, BM_CHECKPOINT_NEEDED, BM_DIRTY, BM_IO_ERROR, BM_IO_IN_PROGRESS, BM_PIN_COUNT_WAITER, buf, BUF_STATE_GET_REFCOUNT, BufferDescriptorGetBuffer(), BufferDescriptorGetIOCV(), ConditionVariableBroadcast(), CurrentResourceOwner, fb(), LockBufHdr(), pgaio_wref_clear(), ResourceOwnerForgetBufferIO(), UnlockBufHdrExt(), and WakePinCountWaiter().
Referenced by AbortBufferIO(), buffer_call_terminate_io(), buffer_readv_complete_one(), ExtendBufferedRelShared(), FlushBuffer(), and ZeroAndLockBuffer().
|
static |
Definition at line 1683 of file bufmgr.c.
References RelFileLocatorBackend::backend, RelFileLocator::dbOid, fb(), IOOP_HIT, BufferUsage::local_blks_hit, RelFileLocatorBackend::locator, pgBufferUsage, pgstat_count_buffer_hit, pgstat_count_io_op(), RelFileLocator::relNumber, BufferUsage::shared_blks_hit, SMgrRelationData::smgr_rlocator, RelFileLocator::spcOid, VacuumCostActive, VacuumCostBalance, and VacuumCostPageHit.
Referenced by AsyncReadBuffers(), PinBufferForBlock(), and WaitReadBuffers().
Definition at line 3535 of file bufmgr.c.
References buf, BufHdrGetBlock, CurrentResourceOwner, fb(), GetBufferDescriptor(), NewPrivateRefCountEntry(), ResourceOwnerRememberBuffer(), and VALGRIND_MAKE_MEM_DEFINED.
Referenced by GetBufferFromRing(), PinBuffer(), PinBuffer_Locked(), and StrategyGetBuffer().
Definition at line 7704 of file bufmgr.c.
References a, b, DatumGetPointer(), and fb().
Referenced by BufferSync().
Definition at line 6581 of file bufmgr.c.
References Assert, PrivateRefCountEntry::buffer, BufferIsLocal, BufferIsPinned, BufferLockUnlock(), fb(), and GetBufferDescriptor().
Referenced by LockBuffer().
Definition at line 5875 of file bufmgr.c.
References BM_PIN_COUNT_WAITER, buf, fb(), LockBufHdr(), MyProcNumber, PinCountWaitBuf, and UnlockBufHdrExt().
Referenced by AbortSubTransaction(), AbortTransaction(), AtProcExit_Buffers(), AutoVacLauncherMain(), BackgroundWriterMain(), CheckpointerMain(), and WalWriterMain().
Definition at line 5626 of file bufmgr.c.
References Assert, BM_PIN_COUNT_WAITER, buf, BUF_REFCOUNT_ONE, PrivateRefCountEntry::buffer, BufferIsLocal, BufferIsPinned, BufferLockDisownInternal(), BufferLockProcessRelease(), BufferLockReleaseSub(), BufHdrGetBlock, CurrentResourceOwner, fb(), ForgetPrivateRefCountEntry(), GetBufferDescriptor(), GetPrivateRefCountEntry(), likely, mode, pg_atomic_sub_fetch_u64(), ResourceOwnerForgetBuffer(), RESUME_INTERRUPTS, UnpinLocalBuffer(), VALGRIND_MAKE_MEM_NOACCESS, and WakePinCountWaiter().
Referenced by _bt_clear_incomplete_split(), _bt_relbuf(), _bt_restore_meta(), _hash_relbuf(), allocNewBuffer(), AlterSequence(), blbulkdelete(), blgetbitmap(), blinsert(), BloomInitMetapage(), blvacuumcleanup(), brin_doinsert(), brin_doupdate(), brin_evacuate_page(), brin_getinsertbuffer(), brin_xlog_createidx(), brin_xlog_desummarize_page(), brin_xlog_insert_update(), brin_xlog_revmap_extend(), brin_xlog_samepage_update(), brin_xlog_update(), brinbuild(), brinbuildempty(), brinGetStats(), brinRevmapDesummarizeRange(), bt_metap(), bt_multi_page_stats(), bt_page_items_internal(), bt_page_stats_internal(), bt_recheck_sibling_links(), btree_xlog_dedup(), btree_xlog_delete(), btree_xlog_insert(), btree_xlog_mark_page_halfdead(), btree_xlog_newroot(), btree_xlog_split(), btree_xlog_unlink_page(), btree_xlog_vacuum(), collect_corrupt_items(), collect_visibility_data(), count_nondeletable_pages(), createPostingTree(), doPickSplit(), entryLoadMoreItems(), fill_seq_fork_with_data(), flushCachedPage(), FreeSpaceMapPrepareTruncateRel(), fsm_search(), fsm_set_and_search(), fsm_vacuum_page(), generic_redo(), get_raw_page_internal(), GetVictimBuffer(), gin_check_parent_keys_consistency(), gin_check_posting_tree_parent_keys_consistency(), gin_refind_parent(), ginbuild(), ginbuildempty(), ginbulkdelete(), ginGetStats(), ginHeapTupleFastInsert(), ginInsertCleanup(), ginPlaceToPage(), ginRedoClearIncompleteSplit(), ginRedoCreatePTree(), ginRedoDeleteListPages(), ginRedoDeletePage(), ginRedoInsert(), ginRedoInsertListPage(), ginRedoSplit(), ginRedoUpdateMetapage(), ginRedoVacuumDataLeafPage(), ginRedoVacuumPage(), ginScanPostingTreeToDelete(), ginStepRight(), ginUpdateStats(), ginvacuumcleanup(), ginVacuumPostingTree(), ginVacuumPostingTreeLeaves(), gistbufferinginserttuples(), gistbuild(), gistbuildempty(), gistdoinsert(), gistFindCorrectParent(), gistFindPath(), gistGetMaxLevel(), gistinserttuples(), gistkillitems(), gistplacetopage(), gistProcessItup(), gistRedoClearFollowRight(), gistRedoDeleteRecord(), gistRedoPageDelete(), gistRedoPageSplitRecord(), gistRedoPageUpdateRecord(), gistScanPage(), gistvacuum_delete_empty_pages(), gistvacuumpage(), hash_xlog_add_ovfl_page(), hash_xlog_delete(), hash_xlog_init_bitmap_page(), hash_xlog_init_meta_page(), hash_xlog_insert(), hash_xlog_move_page_contents(), hash_xlog_split_allocate_page(), hash_xlog_split_cleanup(), hash_xlog_split_complete(), hash_xlog_split_page(), hash_xlog_squeeze_page(), hash_xlog_update_meta_page(), hash_xlog_vacuum_one_page(), heap_delete(), heap_fetch(), heap_finish_speculative(), heap_force_common(), heap_get_latest_tid(), heap_index_delete_tuples(), heap_insert(), heap_lock_updated_tuple_rec(), heap_multi_insert(), heap_update(), heap_xlog_confirm(), heap_xlog_delete(), heap_xlog_inplace(), heap_xlog_insert(), heap_xlog_lock(), heap_xlog_lock_updated(), heap_xlog_multi_insert(), heap_xlog_prune_freeze(), heap_xlog_update(), heapam_scan_analyze_next_tuple(), initBloomState(), invalidate_one_block(), lazy_scan_heap(), lazy_scan_new_or_empty(), lazy_vacuum_heap_rel(), log_newpage_range(), modify_rel_block(), moveLeafs(), nextval_internal(), palloc_btree_page(), pg_get_sequence_data(), pg_sequence_last_value(), pg_visibility(), pgstat_gist_page(), pgstat_heap(), pgstatginindex_internal(), pgstathashindex(), pgstatindex_impl(), ProcessSingleRelationFork(), RelationCopyStorageUsingBuffer(), RelationGetBufferForTuple(), ResetSequence(), revmap_physical_extend(), scanGetCandidate(), scanPendingInsert(), scanPostingTree(), ScanSourceDatabasePgClass(), seq_redo(), SequenceChangePersistence(), SetSequence(), shiftList(), spgAddNodeAction(), spgbuild(), spgdoinsert(), spgGetCache(), SpGistGetBuffer(), SpGistUpdateMetaPage(), spgMatchNodeAction(), spgprocesspending(), spgRedoAddLeaf(), spgRedoAddNode(), spgRedoMoveLeafs(), spgRedoPickSplit(), spgRedoSplitTuple(), spgRedoVacuumLeaf(), spgRedoVacuumRedirect(), spgRedoVacuumRoot(), spgSplitNodeAction(), spgvacuumpage(), spgWalk(), statapprox_heap(), verify_heapam(), verifyBackupPageConsistency(), visibilitymap_prepare_truncate(), writeListPage(), xlog_redo(), and XLogRecordPageWithFreeSpace().
|
static |
Definition at line 3479 of file bufmgr.c.
References b, buf, BufferDescriptorGetBuffer(), CurrentResourceOwner, ResourceOwnerForgetBuffer(), and UnpinBufferNoOwner().
Referenced by BufferAlloc(), EvictUnpinnedBufferInternal(), ExtendBufferedRelShared(), FlushDatabaseBuffers(), FlushRelationBuffers(), FlushRelationsAllBuffers(), GetVictimBuffer(), MarkDirtyUnpinnedBufferInternal(), ReadRecentBuffer(), ReleaseAndReadBuffer(), ReleaseBuffer(), and SyncOneBuffer().
|
static |
Definition at line 3488 of file bufmgr.c.
References Assert, b, BM_PIN_COUNT_WAITER, buf, BUF_REFCOUNT_ONE, BufferDescriptorGetBuffer(), BufferIsLocal, BufferLockHeldByMe(), BufHdrGetBlock, fb(), ForgetPrivateRefCountEntry(), GetPrivateRefCountEntry(), pg_atomic_fetch_sub_u64(), VALGRIND_MAKE_MEM_NOACCESS, and WakePinCountWaiter().
Referenced by ResOwnerReleaseBuffer(), and UnpinBuffer().
| pg_noinline uint64 WaitBufHdrUnlocked | ( | BufferDesc * | buf | ) |
Definition at line 7615 of file bufmgr.c.
References BM_LOCKED, buf, fb(), finish_spin_delay(), init_local_spin_delay, perform_spin_delay(), and pg_atomic_read_u64().
Referenced by GetBufferFromRing(), MarkBufferDirty(), PinBuffer(), and StrategyGetBuffer().
|
static |
Definition at line 7188 of file bufmgr.c.
References Assert, BM_IO_IN_PROGRESS, buf, BufferDescriptorGetIOCV(), ConditionVariableCancelSleep(), ConditionVariablePrepareToSleep(), ConditionVariableSleep(), fb(), LockBufHdr(), pgaio_have_staged(), pgaio_wref_valid(), pgaio_wref_wait(), and UnlockBufHdr().
Referenced by InvalidateBuffer(), and StartSharedBufferIO().
| bool WaitReadBuffers | ( | ReadBuffersOperation * | operation | ) |
Definition at line 1759 of file bufmgr.c.
References Assert, AsyncReadBuffers(), BM_VALID, PrivateRefCountEntry::buffer, BufferIsLocal, CHECK_FOR_INTERRUPTS, CheckReadBuffersOperation(), elog, ERROR, fb(), GetBufferDescriptor(), GetLocalBufferDescriptor(), io_method, IOCONTEXT_NORMAL, IOContextForStrategy(), IOMETHOD_SYNC, IOOBJECT_RELATION, IOOBJECT_TEMP_RELATION, IOOP_READ, operation, pg_atomic_read_u64(), PGAIO_RS_UNKNOWN, pgaio_wref_check_done(), pgaio_wref_valid(), pgaio_wref_wait(), pgstat_count_io_op_time(), pgstat_prepare_io_time(), ProcessReadBuffersResult(), BufferDesc::state, track_io_timing, TrackBufferHit(), and unlikely.
Referenced by read_buffers(), read_stream_next_buffer(), and ReadBuffer_common().
|
static |
Definition at line 3443 of file bufmgr.c.
References BM_PIN_COUNT_WAITER, buf, BUF_STATE_GET_REFCOUNT, fb(), LockBufHdr(), ProcSendSignal(), UnlockBufHdr(), and UnlockBufHdrExt().
Referenced by TerminateBufferIO(), UnlockReleaseBuffer(), and UnpinBufferNoOwner().
| void WritebackContextInit | ( | WritebackContext * | context, |
| int * | max_pending | ||
| ) |
Definition at line 7727 of file bufmgr.c.
References Assert, WritebackContext::max_pending, WritebackContext::nr_pending, and WRITEBACK_MAX_PENDING_FLUSHES.
Referenced by BackgroundWriterMain(), BufferManagerShmemAttach(), BufferManagerShmemInit(), and BufferSync().
|
static |
Definition at line 1137 of file bufmgr.c.
References Assert, BM_VALID, PrivateRefCountEntry::buffer, BUFFER_IO_IN_PROGRESS, BUFFER_IO_READY_FOR_IO, BUFFER_LOCK_EXCLUSIVE, BufferGetPage(), BufferIsLocal, fb(), GetBufferDescriptor(), GetLocalBufferDescriptor(), LockBuffer(), LockBufferForCleanup(), mode, RBM_ZERO_AND_CLEANUP_LOCK, RBM_ZERO_AND_LOCK, StartLocalBufferIO(), StartSharedBufferIO(), TerminateBufferIO(), and TerminateLocalBufferIO().
Referenced by ReadBuffer_common().
| const PgAioHandleCallbacks aio_local_buffer_readv_cb |
Definition at line 8996 of file bufmgr.c.
| const PgAioHandleCallbacks aio_shared_buffer_readv_cb |
Definition at line 8987 of file bufmgr.c.
| int backend_flush_after = DEFAULT_BACKEND_FLUSH_AFTER |
Definition at line 225 of file bufmgr.c.
Referenced by BufferManagerShmemAttach(), and BufferManagerShmemInit().
| int bgwriter_flush_after = DEFAULT_BGWRITER_FLUSH_AFTER |
Definition at line 224 of file bufmgr.c.
Referenced by BackgroundWriterMain().
| int bgwriter_lru_maxpages = 100 |
Definition at line 190 of file bufmgr.c.
Referenced by BgBufferSync().
| double bgwriter_lru_multiplier = 2.0 |
Definition at line 191 of file bufmgr.c.
Referenced by BgBufferSync().
| const ResourceOwnerDesc buffer_io_resowner_desc |
Definition at line 285 of file bufmgr.c.
Referenced by ResourceOwnerForgetBufferIO(), and ResourceOwnerRememberBufferIO().
| const ResourceOwnerDesc buffer_resowner_desc |
Definition at line 294 of file bufmgr.c.
Referenced by ResourceOwnerForgetBuffer(), and ResourceOwnerRememberBuffer().
| int checkpoint_flush_after = DEFAULT_CHECKPOINT_FLUSH_AFTER |
Definition at line 223 of file bufmgr.c.
Referenced by BufferSync().
| int effective_io_concurrency = DEFAULT_EFFECTIVE_IO_CONCURRENCY |
Definition at line 200 of file bufmgr.c.
Referenced by get_tablespace_io_concurrency(), GetAccessStrategy(), read_stream_begin_impl(), and tablespace_reloptions().
| int io_combine_limit = DEFAULT_IO_COMBINE_LIMIT |
Definition at line 215 of file bufmgr.c.
Referenced by assign_io_combine_limit(), assign_io_max_combine_limit(), GetAccessStrategy(), read_buffers(), read_stream_begin_impl(), read_stream_next_buffer(), and read_stream_reset().
| int io_combine_limit_guc = DEFAULT_IO_COMBINE_LIMIT |
Definition at line 216 of file bufmgr.c.
Referenced by assign_io_max_combine_limit().
| int io_max_combine_limit = DEFAULT_IO_COMBINE_LIMIT |
Definition at line 217 of file bufmgr.c.
Referenced by AioHandleDataShmemSize(), AioHandleIOVShmemSize(), AioShmemInit(), assign_io_combine_limit(), pgaio_io_set_handle_data_32(), and pgaio_io_set_handle_data_64().
| int maintenance_io_concurrency = DEFAULT_MAINTENANCE_IO_CONCURRENCY |
Definition at line 207 of file bufmgr.c.
Referenced by assign_maintenance_io_concurrency(), get_tablespace_maintenance_io_concurrency(), heap_index_delete_tuples(), tablespace_reloptions(), and XLogPrefetcherReadRecord().
|
static |
Definition at line 271 of file bufmgr.c.
Referenced by GetAdditionalPinLimit(), GetPinLimit(), and InitBufferManagerAccess().
|
static |
Definition at line 228 of file bufmgr.c.
Referenced by LockBufferForCleanup(), and UnlockBuffers().
|
static |
Definition at line 264 of file bufmgr.c.
Referenced by CheckForBufferLeaks(), ForgetPrivateRefCountEntry(), GetPrivateRefCountEntry(), GetPrivateRefCountEntrySlow(), InitBufferManagerAccess(), NewPrivateRefCountEntry(), and ReservePrivateRefCountEntry().
|
static |
Definition at line 263 of file bufmgr.c.
Referenced by CheckForBufferLeaks(), ForgetPrivateRefCountEntry(), GetPrivateRefCountEntrySlow(), InitBufferManagerAccess(), NewPrivateRefCountEntry(), and ReservePrivateRefCountEntry().
|
static |
Definition at line 267 of file bufmgr.c.
Referenced by ReservePrivateRefCountEntry().
|
static |
Definition at line 269 of file bufmgr.c.
Referenced by GetPrivateRefCountEntry(), GetPrivateRefCountEntrySlow(), and NewPrivateRefCountEntry().
|
static |
Definition at line 265 of file bufmgr.c.
Referenced by CheckForBufferLeaks(), ForgetPrivateRefCountEntry(), GetPrivateRefCountEntrySlow(), InitBufferManagerAccess(), and ReservePrivateRefCountEntry().
|
static |
Definition at line 266 of file bufmgr.c.
Referenced by AtEOXact_Buffers(), CheckForBufferLeaks(), ForgetPrivateRefCountEntry(), GetAdditionalPinLimit(), GetPrivateRefCountEntrySlow(), and ReservePrivateRefCountEntry().
|
static |
Definition at line 268 of file bufmgr.c.
Referenced by ForgetPrivateRefCountEntry(), GetPrivateRefCountEntrySlow(), NewPrivateRefCountEntry(), PinBuffer(), and ReservePrivateRefCountEntry().
Definition at line 192 of file bufmgr.c.
Referenced by AsyncReadBuffers(), BufFileDumpBuffer(), BufFileLoadBuffer(), do_analyze_rel(), ExtendBufferedRelLocal(), ExtendBufferedRelShared(), FlushBuffer(), FlushLocalBuffer(), heap_vacuum_rel(), IssuePendingWritebacks(), mdsyncfiletag(), pgstat_count_backend_io_op_time(), register_dirty_segment(), show_buffer_usage(), and WaitReadBuffers().
Definition at line 189 of file bufmgr.c.
Referenced by AsyncReadBuffers(), mdreadv(), and read_rel_block_ll().