Re: [HACKERS] Bug with pg_basebackup and 'shared' tablespace - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [HACKERS] Bug with pg_basebackup and 'shared' tablespace
Date
Msg-id CAB7nPqTEyHVmET7yaj6F0NVjer4=2HyjTensZZftXVwL2JCX2g@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Bug with pg_basebackup and 'shared' tablespace  (Pierre Ducroquet <p.psql@pinaraf.info>)
Responses Re: [HACKERS] Bug with pg_basebackup and 'shared' tablespace  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers
On Tue, May 2, 2017 at 2:28 AM, Pierre Ducroquet <p.psql@pinaraf.info> wrote:
> I didn't have much time to spend on that issue until today, and I found a
> way to solve it that seems acceptable to me.
>
> The biggest drawback will be that if the backup is interrupted, previous
> tablespaces already copied will stay on disk, but since that issue could
> already happen, I don't think it's too much a drawback.

Yeah... Perhaps cleanup_directories_atexit() could be made smarter by
registering the list of folders to cleanup when they are created. But
that would be for another patch.

> The patch simply delays the empty folder checking until we start reading the
> tablespace tarball. The first entry of the tarball being the PG_MAJOR_CATVER
> folder, that can not be found otherwise, there is no real alternative to
> that.

I think I like this idea. The server allows tablespaces to be created
in parallel for different versions in the same path. It seems that
pg_basebackup should allow the same for consistency. The current
behavior is present since pg_basebackup has been introduced by the
way. Perhaps Magnus has some insight to offer on this.

> I will submit this patch in the current commit fest.

I have not spotted any flaws in the refactored logic.
    bool        basetablespace;
+    bool        firstfile = 1;    char       *copybuf = NULL;
booleans are assigned with true or false.
-- 
Michael



pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: [HACKERS] Bug in ExecModifyTable function and trigger issues forforeign tables
Next
From: Michael Paquier
Date:
Subject: Re: [HACKERS] Duplicate usage of tablespace location?