PostgreSQL Source Code
git master
|
Go to the source code of this file.
Data Structures | |
struct | SMgrRelationData |
Macros | |
#define | SmgrIsTemp(smgr) RelFileNodeBackendIsTemp((smgr)->smgr_rnode) |
Typedefs | |
typedef struct SMgrRelationData | SMgrRelationData |
typedef SMgrRelationData * | SMgrRelation |
#define SmgrIsTemp | ( | smgr | ) | RelFileNodeBackendIsTemp((smgr)->smgr_rnode) |
Definition at line 80 of file smgr.h.
Referenced by mdextend(), mdtruncate(), mdwrite(), ReadBuffer_common(), and register_dirty_segment().
void AtEOXact_SMgr | ( | void | ) |
Definition at line 798 of file smgr.c.
References Assert, SMgrRelationData::smgr_owner, and smgrclose().
Referenced by AbortTransaction(), AutoVacLauncherMain(), BackgroundWriterMain(), CheckpointerMain(), CommitTransaction(), PrepareTransaction(), and WalWriterMain().
void ForgetDatabaseFsyncRequests | ( | Oid | dbid | ) |
Definition at line 1684 of file md.c.
References RelFileNode::dbNode, FORGET_DATABASE_FSYNC, ForwardFsyncRequest(), InvalidForkNumber, IsUnderPostmaster, pg_usleep(), RelFileNode::relNode, RememberFsyncRequest(), and RelFileNode::spcNode.
Referenced by dbase_redo(), and dropdb().
void ForgetRelationFsyncRequests | ( | RelFileNode | rnode, |
ForkNumber | forknum | ||
) |
Definition at line 1651 of file md.c.
References FORGET_RELATION_FSYNC, ForwardFsyncRequest(), IsUnderPostmaster, pg_usleep(), and RememberFsyncRequest().
Referenced by mdunlink().
void mdclose | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 627 of file md.c.
References _fdvec_resize(), FileClose(), SMgrRelationData::md_num_open_segs, SMgrRelationData::md_seg_fds, and _MdfdVec::mdfd_vfd.
Referenced by mdexists().
void mdcreate | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
bool | isRedo | ||
) |
Definition at line 293 of file md.c.
References _fdvec_resize(), Assert, ereport, errcode_for_file_access(), errmsg(), ERROR, fd(), IsBootstrapProcessingMode, SMgrRelationData::md_num_open_segs, SMgrRelationData::md_seg_fds, _MdfdVec::mdfd_segno, _MdfdVec::mdfd_vfd, PathNameOpenFile(), pfree(), PG_BINARY, relpath, and SMgrRelationData::smgr_rnode.
bool mdexists | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
void mdextend | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
char * | buffer, | ||
bool | skipFsync | ||
) |
Definition at line 494 of file md.c.
References _mdfd_getseg(), _mdnblocks(), Assert, ereport, errcode(), errcode_for_file_access(), errhint(), errmsg(), ERROR, EXTENSION_CREATE, FilePathName(), FileSeek(), FileWrite(), InvalidBlockNumber, _MdfdVec::mdfd_vfd, mdnblocks(), register_dirty_segment(), relpath, SMgrRelationData::smgr_rnode, SmgrIsTemp, and WAIT_EVENT_DATA_FILE_EXTEND.
Referenced by _mdfd_getseg().
void mdimmedsync | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 1024 of file md.c.
References ereport, errcode_for_file_access(), errmsg(), ERROR, FilePathName(), FileSync(), SMgrRelationData::md_num_open_segs, SMgrRelationData::md_seg_fds, _MdfdVec::mdfd_vfd, mdnblocks(), and WAIT_EVENT_DATA_FILE_IMMEDIATE_SYNC.
void mdinit | ( | void | ) |
Definition at line 205 of file md.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, AmCheckpointerProcess, AmStartupProcess, HASHCTL::entrysize, HASH_BLOBS, HASH_CONTEXT, hash_create(), HASH_ELEM, HASHCTL::hcxt, IsUnderPostmaster, HASHCTL::keysize, MemoryContextAllowInCriticalSection(), MemSet, NIL, pendingOpsCxt, and TopMemoryContext.
BlockNumber mdnblocks | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 872 of file md.c.
References _mdfd_openseg(), _mdnblocks(), Assert, elog, EXTENSION_FAIL, FATAL, SMgrRelationData::md_num_open_segs, SMgrRelationData::md_seg_fds, and mdopen().
Referenced by mdextend(), mdimmedsync(), mdtruncate(), and mdwrite().
void mdpostckpt | ( | void | ) |
Definition at line 1360 of file md.c.
References AbsorbFsyncRequests(), PendingUnlinkEntry::cycle_ctr, ereport, errcode_for_file_access(), errmsg(), linitial, list_delete_first(), MAIN_FORKNUM, mdckpt_cycle_ctr, NIL, pfree(), relpathperm, PendingUnlinkEntry::rnode, UNLINKS_PER_ABSORB, and WARNING.
void mdpreckpt | ( | void | ) |
void mdprefetch | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum | ||
) |
Definition at line 658 of file md.c.
References _mdfd_getseg(), Assert, EXTENSION_FAIL, FilePrefetch(), _MdfdVec::mdfd_vfd, and WAIT_EVENT_DATA_FILE_PREFETCH.
void mdread | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
char * | buffer | ||
) |
Definition at line 730 of file md.c.
References _mdfd_getseg(), Assert, RelFileNodeBackend::backend, RelFileNode::dbNode, ereport, errcode(), ERRCODE_DATA_CORRUPTED, errcode_for_file_access(), errmsg(), ERROR, EXTENSION_CREATE_RECOVERY, EXTENSION_FAIL, FilePathName(), FileRead(), FileSeek(), InRecovery, _MdfdVec::mdfd_vfd, MemSet, RelFileNodeBackend::node, RelFileNode::relNode, SMgrRelationData::smgr_rnode, RelFileNode::spcNode, WAIT_EVENT_DATA_FILE_READ, and zero_damaged_pages.
void mdsync | ( | void | ) |
Definition at line 1053 of file md.c.
References _mdfd_getseg(), _mdfd_segpath(), AbsorbFsyncRequests(), Assert, bms_first_member(), bms_free(), PendingOperationEntry::canceled, CheckpointStats, CheckpointStatsData::ckpt_agg_sync_time, CheckpointStatsData::ckpt_longest_sync, CheckpointStatsData::ckpt_sync_rels, PendingOperationEntry::cycle_ctr, DEBUG1, elog, enableFsync, ereport, errcode_for_file_access(), errmsg(), ERROR, EXTENSION_DONT_CHECK_SIZE, EXTENSION_RETURN_NULL, FILE_POSSIBLY_DELETED, FilePathName(), FileSync(), FSYNCS_PER_ABSORB, HASH_REMOVE, hash_search(), hash_seq_init(), hash_seq_search(), INSTR_TIME_GET_MICROSEC, INSTR_TIME_SET_CURRENT, INSTR_TIME_SUBTRACT, InvalidBackendId, log_checkpoints, longest(), MAX_FORKNUM, _MdfdVec::mdfd_vfd, mdsync_cycle_ctr, pfree(), PendingOperationEntry::requests, PendingOperationEntry::rnode, smgropen(), and WAIT_EVENT_DATA_FILE_SYNC.
Referenced by SetForwardFsyncRequests().
void mdtruncate | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | nblocks | ||
) |
Definition at line 927 of file md.c.
References _fdvec_resize(), Assert, ereport, errcode_for_file_access(), errmsg(), ERROR, FileClose(), FilePathName(), FileTruncate(), InRecovery, SMgrRelationData::md_num_open_segs, SMgrRelationData::md_seg_fds, _MdfdVec::mdfd_vfd, mdnblocks(), register_dirty_segment(), relpath, SMgrRelationData::smgr_rnode, SmgrIsTemp, and WAIT_EVENT_DATA_FILE_TRUNCATE.
void mdunlink | ( | RelFileNodeBackend | rnode, |
ForkNumber | forknum, | ||
bool | isRedo | ||
) |
Definition at line 386 of file md.c.
References ForgetRelationFsyncRequests(), InvalidForkNumber, MAX_FORKNUM, mdunlinkfork(), RelFileNodeBackend::node, and RelFileNodeBackendIsTemp.
void mdwrite | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
char * | buffer, | ||
bool | skipFsync | ||
) |
Definition at line 801 of file md.c.
References _mdfd_getseg(), Assert, RelFileNodeBackend::backend, RelFileNode::dbNode, ereport, errcode(), errcode_for_file_access(), errhint(), errmsg(), ERROR, EXTENSION_CREATE_RECOVERY, EXTENSION_FAIL, FilePathName(), FileSeek(), FileWrite(), _MdfdVec::mdfd_vfd, mdnblocks(), RelFileNodeBackend::node, register_dirty_segment(), RelFileNode::relNode, SMgrRelationData::smgr_rnode, SmgrIsTemp, RelFileNode::spcNode, and WAIT_EVENT_DATA_FILE_WRITE.
void mdwriteback | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
BlockNumber | nblocks | ||
) |
Definition at line 681 of file md.c.
References _mdfd_getseg(), Assert, EXTENSION_RETURN_NULL, FileWriteback(), _MdfdVec::mdfd_vfd, and WAIT_EVENT_DATA_FILE_FLUSH.
void RememberFsyncRequest | ( | RelFileNode | rnode, |
ForkNumber | forknum, | ||
BlockNumber | segno | ||
) |
Definition at line 1513 of file md.c.
References Assert, bms_add_member(), bms_free(), PendingOperationEntry::canceled, PendingOperationEntry::cycle_ctr, PendingUnlinkEntry::cycle_ctr, RelFileNode::dbNode, FORGET_DATABASE_FSYNC, FORGET_RELATION_FSYNC, HASH_ENTER, HASH_FIND, hash_search(), hash_seq_init(), hash_seq_search(), InvalidForkNumber, lappend(), lfirst, list_delete_cell(), list_head(), lnext, MAIN_FORKNUM, MAX_FORKNUM, mdckpt_cycle_ctr, mdsync_cycle_ctr, MemoryContextSwitchTo(), MemSet, next, palloc(), pfree(), PendingOperationEntry::requests, PendingOperationEntry::rnode, PendingUnlinkEntry::rnode, and UNLINK_RELATION_REQUEST.
Referenced by AbsorbFsyncRequests(), ForgetDatabaseFsyncRequests(), ForgetRelationFsyncRequests(), register_dirty_segment(), and register_unlink().
void SetForwardFsyncRequests | ( | void | ) |
Definition at line 253 of file md.c.
References Assert, hash_destroy(), mdsync(), and NIL.
Referenced by StartupXLOG().
void smgrclearowner | ( | SMgrRelation * | owner, |
SMgrRelation | reln | ||
) |
Definition at line 222 of file smgr.c.
References add_to_unowned_list(), and SMgrRelationData::smgr_owner.
Referenced by FreeFakeRelcacheEntry().
void smgrclose | ( | SMgrRelation | reln | ) |
Definition at line 296 of file smgr.c.
References elog, ERROR, HASH_REMOVE, hash_search(), MAX_FORKNUM, remove_from_unowned_list(), f_smgr::smgr_close, SMgrRelationData::smgr_owner, SMgrRelationData::smgr_rnode, and SMgrRelationData::smgr_which.
Referenced by AtEOXact_SMgr(), ATExecSetTableSpace(), FinishPreparedTransaction(), smgrcloseall(), smgrclosenode(), smgrDoPendingDeletes(), xact_redo_abort(), and xact_redo_commit().
void smgrcloseall | ( | void | ) |
Definition at line 326 of file smgr.c.
References hash_seq_init(), hash_seq_search(), smgrclose(), and status().
Referenced by BackgroundWriterMain(), CheckpointerMain(), RelationCacheInvalidate(), RequestCheckpoint(), WalWriterMain(), and XLogDropDatabase().
void smgrclosenode | ( | RelFileNodeBackend | rnode | ) |
Definition at line 350 of file smgr.c.
References HASH_FIND, hash_search(), and smgrclose().
Referenced by LocalExecuteInvalidationMessage(), and RelationSetNewRelfilenode().
void smgrcreate | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
bool | isRedo | ||
) |
Definition at line 376 of file smgr.c.
References RelFileNode::dbNode, SMgrRelationData::md_num_open_segs, RelFileNodeBackend::node, f_smgr::smgr_create, SMgrRelationData::smgr_rnode, SMgrRelationData::smgr_which, RelFileNode::spcNode, and TablespaceCreateDbspace().
Referenced by ATExecSetTableSpace(), fsm_extend(), heap_create_init_fork(), index_build(), RelationCreateStorage(), smgr_redo(), vm_extend(), and XLogReadBufferExtended().
void smgrdounlink | ( | SMgrRelation | reln, |
bool | isRedo | ||
) |
Definition at line 414 of file smgr.c.
References CacheInvalidateSmgr(), DropRelFileNodesAllBuffers(), InvalidForkNumber, MAX_FORKNUM, f_smgr::smgr_close, SMgrRelationData::smgr_rnode, f_smgr::smgr_unlink, and SMgrRelationData::smgr_which.
Referenced by FinishPreparedTransaction(), xact_redo_abort(), and xact_redo_commit().
void smgrdounlinkall | ( | SMgrRelation * | rels, |
int | nrels, | ||
bool | isRedo | ||
) |
Definition at line 471 of file smgr.c.
References CacheInvalidateSmgr(), DropRelFileNodesAllBuffers(), i, MAX_FORKNUM, palloc(), pfree(), f_smgr::smgr_close, SMgrRelationData::smgr_rnode, f_smgr::smgr_unlink, and SMgrRelationData::smgr_which.
Referenced by smgrDoPendingDeletes().
void smgrdounlinkfork | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
bool | isRedo | ||
) |
Definition at line 549 of file smgr.c.
References CacheInvalidateSmgr(), DropRelFileNodeBuffers(), f_smgr::smgr_close, SMgrRelationData::smgr_rnode, f_smgr::smgr_unlink, and SMgrRelationData::smgr_which.
bool smgrexists | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 287 of file smgr.c.
References f_smgr::smgr_exists, and SMgrRelationData::smgr_which.
Referenced by ATExecSetTableSpace(), autoprewarm_database_main(), FreeSpaceMapTruncateRel(), fsm_extend(), fsm_readbuf(), index_build(), pg_prewarm(), RelationTruncate(), smgr_redo(), visibilitymap_truncate(), vm_extend(), and vm_readbuf().
void smgrextend | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
char * | buffer, | ||
bool | skipFsync | ||
) |
Definition at line 600 of file smgr.c.
References f_smgr::smgr_extend, and SMgrRelationData::smgr_which.
Referenced by _bt_blwritepage(), _hash_alloc_buckets(), copy_relation_data(), end_heap_rewrite(), fsm_extend(), raw_heap_insert(), ReadBuffer_common(), and vm_extend().
void smgrimmedsync | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 734 of file smgr.c.
References f_smgr::smgr_immedsync, and SMgrRelationData::smgr_which.
Referenced by _bt_load(), blbuildempty(), btbuildempty(), copy_relation_data(), heap_create_init_fork(), heap_sync(), and spgbuildempty().
void smgrinit | ( | void | ) |
Definition at line 102 of file smgr.c.
References i, NSmgr, on_proc_exit(), f_smgr::smgr_init, and smgrshutdown().
Referenced by BaseInit().
BlockNumber smgrnblocks | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 672 of file smgr.c.
References f_smgr::smgr_nblocks, and SMgrRelationData::smgr_which.
Referenced by copy_relation_data(), FreeSpaceMapTruncateRel(), fsm_extend(), fsm_readbuf(), gistBuildCallback(), ReadBuffer_common(), RelationGetNumberOfBlocksInFork(), visibilitymap_truncate(), vm_extend(), vm_readbuf(), and XLogReadBufferExtended().
SMgrRelation smgropen | ( | RelFileNode | rnode, |
BackendId | backend | ||
) |
Definition at line 137 of file smgr.c.
References add_to_unowned_list(), RelFileNodeBackend::backend, HASHCTL::entrysize, HASH_BLOBS, hash_create(), HASH_ELEM, HASH_ENTER, hash_search(), InvalidBlockNumber, HASHCTL::keysize, MAX_FORKNUM, SMgrRelationData::md_num_open_segs, MemSet, RelFileNodeBackend::node, SMgrRelationData::smgr_fsm_nblocks, SMgrRelationData::smgr_owner, SMgrRelationData::smgr_targblock, SMgrRelationData::smgr_vm_nblocks, and SMgrRelationData::smgr_which.
Referenced by ATExecSetTableSpace(), FinishPreparedTransaction(), FlushBuffer(), IssuePendingWritebacks(), LocalBufferAlloc(), mdsync(), ReadBufferWithoutRelcache(), RelationCreateStorage(), smgr_redo(), smgrDoPendingDeletes(), xact_redo_abort(), xact_redo_commit(), and XLogReadBufferExtended().
void smgrpostckpt | ( | void | ) |
Definition at line 774 of file smgr.c.
References i, NSmgr, and f_smgr::smgr_post_ckpt.
Referenced by CreateCheckPoint().
void smgrpreckpt | ( | void | ) |
Definition at line 744 of file smgr.c.
References i, NSmgr, and f_smgr::smgr_pre_ckpt.
Referenced by CreateCheckPoint().
void smgrprefetch | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum | ||
) |
Definition at line 611 of file smgr.c.
References f_smgr::smgr_prefetch, and SMgrRelationData::smgr_which.
Referenced by LocalPrefetchBuffer(), and PrefetchBuffer().
void smgrread | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
char * | buffer | ||
) |
Definition at line 625 of file smgr.c.
References f_smgr::smgr_read, and SMgrRelationData::smgr_which.
Referenced by copy_relation_data(), pg_prewarm(), and ReadBuffer_common().
void smgrsetowner | ( | SMgrRelation * | owner, |
SMgrRelation | reln | ||
) |
Definition at line 193 of file smgr.c.
References Assert, remove_from_unowned_list(), and SMgrRelationData::smgr_owner.
void smgrsync | ( | void | ) |
Definition at line 759 of file smgr.c.
References i, NSmgr, and f_smgr::smgr_sync.
Referenced by CheckPointBuffers().
void smgrtruncate | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | nblocks | ||
) |
Definition at line 684 of file smgr.c.
References CacheInvalidateSmgr(), DropRelFileNodeBuffers(), SMgrRelationData::smgr_rnode, f_smgr::smgr_truncate, and SMgrRelationData::smgr_which.
Referenced by FreeSpaceMapTruncateRel(), RelationTruncate(), smgr_redo(), and visibilitymap_truncate().
void smgrwrite | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
char * | buffer, | ||
bool | skipFsync | ||
) |
Definition at line 647 of file smgr.c.
References SMgrRelationData::smgr_which, and f_smgr::smgr_write.
Referenced by _bt_blwritepage(), blbuildempty(), btbuildempty(), FlushBuffer(), FlushRelationBuffers(), LocalBufferAlloc(), and spgbuildempty().
void smgrwriteback | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
BlockNumber | nblocks | ||
) |
Definition at line 660 of file smgr.c.
References SMgrRelationData::smgr_which, and f_smgr::smgr_writeback.
Referenced by IssuePendingWritebacks().