PostgreSQL Source Code  git master
tablespace.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * tablespace.h
4  * Tablespace management commands (create/drop tablespace).
5  *
6  *
7  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/commands/tablespace.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef TABLESPACE_H
15 #define TABLESPACE_H
16 
17 #include "access/xlogreader.h"
18 #include "catalog/objectaddress.h"
19 #include "lib/stringinfo.h"
20 #include "nodes/parsenodes.h"
21 
22 extern PGDLLIMPORT char *default_tablespace;
23 extern PGDLLIMPORT char *temp_tablespaces;
25 
26 /* XLOG stuff */
27 #define XLOG_TBLSPC_CREATE 0x00
28 #define XLOG_TBLSPC_DROP 0x10
29 
30 typedef struct xl_tblspc_create_rec
31 {
33  char ts_path[FLEXIBLE_ARRAY_MEMBER]; /* null-terminated string */
35 
36 typedef struct xl_tblspc_drop_rec
37 {
40 
41 typedef struct TableSpaceOpts
42 {
43  int32 vl_len_; /* varlena header (do not touch directly!) */
49 
52 extern ObjectAddress RenameTableSpace(const char *oldname, const char *newname);
54 
55 extern void TablespaceCreateDbspace(Oid spcOid, Oid dbOid, bool isRedo);
56 
57 extern Oid GetDefaultTablespace(char relpersistence, bool partitioned);
58 
59 extern void PrepareTempTablespaces(void);
60 
61 extern Oid get_tablespace_oid(const char *tablespacename, bool missing_ok);
62 extern char *get_tablespace_name(Oid spc_oid);
63 
64 extern bool directory_is_empty(const char *path);
65 extern void remove_tablespace_symlink(const char *linkloc);
66 
67 extern void tblspc_redo(XLogReaderState *record);
68 extern void tblspc_desc(StringInfo buf, XLogReaderState *record);
69 extern const char *tblspc_identify(uint8 info);
70 
71 #endif /* TABLESPACE_H */
#define PGDLLIMPORT
Definition: c.h:1274
uint8_t uint8
Definition: c.h:483
double float8
Definition: c.h:584
#define FLEXIBLE_ARRAY_MEMBER
Definition: c.h:417
int32_t int32
Definition: c.h:481
#define stmt
Definition: indent_codes.h:59
static char * buf
Definition: pg_test_fsync.c:72
unsigned int Oid
Definition: postgres_ext.h:31
int maintenance_io_concurrency
Definition: tablespace.h:47
float8 random_page_cost
Definition: tablespace.h:44
int effective_io_concurrency
Definition: tablespace.h:46
float8 seq_page_cost
Definition: tablespace.h:45
char ts_path[FLEXIBLE_ARRAY_MEMBER]
Definition: tablespace.h:33
char * get_tablespace_name(Oid spc_oid)
Definition: tablespace.c:1472
Oid AlterTableSpaceOptions(AlterTableSpaceOptionsStmt *stmt)
Definition: tablespace.c:1015
struct TableSpaceOpts TableSpaceOpts
PGDLLIMPORT char * default_tablespace
Definition: tablespace.c:83
bool directory_is_empty(const char *path)
Definition: tablespace.c:853
PGDLLIMPORT bool allow_in_place_tablespaces
Definition: tablespace.c:85
struct xl_tblspc_drop_rec xl_tblspc_drop_rec
void tblspc_desc(StringInfo buf, XLogReaderState *record)
Definition: tblspcdesc.c:21
void remove_tablespace_symlink(const char *linkloc)
Definition: tablespace.c:883
void DropTableSpace(DropTableSpaceStmt *stmt)
Definition: tablespace.c:395
void PrepareTempTablespaces(void)
Definition: tablespace.c:1331
Oid get_tablespace_oid(const char *tablespacename, bool missing_ok)
Definition: tablespace.c:1426
PGDLLIMPORT char * temp_tablespaces
Definition: tablespace.c:84
ObjectAddress RenameTableSpace(const char *oldname, const char *newname)
Definition: tablespace.c:930
Oid GetDefaultTablespace(char relpersistence, bool partitioned)
Definition: tablespace.c:1143
void TablespaceCreateDbspace(Oid spcOid, Oid dbOid, bool isRedo)
Definition: tablespace.c:112
const char * tblspc_identify(uint8 info)
Definition: tblspcdesc.c:41
Oid CreateTableSpace(CreateTableSpaceStmt *stmt)
Definition: tablespace.c:208
struct xl_tblspc_create_rec xl_tblspc_create_rec
void tblspc_redo(XLogReaderState *record)
Definition: tablespace.c:1511