Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
<!-- doc/src/sgml/test-decoding.sgml -->
|
|
|
|
|
|
|
|
<sect1 id="test-decoding" xreflabel="test_decoding">
|
|
|
|
<title>test_decoding</title>
|
|
|
|
|
|
|
|
<indexterm zone="test-decoding">
|
|
|
|
<primary>test_decoding</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
<filename>test_decoding</> is an example of a logical decoding
|
|
|
|
output plugin. It doesn't do anything especially useful, but can serve as
|
|
|
|
a starting point for developing your own decoder.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
<filename>test_decoding</> receives WAL through the logical decoding
|
|
|
|
mechanism and decodes it into text representations of the operations
|
|
|
|
performed.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Typical output from this plugin, used over the SQL logical decoding
|
|
|
|
interface, might be:
|
|
|
|
|
2014-07-08 17:39:07 +02:00
|
|
|
<programlisting>
|
2014-03-12 19:11:06 +01:00
|
|
|
postgres=# SELECT * FROM pg_logical_slot_get_changes('test_slot', NULL, NULL, 'include-xids', '0');
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
location | xid | data
|
|
|
|
-----------+-----+--------------------------------------------------
|
|
|
|
0/16D30F8 | 691 | BEGIN
|
|
|
|
0/16D32A0 | 691 | table public.data: INSERT: id[int4]:2 data[text]:'arg'
|
|
|
|
0/16D32A0 | 691 | table public.data: INSERT: id[int4]:3 data[text]:'demo'
|
|
|
|
0/16D32A0 | 691 | COMMIT
|
|
|
|
0/16D32D8 | 692 | BEGIN
|
|
|
|
0/16D3398 | 692 | table public.data: DELETE: id[int4]:2
|
|
|
|
0/16D3398 | 692 | table public.data: DELETE: id[int4]:3
|
|
|
|
0/16D3398 | 692 | COMMIT
|
|
|
|
(8 rows)
|
2014-07-08 17:39:07 +02:00
|
|
|
</programlisting>
|
Introduce logical decoding.
This feature, building on previous commits, allows the write-ahead log
stream to be decoded into a series of logical changes; that is,
inserts, updates, and deletes and the transactions which contain them.
It is capable of handling decoding even across changes to the schema
of the effected tables. The output format is controlled by a
so-called "output plugin"; an example is included. To make use of
this in a real replication system, the output plugin will need to be
modified to produce output in the format appropriate to that system,
and to perform filtering.
Currently, information can be extracted from the logical decoding
system only via SQL; future commits will add the ability to stream
changes via walsender.
Andres Freund, with review and other contributions from many other
people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
Singer.
2014-03-03 22:32:18 +01:00
|
|
|
</para>
|
|
|
|
|
|
|
|
</sect1>
|