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 spcNode, Oid dbNode, 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 *rptr) |
void | tblspc_desc (StringInfo buf, XLogReaderState *rptr) |
const char * | tblspc_identify (uint8 info) |
#define XLOG_TBLSPC_CREATE 0x00 |
Definition at line 23 of file tablespace.h.
Referenced by CreateTableSpace(), tblspc_desc(), tblspc_identify(), and tblspc_redo().
#define XLOG_TBLSPC_DROP 0x10 |
Definition at line 24 of file tablespace.h.
Referenced by DropTableSpace(), tblspc_desc(), tblspc_identify(), and tblspc_redo().
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 1022 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, AlterTableSpaceOptionsStmt::isReset, NoLock, OBJECT_TABLESPACE, AlterTableSpaceOptionsStmt::options, pg_tablespace_ownercheck(), RelationGetDescr, RowExclusiveLock, ScanKeyInit(), HeapTupleData::t_self, table_beginscan_catalog(), table_close(), table_endscan(), table_open(), tablespace_reloptions(), AlterTableSpaceOptionsStmt::tablespacename, and transformRelOptions().
Referenced by standard_ProcessUtility().
Oid CreateTableSpace | ( | CreateTableSpaceStmt * | stmt | ) |
Definition at line 233 of file tablespace.c.
References allowSystemTableMods, 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, IsReservedName(), CreateTableSpaceStmt::location, MAXPGPATH, MemSet, namein(), NoLock, ObjectIdGetDatum, offsetof, OIDCHARS, OidIsValid, CreateTableSpaceStmt::options, CreateTableSpaceStmt::owner, path_is_prefix_of_path(), pfree(), pstrdup(), RelationData::rd_att, recordDependencyOnOwner(), RowExclusiveLock, superuser(), table_close(), table_open(), tablespace_reloptions(), TABLESPACE_VERSION_DIRECTORY, CreateTableSpaceStmt::tablespacename, TablespaceOidIndexId, 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 858 of file tablespace.c.
References AllocateDir(), dirent::d_name, FreeDir(), and ReadDir().
Referenced by createdb(), destroy_tablespace_directories(), and pg_tablespace_databases().
void DropTableSpace | ( | DropTableSpaceStmt * | stmt | ) |
Definition at line 413 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(), ereport, errcode(), errdetail_internal(), errdetail_log(), errmsg(), ERROR, ForceSyncCommit(), ForwardScanDirection, GETSTRUCT, GetUserId(), heap_getnext(), HeapTupleIsValid, InvokeObjectDropHook, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), DropTableSpaceStmt::missing_ok, NoLock, NOTICE, OBJECT_TABLESPACE, pg_tablespace_ownercheck(), RequestCheckpoint(), RowExclusiveLock, ScanKeyInit(), HeapTupleData::t_self, table_beginscan_catalog(), table_close(), table_endscan(), table_open(), DropTableSpaceStmt::tablespacename, xl_tblspc_drop_rec::ts_id, XLOG_TBLSPC_DROP, XLogBeginInsert(), XLogInsert(), and XLogRegisterData().
Referenced by standard_ProcessUtility().
char* get_tablespace_name | ( | Oid | spc_oid | ) |
Definition at line 1479 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(), generateClonedIndexStmt(), getObjectDescription(), getObjectIdentityParts(), pg_get_constraintdef_worker(), pg_get_indexdef_worker(), and shdepLockAndCheckObject().
Definition at line 1433 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(), get_object_address_unqualified(), GetDefaultTablespace(), movedb(), objectNamesToOids(), pg_tablespace_size_name(), and PrepareTempTablespaces().
Definition at line 1150 of file tablespace.c.
References default_tablespace, ereport, errcode(), errmsg(), ERROR, get_tablespace_oid(), GetNextTempTableSpace(), InvalidOid, MyDatabaseTableSpace, and PrepareTempTablespaces().
Referenced by DefineIndex(), DefineRelation(), and ExecRefreshMatView().
void PrepareTempTablespaces | ( | void | ) |
Definition at line 1338 of file tablespace.c.
References ACL_CREATE, ACLCHECK_OK, get_tablespace_oid(), GetUserId(), InvalidOid, IsTransactionState(), lfirst, list_free(), list_length(), MemoryContextAlloc(), MyDatabaseTableSpace, pfree(), pg_tablespace_aclcheck(), pstrdup(), SetTempTablespaces(), SplitIdentifierString(), temp_tablespaces, TempTablespacesAreSet(), and TopTransactionContext.
Referenced by BufFileCreateTemp(), ExecHashIncreaseNumBatches(), ExecHashTableCreate(), GetDefaultTablespace(), inittapestate(), SharedFileSetInit(), and tuplestore_puttuple_common().
void remove_tablespace_symlink | ( | const char * | linkloc | ) |
Definition at line 888 of file tablespace.c.
References ereport, errcode(), errcode_for_file_access(), errmsg(), ERROR, lstat, S_ISDIR, and stat::st_mode.
Referenced by create_tablespace_directories(), and StartupXLOG().
ObjectAddress RenameTableSpace | ( | const char * | oldname, |
const char * | newname | ||
) |
Definition at line 937 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_TABLESPACE, ObjectAddressSet, pg_tablespace_ownercheck(), RowExclusiveLock, ScanKeyInit(), HeapTupleData::t_self, table_beginscan_catalog(), table_close(), table_endscan(), table_open(), and WARNING.
Referenced by ExecRenameStmt().
Definition at line 115 of file tablespace.c.
References Assert, ereport, errcode(), errcode_for_file_access(), errmsg(), ERROR, get_parent_directory(), GetDatabasePath(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MakePGDirectory(), OidIsValid, pfree(), pstrdup(), S_ISDIR, stat::st_mode, and stat.
Referenced by mdcreate().
void tblspc_desc | ( | StringInfo | buf, |
XLogReaderState * | rptr | ||
) |
Definition at line 21 of file tblspcdesc.c.
References appendStringInfo(), 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 * | rptr | ) |
Definition at line 1518 of file tablespace.c.
References Assert, create_tablespace_directories(), destroy_tablespace_directories(), elog, ereport, errcode(), errhint(), errmsg(), LOG, PANIC, ResolveRecoveryConflictWithTablespace(), 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, XLogRecHasAnyBlockRefs, and XLR_INFO_MASK.