Re: Replication protocol doc fix

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Replication protocol doc fix
Date: 2021-07-02 05:55:40
Message-ID: c82231a3ea45a75ee44b50463fa82ad66ab1a003.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2021-07-02 05:59:47 Re: Synchronous commit behavior during network outage
Previous Message vignesh C 2021-07-02 05:41:32 Logical replication - schema change not invalidating the relation cache