Re: Stopping logical replication protocol - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: Stopping logical replication protocol
Date
Msg-id CAMsr+YFA8Tjw5CEonbVK1=TvBMer4CG+ftctKzjmoDOezrgiig@mail.gmail.com
Whole thread Raw
In response to Stopping logical replication protocol  (Vladimir Gordiychuk <folyga@gmail.com>)
List pgsql-hackers
On 6 May 2016 at 23:23, Vladimir Gordiychuk <folyga@gmail.com> wrote:
 

I prepare small patch that fix problems describe below. Now WalSndWriteData first check message from consumer and during decode transaction check that replication still active. KeppAlive message now not send if was get CopyDone package(keep alive now not necessary we preparing to complete). WalSndWaitForWal after get CopyDone exit from loop. With apply this patch I get next measurements


I'll review this, but based on the description and concept I agree it's useful.

I have been frustrated in the past by the inability to terminate the logical replication stream and return to command mode without a disconnect/reconnect so I'd like to have this.

AFAIK there's no particular reason we can't do it, it's just not implemented. It does have to be a clean exit though, where the logical decoding context is destroyed, the xact it was running in is closed, etc. Like for the SQL interface.

You still won't want to do it too often because there's a cost to stopping decoding and restarting it. We have to re-read from the restart_lsn and reassemble transactions again up to the point where we can start sending them to the client again. Especially if you're most of the way through decoding a big xact, or if there's a long-running xact holding restart_lsn down this might cost a bit. But no worse than repeatedly calling the SQL logical decoding interface.

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

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: parallel.c is not marked as test covered
Next
From: David Rowley
Date:
Subject: Re: parallel.c is not marked as test covered