From 443dd97001c4cdb78ec388fffd5780ddccb3218f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 8 Jul 2014 11:39:07 -0400 Subject: doc: Fix spacing in verbatim environments --- doc/src/sgml/logicaldecoding.sgml | 45 ++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'doc/src/sgml/logicaldecoding.sgml') diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml index a2108d68e2d..41b63b4a039 100644 --- a/doc/src/sgml/logicaldecoding.sgml +++ b/doc/src/sgml/logicaldecoding.sgml @@ -51,7 +51,7 @@ Then, you should connect to the target database (in the example below, postgres) as a superuser. - + postgres=# -- Create a slot named 'regression_slot' using the output plugin 'test_decoding' postgres=# SELECT * FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding'); slot_name | xlog_position @@ -139,7 +139,7 @@ postgres=# SELECT pg_drop_replication_slot('regression_slot'); ----------------------- (1 row) - + The following example shows usage of the walsender interface using the pg_recvlogical @@ -148,7 +148,7 @@ postgres=# SELECT pg_drop_replication_slot('regression_slot'); and max_wal_senders to be set sufficiently high for another connection. - + # pg_recvlogical -d postgres --slot test --create # pg_recvlogical -d postgres --slot test --start -f - CTRL-Z @@ -159,7 +159,7 @@ table public.data: INSERT: id[integer]:4 data[text]:'4' COMMIT 693 CTRL-C # pg_recvlogical -d postgres --slot test --drop - + Logical Decoding Concepts @@ -317,7 +317,7 @@ CTRL-C _PG_output_plugin_init. This function is passed a struct that needs to be filled with the callback function pointers for individual actions. - + typedef struct OutputPluginCallbacks { LogicalDecodeStartupCB startup_cb; @@ -326,8 +326,9 @@ typedef struct OutputPluginCallbacks LogicalDecodeCommitCB commit_cb; LogicalDecodeShutdownCB shutdown_cb; } OutputPluginCallbacks; + typedef void (*LogicalOutputPluginInit)(struct OutputPluginCallbacks *cb); - + The begin_cb, change_cb and commit_cb callbacks are required, while startup_cb @@ -344,10 +345,10 @@ typedef void (*LogicalOutputPluginInit)(struct OutputPluginCallbacks *cb); accessed that either have been created by initdb in the pg_catalog schema, or have been marked as user provided catalog tables using - + ALTER TABLE user_catalog_table SET (user_catalog_table = true); CREATE TABLE another_catalog_table(data text) WITH (user_catalog_table = true); - + Any actions leading to xid assignment are prohibited. That, among others, includes writing to tables, performing DDL changes and calling txid_current(). @@ -385,23 +386,23 @@ CREATE TABLE another_catalog_table(data text) WITH (user_catalog_table = true); The optional startup_cb callback is called whenever a replication slot is created or asked to stream changes, independent of the number of changes that are ready to be put out. - + typedef void (*LogicalDecodeStartupCB) ( struct LogicalDecodingContext *ctx, OutputPluginOptions *options, bool is_init ); - + The is_init parameter will be true when the replication slot is being created and false otherwise. options points to a struct of options that output plugins can set: - + typedef struct OutputPluginOptions { OutputPluginOutputType output_type; } OutputPluginOptions; - + output_type has to either be set to OUTPUT_PLUGIN_TEXTUAL_OUTPUT or OUTPUT_PLUGIN_BINARY_OUTPUT. @@ -420,11 +421,11 @@ typedef struct OutputPluginOptions whenever a formerly active replication slot is not used anymore and can be used to deallocate resources private to the output plugin. The slot isn't necessarily being dropped, streaming is just being stopped. - + typedef void (*LogicalDecodeShutdownCB) ( struct LogicalDecodingContext *ctx ); - + @@ -433,12 +434,12 @@ typedef void (*LogicalDecodeShutdownCB) ( The required begin_cb callback is called whenever a start of a commited transaction has been decoded. Aborted transactions and their contents never get decoded. - + typedef void (*LogicalDecodeBeginCB) ( struct LogicalDecodingContext *, ReorderBufferTXN *txn ); - + The txn parameter contains meta information about the transaction, like the timestamp at which it has been committed and its XID. @@ -452,12 +453,12 @@ typedef void (*LogicalDecodeBeginCB) ( decoded. The change_cb callbacks for all modified rows will have been called before this, if there have been any modified rows. - + typedef void (*LogicalDecodeCommitCB) ( struct LogicalDecodingContext *, ReorderBufferTXN *txn ); - + @@ -470,14 +471,14 @@ typedef void (*LogicalDecodeCommitCB) ( or DELETE. Even if the original command modified several rows at once the callback will be called indvidually for each row. - + typedef void (*LogicalDecodeChangeCB) ( struct LogicalDecodingContext *ctx, ReorderBufferTXN *txn, Relation relation, ReorderBufferChange *change ); - + The ctx and txn parameters have the same contents as for the begin_cb and commit_cb callbacks, but additionally the @@ -513,11 +514,11 @@ typedef void (*LogicalDecodeChangeCB) ( The following example shows how to output data to the consumer of an output plugin: - + OutputPluginPrepareWrite(ctx, true); appendStringInfo(ctx->out, "BEGIN %u", txn->xid); OutputPluginWrite(ctx, true); - + -- cgit v1.2.3