Age Owner Branch data TLA Line data Source code
1 : : /*-------------------------------------------------------------------------
2 : : *
3 : : * dbasedesc.c
4 : : * rmgr descriptor routines for commands/dbcommands.c
5 : : *
6 : : * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7 : : * Portions Copyright (c) 1994, Regents of the University of California
8 : : *
9 : : *
10 : : * IDENTIFICATION
11 : : * src/backend/access/rmgrdesc/dbasedesc.c
12 : : *
13 : : *-------------------------------------------------------------------------
14 : : */
15 : : #include "postgres.h"
16 : :
17 : : #include "commands/dbcommands_xlog.h"
18 : : #include "lib/stringinfo.h"
19 : :
20 : :
21 : : void
3995 heikki.linnakangas@i 22 :CBC 35 : dbase_desc(StringInfo buf, XLogReaderState *record)
23 : : {
4154 24 : 35 : char *rec = XLogRecGetData(record);
3995 25 : 35 : uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
26 : :
1309 rhaas@postgresql.org 27 [ + + ]: 35 : if (info == XLOG_DBASE_CREATE_FILE_COPY)
28 : : {
29 : 10 : xl_dbase_create_file_copy_rec *xlrec =
30 : : (xl_dbase_create_file_copy_rec *) rec;
31 : :
4057 andres@anarazel.de 32 : 10 : 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 : : }
1309 rhaas@postgresql.org 36 [ + + ]: 25 : else if (info == XLOG_DBASE_CREATE_WAL_LOG)
37 : : {
38 : 6 : xl_dbase_create_wal_log_rec *xlrec =
39 : : (xl_dbase_create_wal_log_rec *) rec;
40 : :
41 : 6 : appendStringInfo(buf, "create dir %u/%u",
42 : : xlrec->tablespace_id, xlrec->db_id);
43 : : }
4717 alvherre@alvh.no-ip. 44 [ + - ]: 19 : else if (info == XLOG_DBASE_DROP)
45 : : {
46 : 19 : xl_dbase_drop_rec *xlrec = (xl_dbase_drop_rec *) rec;
47 : : int i;
48 : :
1839 drowley@postgresql.o 49 : 19 : appendStringInfoString(buf, "dir");
2168 fujii@postgresql.org 50 [ + + ]: 38 : for (i = 0; i < xlrec->ntablespaces; i++)
51 : 19 : appendStringInfo(buf, " %u/%u",
52 : : xlrec->tablespace_ids[i], xlrec->db_id);
53 : : }
4057 andres@anarazel.de 54 : 35 : }
55 : :
56 : : const char *
57 : 37 : dbase_identify(uint8 info)
58 : : {
59 : 37 : const char *id = NULL;
60 : :
4054 61 [ + + + - ]: 37 : switch (info & ~XLR_INFO_MASK)
62 : : {
1309 rhaas@postgresql.org 63 : 10 : case XLOG_DBASE_CREATE_FILE_COPY:
64 : 10 : id = "CREATE_FILE_COPY";
65 : 10 : break;
66 : 7 : case XLOG_DBASE_CREATE_WAL_LOG:
67 : 7 : id = "CREATE_WAL_LOG";
4057 andres@anarazel.de 68 : 7 : break;
69 : 20 : case XLOG_DBASE_DROP:
70 : 20 : id = "DROP";
71 : 20 : break;
72 : : }
73 : :
74 : 37 : return id;
75 : : }
|