1 /*-------------------------------------------------------------------------
4 * rmgr descriptor routines for commands/dbcommands.c
6 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
11 * src/backend/access/rmgrdesc/dbasedesc.c
13 *-------------------------------------------------------------------------
17 #include "commands/dbcommands_xlog.h"
18 #include "lib/stringinfo.h"
22 dbase_desc(StringInfo buf
, XLogReaderState
*record
)
24 char *rec
= XLogRecGetData(record
);
25 uint8 info
= XLogRecGetInfo(record
) & ~XLR_INFO_MASK
;
27 if (info
== XLOG_DBASE_CREATE_FILE_COPY
)
29 xl_dbase_create_file_copy_rec
*xlrec
=
30 (xl_dbase_create_file_copy_rec
*) rec
;
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
);
36 else if (info
== XLOG_DBASE_CREATE_WAL_LOG
)
38 xl_dbase_create_wal_log_rec
*xlrec
=
39 (xl_dbase_create_wal_log_rec
*) rec
;
41 appendStringInfo(buf
, "create dir %u/%u",
42 xlrec
->tablespace_id
, xlrec
->db_id
);
44 else if (info
== XLOG_DBASE_DROP
)
46 xl_dbase_drop_rec
*xlrec
= (xl_dbase_drop_rec
*) rec
;
49 appendStringInfoString(buf
, "dir");
50 for (i
= 0; i
< xlrec
->ntablespaces
; i
++)
51 appendStringInfo(buf
, " %u/%u",
52 xlrec
->tablespace_ids
[i
], xlrec
->db_id
);
57 dbase_identify(uint8 info
)
59 const char *id
= NULL
;
61 switch (info
& ~XLR_INFO_MASK
)
63 case XLOG_DBASE_CREATE_FILE_COPY
:
64 id
= "CREATE_FILE_COPY";
66 case XLOG_DBASE_CREATE_WAL_LOG
:
67 id
= "CREATE_WAL_LOG";