PostgreSQL Source Code
git master
|
#include "access/xlogreader.h"
#include "catalog/objectaddress.h"
#include "lib/stringinfo.h"
#include "nodes/parsenodes.h"
Go to the source code of this file.
Data Structures | |
struct | xl_tblspc_create_rec |
struct | xl_tblspc_drop_rec |
struct | TableSpaceOpts |
Macros | |
#define | XLOG_TBLSPC_CREATE 0x00 |
#define | XLOG_TBLSPC_DROP 0x10 |
Typedefs | |
typedef struct xl_tblspc_create_rec | xl_tblspc_create_rec |
typedef struct xl_tblspc_drop_rec | xl_tblspc_drop_rec |
typedef struct TableSpaceOpts | TableSpaceOpts |
Functions | |
Oid | CreateTableSpace (CreateTableSpaceStmt *stmt) |
void | DropTableSpace (DropTableSpaceStmt *stmt) |
ObjectAddress | RenameTableSpace (const char *oldname, const char *newname) |
Oid | AlterTableSpaceOptions (AlterTableSpaceOptionsStmt *stmt) |
void | TablespaceCreateDbspace (Oid spcOid, Oid dbOid, bool isRedo) |
Oid | GetDefaultTablespace (char relpersistence, bool partitioned) |
void | PrepareTempTablespaces (void) |
Oid | get_tablespace_oid (const char *tablespacename, bool missing_ok) |
char * | get_tablespace_name (Oid spc_oid) |
bool | directory_is_empty (const char *path) |
void | remove_tablespace_symlink (const char *linkloc) |
void | tblspc_redo (XLogReaderState *record) |
void | tblspc_desc (StringInfo buf, XLogReaderState *record) |
const char * | tblspc_identify (uint8 info) |
Variables | |
PGDLLIMPORT char * | default_tablespace |
PGDLLIMPORT char * | temp_tablespaces |
PGDLLIMPORT bool | allow_in_place_tablespaces |
#define XLOG_TBLSPC_CREATE 0x00 |
Definition at line 27 of file tablespace.h.
#define XLOG_TBLSPC_DROP 0x10 |
Definition at line 28 of file tablespace.h.
typedef struct TableSpaceOpts TableSpaceOpts |
typedef struct xl_tblspc_create_rec xl_tblspc_create_rec |
typedef struct xl_tblspc_drop_rec xl_tblspc_drop_rec |
Oid AlterTableSpaceOptions | ( | AlterTableSpaceOptionsStmt * | stmt | ) |
Definition at line 1015 of file tablespace.c.
References aclcheck_error(), ACLCHECK_NOT_OWNER, BTEqualStrategyNumber, CatalogTupleUpdate(), CStringGetDatum(), ereport, errcode(), errmsg(), ERROR, ForwardScanDirection, GETSTRUCT, GetUserId(), heap_freetuple(), heap_getattr(), heap_getnext(), heap_modify_tuple(), HeapTupleIsValid, InvokeObjectPostAlterHook, NoLock, object_ownercheck(), OBJECT_TABLESPACE, RelationGetDescr, RowExclusiveLock, ScanKeyInit(), stmt, HeapTupleData::t_self, table_beginscan_catalog(), table_close(), table_endscan(), table_open(), tablespace_reloptions(), and transformRelOptions().
Referenced by standard_ProcessUtility().
Oid CreateTableSpace | ( | CreateTableSpaceStmt * | stmt | ) |
Definition at line 208 of file tablespace.c.
References allow_in_place_tablespaces, allowSystemTableMods, binary_upgrade_next_pg_tablespace_oid, canonicalize_path(), CatalogTupleInsert(), create_tablespace_directories(), CStringGetDatum(), DataDir, DirectFunctionCall1, elog, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errdetail(), errhint(), errmsg(), ERROR, ForceSyncCommit(), FORKNAMECHARS, get_rolespec_oid(), get_tablespace_oid(), GetNewOidWithIndex(), GetUserId(), heap_form_tuple(), heap_freetuple(), InvalidOid, InvokeObjectPostCreateHook, is_absolute_path, IsBinaryUpgrade, IsReservedName(), MAXPGPATH, namein(), NoLock, ObjectIdGetDatum(), OIDCHARS, OidIsValid, path_is_prefix_of_path(), pfree(), pstrdup(), RelationData::rd_att, recordDependencyOnOwner(), RowExclusiveLock, stmt, superuser(), table_close(), table_open(), tablespace_reloptions(), TABLESPACE_VERSION_DIRECTORY, transformRelOptions(), xl_tblspc_create_rec::ts_id, values, WARNING, XLOG_TBLSPC_CREATE, XLogBeginInsert(), XLogInsert(), and XLogRegisterData().
Referenced by standard_ProcessUtility().
bool directory_is_empty | ( | const char * | path | ) |
Definition at line 853 of file tablespace.c.
References AllocateDir(), dirent::d_name, FreeDir(), and ReadDir().
Referenced by CreateDatabaseUsingFileCopy(), createdb(), destroy_tablespace_directories(), and pg_tablespace_databases().
void DropTableSpace | ( | DropTableSpaceStmt * | stmt | ) |
Definition at line 395 of file tablespace.c.
References aclcheck_error(), ACLCHECK_NO_PRIV, ACLCHECK_NOT_OWNER, BTEqualStrategyNumber, CatalogTupleDelete(), CHECKPOINT_FORCE, CHECKPOINT_IMMEDIATE, CHECKPOINT_WAIT, checkSharedDependencies(), CStringGetDatum(), DeleteSharedComments(), deleteSharedDependencyRecordsFor(), DeleteSharedSecurityLabel(), destroy_tablespace_directories(), EmitProcSignalBarrier(), ereport, errcode(), errdetail_internal(), errdetail_log(), errmsg(), ERROR, ForceSyncCommit(), ForwardScanDirection, GETSTRUCT, GetUserId(), heap_getnext(), HeapTupleIsValid, InvokeObjectDropHook, IsPinnedObject(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), NoLock, NOTICE, object_ownercheck(), OBJECT_TABLESPACE, PROCSIGNAL_BARRIER_SMGRRELEASE, RequestCheckpoint(), RowExclusiveLock, ScanKeyInit(), stmt, HeapTupleData::t_self, table_beginscan_catalog(), table_close(), table_endscan(), table_open(), xl_tblspc_drop_rec::ts_id, WaitForProcSignalBarrier(), XLOG_TBLSPC_DROP, XLogBeginInsert(), XLogInsert(), and XLogRegisterData().
Referenced by standard_ProcessUtility().
char* get_tablespace_name | ( | Oid | spc_oid | ) |
Definition at line 1472 of file tablespace.c.
References AccessShareLock, BTEqualStrategyNumber, ForwardScanDirection, GETSTRUCT, heap_getnext(), HeapTupleIsValid, NameStr, ObjectIdGetDatum(), pstrdup(), ScanKeyInit(), table_beginscan_catalog(), table_close(), table_endscan(), and table_open().
Referenced by AlterTableMoveAll(), calculate_tablespace_size(), DefineIndex(), DefineRelation(), ExecReindex(), generateClonedIndexStmt(), getObjectDescription(), getObjectIdentityParts(), pg_get_constraintdef_worker(), pg_get_indexdef_worker(), ReindexMultipleInternal(), ReindexRelationConcurrently(), and shdepLockAndCheckObject().
Oid get_tablespace_oid | ( | const char * | tablespacename, |
bool | missing_ok | ||
) |
Definition at line 1426 of file tablespace.c.
References AccessShareLock, BTEqualStrategyNumber, CStringGetDatum(), ereport, errcode(), errmsg(), ERROR, ForwardScanDirection, GETSTRUCT, heap_getnext(), HeapTupleIsValid, InvalidOid, OidIsValid, ScanKeyInit(), table_beginscan_catalog(), table_close(), table_endscan(), and table_open().
Referenced by AlterTableMoveAll(), ATPrepSetTableSpace(), check_default_tablespace(), check_temp_tablespaces(), convert_tablespace_name(), createdb(), CreateTableSpace(), DefineIndex(), DefineRelation(), ExecReindex(), get_object_address_unqualified(), GetDefaultTablespace(), movedb(), pg_tablespace_size_name(), and PrepareTempTablespaces().
Oid GetDefaultTablespace | ( | char | relpersistence, |
bool | partitioned | ||
) |
Definition at line 1143 of file tablespace.c.
References default_tablespace, ereport, errcode(), errmsg(), ERROR, get_tablespace_oid(), GetNextTempTableSpace(), InvalidOid, MyDatabaseTableSpace, and PrepareTempTablespaces().
Referenced by DefineIndex(), DefineRelation(), and RefreshMatViewByOid().
void PrepareTempTablespaces | ( | void | ) |
Definition at line 1331 of file tablespace.c.
References ACL_CREATE, ACLCHECK_OK, get_tablespace_oid(), GetUserId(), InvalidOid, IsTransactionState(), lfirst, list_free(), list_length(), MemoryContextAlloc(), MyDatabaseTableSpace, object_aclcheck(), pfree(), pstrdup(), SetTempTablespaces(), SplitIdentifierString(), temp_tablespaces, TempTablespacesAreSet(), and TopTransactionContext.
Referenced by BufFileCreateTemp(), ExecHashIncreaseNumBatches(), ExecHashTableCreate(), FileSetInit(), GetDefaultTablespace(), inittapestate(), and tuplestore_puttuple_common().
void remove_tablespace_symlink | ( | const char * | linkloc | ) |
Definition at line 883 of file tablespace.c.
References ereport, errcode(), errcode_for_file_access(), errmsg(), ERROR, lstat, S_ISDIR, S_ISLNK, and stat::st_mode.
Referenced by create_tablespace_directories(), and InitWalRecovery().
ObjectAddress RenameTableSpace | ( | const char * | oldname, |
const char * | newname | ||
) |
Definition at line 930 of file tablespace.c.
References aclcheck_error(), ACLCHECK_NO_PRIV, allowSystemTableMods, BTEqualStrategyNumber, CatalogTupleUpdate(), CStringGetDatum(), elog, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errdetail(), errmsg(), ERROR, ForwardScanDirection, GETSTRUCT, GetUserId(), heap_copytuple(), heap_getnext(), HeapTupleIsValid, InvokeObjectPostAlterHook, IsReservedName(), namestrcpy(), NoLock, object_ownercheck(), OBJECT_TABLESPACE, ObjectAddressSet, RowExclusiveLock, ScanKeyInit(), HeapTupleData::t_self, table_beginscan_catalog(), table_close(), table_endscan(), table_open(), and WARNING.
Referenced by ExecRenameStmt().
Definition at line 112 of file tablespace.c.
References Assert, ereport, errcode(), errcode_for_file_access(), errmsg(), ERROR, GetDatabasePath(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MakePGDirectory(), OidIsValid, pfree(), pg_dir_create_mode, pg_mkdir_p(), S_ISDIR, stat::st_mode, and stat.
Referenced by mdcreate().
void tblspc_desc | ( | StringInfo | buf, |
XLogReaderState * | record | ||
) |
Definition at line 21 of file tblspcdesc.c.
References appendStringInfo(), buf, xl_tblspc_create_rec::ts_id, xl_tblspc_drop_rec::ts_id, xl_tblspc_create_rec::ts_path, XLOG_TBLSPC_CREATE, XLOG_TBLSPC_DROP, XLogRecGetData, XLogRecGetInfo, and XLR_INFO_MASK.
const char* tblspc_identify | ( | uint8 | info | ) |
Definition at line 41 of file tblspcdesc.c.
References XLOG_TBLSPC_CREATE, XLOG_TBLSPC_DROP, and XLR_INFO_MASK.
void tblspc_redo | ( | XLogReaderState * | record | ) |
Definition at line 1511 of file tablespace.c.
References Assert, create_tablespace_directories(), destroy_tablespace_directories(), elog, EmitProcSignalBarrier(), ereport, errcode(), errhint(), errmsg(), LOG, PANIC, PROCSIGNAL_BARRIER_SMGRRELEASE, ResolveRecoveryConflictWithTablespace(), xl_tblspc_create_rec::ts_id, xl_tblspc_drop_rec::ts_id, xl_tblspc_create_rec::ts_path, WaitForProcSignalBarrier(), XLOG_TBLSPC_CREATE, XLOG_TBLSPC_DROP, XLogRecGetData, XLogRecGetInfo, XLogRecHasAnyBlockRefs, and XLR_INFO_MASK.
|
extern |
Definition at line 85 of file tablespace.c.
Referenced by CheckTablespaceDirectory(), CreateTableSpace(), and recovery_create_dbdir().
|
extern |
Definition at line 83 of file tablespace.c.
Referenced by GetDefaultTablespace().
|
extern |
Definition at line 84 of file tablespace.c.
Referenced by PrepareTempTablespaces().