PostgreSQL Source Code  git master
decode.h File Reference
Include dependency graph for decode.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void LogicalDecodingProcessRecord (LogicalDecodingContext *ctx, XLogReaderState *record)
 

Function Documentation

◆ LogicalDecodingProcessRecord()

void LogicalDecodingProcessRecord ( LogicalDecodingContext ctx,
XLogReaderState record 
)

Definition at line 94 of file decode.c.

References buf, DecodeHeap2Op(), DecodeHeapOp(), DecodeLogicalMsgOp(), DecodeStandbyOp(), DecodeXactOp(), DecodeXLogOp(), elog, XLogRecordBuffer::endptr, XLogReaderState::EndRecPtr, ERROR, XLogRecordBuffer::origptr, LogicalDecodingContext::reader, XLogReaderState::ReadRecPtr, XLogRecordBuffer::record, LogicalDecodingContext::reorder, ReorderBufferProcessXid(), RM_NEXT_ID, XLogRecGetRmid, and XLogRecGetXid.

Referenced by DecodingContextFindStartpoint(), pg_logical_replication_slot_advance(), pg_logical_slot_get_changes_guts(), and XLogSendLogical().

95 {
97 
98  buf.origptr = ctx->reader->ReadRecPtr;
99  buf.endptr = ctx->reader->EndRecPtr;
100  buf.record = record;
101 
102  /* cast so we get a warning when new rmgrs are added */
103  switch ((RmgrIds) XLogRecGetRmid(record))
104  {
105  /*
106  * Rmgrs we care about for logical decoding. Add new rmgrs in
107  * rmgrlist.h's order.
108  */
109  case RM_XLOG_ID:
110  DecodeXLogOp(ctx, &buf);
111  break;
112 
113  case RM_XACT_ID:
114  DecodeXactOp(ctx, &buf);
115  break;
116 
117  case RM_STANDBY_ID:
118  DecodeStandbyOp(ctx, &buf);
119  break;
120 
121  case RM_HEAP2_ID:
122  DecodeHeap2Op(ctx, &buf);
123  break;
124 
125  case RM_HEAP_ID:
126  DecodeHeapOp(ctx, &buf);
127  break;
128 
129  case RM_LOGICALMSG_ID:
130  DecodeLogicalMsgOp(ctx, &buf);
131  break;
132 
133  /*
134  * Rmgrs irrelevant for logical decoding; they describe stuff not
135  * represented in logical decoding. Add new rmgrs in rmgrlist.h's
136  * order.
137  */
138  case RM_SMGR_ID:
139  case RM_CLOG_ID:
140  case RM_DBASE_ID:
141  case RM_TBLSPC_ID:
142  case RM_MULTIXACT_ID:
143  case RM_RELMAP_ID:
144  case RM_BTREE_ID:
145  case RM_HASH_ID:
146  case RM_GIN_ID:
147  case RM_GIST_ID:
148  case RM_SEQ_ID:
149  case RM_SPGIST_ID:
150  case RM_BRIN_ID:
151  case RM_COMMIT_TS_ID:
152  case RM_REPLORIGIN_ID:
153  case RM_GENERIC_ID:
154  /* just deal with xid, and done */
156  buf.origptr);
157  break;
158  case RM_NEXT_ID:
159  elog(ERROR, "unexpected RM_NEXT_ID rmgr_id: %u", (RmgrIds) XLogRecGetRmid(buf.record));
160  }
161 }
struct ReorderBuffer * reorder
Definition: logical.h:42
XLogRecPtr EndRecPtr
Definition: xlogreader.h:132
static void DecodeXactOp(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
Definition: decode.c:209
static void DecodeLogicalMsgOp(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
Definition: decode.c:509
#define ERROR
Definition: elog.h:43
XLogRecPtr endptr
Definition: decode.c:49
static char * buf
Definition: pg_test_fsync.c:67
XLogRecPtr ReadRecPtr
Definition: xlogreader.h:131
XLogReaderState * record
Definition: decode.c:50
static void DecodeXLogOp(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
Definition: decode.c:167
static void DecodeHeap2Op(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
Definition: decode.c:354
#define XLogRecGetXid(decoder)
Definition: xlogreader.h:281
XLogRecPtr origptr
Definition: decode.c:48
XLogReaderState * reader
Definition: logical.h:41
#define elog(elevel,...)
Definition: elog.h:228
static void DecodeHeapOp(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
Definition: decode.c:414
void ReorderBufferProcessXid(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn)
RmgrIds
Definition: rmgr.h:25
static void DecodeStandbyOp(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
Definition: decode.c:304
#define XLogRecGetRmid(decoder)
Definition: xlogreader.h:280