Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit93e6e40

Browse files
committed
Formatting and docs corrections for logical decoding output plugins.
Make the typedefs for output plugins consistent with project style;they were previously not even consistent with each other as to layoutor inclusion of parameter names. Make the documentation look the same,and fix errors therein (missing and misdescribed parameters).Back-patch because of the documentation bugs.
1 parentadb67d6 commit93e6e40

File tree

2 files changed

+35
-57
lines changed

2 files changed

+35
-57
lines changed

‎doc/src/sgml/logicaldecoding.sgml

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ typedef struct OutputPluginCallbacks
380380
LogicalDecodeShutdownCB shutdown_cb;
381381
} OutputPluginCallbacks;
382382

383-
typedef void (*LogicalOutputPluginInit)(struct OutputPluginCallbacks *cb);
383+
typedef void (*LogicalOutputPluginInit)(struct OutputPluginCallbacks *cb);
384384
</programlisting>
385385
The <function>begin_cb</function>, <function>change_cb</function>
386386
and <function>commit_cb</function> callbacks are required,
@@ -465,11 +465,9 @@ CREATE TABLE another_catalog_table(data text) WITH (user_catalog_table = true);
465465
a replication slot is created or asked to stream changes, independent
466466
of the number of changes that are ready to be put out.
467467
<programlisting>
468-
typedef void (*LogicalDecodeStartupCB) (
469-
struct LogicalDecodingContext *ctx,
470-
OutputPluginOptions *options,
471-
bool is_init
472-
);
468+
typedef void (*LogicalDecodeStartupCB) (struct LogicalDecodingContext *ctx,
469+
OutputPluginOptions *options,
470+
bool is_init);
473471
</programlisting>
474472
The <literal>is_init</literal> parameter will be true when the
475473
replication slot is being created and false
@@ -504,9 +502,7 @@ typedef struct OutputPluginOptions
504502
be used to deallocate resources private to the output plugin. The slot
505503
isn't necessarily being dropped, streaming is just being stopped.
506504
<programlisting>
507-
typedef void (*LogicalDecodeShutdownCB) (
508-
struct LogicalDecodingContext *ctx
509-
);
505+
typedef void (*LogicalDecodeShutdownCB) (struct LogicalDecodingContext *ctx);
510506
</programlisting>
511507
</para>
512508
</sect3>
@@ -519,10 +515,8 @@ typedef void (*LogicalDecodeShutdownCB) (
519515
start of a committed transaction has been decoded. Aborted transactions
520516
and their contents never get decoded.
521517
<programlisting>
522-
typedef void (*LogicalDecodeBeginCB) (
523-
struct LogicalDecodingContext *,
524-
ReorderBufferTXN *txn
525-
);
518+
typedef void (*LogicalDecodeBeginCB) (struct LogicalDecodingContext *ctx,
519+
ReorderBufferTXN *txn);
526520
</programlisting>
527521
The <parameter>txn</parameter> parameter contains meta information about
528522
the transaction, like the time stamp at which it has been committed and
@@ -540,10 +534,9 @@ typedef void (*LogicalDecodeBeginCB) (
540534
rows will have been called before this, if there have been any modified
541535
rows.
542536
<programlisting>
543-
typedef void (*LogicalDecodeCommitCB) (
544-
struct LogicalDecodingContext *,
545-
ReorderBufferTXN *txn
546-
);
537+
typedef void (*LogicalDecodeCommitCB) (struct LogicalDecodingContext *ctx,
538+
ReorderBufferTXN *txn,
539+
XLogRecPtr commit_lsn);
547540
</programlisting>
548541
</para>
549542
</sect3>
@@ -559,12 +552,10 @@ typedef void (*LogicalDecodeCommitCB) (
559552
several rows at once the callback will be called individually for each
560553
row.
561554
<programlisting>
562-
typedef void (*LogicalDecodeChangeCB) (
563-
struct LogicalDecodingContext *ctx,
564-
ReorderBufferTXN *txn,
565-
Relation relation,
566-
ReorderBufferChange *change
567-
);
555+
typedef void (*LogicalDecodeChangeCB) (struct LogicalDecodingContext *ctx,
556+
ReorderBufferTXN *txn,
557+
Relation relation,
558+
ReorderBufferChange *change);
568559
</programlisting>
569560
The <parameter>ctx</parameter> and <parameter>txn</parameter> parameters
570561
have the same contents as for the <function>begin_cb</function>
@@ -594,10 +585,8 @@ typedef void (*LogicalDecodeChangeCB) (
594585
from <parameter>origin_id</parameter> is of interest to the
595586
output plugin.
596587
<programlisting>
597-
typedef bool (*LogicalDecodeFilterByOriginCB) (
598-
struct LogicalDecodingContext *ctx,
599-
RepNodeId origin_id
600-
);
588+
typedef bool (*LogicalDecodeFilterByOriginCB) (struct LogicalDecodingContext *ctx,
589+
RepOriginId origin_id);
601590
</programlisting>
602591
The <parameter>ctx</parameter> parameter has the same contents
603592
as for the other callbacks. No information but the origin is
@@ -623,15 +612,13 @@ typedef bool (*LogicalDecodeFilterByOriginCB) (
623612
The optional <function>message_cb</function> callback is called whenever
624613
a logical decoding message has been decoded.
625614
<programlisting>
626-
typedef void (*LogicalDecodeMessageCB) (
627-
struct LogicalDecodingContext *,
628-
ReorderBufferTXN *txn,
629-
XLogRecPtr message_lsn,
630-
bool transactional,
631-
const char *prefix,
632-
Size message_size,
633-
const char *message
634-
);
615+
typedef void (*LogicalDecodeMessageCB) (struct LogicalDecodingContext *ctx,
616+
ReorderBufferTXN *txn,
617+
XLogRecPtr message_lsn,
618+
bool transactional,
619+
const char *prefix,
620+
Size message_size,
621+
const char *message);
635622
</programlisting>
636623
The <parameter>txn</parameter> parameter contains meta information about
637624
the transaction, like the time stamp at which it has been committed and

‎src/include/replication/output_plugin.h

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,43 +41,36 @@ typedef void (*LogicalOutputPluginInit) (struct OutputPluginCallbacks *cb);
4141
* "is_init" will be set to "true" if the decoding slot just got defined. When
4242
* the same slot is used from there one, it will be "false".
4343
*/
44-
typedefvoid (*LogicalDecodeStartupCB) (
45-
structLogicalDecodingContext*ctx,
44+
typedefvoid (*LogicalDecodeStartupCB) (structLogicalDecodingContext*ctx,
4645
OutputPluginOptions*options,
47-
boolis_init
48-
);
46+
boolis_init);
4947

5048
/*
5149
* Callback called for every (explicit or implicit) BEGIN of a successful
5250
* transaction.
5351
*/
54-
typedefvoid (*LogicalDecodeBeginCB) (
55-
structLogicalDecodingContext*,
52+
typedefvoid (*LogicalDecodeBeginCB) (structLogicalDecodingContext*ctx,
5653
ReorderBufferTXN*txn);
5754

5855
/*
5956
* Callback for every individual change in a successful transaction.
6057
*/
61-
typedefvoid (*LogicalDecodeChangeCB) (
62-
structLogicalDecodingContext*,
58+
typedefvoid (*LogicalDecodeChangeCB) (structLogicalDecodingContext*ctx,
6359
ReorderBufferTXN*txn,
6460
Relationrelation,
65-
ReorderBufferChange*change
66-
);
61+
ReorderBufferChange*change);
6762

6863
/*
6964
* Called for every (explicit or implicit) COMMIT of a successful transaction.
7065
*/
71-
typedefvoid (*LogicalDecodeCommitCB) (
72-
structLogicalDecodingContext*,
66+
typedefvoid (*LogicalDecodeCommitCB) (structLogicalDecodingContext*ctx,
7367
ReorderBufferTXN*txn,
7468
XLogRecPtrcommit_lsn);
7569

7670
/*
7771
* Called for the generic logical decoding messages.
7872
*/
79-
typedefvoid (*LogicalDecodeMessageCB) (
80-
structLogicalDecodingContext*,
73+
typedefvoid (*LogicalDecodeMessageCB) (structLogicalDecodingContext*ctx,
8174
ReorderBufferTXN*txn,
8275
XLogRecPtrmessage_lsn,
8376
booltransactional,
@@ -88,16 +81,13 @@ typedef void (*LogicalDecodeMessageCB) (
8881
/*
8982
* Filter changes by origin.
9083
*/
91-
typedefbool (*LogicalDecodeFilterByOriginCB) (
92-
structLogicalDecodingContext*,
84+
typedefbool (*LogicalDecodeFilterByOriginCB) (structLogicalDecodingContext*ctx,
9385
RepOriginIdorigin_id);
9486

9587
/*
9688
* Called to shutdown an output plugin.
9789
*/
98-
typedefvoid (*LogicalDecodeShutdownCB) (
99-
structLogicalDecodingContext*
100-
);
90+
typedefvoid (*LogicalDecodeShutdownCB) (structLogicalDecodingContext*ctx);
10191

10292
/*
10393
* Output plugin callbacks
@@ -113,7 +103,8 @@ typedef struct OutputPluginCallbacks
113103
LogicalDecodeShutdownCBshutdown_cb;
114104
}OutputPluginCallbacks;
115105

116-
voidOutputPluginPrepareWrite(structLogicalDecodingContext*ctx,boollast_write);
117-
voidOutputPluginWrite(structLogicalDecodingContext*ctx,boollast_write);
106+
/* Functions in replication/logical/logical.c */
107+
externvoidOutputPluginPrepareWrite(structLogicalDecodingContext*ctx,boollast_write);
108+
externvoidOutputPluginWrite(structLogicalDecodingContext*ctx,boollast_write);
118109

119110
#endif/* OUTPUT_PLUGIN_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp