Re: detecting binary backup in progress

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Joe Conway <mail(at)joeconway(dot)com>, "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: detecting binary backup in progress
Date: 2013-05-31 19:53:14
Message-ID: 51A8FFAA.9020709@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 31.05.2013 22:36, Andres Freund wrote:
> On 2013-05-31 22:29:45 +0300, Heikki Linnakangas wrote:
>> Note that pg_is_in_backup() just checks for presence of
>> $PGDATA/backup_label. Also note that pg_basebackup doesn't create
>> backup_label in the server. It's included in the backup that's sent to the
>> client, but it's never written to disk in the server. So checking for
>> backup_label manually or with pg_is_in_backup() will return false even if
>> pg_basebackup is running.
>
> Whoa. You are right, but I'd call that a bug. I don't understand why we
> aren't just checking
> XLogCtl->Insert.(nonExclusiveBackups||exlusiveBackup)?

Well, depends on what you imagine the function is used for. If you think
of it as "will pg_start_backup() throw an error if I call it now", or
"do I need to call pg_stop_backup()", then the current behavior is correct.

The manual says:
> pg_is_in_backup() bool True if an on-line exclusive backup is still in progress.

So clearly that is intentional. That could use some rephrasing, though;
a layman won't know what an "exclusive backup" is.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2013-05-31 19:55:55 Re: detecting binary backup in progress
Previous Message Andrew Dunstan 2013-05-31 19:51:30 Re: Running pgindent