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 96 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().

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