Re: Bug with pg_basebackup and 'shared' tablespace

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Pierre Ducroquet <p(dot)psql(at)pinaraf(dot)info>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: Bug with pg_basebackup and 'shared' tablespace
Date: 2017-05-15 05:26:07
Message-ID: CAB7nPqTEyHVmET7yaj6F0NVjer4=2HyjTensZZftXVwL2JCX2g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 2, 2017 at 2:28 AM, Pierre Ducroquet <p(dot)psql(at)pinaraf(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2017-05-15 05:35:20 Re: Duplicate usage of tablespace location?
Previous Message Dilip Kumar 2017-05-15 05:04:58 Re: Bug in ExecModifyTable function and trigger issues for foreign tables