PostgreSQL Source Code  git master
logicalmsgdesc.c File Reference
#include "postgres.h"
#include "replication/message.h"
Include dependency graph for logicalmsgdesc.c:

Go to the source code of this file.

Functions

void logicalmsg_desc (StringInfo buf, XLogReaderState *record)
 
const char * logicalmsg_identify (uint8 info)
 

Function Documentation

◆ logicalmsg_desc()

void logicalmsg_desc ( StringInfo  buf,
XLogReaderState record 
)

Definition at line 19 of file logicalmsgdesc.c.

References appendStringInfo(), xl_logical_message::message_size, xl_logical_message::transactional, XLOG_LOGICAL_MESSAGE, XLogRecGetData, XLogRecGetInfo, and XLR_INFO_MASK.

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 }
unsigned char uint8
Definition: c.h:294
#define XLogRecGetData(decoder)
Definition: xlogreader.h:226
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:78
#define XLogRecGetInfo(decoder)
Definition: xlogreader.h:222
bool transactional
Definition: message.h:23
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
#define XLOG_LOGICAL_MESSAGE
Definition: message.h:37

◆ logicalmsg_identify()

const char* logicalmsg_identify ( uint8  info)

Definition at line 35 of file logicalmsgdesc.c.

References XLOG_LOGICAL_MESSAGE, and XLR_INFO_MASK.

36 {
37  if ((info & ~XLR_INFO_MASK) == XLOG_LOGICAL_MESSAGE)
38  return "MESSAGE";
39 
40  return NULL;
41 }
#define XLR_INFO_MASK
Definition: xlogrecord.h:62
#define XLOG_LOGICAL_MESSAGE
Definition: message.h:37