PostgreSQL Source Code
git master
|
#include "storage/block.h"
#include "storage/relfilelocator.h"
#include "storage/smgr.h"
#include "utils/relcache.h"
Go to the source code of this file.
Functions | |
SMgrRelation | RelationCreateStorage (RelFileLocator rlocator, char relpersistence, bool register_delete) |
void | RelationDropStorage (Relation rel) |
void | RelationPreserveStorage (RelFileLocator rlocator, bool atCommit) |
void | RelationPreTruncate (Relation rel) |
void | RelationTruncate (Relation rel, BlockNumber nblocks) |
void | RelationCopyStorage (SMgrRelation src, SMgrRelation dst, ForkNumber forkNum, char relpersistence) |
bool | RelFileLocatorSkippingWAL (RelFileLocator rlocator) |
Size | EstimatePendingSyncsSpace (void) |
void | SerializePendingSyncs (Size maxSize, char *startAddress) |
void | RestorePendingSyncs (char *startAddress) |
void | smgrDoPendingDeletes (bool isCommit) |
void | smgrDoPendingSyncs (bool isCommit, bool isParallelWorker) |
int | smgrGetPendingDeletes (bool forCommit, RelFileLocator **ptr) |
void | AtSubCommit_smgr (void) |
void | AtSubAbort_smgr (void) |
void | PostPrepare_smgr (void) |
Variables | |
PGDLLIMPORT int | wal_skip_threshold |
void AtSubAbort_smgr | ( | void | ) |
Definition at line 934 of file storage.c.
References smgrDoPendingDeletes().
Referenced by AbortSubTransaction().
void AtSubCommit_smgr | ( | void | ) |
Definition at line 914 of file storage.c.
References GetCurrentTransactionNestLevel(), PendingRelDelete::nestLevel, PendingRelDelete::next, and pendingDeletes.
Referenced by CommitSubTransaction().
Size EstimatePendingSyncsSpace | ( | void | ) |
Definition at line 546 of file storage.c.
References hash_get_num_entries(), mul_size(), and pendingSyncHash.
Referenced by InitializeParallelDSM().
void PostPrepare_smgr | ( | void | ) |
Definition at line 893 of file storage.c.
References next, PendingRelDelete::next, pendingDeletes, and pfree().
Referenced by PrepareTransaction().
void RelationCopyStorage | ( | SMgrRelation | src, |
SMgrRelation | dst, | ||
ForkNumber | forkNum, | ||
char | relpersistence | ||
) |
Definition at line 452 of file storage.c.
References RelFileLocatorBackend::backend, buf, CHECK_FOR_INTERRUPTS, ereport, errcode(), ERRCODE_DATA_CORRUPTED, errmsg(), ERROR, INIT_FORKNUM, RelFileLocatorBackend::locator, PageIsVerifiedExtended(), PIV_LOG_WARNING, PIV_REPORT_STAT, relpath, relpathbackend, smgr_bulk_finish(), smgr_bulk_get_buf(), smgr_bulk_start_smgr(), smgr_bulk_write(), SMgrRelationData::smgr_rlocator, smgrnblocks(), smgrread(), and XLogIsNeeded.
Referenced by heapam_relation_copy_data(), and index_copy_data().
SMgrRelation RelationCreateStorage | ( | RelFileLocator | rlocator, |
char | relpersistence, | ||
bool | register_delete | ||
) |
Definition at line 121 of file storage.c.
References AddPendingSync(), Assert, PendingRelDelete::atCommit, elog, ERROR, GetCurrentTransactionNestLevel(), INVALID_PROC_NUMBER, IsInParallelMode(), RelFileLocatorBackend::locator, log_smgrcreate(), MAIN_FORKNUM, MemoryContextAlloc(), PendingRelDelete::nestLevel, PendingRelDelete::next, pendingDeletes, PendingRelDelete::procNumber, ProcNumberForTempRelations, PendingRelDelete::rlocator, SMgrRelationData::smgr_rlocator, smgrcreate(), smgropen(), TopMemoryContext, and XLogIsNeeded.
Referenced by CreateAndCopyRelationData(), heap_create(), heapam_relation_copy_data(), heapam_relation_set_new_filelocator(), index_copy_data(), and RelationSetNewRelfilenumber().
void RelationDropStorage | ( | Relation | rel | ) |
Definition at line 206 of file storage.c.
References PendingRelDelete::atCommit, GetCurrentTransactionNestLevel(), MemoryContextAlloc(), PendingRelDelete::nestLevel, PendingRelDelete::next, pendingDeletes, PendingRelDelete::procNumber, RelationData::rd_backend, RelationData::rd_locator, RelationCloseSmgr(), PendingRelDelete::rlocator, and TopMemoryContext.
Referenced by heap_drop_with_catalog(), heapam_relation_copy_data(), index_copy_data(), index_drop(), reindex_index(), and RelationSetNewRelfilenumber().
void RelationPreserveStorage | ( | RelFileLocator | rlocator, |
bool | atCommit | ||
) |
Definition at line 251 of file storage.c.
References PendingRelDelete::atCommit, next, PendingRelDelete::next, pendingDeletes, pfree(), RelFileLocatorEquals, and PendingRelDelete::rlocator.
Referenced by ATExecAddIndex(), and write_relmap_file().
void RelationPreTruncate | ( | Relation | rel | ) |
Definition at line 424 of file storage.c.
References HASH_FIND, hash_search(), PendingRelSync::is_truncated, pendingSyncHash, and RelationGetSmgr().
Referenced by RelationTruncate().
void RelationTruncate | ( | Relation | rel, |
BlockNumber | nblocks | ||
) |
Definition at line 288 of file storage.c.
References Assert, xl_smgr_truncate::blkno, BlockNumberIsValid(), DELAY_CHKPT_COMPLETE, PGPROC::delayChkptFlags, xl_smgr_truncate::flags, FreeSpaceMapPrepareTruncateRel(), FreeSpaceMapVacuumRange(), FSM_FORKNUM, i, InvalidBlockNumber, MAIN_FORKNUM, MAX_FORKNUM, MyProc, RelationData::rd_locator, RelationGetSmgr(), RelationNeedsWAL, RelationPreTruncate(), xl_smgr_truncate::rlocator, SMgrRelationData::smgr_cached_nblocks, SMgrRelationData::smgr_targblock, SMGR_TRUNCATE_ALL, smgrexists(), smgrtruncate(), VISIBILITYMAP_FORKNUM, visibilitymap_prepare_truncate(), XLOG_SMGR_TRUNCATE, XLogBeginInsert(), XLogFlush(), XLogInsert(), XLogRegisterData(), and XLR_SPECIAL_REL_UPDATE.
Referenced by heapam_relation_nontransactional_truncate(), lazy_truncate_heap(), RelationTruncateIndexes(), and spgvacuumscan().
bool RelFileLocatorSkippingWAL | ( | RelFileLocator | rlocator | ) |
Definition at line 532 of file storage.c.
References HASH_FIND, hash_search(), and pendingSyncHash.
Referenced by MarkBufferDirtyHint(), and RelationInitPhysicalAddr().
void RestorePendingSyncs | ( | char * | startAddress | ) |
Definition at line 610 of file storage.c.
References AddPendingSync(), Assert, pendingSyncHash, and RelFileLocator::relNumber.
Referenced by ParallelWorkerMain().
void SerializePendingSyncs | ( | Size | maxSize, |
char * | startAddress | ||
) |
Definition at line 559 of file storage.c.
References ctl, CurrentMemoryContext, generate_unaccent_rules::dest, HASH_BLOBS, HASH_CONTEXT, hash_create(), hash_destroy(), HASH_ELEM, HASH_ENTER, hash_get_num_entries(), HASH_REMOVE, hash_search(), hash_seq_init(), hash_seq_search(), MemSet, PendingRelDelete::next, pendingDeletes, pendingSyncHash, and PendingRelSync::rlocator.
Referenced by InitializeParallelDSM().
void smgrDoPendingDeletes | ( | bool | isCommit | ) |
Definition at line 632 of file storage.c.
References PendingRelDelete::atCommit, GetCurrentTransactionNestLevel(), i, PendingRelDelete::nestLevel, next, PendingRelDelete::next, palloc(), pendingDeletes, pfree(), PendingRelDelete::procNumber, repalloc(), PendingRelDelete::rlocator, smgrclose(), smgrdounlinkall(), and smgropen().
Referenced by AbortTransaction(), AtSubAbort_smgr(), and CommitTransaction().
Definition at line 700 of file storage.c.
References Assert, AssertPendingSyncs_RelationCache, PendingRelDelete::atCommit, BlockNumberIsValid(), CreateFakeRelcacheEntry(), FreeFakeRelcacheEntry(), GetCurrentTransactionNestLevel(), HASH_REMOVE, hash_search(), hash_seq_init(), hash_seq_search(), INIT_FORKNUM, INVALID_PROC_NUMBER, InvalidBlockNumber, PendingRelSync::is_truncated, RelFileLocatorBackend::locator, log_newpage_range(), MAX_FORKNUM, PendingRelDelete::next, palloc(), pendingDeletes, pendingSyncHash, pfree(), repalloc(), PendingRelDelete::rlocator, PendingRelSync::rlocator, SMgrRelationData::smgr_rlocator, smgrdosyncall(), smgrexists(), smgrnblocks(), smgropen(), and wal_skip_threshold.
Referenced by AbortTransaction(), CommitTransaction(), and PrepareTransaction().
int smgrGetPendingDeletes | ( | bool | forCommit, |
RelFileLocator ** | ptr | ||
) |
Definition at line 852 of file storage.c.
References PendingRelDelete::atCommit, GetCurrentTransactionNestLevel(), INVALID_PROC_NUMBER, PendingRelDelete::nestLevel, PendingRelDelete::next, palloc(), pendingDeletes, PendingRelDelete::procNumber, and PendingRelDelete::rlocator.
Referenced by RecordTransactionAbort(), RecordTransactionCommit(), and StartPrepare().
|
extern |
Definition at line 39 of file storage.c.
Referenced by smgrDoPendingSyncs().