PostgreSQL Source Code  git master
logical.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  * logical.h
3  * PostgreSQL logical decoding coordination
4  *
5  * Copyright (c) 2012-2018, PostgreSQL Global Development Group
6  *
7  *-------------------------------------------------------------------------
8  */
9 #ifndef LOGICAL_H
10 #define LOGICAL_H
11 
12 #include "replication/slot.h"
13 
14 #include "access/xlog.h"
15 #include "access/xlogreader.h"
17 
19 
21  struct LogicalDecodingContext *lr,
22  XLogRecPtr Ptr,
23  TransactionId xid,
24  bool last_write
25 );
26 
28 
30  struct LogicalDecodingContext *lr,
31  XLogRecPtr Ptr,
32  TransactionId xid
33 );
34 
35 typedef struct LogicalDecodingContext
36 {
37  /* memory context this is all allocated in */
39 
40  /* The associated replication slot */
42 
43  /* infrastructure pieces for decoding */
47 
48  /*
49  * Marks the logical decoding context as fast forward decoding one.
50  * Such a context does not have plugin loaded so most of the the following
51  * properties are unused.
52  */
54 
57 
58  /*
59  * User specified options
60  */
62 
63  /*
64  * User-Provided callback for writing/streaming out data.
65  */
69 
70  /*
71  * Output buffer.
72  */
74 
75  /*
76  * Private data pointer of the output plugin.
77  */
79 
80  /*
81  * Private data pointer for the data writer.
82  */
84 
85  /*
86  * State for writing output.
87  */
93 
94 
95 extern void CheckLogicalDecodingRequirements(void);
96 
99  bool need_full_snapshot,
100  XLogPageReadCB read_page,
105  XLogRecPtr start_lsn,
107  bool fast_forward,
108  XLogPageReadCB read_page,
115 
117 extern void LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn,
118  XLogRecPtr restart_lsn);
120 
122 
123 #endif
TransactionId write_xid
Definition: logical.h:91
static const char * plugin
struct ReorderBuffer * reorder
Definition: logical.h:45
uint32 TransactionId
Definition: c.h:474
OutputPluginOptions options
Definition: logical.h:56
bool DecodingContextReady(LogicalDecodingContext *ctx)
Definition: logical.c:436
OutputPluginCallbacks callbacks
Definition: logical.h:55
uint16 RepOriginId
Definition: xlogdefs.h:51
void * output_plugin_private
Definition: logical.h:78
void LogicalIncreaseXminForSlot(XLogRecPtr lsn, TransactionId xmin)
Definition: logical.c:855
MemoryContext context
Definition: logical.h:38
List * output_plugin_options
Definition: logical.h:61
LogicalDecodingContext * CreateInitDecodingContext(char *plugin, List *output_plugin_options, bool need_full_snapshot, XLogPageReadCB read_page, LogicalOutputPluginWriterPrepareWrite prepare_write, LogicalOutputPluginWriterWrite do_write, LogicalOutputPluginWriterUpdateProgress update_progress)
Definition: logical.c:223
LogicalOutputPluginWriterWrite LogicalOutputPluginWriterPrepareWrite
Definition: logical.h:27
void(* LogicalOutputPluginWriterUpdateProgress)(struct LogicalDecodingContext *lr, XLogRecPtr Ptr, TransactionId xid)
Definition: logical.h:29
XLogRecPtr write_location
Definition: logical.h:90
void DecodingContextFindStartpoint(LogicalDecodingContext *ctx)
Definition: logical.c:445
LogicalOutputPluginWriterPrepareWrite prepare_write
Definition: logical.h:66
bool filter_by_origin_cb_wrapper(LogicalDecodingContext *ctx, RepOriginId origin_id)
Definition: logical.c:781
LogicalDecodingContext * CreateDecodingContext(XLogRecPtr start_lsn, List *output_plugin_options, bool fast_forward, XLogPageReadCB read_page, LogicalOutputPluginWriterPrepareWrite prepare_write, LogicalOutputPluginWriterWrite do_write, LogicalOutputPluginWriterUpdateProgress update_progress)
Definition: logical.c:353
LogicalOutputPluginWriterUpdateProgress update_progress
Definition: logical.h:68
struct LogicalDecodingContext LogicalDecodingContext
void LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, XLogRecPtr restart_lsn)
Definition: logical.c:912
struct SnapBuild * snapshot_builder
Definition: logical.h:46
uint64 XLogRecPtr
Definition: xlogdefs.h:21
int(* XLogPageReadCB)(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, int reqLen, XLogRecPtr targetRecPtr, char *readBuf, TimeLineID *pageTLI)
Definition: xlogreader.h:33
void(* LogicalOutputPluginWriterWrite)(struct LogicalDecodingContext *lr, XLogRecPtr Ptr, TransactionId xid, bool last_write)
Definition: logical.h:20
void LogicalConfirmReceivedLocation(XLogRecPtr lsn)
Definition: logical.c:981
XLogReaderState * reader
Definition: logical.h:44
TransactionId xmin
Definition: snapbuild.c:162
ReplicationSlot * slot
Definition: logical.h:41
LogicalOutputPluginWriterWrite write
Definition: logical.h:67
StringInfo out
Definition: logical.h:73
void FreeDecodingContext(LogicalDecodingContext *ctx)
Definition: logical.c:488
Definition: pg_list.h:45
void * output_writer_private
Definition: logical.h:83
void CheckLogicalDecodingRequirements(void)
Definition: logical.c:78