PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
dbasedesc.c File Reference
#include "postgres.h"
#include "commands/dbcommands_xlog.h"
#include "lib/stringinfo.h"
Include dependency graph for dbasedesc.c:

Go to the source code of this file.

Functions

void dbase_desc (StringInfo buf, XLogReaderState *record)
 
const char * dbase_identify (uint8 info)
 

Function Documentation

◆ dbase_desc()

void dbase_desc ( StringInfo  buf,
XLogReaderState record 
)

Definition at line 22 of file dbasedesc.c.

23{
24 char *rec = XLogRecGetData(record);
25 uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
26
28 {
31
32 appendStringInfo(buf, "copy dir %u/%u to %u/%u",
33 xlrec->src_tablespace_id, xlrec->src_db_id,
34 xlrec->tablespace_id, xlrec->db_id);
35 }
36 else if (info == XLOG_DBASE_CREATE_WAL_LOG)
37 {
40
41 appendStringInfo(buf, "create dir %u/%u",
42 xlrec->tablespace_id, xlrec->db_id);
43 }
44 else if (info == XLOG_DBASE_DROP)
45 {
46 xl_dbase_drop_rec *xlrec = (xl_dbase_drop_rec *) rec;
47 int i;
48
50 for (i = 0; i < xlrec->ntablespaces; i++)
51 appendStringInfo(buf, " %u/%u",
52 xlrec->tablespace_ids[i], xlrec->db_id);
53 }
54}
uint8_t uint8
Definition: c.h:500
#define XLOG_DBASE_CREATE_WAL_LOG
#define XLOG_DBASE_DROP
#define XLOG_DBASE_CREATE_FILE_COPY
int i
Definition: isn.c:74
static char * buf
Definition: pg_test_fsync.c:72
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:145
void appendStringInfoString(StringInfo str, const char *s)
Definition: stringinfo.c:230
Oid tablespace_ids[FLEXIBLE_ARRAY_MEMBER]
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:410
#define XLogRecGetData(decoder)
Definition: xlogreader.h:415

References appendStringInfo(), appendStringInfoString(), buf, xl_dbase_create_file_copy_rec::db_id, xl_dbase_create_wal_log_rec::db_id, xl_dbase_drop_rec::db_id, i, xl_dbase_drop_rec::ntablespaces, xl_dbase_create_file_copy_rec::src_db_id, xl_dbase_create_file_copy_rec::src_tablespace_id, xl_dbase_create_file_copy_rec::tablespace_id, xl_dbase_create_wal_log_rec::tablespace_id, xl_dbase_drop_rec::tablespace_ids, XLOG_DBASE_CREATE_FILE_COPY, XLOG_DBASE_CREATE_WAL_LOG, XLOG_DBASE_DROP, XLogRecGetData, and XLogRecGetInfo.

◆ dbase_identify()

const char * dbase_identify ( uint8  info)

Definition at line 57 of file dbasedesc.c.

58{
59 const char *id = NULL;
60
61 switch (info & ~XLR_INFO_MASK)
62 {
64 id = "CREATE_FILE_COPY";
65 break;
67 id = "CREATE_WAL_LOG";
68 break;
69 case XLOG_DBASE_DROP:
70 id = "DROP";
71 break;
72 }
73
74 return id;
75}
#define XLR_INFO_MASK
Definition: xlogrecord.h:62

References XLOG_DBASE_CREATE_FILE_COPY, XLOG_DBASE_CREATE_WAL_LOG, XLOG_DBASE_DROP, and XLR_INFO_MASK.