Logical decoding fast-forward and slot advance

From: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Logical decoding fast-forward and slot advance
Date: 2017-12-31 10:44:04
Message-ID: 5c26ff40-8452-fb13-1bea-56a0338a809a@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Attached is patch which adds ability to do fast-forwarding while
decoding. That means wal is consumed as fast as possible and changes are
not given to output plugin for sending. The implementation is less
invasive than I originally though it would be. Most of it is just
additional filter condition in places where we would normally filter out
changes because we don't yet have full snapshot.

This is useful for multiple things. It enables us to do the replication
slot advance for both physical and logical slots, something that Magnus
took stab at some time ago, but does not seem like it went anywhere
(this is useful for replication tooling). This patch adds SQL visible
pg_replication_slot_advance() function for that use case.

It also makes second phase (after we reached SNAPBUILD_FULL_SNAPSHOT) of
replication slot creation faster, especially when there are big
transactions as the reorder buffer does not have to deal with data
changes and does not have to spill to disk.

And finally it will be useful for developing failover support of slots.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
0001-Add-pg_replication_slot_advance-function.patch text/x-patch 17.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo Nagata 2017-12-31 10:49:57 Re: Fix a Oracle-compatible instr function in the documentation
Previous Message Yugo Nagata 2017-12-31 10:32:19 Re: [PATCH] GET DIAGNOSTICS FUNCTION_NAME