PostgreSQL Source Code  git master
relmapdesc.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * relmapdesc.c
4  * rmgr descriptor routines for utils/cache/relmapper.c
5  *
6  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  * src/backend/access/rmgrdesc/relmapdesc.c
12  *
13  *-------------------------------------------------------------------------
14  */
15 #include "postgres.h"
16 
17 #include "utils/relmapper.h"
18 
19 void
21 {
22  char *rec = XLogRecGetData(record);
23  uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
24 
25  if (info == XLOG_RELMAP_UPDATE)
26  {
27  xl_relmap_update *xlrec = (xl_relmap_update *) rec;
28 
29  appendStringInfo(buf, "database %u tablespace %u size %d",
30  xlrec->dbid, xlrec->tsid, xlrec->nbytes);
31  }
32 }
33 
34 const char *
36 {
37  const char *id = NULL;
38 
39  switch (info & ~XLR_INFO_MASK)
40  {
41  case XLOG_RELMAP_UPDATE:
42  id = "UPDATE";
43  break;
44  }
45 
46  return id;
47 }
unsigned char uint8
Definition: c.h:507
static char * buf
Definition: pg_test_fsync.c:73
void relmap_desc(StringInfo buf, XLogReaderState *record)
Definition: relmapdesc.c:20
const char * relmap_identify(uint8 info)
Definition: relmapdesc.c:35
#define XLOG_RELMAP_UPDATE
Definition: relmapper.h:25
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:97
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:410
#define XLogRecGetData(decoder)
Definition: xlogreader.h:415
#define XLR_INFO_MASK
Definition: xlogrecord.h:62