|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <fcntl.h>#include <sys/stat.h>#include <unistd.h>#include "access/xact.h"#include "access/xlog.h"#include "access/xloginsert.h"#include "catalog/pg_tablespace.h"#include "catalog/storage.h"#include "miscadmin.h"#include "pgstat.h"#include "storage/fd.h"#include "storage/lwlock.h"#include "utils/inval.h"#include "utils/relmapper.h"#include "utils/wait_event.h"
Go to the source code of this file.
Data Structures | |
| struct | RelMapping |
| struct | RelMapFile |
| struct | SerializedActiveRelMaps |
Macros | |
| #define | RELMAPPER_FILENAME "pg_filenode.map" |
| #define | RELMAPPER_TEMP_FILENAME "pg_filenode.map.tmp" |
| #define | RELMAPPER_FILEMAGIC 0x592717 /* version ID value */ |
| #define | MAX_MAPPINGS 64 |
Typedefs | |
| typedef struct RelMapping | RelMapping |
| typedef struct RelMapFile | RelMapFile |
| typedef struct SerializedActiveRelMaps | SerializedActiveRelMaps |
| #define MAX_MAPPINGS 64 |
Definition at line 82 of file relmapper.c.
Definition at line 74 of file relmapper.c.
| #define RELMAPPER_FILENAME "pg_filenode.map" |
Definition at line 71 of file relmapper.c.
| #define RELMAPPER_TEMP_FILENAME "pg_filenode.map.tmp" |
Definition at line 72 of file relmapper.c.
| typedef struct RelMapFile RelMapFile |
| typedef struct RelMapping RelMapping |
|
static |
Definition at line 384 of file relmapper.c.
References elog, ERROR, fb(), i, RelMapping::mapfilenumber, RelMapping::mapoid, RelMapFile::mappings, MAX_MAPPINGS, and RelMapFile::num_mappings.
Referenced by merge_map_updates(), and RelationMapUpdateMap().
Definition at line 505 of file relmapper.c.
References active_local_updates, active_shared_updates, merge_map_updates(), RelMapFile::num_mappings, pending_local_updates, and pending_shared_updates.
Referenced by AtCCI_LocalCache().
Definition at line 542 of file relmapper.c.
References active_local_updates, active_shared_updates, Assert, fb(), RelMapFile::num_mappings, pending_local_updates, pending_shared_updates, and perform_relmap_update().
Referenced by AbortTransaction(), and CommitTransaction().
Definition at line 589 of file relmapper.c.
References active_local_updates, active_shared_updates, ereport, errcode(), errmsg, ERROR, fb(), RelMapFile::num_mappings, pending_local_updates, and pending_shared_updates.
Referenced by PrepareTransaction().
Definition at line 612 of file relmapper.c.
References fb(), LW_SHARED, LWLockAcquire(), and LWLockRelease().
Referenced by CheckPointGuts().
Definition at line 714 of file relmapper.c.
Referenced by InitializeParallelDSM(), and SerializeRelationMap().
Definition at line 766 of file relmapper.c.
References DatabasePath, FATAL, fb(), local_map, read_relmap_file(), and shared_map.
Referenced by perform_relmap_update(), RelationMapInitializePhase2(), RelationMapInitializePhase3(), RelationMapInvalidate(), and RelationMapInvalidateAll().
|
static |
Definition at line 417 of file relmapper.c.
References apply_map_update(), fb(), i, RelMapping::mapoid, and RelMapFile::mappings.
Referenced by AtCCI_RelationMap(), and perform_relmap_update().
|
static |
Definition at line 1040 of file relmapper.c.
References allowSystemTableMods, DatabasePath, fb(), InvalidOid, load_relmap_file(), local_map, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), merge_map_updates(), MyDatabaseId, MyDatabaseTableSpace, shared_map, and write_relmap_file().
Referenced by AtEOXact_RelationMap().
Definition at line 785 of file relmapper.c.
References Assert, CloseTransientFile(), COMP_CRC32C, RelMapFile::crc, crc, EQ_CRC32C, ereport, errcode(), ERRCODE_DATA_CORRUPTED, errcode_for_file_access(), errmsg, ERROR, fb(), fd(), FIN_CRC32C, INIT_CRC32C, LW_SHARED, LWLockAcquire(), LWLockRelease(), RelMapFile::magic, MAX_MAPPINGS, MAXPGPATH, RelMapFile::num_mappings, OpenTransientFile(), PG_BINARY, pgstat_report_wait_end(), pgstat_report_wait_start(), read, RELMAPPER_FILEMAGIC, RELMAPPER_FILENAME, and snprintf.
Referenced by load_relmap_file(), RelationMapCopy(), and RelationMapOidToFilenumberForDatabase().
Definition at line 293 of file relmapper.c.
References ERROR, fb(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), read_relmap_file(), and write_relmap_file().
Referenced by CreateDatabaseUsingWalLog().
| Oid RelationMapFilenumberToOid | ( | RelFileNumber | filenumber, |
| bool | shared | ||
| ) |
Definition at line 219 of file relmapper.c.
References active_local_updates, active_shared_updates, i, InvalidOid, local_map, RelMapping::mapfilenumber, RelMapping::mapoid, RelMapFile::mappings, RelMapFile::num_mappings, and shared_map.
Referenced by RelidByRelfilenumber().
Definition at line 626 of file relmapper.c.
References active_local_updates, active_shared_updates, Assert, DatabasePath, fb(), InvalidOid, IsBootstrapProcessingMode, local_map, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyDatabaseId, MyDatabaseTableSpace, RelMapFile::num_mappings, pending_local_updates, pending_shared_updates, shared_map, and write_relmap_file().
Referenced by BootstrapModeMain().
Definition at line 652 of file relmapper.c.
References active_local_updates, active_shared_updates, local_map, RelMapFile::magic, RelMapFile::num_mappings, pending_local_updates, pending_shared_updates, and shared_map.
Referenced by RelationCacheInitialize().
Definition at line 672 of file relmapper.c.
References IsBootstrapProcessingMode, and load_relmap_file().
Referenced by RelationCacheInitializePhase2().
Definition at line 693 of file relmapper.c.
References IsBootstrapProcessingMode, and load_relmap_file().
Referenced by RelationCacheInitializePhase3().
Definition at line 469 of file relmapper.c.
References load_relmap_file(), local_map, RelMapFile::magic, RELMAPPER_FILEMAGIC, and shared_map.
Referenced by LocalExecuteInvalidationMessage().
Definition at line 491 of file relmapper.c.
References load_relmap_file(), local_map, RelMapFile::magic, RELMAPPER_FILEMAGIC, and shared_map.
Referenced by RelationCacheInvalidate().
| RelFileNumber RelationMapOidToFilenumber | ( | Oid | relationId, |
| bool | shared | ||
| ) |
Definition at line 166 of file relmapper.c.
References active_local_updates, active_shared_updates, fb(), i, InvalidRelFileNumber, local_map, RelMapping::mapfilenumber, RelMapping::mapoid, RelMapFile::mappings, RelMapFile::num_mappings, and shared_map.
Referenced by pg_relation_filenode(), pg_relation_filepath(), RelationInitPhysicalAddr(), and swap_relation_files().
| RelFileNumber RelationMapOidToFilenumberForDatabase | ( | char * | dbpath, |
| Oid | relationId | ||
| ) |
Definition at line 266 of file relmapper.c.
References ERROR, fb(), i, InvalidRelFileNumber, RelMapping::mapfilenumber, RelMapping::mapoid, RelMapFile::mappings, RelMapFile::num_mappings, and read_relmap_file().
Referenced by ScanSourceDatabasePgClass(), and ScanSourceDatabasePgClassTuple().
Definition at line 439 of file relmapper.c.
References active_local_updates, elog, ERROR, fb(), i, RelMapping::mapoid, RelMapFile::mappings, and RelMapFile::num_mappings.
Referenced by finish_heap_swap().
| void RelationMapUpdateMap | ( | Oid | relationId, |
| RelFileNumber | fileNumber, | ||
| bool | shared, | ||
| bool | immediate | ||
| ) |
Definition at line 326 of file relmapper.c.
References active_local_updates, active_shared_updates, apply_map_update(), elog, ERROR, fb(), GetCurrentTransactionNestLevel(), IsBootstrapProcessingMode, IsInParallelMode(), local_map, pending_local_updates, pending_shared_updates, and shared_map.
Referenced by formrdesc(), RelationBuildLocalRelation(), RelationSetNewRelfilenumber(), and swap_relation_files().
| void relmap_redo | ( | XLogReaderState * | record | ) |
Definition at line 1097 of file relmapper.c.
References Assert, elog, fb(), GetDatabasePath(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), PANIC, pfree(), write_relmap_file(), XLOG_RELMAP_UPDATE, XLogRecGetData, XLogRecGetInfo, and XLogRecHasAnyBlockRefs.
Definition at line 742 of file relmapper.c.
References active_local_updates, active_shared_updates, elog, ERROR, fb(), RelMapFile::num_mappings, pending_local_updates, and pending_shared_updates.
Referenced by ParallelWorkerMain().
Definition at line 725 of file relmapper.c.
References active_local_updates, active_shared_updates, Assert, EstimateRelationMapSpace(), and fb().
Referenced by InitializeParallelDSM().
|
static |
Definition at line 890 of file relmapper.c.
References Assert, CacheInvalidateRelmap(), CloseTransientFile(), COMP_CRC32C, crc, RelFileLocator::dbOid, durable_rename(), elog, END_CRIT_SECTION, ereport, errcode_for_file_access(), errmsg, ERROR, fb(), fd(), FIN_CRC32C, i, INIT_CRC32C, LW_EXCLUSIVE, LWLockHeldByMeInMode(), MAX_MAPPINGS, MAXPGPATH, MinSizeOfRelmapUpdate, OpenTransientFile(), PG_BINARY, pgstat_report_wait_end(), pgstat_report_wait_start(), RelationPreserveStorage(), RELMAPPER_FILEMAGIC, RELMAPPER_FILENAME, RELMAPPER_TEMP_FILENAME, RelFileLocator::relNumber, snprintf, RelFileLocator::spcOid, START_CRIT_SECTION, write, XLOG_RELMAP_UPDATE, XLogBeginInsert(), XLogFlush(), XLogInsert(), and XLogRegisterData().
Referenced by perform_relmap_update(), RelationMapCopy(), RelationMapFinishBootstrap(), and relmap_redo().
|
static |
Definition at line 133 of file relmapper.c.
Referenced by AtCCI_RelationMap(), AtEOXact_RelationMap(), AtPrepare_RelationMap(), RelationMapFilenumberToOid(), RelationMapFinishBootstrap(), RelationMapInitialize(), RelationMapOidToFilenumber(), RelationMapRemoveMapping(), RelationMapUpdateMap(), RestoreRelationMap(), and SerializeRelationMap().
|
static |
Definition at line 132 of file relmapper.c.
Referenced by AtCCI_RelationMap(), AtEOXact_RelationMap(), AtPrepare_RelationMap(), RelationMapFilenumberToOid(), RelationMapFinishBootstrap(), RelationMapInitialize(), RelationMapOidToFilenumber(), RelationMapUpdateMap(), RestoreRelationMap(), and SerializeRelationMap().
|
static |
Definition at line 114 of file relmapper.c.
Referenced by load_relmap_file(), perform_relmap_update(), RelationMapFilenumberToOid(), RelationMapFinishBootstrap(), RelationMapInitialize(), RelationMapInvalidate(), RelationMapInvalidateAll(), RelationMapOidToFilenumber(), and RelationMapUpdateMap().
|
static |
Definition at line 135 of file relmapper.c.
Referenced by AtCCI_RelationMap(), AtEOXact_RelationMap(), AtPrepare_RelationMap(), RelationMapFinishBootstrap(), RelationMapInitialize(), RelationMapUpdateMap(), and RestoreRelationMap().
|
static |
Definition at line 134 of file relmapper.c.
Referenced by AtCCI_RelationMap(), AtEOXact_RelationMap(), AtPrepare_RelationMap(), RelationMapFinishBootstrap(), RelationMapInitialize(), RelationMapUpdateMap(), and RestoreRelationMap().
|
static |
Definition at line 113 of file relmapper.c.
Referenced by load_relmap_file(), perform_relmap_update(), RelationMapFilenumberToOid(), RelationMapFinishBootstrap(), RelationMapInitialize(), RelationMapInvalidate(), RelationMapInvalidateAll(), RelationMapOidToFilenumber(), and RelationMapUpdateMap().