Re: [HACKERS] detecting binary backup in progress

2013-06-01 Thread Michael Paquier
On Sat, Jun 1, 2013 at 4:55 AM, Alvaro Herrera alvhe...@2ndquadrant.comwrote: Heikki Linnakangas wrote: The manual says: pg_is_in_backup()boolTrue if an on-line exclusive backup is still in progress. So clearly that is intentional. That could use some rephrasing, though; a

Re: [HACKERS] detecting binary backup in progress

2013-06-01 Thread Andres Freund
On 2013-06-01 17:05:57 +0900, Michael Paquier wrote: On Sat, Jun 1, 2013 at 4:55 AM, Alvaro Herrera alvhe...@2ndquadrant.comwrote: Heikki Linnakangas wrote: The manual says: pg_is_in_backup()boolTrue if an on-line exclusive backup is still in progress. So clearly

Re: [HACKERS] detecting binary backup in progress

2013-06-01 Thread Christoph Moench-Tegeder
## Joe Conway (m...@joeconway.com): 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? When I did some

Re: [HACKERS] detecting binary backup in progress

2013-06-01 Thread Simon Riggs
On 31 May 2013 21:06, Andres Freund and...@2ndquadrant.com wrote: On 2013-05-31 22:53:14 +0300, Heikki Linnakangas wrote: 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

Re: [HACKERS] detecting binary backup in progress

2013-06-01 Thread Tom Lane
Simon Riggs si...@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()?

Re: [HACKERS] detecting binary backup in progress

2013-06-01 Thread Joe Conway
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/01/2013 02:43 AM, Christoph Moench-Tegeder wrote: ## Joe Conway (m...@joeconway.com): 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

Re: [HACKERS] detecting binary backup in progress

2013-06-01 Thread Andres Freund
On 2013-06-01 08:11:26 -0700, Joe Conway wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/01/2013 02:43 AM, Christoph Moench-Tegeder wrote: ## Joe Conway (m...@joeconway.com): However there is a period of time after pg_start_backup() is first executed to when it completes,

Re: [HACKERS] detecting binary backup in progress

2013-06-01 Thread Joe Conway
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/01/2013 08:14 AM, Andres Freund wrote: On 2013-06-01 08:11:26 -0700, Joe Conway wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/01/2013 02:43 AM, Christoph Moench-Tegeder wrote: ## Joe Conway (m...@joeconway.com): However

Re: [HACKERS] detecting binary backup in progress

2013-06-01 Thread Andres Freund
On 2013-06-01 08:27:42 -0700, Joe Conway wrote: Uh. Why would you do the lock(file) thingy *after* calling pg_start_backup? You should do lock before calling start backup and remove the lock after calling stop backup. In that case I don't see where the race condition is? No, the point

Re: [HACKERS] detecting binary backup in progress

2013-06-01 Thread Simon Riggs
On 1 June 2013 15:45, Tom Lane t...@sss.pgh.pa.us wrote: Simon Riggs si...@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

Re: [HACKERS] detecting binary backup in progress

2013-05-31 Thread Andres Freund
On 2013-05-31 10:38:56 -0700, 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

Re: [HACKERS] detecting binary backup in progress

2013-05-31 Thread Thom Brown
On 31 May 2013 18:38, Joe Conway m...@joeconway.com wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 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

Re: [HACKERS] detecting binary backup in progress

2013-05-31 Thread Heikki Linnakangas
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

Re: [HACKERS] detecting binary backup in progress

2013-05-31 Thread Joe Conway
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/31/2013 10:42 AM, Andres Freund wrote: On 2013-05-31 10:38:56 -0700, 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

Re: [HACKERS] detecting binary backup in progress

2013-05-31 Thread Joe Conway
-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

Re: [HACKERS] detecting binary backup in progress

2013-05-31 Thread Heikki Linnakangas
On 31.05.2013 21:41, Joe Conway wrote: 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

Re: [HACKERS] detecting binary backup in progress

2013-05-31 Thread Joe Conway
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/31/2013 12:29 PM, 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

Re: [HACKERS] detecting binary backup in progress

2013-05-31 Thread Andres Freund
On 2013-05-31 22:29:45 +0300, Heikki Linnakangas wrote: On 31.05.2013 21:41, Joe Conway wrote: 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.

Re: [HACKERS] detecting binary backup in progress

2013-05-31 Thread Joe Conway
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/31/2013 12:36 PM, 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

Re: [HACKERS] detecting binary backup in progress

2013-05-31 Thread Heikki Linnakangas
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

Re: [HACKERS] detecting binary backup in progress

2013-05-31 Thread Alvaro Herrera
Heikki Linnakangas wrote: The manual says: pg_is_in_backup()boolTrue 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. Heck, I don't understand what it is

Re: [HACKERS] detecting binary backup in progress

2013-05-31 Thread Andres Freund
On 2013-05-31 22:53:14 +0300, Heikki Linnakangas wrote: 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