Re: pg_basebackup caused FailedAssertion
Heikki Linnakangas <hlinnaka@iki.fi>
From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Jeff Davis <pgsql@j-davis.com>,
Heikki Linnakangas <hlinnakangas@vmware.com>, Tom Lane <tgl@sss.pgh.pa.us>,
Fujii Masao <masao.fujii@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>,
Andres Freund <andres@anarazel.de>
Date: 2020-12-14T08:51:45Z
Lists: pgsql-hackers
On 12/12/2020 00:47, Jeff Davis wrote: > On Wed, 2013-02-27 at 19:29 +0200, Heikki Linnakangas wrote: >> Right. I fixed that by adding WL_SOCKET_READABLE, and handling any >> messages that might arrive after the frontend already sent CopyEnd. >> The >> frontend shouldn't send any messages after CopyEnd, until it receives >> a >> CopyEnd from the backend. > > It looks like 4bad60e3 may have fixed the problem, is it possible to > just revert 3a9e64aa and allow the case? Yes, I think you're right. > Also, the comment added by 3a9e64aa is misleading, because waiting for > a CopyDone from the server is not enough. It's possible that the client > receives the CopyDone from the server and the client sends a new query > before the server breaks from the loop. The client needs to wait until > at least the first CommandComplete. Good point. I think that's a bug in the implementation rather than the comment, though. ProcessRepliesIfAny() should exit the loop immediately if (streamingDoneReceiving && streamingDoneSending). But that's moot if we revert 3a9e64aa altogether. I think we could backpatch the revert, because it's not quite right as it is, and we have 3a9e64aa in all the supported versions. >> In theory, the frontend could already send the next query before >> receiving the CopyEnd, but libpq doesn't currently allow that. Until >> someone writes a client that actually tries to do that, I'm not going >> to >> try to support that in the backend. It would be a lot more work, and >> likely be broken anyway, without any way to test it. > > I tried to add streaming replication support (still a work in progress) > to the rust client[1], and I ran into this problem. > > The core of the rust client is fully pipelined and async, so it's a bit > annoying to work around this problem. Since you have the means to test this, would you like to do the honors and revert 3a9e64aa? - Heikki
Commits
-
Revert "Cannot use WL_SOCKET_WRITEABLE without WL_SOCKET_READABLE."
- 133a0906d5bf 9.5.25 landed
- f10da1e9c970 9.6.21 landed
- ac7df6e8feeb 10.16 landed
- 4ee058a3bd9b 11.11 landed
- fde5f130c9c3 13.2 landed
- 706d84fe701e 12.6 landed
- a58db3aa10e6 14.0 landed
-
Cannot use WL_SOCKET_WRITEABLE without WL_SOCKET_READABLE.
- 3a9e64aa0d96 9.3.0 cited
-
Make pg_receivexlog and pg_basebackup -X stream work across timeline switches.
- 0b6329130e8e 9.3.0 cited