On Wed, Mar 19, 2014 at 2:21 AM, Robert Haas <[email protected]> wrote:
> Documentation for logical decoding.
>
> Craig Ringer, Andres Freund, Christian Kruse, with edits by me.
>
> Branch
> ------
> master
>
> Details
> -------
> http://git.postgresql.org/pg/commitdiff/49c0864d7ef5227faa24f903902db90e5c9d5d69
>
> Modified Files
> --------------
> doc/src/sgml/catalogs.sgml | 27 +-
> doc/src/sgml/filelist.sgml | 1 +
> doc/src/sgml/func.sgml | 99 ++++++
> doc/src/sgml/logicaldecoding.sgml | 560 ++++++++++++++++++++++++++++++++++
> doc/src/sgml/postgres.sgml | 1 +
> doc/src/sgml/protocol.sgml | 52 +++-
> doc/src/sgml/ref/allfiles.sgml | 1 +
> doc/src/sgml/ref/alter_table.sgml | 2 +-
> doc/src/sgml/ref/create_table.sgml | 15 +-
> doc/src/sgml/ref/pg_recvlogical.sgml | 331 ++++++++++++++++++++
> doc/src/sgml/reference.sgml | 1 +
> 11 files changed, 1085 insertions(+), 5 deletions(-)
In the example of usage of pg_recvlogical, I think it's better to use
postgres database
instead of testdb because the document says "in the example below,
postgres" at the
top of the page and the postgres database is also used in the example
of usage of
pg_create_logical_replication_slot(). Attached patch changes the
example that way
and does some minor improvements.
Regards,
--
Fujii Masao
*** a/doc/src/sgml/logicaldecoding.sgml
--- b/doc/src/sgml/logicaldecoding.sgml
***************
*** 23,29 ****
Every output plugin has access to each individual new row produced
by <command>INSERT</command> and the new row version created
by <command>UPDATE</command>. Availability of old row versions for
! <command>UPDATE</command> and delete <command>DELETE</command> depends on
the configured
<link linkend="SQL-CREATETABLE-REPLICA-IDENTITY"><literal>REPLICA
IDENTITY</literal></link>.
--- 23,29 ----
Every output plugin has access to each individual new row produced
by <command>INSERT</command> and the new row version created
by <command>UPDATE</command>. Availability of old row versions for
! <command>UPDATE</command> and <command>DELETE</command> depends on
the configured
<link linkend="SQL-CREATETABLE-REPLICA-IDENTITY"><literal>REPLICA
IDENTITY</literal></link>.
***************
*** 46,52 ****
</para>
<para>
Before you can use logical decoding, you must set
! <xref linkend="guc-wal-level"> to logical and
<xref linkend="guc-max-replication-slots"> to at least 1.
Then, you should connect to the target database (in the example
below, <literal>postgres</literal>) as a superuser.
--- 46,52 ----
</para>
<para>
Before you can use logical decoding, you must set
! <xref linkend="guc-wal-level"> to <literal>logical</literal> and
<xref linkend="guc-max-replication-slots"> to at least 1.
Then, you should connect to the target database (in the example
below, <literal>postgres</literal>) as a superuser.
***************
*** 149,164 **** postgres=# SELECT pg_drop_replication_slot('regression_slot');
another connection.
</para>
<programlisting>
! # pg_recvlogical -d testdb --slot test --create
! # pg_recvlogical -d testdb --slot test --start -f -
CTRL-Z
! # psql -c "INSERT INTO data(data) VALUES('4');"
# fg
BEGIN 693
table public.data: INSERT: id[integer]:4 data[text]:'4'
COMMIT 693
CTRL-C
! # pg_recvlogical -d testdb --slot test --drop
</programlisting>
</sect1>
<sect1 id="logicaldecoding-explanation">
--- 149,164 ----
another connection.
</para>
<programlisting>
! # pg_recvlogical -d postgres --slot test --create
! # pg_recvlogical -d postgres --slot test --start -f -
CTRL-Z
! # psql -d postgres -c "INSERT INTO data(data) VALUES('4');"
# fg
BEGIN 693
table public.data: INSERT: id[integer]:4 data[text]:'4'
COMMIT 693
CTRL-C
! # pg_recvlogical -d postgres --slot test --drop
</programlisting>
</sect1>
<sect1 id="logicaldecoding-explanation">
***************
*** 198,204 **** CTRL-C
in the stream).
</para>
<note>
! <para>PostgreSQL also has streaming replication slots
(see <xref linkend="streaming-replication">), but they are used somewhat
differently there.
</para>
--- 198,204 ----
in the stream).
</para>
<note>
! <para><productname>PostgreSQL</productname> also has streaming replication slots
(see <xref linkend="streaming-replication">), but they are used somewhat
differently there.
</para>
***************
*** 258,265 **** CTRL-C
<sect1 id="logicaldecoding-walsender">
<title>Streaming Replication Protocol Interface</title>
<para>
! The <literal>CREATE_REPLICATION_SLOT SLOT slotname LOGICAL
! options</literal>, <literal>DROP_REPLICATION_SLOT SLOT slotname</literal>
and <literal>START_REPLICATION SLOT slotname LOGICAL options</literal>
commands can be used to create, drop and stream changes from a replication
slot respectively. These commands are only available over a replication
--- 258,265 ----
<sect1 id="logicaldecoding-walsender">
<title>Streaming Replication Protocol Interface</title>
<para>
! The <literal>CREATE_REPLICATION_SLOT slotname LOGICAL
! options</literal>, <literal>DROP_REPLICATION_SLOT slotname</literal>
and <literal>START_REPLICATION SLOT slotname LOGICAL options</literal>
commands can be used to create, drop and stream changes from a replication
slot respectively. These commands are only available over a replication
*** a/src/bin/pg_basebackup/pg_recvlogical.c
--- b/src/bin/pg_basebackup/pg_recvlogical.c
***************
*** 83,89 **** usage(void)
printf(_(" -F --fsync-interval=INTERVAL\n"
" frequency of syncs to the output file (in seconds, defaults to 10)\n"));
printf(_(" -o, --option=NAME[=VALUE]\n"
! " Specify option NAME with optional value VAL, to be passed\n"
" to the output plugin\n"));
printf(_(" -P, --plugin=PLUGIN use output plugin PLUGIN (defaults to test_decoding)\n"));
printf(_(" -s, --status-interval=INTERVAL\n"
--- 83,89 ----
printf(_(" -F --fsync-interval=INTERVAL\n"
" frequency of syncs to the output file (in seconds, defaults to 10)\n"));
printf(_(" -o, --option=NAME[=VALUE]\n"
! " Specify option NAME with optional value VALUE, to be passed\n"
" to the output plugin\n"));
printf(_(" -P, --plugin=PLUGIN use output plugin PLUGIN (defaults to test_decoding)\n"));
printf(_(" -s, --status-interval=INTERVAL\n"
--
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers