Re: detecting binary backup in progress

From: Joe Conway <mail(at)joeconway(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: detecting binary backup in progress
Date: 2013-05-31 18:41:27
Message-ID: 51A8EED7.1060402@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/31/2013 10:46 AM, Heikki Linnakangas wrote:
> On 31.05.2013 20:38, Joe Conway wrote:
>> I can check for the presence of $PGDATA/backup_label in order to
>> detect a backup in progress (i.e. pg_start_backup() has been run
>> and pg_stop_backup() has not yet been run).
>>
>> However there is a period of time after pg_start_backup() is
>> first executed to when it completes, during which backup_label
>> file does not exist yet, but the backup has essentially been
>> started. Is there any way to detect this state?
>
> What are you trying to accomplish? Even if you eliminate that
> window, it's always possible that a backup starts just after you've
> checked that there is no backup in progress.

We can lay down a lockfile before checking for backup in progress, and
the script that starts the backup can check for the lockfile before
doing anything. There is still a race-window, but I want to minimize
it. pg_is_in_backup() mentioned nearby on this thread will help close
the gap.

Joe

- --
Joe Conway
credativ LLC: http://www.credativ.us
Linux, PostgreSQL, and general Open Source
Training, Service, Consulting, & 24x7 Support
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRqO7WAAoJEDfy90M199hlSPkP/AtbQjRImH0TYp0nGV+XG8zq
zyeaQXtU1kB+eon7egUjObN/khnM2ePlqmKBG5TuZW8HQWK+AnISG68rB/FU10Vo
rgiN2BSw/GZ4oCsJ1tXnbvyE70vRhq5pMbEbkfCCqjt/LZOGg50/Z/ROmr7RwmSx
2dSVsvhUryYS3eo/OxgkyBlCtnlV3fkkdKLc6S5VCaNWfHvu731Q9JPgN6/S7NhB
kcpjdD8/OA6m7MH7VkZkYcz1clVJKDCTRP39MteM4RT4IHZL6+rztnqrgICEccSh
b+gP8GUipY4o/V3QBTH09OXkSjyomgobtRFUqtB5DslY3JCdATyZdDKePUyHqZdo
/jVeUddde22BkRIoC98QwB1MiNUNXXrHBZqUV9ITlj1BrFC0HpWXJ4d/TP6Sah7W
4+n6eW+2mbRd3w+TzY95Q4i3gT3U4DS6qJKL36DBlKJQhwlmvJjZS1AMEXoaAiMj
BBl78u9Bo6meKxKacrwXq9vfgkKwup/kc8vHwEHvJz+nM/j2/Gve0iwjhIuuXoHp
XETld9x2LWiEN8xYzI5halycP1eR7eD/IBDm8X6FzUCL+gV3/ORvYxwAR587aprf
eS143/GS1JPH9nt+3ILhCGrwaBz8a/HPWE3eYnJqYlH8hVmoxjbZToDjU3FHdCNg
zsdcwv1Lg7XtX6wCMiEm
=eG9/
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2013-05-31 19:22:57 Re: removing PD_ALL_VISIBLE
Previous Message Joe Conway 2013-05-31 18:35:34 Re: detecting binary backup in progress