1 | /*------------------------------------------------------------------------- |
---|---|
2 | * |
3 | * logicalmsgdesc.c |
4 | * rmgr descriptor routines for replication/logical/message.c |
5 | * |
6 | * Portions Copyright (c) 2015-2019, 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 |
19 | logicalmsg_desc(StringInfo buf, XLogReaderState *record) |
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 * |
35 | logicalmsg_identify(uint8 info) |
36 | { |
37 | if ((info & ~XLR_INFO_MASK) == XLOG_LOGICAL_MESSAGE) |
38 | return "MESSAGE"; |
39 | |
40 | return NULL; |
41 | } |
42 |