Re: Replication protocol doc fix - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Replication protocol doc fix
Date
Msg-id c82231a3ea45a75ee44b50463fa82ad66ab1a003.camel@j-davis.com
Whole thread Raw
In response to Re: Replication protocol doc fix  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Replication protocol doc fix  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Wed, 2021-06-30 at 12:25 -0400, Robert Haas wrote:
> I am not sure whether this works or not. Holding off cancel
> interrupts
> across possible network I/O seems like a non-starter. We have to be
> able to kill off connections that have wedged.

I was following a pattern that I saw in CopyGetData() and
SocketBackend(). If I understand correctly, the idea is to avoid a
cancel leaving part of a message unread, which would desync the
protocol.

>  Also, if we have to
> postpone sending ErrorResponse until we see the Sync, that's also
> bad:
> I think we need to be able to error out whenever.

I think we could still send an ErrorResponse whenever we want, and then
just ignore messages until we get a Sync (just like for an ordinary
extended protocol sequence).

> But, hmm, maybe it's
> OK to send ErrorResponse either before or after sending
> Copy{In,Both}Response. Then the client knows that if ErrorResponse
> shows up before Copy{In,Both}Response, the server sent it before
> consuming the Sync and will stop skipping messages when it sees the
> Sync; whereas if the ErrorResponse shows up after the
> Copy{In,Both}Response then the client knows the Sync was eaten and it
> has to send another one.

That's what I had in mind.

Regards,
    Jeff Davis





pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Logical replication - schema change not invalidating the relation cache
Next
From: Jeff Davis
Date:
Subject: Re: Synchronous commit behavior during network outage