PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
logicalmsgdesc.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * logicalmsgdesc.c
4  * rmgr descriptor routines for replication/logical/message.c
5  *
6  * Portions Copyright (c) 2015-2017, PostgreSQL Global Development Group
7  *
8  *
9  * IDENTIFICATION
10  * src/backend/access/rmgrdesc/logicalmsgdesc.c
11  *
12  *-------------------------------------------------------------------------
13  */
14 #include "postgres.h"
15 
16 #include "replication/message.h"
17 
18 void
20 {
21  char *rec = XLogRecGetData(record);
22  uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK;
23 
24  if (info == XLOG_LOGICAL_MESSAGE)
25  {
26  xl_logical_message *xlrec = (xl_logical_message *) rec;
27 
28  appendStringInfo(buf, "%s message size %zu bytes",
29  xlrec->transactional ? "transactional" : "nontransactional",
30  xlrec->message_size);
31  }
32 }
33 
34 const char *
36 {
37  if ((info & ~XLR_INFO_MASK) == XLOG_LOGICAL_MESSAGE)
38  return "MESSAGE";
39 
40  return NULL;
41 }
const char * logicalmsg_identify(uint8 info)
unsigned char uint8
Definition: c.h:263
#define XLogRecGetData(decoder)
Definition: xlogreader.h:202
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:110
static char * buf
Definition: pg_test_fsync.c:65
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:198
bool transactional
Definition: message.h:23
#define NULL
Definition: c.h:226
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
#define XLOG_LOGICAL_MESSAGE
Definition: message.h:37
void logicalmsg_desc(StringInfo buf, XLogReaderState *record)