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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Subject: Re: Don't choke on files that are removed while pg_rewind runs.
Date: 2020-07-13 07:56:29
Message-ID: 20200713075629.GA10826@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 13, 2020 at 03:59:56PM +0900, Masahiko Sawada wrote:
> On Mon, 13 Jul 2020 at 15:34, Daniel Gustafsson <daniel(at)yesql(dot)se> 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. The second column
matches with the file size, so if its value is NULL then atol() would
just crash first. I think that it would be more simple to first check
if the file size is NULL (isdir and link_target would be also NULL,
but just checking for the file size is fine), and then assign the
result values, like in the attached. Any thoughts?
--
Michael

Attachment Content-Type Size
libpq-null-crash.patch text/x-diff 1.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2020-07-13 08:12:54 Re: Don't choke on files that are removed while pg_rewind runs.
Previous Message Peter Eisentraut 2020-07-13 07:40:25 Re: OpenSSL 3.0.0 compatibility