PostgreSQL Source Code  git master
replorigindesc.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * replorigindesc.c
4  * rmgr descriptor routines for replication/logical/origin.c
5  *
6  * Portions Copyright (c) 2015-2024, PostgreSQL Global Development Group
7  *
8  *
9  * IDENTIFICATION
10  * src/backend/access/rmgrdesc/replorigindesc.c
11  *
12  *-------------------------------------------------------------------------
13  */
14 #include "postgres.h"
15 
16 #include "replication/origin.h"
17 
18 void
20 {
21  char *rec = XLogRecGetData(record);
22  uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
23 
24  switch (info)
25  {
27  {
28  xl_replorigin_set *xlrec;
29 
30  xlrec = (xl_replorigin_set *) rec;
31 
32  appendStringInfo(buf, "set %u; lsn %X/%X; force: %d",
33  xlrec->node_id,
35  xlrec->force);
36  break;
37  }
39  {
40  xl_replorigin_drop *xlrec;
41 
42  xlrec = (xl_replorigin_drop *) rec;
43 
44  appendStringInfo(buf, "drop %u", xlrec->node_id);
45  break;
46  }
47  }
48 }
49 
50 const char *
52 {
53  switch (info)
54  {
56  return "SET";
58  return "DROP";
59  default:
60  return NULL;
61  }
62 }
unsigned char uint8
Definition: c.h:516
#define XLOG_REPLORIGIN_DROP
Definition: origin.h:31
#define XLOG_REPLORIGIN_SET
Definition: origin.h:30
static char * buf
Definition: pg_test_fsync.c:72
void replorigin_desc(StringInfo buf, XLogReaderState *record)
const char * replorigin_identify(uint8 info)
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:94
RepOriginId node_id
Definition: origin.h:27
RepOriginId node_id
Definition: origin.h:21
XLogRecPtr remote_lsn
Definition: origin.h:20
#define LSN_FORMAT_ARGS(lsn)
Definition: xlogdefs.h:43
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:410
#define XLogRecGetData(decoder)
Definition: xlogreader.h:415
#define XLR_INFO_MASK
Definition: xlogrecord.h:62