/Users/deen/code/yugabyte-db/src/postgres/src/bin/pg_waldump/replorigindesc.c
Line | Count | Source (jump to first uncovered line) |
1 | | /*------------------------------------------------------------------------- |
2 | | * |
3 | | * replorigindesc.c |
4 | | * rmgr descriptor routines for replication/logical/origin.c |
5 | | * |
6 | | * Portions Copyright (c) 2015-2018, 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 | 0 | { |
21 | 0 | char *rec = XLogRecGetData(record); |
22 | 0 | uint8 info = XLogRecGetInfo(record) & ~XLR_INFO_MASK; |
23 | |
|
24 | 0 | switch (info) |
25 | 0 | { |
26 | 0 | case XLOG_REPLORIGIN_SET: |
27 | 0 | { |
28 | 0 | xl_replorigin_set *xlrec; |
29 | |
|
30 | 0 | xlrec = (xl_replorigin_set *) rec; |
31 | |
|
32 | 0 | appendStringInfo(buf, "set %u; lsn %X/%X; force: %d", |
33 | 0 | xlrec->node_id, |
34 | 0 | (uint32) (xlrec->remote_lsn >> 32), |
35 | 0 | (uint32) xlrec->remote_lsn, |
36 | 0 | xlrec->force); |
37 | 0 | break; |
38 | 0 | } |
39 | 0 | case XLOG_REPLORIGIN_DROP: |
40 | 0 | { |
41 | 0 | xl_replorigin_drop *xlrec; |
42 | |
|
43 | 0 | xlrec = (xl_replorigin_drop *) rec; |
44 | |
|
45 | 0 | appendStringInfo(buf, "drop %u", xlrec->node_id); |
46 | 0 | break; |
47 | 0 | } |
48 | 0 | } |
49 | 0 | } |
50 | | |
51 | | const char * |
52 | | replorigin_identify(uint8 info) |
53 | 0 | { |
54 | 0 | switch (info) |
55 | 0 | { |
56 | 0 | case XLOG_REPLORIGIN_SET: |
57 | 0 | return "SET"; |
58 | 0 | case XLOG_REPLORIGIN_DROP: |
59 | 0 | return "DROP"; |
60 | 0 | default: |
61 | 0 | return NULL; |
62 | 0 | } |
63 | 0 | } |