Re: Don't choke on files that are removed while pg_rewind runs.

2020-07-15 Thread Michael Paquier
On Tue, Jul 14, 2020 at 12:18:41PM +0200, Daniel Gustafsson wrote: > I don't have strong opinions either, both approaches will work, so feel free > to > go ahead with the proposed change. Thanks. I have just gone with the solution to not change the query, and applied it down to 9.5. Please

Re: Don't choke on files that are removed while pg_rewind runs.

2020-07-14 Thread Daniel Gustafsson
> On 13 Jul 2020, at 14:18, Michael Paquier wrote: > That sounds like a good idea with an extra qual in the first part of > the inner CTE, if coupled with a check to make sure that we never > get a NULL result. Now there is IMO an argument to not complicate > more this query as it is not like a

Re: Don't choke on files that are removed while pg_rewind runs.

2020-07-13 Thread Michael Paquier
On Mon, Jul 13, 2020 at 10:12:54AM +0200, Daniel Gustafsson wrote: > Does it? PGgetvalue will return an empty string and not NULL, so atol will > convert that to zero wont it? It can be argued whether zero is the right size > for a missing file, but it shouldn't crash at least. Nay, you are

Re: Don't choke on files that are removed while pg_rewind runs.

2020-07-13 Thread Daniel Gustafsson
> On 13 Jul 2020, at 09:56, Michael Paquier wrote: > > On Mon, Jul 13, 2020 at 03:59:56PM +0900, Masahiko Sawada wrote: >> On Mon, 13 Jul 2020 at 15:34, Daniel Gustafsson wrote: >>> Yeah, I agree with that, seems like the call should've been >>> PQgetisnull(res, i, 1); >>> to match the loop.

Re: Don't choke on files that are removed while pg_rewind runs.

2020-07-13 Thread Michael Paquier
On Mon, Jul 13, 2020 at 03:59:56PM +0900, Masahiko Sawada wrote: > On Mon, 13 Jul 2020 at 15:34, Daniel Gustafsson wrote: >> Yeah, I agree with that, seems like the call should've been PQgetisnull(res, >> i, 1); >> to match the loop. > > +1 Good catch, Justin. There is a second thing here.

Re: Don't choke on files that are removed while pg_rewind runs.

2020-07-13 Thread Masahiko Sawada
On Mon, 13 Jul 2020 at 15:34, Daniel Gustafsson wrote: > > > On 13 Jul 2020, at 08:10, Justin Pryzby wrote: > > > Every other access to "res" in this loop is to res(i), which I believe is > > what > > was intended here, too. Currently, it will dumbly loop but skip *every* > > row if > > the

Re: Don't choke on files that are removed while pg_rewind runs.

2020-07-13 Thread Daniel Gustafsson
> On 13 Jul 2020, at 08:10, Justin Pryzby wrote: > Every other access to "res" in this loop is to res(i), which I believe is what > was intended here, too. Currently, it will dumbly loop but skip *every* row > if > the 2nd column (1: size) of the first row (0) is null. Yeah, I agree with

Re: Don't choke on files that are removed while pg_rewind runs.

2020-07-13 Thread Justin Pryzby
commit b36805f3c54fe0e50e58bb9e6dad66daca46fbf6 Author: Heikki Linnakangas Date: Sun Jun 28 21:35:51 2015 +0300 ... |@@ -175,22 +175,31 @@ libpqProcessFileList(void) |pg_fatal("unexpected result set while fetching file list\n"); | |/* Read result to local variables */