PostgreSQL Source Code
git master
|
#include "storage/block.h"
#include "storage/relfilelocator.h"
#include "storage/smgr.h"
#include "storage/sync.h"
Go to the source code of this file.
void DropRelationFiles | ( | RelFileLocator * | delrels, |
int | ndelrels, | ||
bool | isRedo | ||
) |
Definition at line 1110 of file md.c.
References i, InvalidBackendId, MAX_FORKNUM, palloc(), pfree(), smgrclose(), smgrdounlinkall(), smgropen(), and XLogDropRelation().
Referenced by FinishPreparedTransaction(), xact_redo_abort(), and xact_redo_commit().
void ForgetDatabaseSyncRequests | ( | Oid | dbid | ) |
Definition at line 1092 of file md.c.
References RelFileLocator::dbOid, INIT_MD_FILETAG, InvalidBlockNumber, InvalidForkNumber, RegisterSyncRequest(), RelFileLocator::relNumber, RelFileLocator::spcOid, and SYNC_FILTER_REQUEST.
Referenced by createdb_failure_callback(), dbase_redo(), and dropdb().
void mdclose | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 568 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 182 of file md.c.
References _fdvec_resize(), Assert(), RelFileLocator::dbOid, ereport, errcode_for_file_access(), errmsg(), ERROR, fd(), RelFileLocatorBackend::locator, SMgrRelationData::md_num_open_segs, SMgrRelationData::md_seg_fds, _MdfdVec::mdfd_segno, _MdfdVec::mdfd_vfd, PathNameOpenFile(), pfree(), PG_BINARY, relpath, SMgrRelationData::smgr_rlocator, RelFileLocator::spcOid, and TablespaceCreateDbspace().
bool mdexists | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 163 of file md.c.
References EXTENSION_RETURN_NULL, InRecovery, mdclose(), and mdopenfork().
void mdextend | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
const void * | buffer, | ||
bool | skipFsync | ||
) |
Definition at line 449 of file md.c.
References _mdfd_getseg(), _mdnblocks(), Assert(), ereport, errcode(), errcode_for_file_access(), errhint(), errmsg(), ERROR, EXTENSION_CREATE, FilePathName(), FileWrite(), InvalidBlockNumber, _MdfdVec::mdfd_vfd, mdnblocks(), register_dirty_segment(), relpath, SMgrRelationData::smgr_rlocator, SmgrIsTemp, and WAIT_EVENT_DATA_FILE_EXTEND.
Referenced by _mdfd_getseg().
void mdimmedsync | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 960 of file md.c.
References _fdvec_resize(), _mdfd_openseg(), data_sync_elevel(), ereport, errcode_for_file_access(), errmsg(), ERROR, FileClose(), 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 150 of file md.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, MdCxt, and TopMemoryContext.
BlockNumber mdnblocks | ( | SMgrRelation | reln, |
ForkNumber | forknum | ||
) |
Definition at line 801 of file md.c.
References _mdfd_openseg(), _mdnblocks(), Assert(), elog(), EXTENSION_FAIL, FATAL, SMgrRelationData::md_num_open_segs, SMgrRelationData::md_seg_fds, and mdopenfork().
Referenced by mdextend(), mdimmedsync(), mdtruncate(), and mdwrite().
void mdopen | ( | SMgrRelation | reln | ) |
Definition at line 557 of file md.c.
References MAX_FORKNUM, and SMgrRelationData::md_num_open_segs.
bool mdprefetch | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum | ||
) |
Definition at line 591 of file md.c.
References _mdfd_getseg(), Assert(), EXTENSION_FAIL, EXTENSION_RETURN_NULL, FilePrefetch(), InRecovery, _MdfdVec::mdfd_vfd, and WAIT_EVENT_DATA_FILE_PREFETCH.
void mdread | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
void * | buffer | ||
) |
Definition at line 671 of file md.c.
References _mdfd_getseg(), Assert(), RelFileLocatorBackend::backend, RelFileLocator::dbOid, ereport, errcode(), ERRCODE_DATA_CORRUPTED, errcode_for_file_access(), errmsg(), ERROR, EXTENSION_CREATE_RECOVERY, EXTENSION_FAIL, FilePathName(), FileRead(), InRecovery, RelFileLocatorBackend::locator, _MdfdVec::mdfd_vfd, MemSet, RelFileLocator::relNumber, SMgrRelationData::smgr_rlocator, RelFileLocator::spcOid, WAIT_EVENT_DATA_FILE_READ, and zero_damaged_pages.
int mdsyncfiletag | ( | const FileTag * | ftag, |
char * | path | ||
) |
Definition at line 1399 of file md.c.
References _mdfd_segpath(), FileClose(), FilePathName(), FileSync(), FileTag::forknum, InvalidBackendId, IOCONTEXT_NORMAL, IOOBJECT_RELATION, IOOP_FSYNC, MAXPGPATH, SMgrRelationData::md_num_open_segs, SMgrRelationData::md_seg_fds, _MdfdVec::mdfd_vfd, PathNameOpenFile(), pfree(), PG_BINARY, pgstat_count_io_op(), FileTag::rlocator, FileTag::segno, smgropen(), strlcpy(), and WAIT_EVENT_DATA_FILE_SYNC.
void mdtruncate | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | nblocks | ||
) |
Definition at line 858 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_rlocator, SmgrIsTemp, and WAIT_EVENT_DATA_FILE_TRUNCATE.
void mdunlink | ( | RelFileLocatorBackend | rlocator, |
ForkNumber | forknum, | ||
bool | isRedo | ||
) |
Definition at line 296 of file md.c.
References InvalidForkNumber, MAX_FORKNUM, and mdunlinkfork().
int mdunlinkfiletag | ( | const FileTag * | ftag, |
char * | path | ||
) |
Definition at line 1448 of file md.c.
References MAIN_FORKNUM, MAXPGPATH, pfree(), relpathperm, FileTag::rlocator, and strlcpy().
void mdwrite | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
const void * | buffer, | ||
bool | skipFsync | ||
) |
Definition at line 736 of file md.c.
References _mdfd_getseg(), Assert(), RelFileLocatorBackend::backend, RelFileLocator::dbOid, ereport, errcode(), errcode_for_file_access(), errhint(), errmsg(), ERROR, EXTENSION_CREATE_RECOVERY, EXTENSION_FAIL, FilePathName(), FileWrite(), RelFileLocatorBackend::locator, _MdfdVec::mdfd_vfd, mdnblocks(), register_dirty_segment(), RelFileLocator::relNumber, SMgrRelationData::smgr_rlocator, SmgrIsTemp, RelFileLocator::spcOid, and WAIT_EVENT_DATA_FILE_WRITE.
void mdwriteback | ( | SMgrRelation | reln, |
ForkNumber | forknum, | ||
BlockNumber | blocknum, | ||
BlockNumber | nblocks | ||
) |
Definition at line 619 of file md.c.
References _mdfd_getseg(), Assert(), EXTENSION_DONT_OPEN, FileWriteback(), _MdfdVec::mdfd_vfd, and WAIT_EVENT_DATA_FILE_FLUSH.