Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file
Date: 2015-06-09 03:39:41
Message-ID: CAHGQGwFB+qR+y8r3Gjv+ZCGgU+J_G8ECPQOf5+Nanm9eGXmOTg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Tue, May 12, 2015 at 10:42 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
> Map basebackup tablespaces using a tablespace_map file
>
> Windows can't reliably restore symbolic links from a tar format, so
> instead during backup start we create a tablespace_map file, which is
> used by the restoring postgres to create the correct links in pg_tblspc.
> The backup protocol also now has an option to request this file to be
> included in the backup stream, and this is used by pg_basebackup when
> operating in tar mode.
>
> This is done on all platforms, not just Windows.
>
> This means that pg_basebackup will not not work in tar mode against 9.4
> and older servers, as this protocol option isn't implemented there.

While I was performing the recovery-related tests, I found that there was
the case where $PGDATA/tablespace_map was not renamed to *.old at the recovery.
Is this harmless and intentional? Sorry if this has been already
discussed so far.

The steps to reproduce the problem is:

1. start base backup, i.e., call pg_start_backup().
2. repeat some write transactions and checkpoints until the WAL file containing
the checkpoint record that backup_label indicates will be removed.
3. killall -9 postgres
4. start the server and a crash recovery.

At this time, the crash recovery fails with the following error messages.
2015-06-09 12:26:54 JST FATAL: could not locate required checkpoint record
2015-06-09 12:26:54 JST HINT: If you are not restoring from a backup,
try removing the file ".../backup_label".

5. according to the above hint message, remove $PGDATA/backup_label
and restart a crash recovery

Then you can see that tablespace_map remains in $PGDATA after the recovery ends.

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2015-06-09 04:04:20 Re: Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file
Previous Message Amit Kapila 2015-06-09 03:19:24 Re: Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2015-06-09 03:47:49 Re: Memory leak with XLogFileCopy since de768844 (WAL file with .partial)
Previous Message Amit Kapila 2015-06-09 03:19:24 Re: Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file