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

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: pgsql-hackers@lists.postgresql.org
Cc: Heikki Linnakangas <heikki.linnakangas@iki.fi>, Michael Paquier <michael@paquier.xyz>, Fujii Masao <masao.fujii@oss.nttdata.com>
Date: 2020-07-13T06:10:10Z
Lists: pgsql-hackers
commit b36805f3c54fe0e50e58bb9e6dad66daca46fbf6
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
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 */
|        for (i = 0; i < PQntuples(res); i++)
|        {
|                char       *path = PQgetvalue(res, i, 0);
|                int                     filesize = atoi(PQgetvalue(res, i, 1));
|                bool            isdir = (strcmp(PQgetvalue(res, i, 2), "t") == 0);
|                char       *link_target = PQgetvalue(res, i, 3);
|                file_type_t type;
| 
|+               if (PQgetisnull(res, 0, 1))
...
|+                       continue;

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.

-- 
Justin



Commits

  1. Fix handling of missing files when using pg_rewind with online source

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