00001 /*------------------------------------------------------------------------- 00002 * 00003 * tablespace.h 00004 * Tablespace management commands (create/drop tablespace). 00005 * 00006 * 00007 * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group 00008 * Portions Copyright (c) 1994, Regents of the University of California 00009 * 00010 * src/include/commands/tablespace.h 00011 * 00012 *------------------------------------------------------------------------- 00013 */ 00014 #ifndef TABLESPACE_H 00015 #define TABLESPACE_H 00016 00017 #include "access/xlog.h" 00018 #include "nodes/parsenodes.h" 00019 00020 /* XLOG stuff */ 00021 #define XLOG_TBLSPC_CREATE 0x00 00022 #define XLOG_TBLSPC_DROP 0x10 00023 00024 typedef struct xl_tblspc_create_rec 00025 { 00026 Oid ts_id; 00027 char ts_path[1]; /* VARIABLE LENGTH STRING */ 00028 } xl_tblspc_create_rec; 00029 00030 typedef struct xl_tblspc_drop_rec 00031 { 00032 Oid ts_id; 00033 } xl_tblspc_drop_rec; 00034 00035 typedef struct TableSpaceOpts 00036 { 00037 int32 vl_len_; /* varlena header (do not touch directly!) */ 00038 float8 random_page_cost; 00039 float8 seq_page_cost; 00040 } TableSpaceOpts; 00041 00042 extern Oid CreateTableSpace(CreateTableSpaceStmt *stmt); 00043 extern void DropTableSpace(DropTableSpaceStmt *stmt); 00044 extern Oid RenameTableSpace(const char *oldname, const char *newname); 00045 extern Oid AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt); 00046 00047 extern void TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo); 00048 00049 extern Oid GetDefaultTablespace(char relpersistence); 00050 00051 extern void PrepareTempTablespaces(void); 00052 00053 extern Oid get_tablespace_oid(const char *tablespacename, bool missing_ok); 00054 extern char *get_tablespace_name(Oid spc_oid); 00055 00056 extern bool directory_is_empty(const char *path); 00057 00058 extern void tblspc_redo(XLogRecPtr lsn, XLogRecord *rptr); 00059 extern void tblspc_desc(StringInfo buf, uint8 xl_info, char *rec); 00060 00061 #endif /* TABLESPACE_H */