PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
logical.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  * logical.h
3  * PostgreSQL logical decoding coordination
4  *
5  * Copyright (c) 2012-2017, 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 
29 typedef struct LogicalDecodingContext
30 {
31  /* memory context this is all allocated in */
33 
34  /* The associated replication slot */
36 
37  /* infrastructure pieces for decoding */
41 
44 
45  /*
46  * User specified options
47  */
49 
50  /*
51  * User-Provided callback for writing/streaming out data.
52  */
55 
56  /*
57  * Output buffer.
58  */
60 
61  /*
62  * Private data pointer of the output plugin.
63  */
65 
66  /*
67  * Private data pointer for the data writer.
68  */
70 
71  /*
72  * State for writing output.
73  */
79 
80 
81 extern void CheckLogicalDecodingRequirements(void);
82 
84  List *output_plugin_options,
85  XLogPageReadCB read_page,
89  XLogRecPtr start_lsn,
90  List *output_plugin_options,
91  XLogPageReadCB read_page,
97 
99  List *output_plugin_options,
103 
105 extern void LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn,
106  XLogRecPtr restart_lsn);
108 
109 extern void LagTrackerWrite(XLogRecPtr lsn, TimestampTz local_flush_time);
110 
112 
113 #endif
LogicalDecodingContext * CreateInitDecodingContext(char *plugin, List *output_plugin_options, XLogPageReadCB read_page, LogicalOutputPluginWriterPrepareWrite prepare_write, LogicalOutputPluginWriterWrite do_write)
Definition: logical.c:211
TransactionId write_xid
Definition: logical.h:77
static const char * plugin
struct ReorderBuffer * reorder
Definition: logical.h:39
uint32 TransactionId
Definition: c.h:397
int64 TimestampTz
Definition: timestamp.h:39
OutputPluginOptions options
Definition: logical.h:43
void LagTrackerWrite(XLogRecPtr lsn, TimestampTz local_flush_time)
Definition: walsender.c:3226
bool DecodingContextReady(LogicalDecodingContext *ctx)
Definition: logical.c:405
OutputPluginCallbacks callbacks
Definition: logical.h:42
uint16 RepOriginId
Definition: xlogdefs.h:51
void * output_plugin_private
Definition: logical.h:64
void LogicalIncreaseXminForSlot(XLogRecPtr lsn, TransactionId xmin)
Definition: logical.c:758
MemoryContext context
Definition: logical.h:32
List * output_plugin_options
Definition: logical.h:48
LogicalOutputPluginWriterWrite LogicalOutputPluginWriterPrepareWrite
Definition: logical.h:27
XLogRecPtr write_location
Definition: logical.h:76
void DecodingContextFindStartpoint(LogicalDecodingContext *ctx)
Definition: logical.c:414
LogicalDecodingContext * CreateDecodingContext(XLogRecPtr start_lsn, List *output_plugin_options, XLogPageReadCB read_page, LogicalOutputPluginWriterPrepareWrite prepare_write, LogicalOutputPluginWriterWrite do_write)
Definition: logical.c:327
LogicalOutputPluginWriterPrepareWrite prepare_write
Definition: logical.h:53
List * DecodingContextGetTableList(LogicalDecodingContext *ctx)
bool filter_by_origin_cb_wrapper(LogicalDecodingContext *ctx, RepOriginId origin_id)
Definition: logical.c:688
void(* LogicalOutputPluginWriterWrite)(struct LogicalDecodingContext *lr, XLogRecPtr Ptr, TransactionId xid, bool last_write)
Definition: logical.h:20
LogicalDecodingContext * CreateCopyDecodingContext(List *output_plugin_options, LogicalOutputPluginWriterPrepareWrite prepare_write, LogicalOutputPluginWriterWrite do_write)
struct LogicalDecodingContext LogicalDecodingContext
void LogicalIncreaseRestartDecodingForSlot(XLogRecPtr current_lsn, XLogRecPtr restart_lsn)
Definition: logical.c:815
struct SnapBuild * snapshot_builder
Definition: logical.h:40
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 LogicalConfirmReceivedLocation(XLogRecPtr lsn)
Definition: logical.c:884
XLogReaderState * reader
Definition: logical.h:38
TransactionId xmin
Definition: snapbuild.c:151
ReplicationSlot * slot
Definition: logical.h:35
LogicalOutputPluginWriterWrite write
Definition: logical.h:54
StringInfo out
Definition: logical.h:59
void FreeDecodingContext(LogicalDecodingContext *ctx)
Definition: logical.c:457
Definition: pg_list.h:45
void * output_writer_private
Definition: logical.h:69
void CheckLogicalDecodingRequirements(void)
Definition: logical.c:76