1 | /*------------------------------------------------------------------------- |
---|---|
2 | * |
3 | * replorigindesc.c |
4 | * rmgr descriptor routines for replication/logical/origin.c |
5 | * |
6 | * Portions Copyright (c) 2015-2019, 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 |
19 | replorigin_desc(StringInfo buf, XLogReaderState *record) |
20 | { |
21 | char *rec = XLogRecGetData(record); |
22 | uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; |
23 | |
24 | switch (info) |
25 | { |
26 | case XLOG_REPLORIGIN_SET: |
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, |
34 | (uint32) (xlrec->remote_lsn >> 32), |
35 | (uint32) xlrec->remote_lsn, |
36 | xlrec->force); |
37 | break; |
38 | } |
39 | case XLOG_REPLORIGIN_DROP: |
40 | { |
41 | xl_replorigin_drop *xlrec; |
42 | |
43 | xlrec = (xl_replorigin_drop *) rec; |
44 | |
45 | appendStringInfo(buf, "drop %u", xlrec->node_id); |
46 | break; |
47 | } |
48 | } |
49 | } |
50 | |
51 | const char * |
52 | replorigin_identify(uint8 info) |
53 | { |
54 | switch (info) |
55 | { |
56 | case XLOG_REPLORIGIN_SET: |
57 | return "SET"; |
58 | case XLOG_REPLORIGIN_DROP: |
59 | return "DROP"; |
60 | default: |
61 | return NULL; |
62 | } |
63 | } |
64 |