On 1 June 2013 15:45, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Simon Riggs <simon@2ndQuadrant.com> writes:
>> The way to resolve this is to have two functions:
>> pg_is_in_backup() - which covers both/all kinds of backup
>> pg_is_in_exclusive_backup() - which covers just the exclusive backup mode
>
> What will you do with pg_backup_start_time()?
Hmm, at least all of those functions use the "backup" name
consistently. I guess I wasn't suggesting we rename pg_start_backup()
to pg_start_exclusive_backup(), so maybe it makes sense.
pg_start_backup() talks about an online backup, while
pg_is_in_backup() talks about an exclusive backup. Minimum change here
would be to make pg_start_backup talk about an exclusive backup also.
What we need is a function that says whether it is possible to
shutdown because of a backup, or not. pg_basebackup is an active task,
whereas an exclusive backup never is. So we need a function to tell us
that although nothing else is running, but we are running an exclusive
backup. So changing pg_is_in_backup() to refer to all kinds of backup
still allows it to be used for its primary purpose - to tell whether
its OK to shutdown or not, but it also makes it clearer.
--Simon Riggs http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services