1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Add confirmed_flush column to pg_replication_slots.

There's no reason not to expose both restart_lsn and confirmed_flush
since they have rather distinct meanings. The former is the oldest WAL
still required and valid for both physical and logical slots, whereas
the latter is the location up to which a logical slot's consumer has
confirmed receiving data. Most of the time a slot will require older
WAL (i.e. restart_lsn) than the confirmed
position (i.e. confirmed_flush_lsn).

Author: Marko Tiikkaja, editorialized by me
Discussion: 559D110B.1020109@joh.to
This commit is contained in:
Andres Freund
2015-08-10 13:28:18 +02:00
parent 5c4b25acce
commit 3f811c2d6f
9 changed files with 35 additions and 15 deletions

View File

@ -5577,6 +5577,17 @@
automatically removed during checkpoints.
</entry>
</row>
<row>
<entry><structfield>confirmed_flush</structfield></entry>
<entry><type>pg_lsn</type></entry>
<entry></entry>
<entry>The address (<literal>LSN</literal>) up to which the logical
slot's consumer has confirmed receiving data. Data older than this is
not available anymore. <literal>NULL</> for physical slots.
</entry>
</row>
</tbody>
</tgroup>
</table>

View File

@ -934,9 +934,9 @@ postgres=# SELECT * FROM pg_create_physical_replication_slot('node_a_slot');
node_a_slot |
postgres=# SELECT * FROM pg_replication_slots;
slot_name | slot_type | datoid | database | active | xmin | restart_lsn
-------------+-----------+--------+----------+--------+------+-------------
node_a_slot | physical | | | f | |
slot_name | slot_type | datoid | database | active | xmin | restart_lsn | confirmed_flush_lsn
-------------+-----------+--------+----------+--------+------+-------------+---------------------
node_a_slot | physical | | | f | | |
(1 row)
</programlisting>
To configure the standby to use this slot, <varname>primary_slot_name</>

View File

@ -62,10 +62,10 @@ postgres=# SELECT * FROM pg_create_logical_replication_slot('regression_slot', '
regression_slot | 0/16B1970
(1 row)
postgres=# SELECT slot_name, plugin, slot_type, database, active, restart_lsn FROM pg_replication_slots;
slot_name | plugin | slot_type | database | active | restart_lsn
-----------------+---------------+-----------+----------+--------+-------------
regression_slot | test_decoding | logical | postgres | f | 0/16A4408
postgres=# SELECT slot_name, plugin, slot_type, database, active, restart_lsn, confirmed_flush_lsn FROM pg_replication_slots;
slot_name | plugin | slot_type | database | active | restart_lsn | confirmed_flush_lsn
-----------------+---------------+-----------+----------+--------+-------------+-----------------
regression_slot | test_decoding | logical | postgres | f | 0/16A4408 | 0/16A4440
(1 row)
postgres=# -- There are no changes to see yet