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-2019, 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  XLogRecPtr Ptr,
22  TransactionId xid,
23  bool last_write
24 );
25 
27 
29  XLogRecPtr Ptr,
30  TransactionId xid
31 );
32 
33 typedef struct LogicalDecodingContext
34 {
35  /* memory context this is all allocated in */
37 
38  /* The associated replication slot */
40 
41  /* infrastructure pieces for decoding */
45 
46  /*
47  * Marks the logical decoding context as fast forward decoding one. Such a
48  * context does not have plugin loaded so most of the following properties
49  * are unused.
50  */
52 
55 
56  /*
57  * User specified options
58  */
60 
61  /*
62  * User-Provided callback for writing/streaming out data.
63  */
67 
68  /*
69  * Output buffer.
70  */
72 
73  /*
74  * Private data pointer of the output plugin.
75  */
77 
78  /*
79  * Private data pointer for the data writer.
80  */
82 
83  /*
84  * State for writing output.
85  */
91 
92 
93 extern void CheckLogicalDecodingRequirements(void);
94 
97  bool need_full_snapshot,
98  XLogRecPtr restart_lsn,
99  XLogPageReadCB read_page,
105  bool fast_forward,
106  XLogPageReadCB read_page,
113 
115 extern void LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn,
116  XLogRecPtr restart_lsn);
118 
120 
121 #endif
TransactionId write_xid
Definition: logical.h:89
static const char * plugin
struct ReorderBuffer * reorder
Definition: logical.h:43
uint32 TransactionId
Definition: c.h:508
OutputPluginOptions options
Definition: logical.h:54
bool DecodingContextReady(LogicalDecodingContext *ctx)
Definition: logical.c:453
OutputPluginCallbacks callbacks
Definition: logical.h:53
uint16 RepOriginId
Definition: xlogdefs.h:58
void * output_plugin_private
Definition: logical.h:76
void LogicalIncreaseXminForSlot(XLogRecPtr lsn, TransactionId xmin)
Definition: logical.c:875
MemoryContext context
Definition: logical.h:36
List * output_plugin_options
Definition: logical.h:59
LogicalOutputPluginWriterWrite LogicalOutputPluginWriterPrepareWrite
Definition: logical.h:26
void(* LogicalOutputPluginWriterUpdateProgress)(struct LogicalDecodingContext *lr, XLogRecPtr Ptr, TransactionId xid)
Definition: logical.h:28
LogicalDecodingContext * CreateInitDecodingContext(char *plugin, List *output_plugin_options, bool need_full_snapshot, XLogRecPtr restart_lsn, XLogPageReadCB read_page, LogicalOutputPluginWriterPrepareWrite prepare_write, LogicalOutputPluginWriterWrite do_write, LogicalOutputPluginWriterUpdateProgress update_progress)
Definition: logical.c:227
XLogRecPtr write_location
Definition: logical.h:88
void DecodingContextFindStartpoint(LogicalDecodingContext *ctx)
Definition: logical.c:462
LogicalOutputPluginWriterPrepareWrite prepare_write
Definition: logical.h:64
bool filter_by_origin_cb_wrapper(LogicalDecodingContext *ctx, RepOriginId origin_id)
Definition: logical.c:801
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:370
LogicalOutputPluginWriterUpdateProgress update_progress
Definition: logical.h:66
struct LogicalDecodingContext LogicalDecodingContext
void LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, XLogRecPtr restart_lsn)
Definition: logical.c:932
struct SnapBuild * snapshot_builder
Definition: logical.h:44
uint64 XLogRecPtr
Definition: xlogdefs.h:21
void(* LogicalOutputPluginWriterWrite)(struct LogicalDecodingContext *lr, XLogRecPtr Ptr, TransactionId xid, bool last_write)
Definition: logical.h:20
void LogicalConfirmReceivedLocation(XLogRecPtr lsn)
Definition: logical.c:1001
XLogReaderState * reader
Definition: logical.h:42
TransactionId xmin
Definition: snapbuild.c:156
ReplicationSlot * slot
Definition: logical.h:39
LogicalOutputPluginWriterWrite write
Definition: logical.h:65
StringInfo out
Definition: logical.h:71
void FreeDecodingContext(LogicalDecodingContext *ctx)
Definition: logical.c:508
int(* XLogPageReadCB)(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, int reqLen, XLogRecPtr targetRecPtr, char *readBuf)
Definition: xlogreader.h:53
Definition: pg_list.h:50
void * output_writer_private
Definition: logical.h:81
void CheckLogicalDecodingRequirements(void)
Definition: logical.c:75