PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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

void LogicalDecodingProcessRecord ( LogicalDecodingContext ctx,
XLogReaderState record 
)

Definition at line 93 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_slot_get_changes_guts(), and XLogSendLogical().

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