Re: [HACKERS] detecting binary backup in progress

2013-06-01 Thread Simon Riggs
On 1 June 2013 15:45, Tom Lane wrote: > Simon Riggs 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_t

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, t

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): >>>

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 i

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 ye

Re: [HACKERS] detecting binary backup in progress

2013-06-01 Thread Tom Lane
Simon Riggs 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()? regards, tom la

Re: [HACKERS] detecting binary backup in progress

2013-06-01 Thread Simon Riggs
On 31 May 2013 21:06, Andres Freund 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 >> >>$PGDATA/backup_label. Also

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 rese

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 > wrote: > > > Heikki Linnakangas wrote: > > > > > The manual says: > > > >pg_is_in_backup()boolTrue if an on-line exclusive backup is > > still in progress. > > > > > > So clearly that i

Re: [HACKERS] detecting binary backup in progress

2013-06-01 Thread Michael Paquier
On Sat, Jun 1, 2013 at 4:55 AM, Alvaro Herrera wrote: > 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

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

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 wha

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 c

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 t

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.

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 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 been

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() h

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

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 when

Re: [HACKERS] detecting binary backup in progress

2013-05-31 Thread Thom Brown
On 31 May 2013 18:38, Joe Conway 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 there is a per

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

[HACKERS] detecting binary backup in progress

2013-05-31 Thread Joe Conway
-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 there is a period of time after pg_start_backup() is first executed t