Re: detecting binary backup in progress - Mailing list pgsql-hackers

From Andres Freund
Subject Re: detecting binary backup in progress
Date
Msg-id 20130601153139.GC6732@awork2.anarazel.de
Whole thread Raw
In response to Re: detecting binary backup in progress  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
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 is I have no control over Proc1. I am trying to prevent
> Proc2 from running concurrently with a binary backup (Proc1). So I
> need to lock out Proc1, or detect it is running and wait for it to finish.

Backups over which you don't have control sound a bit scary ;). I think
at that point you have a race condition no matter what since the backup
could be started between your check and when you call pg_start_backup
anyay. So just calling pg_start_backup and handling the error properly
sounds like the way to go in that case.

Andres
-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Re: detecting binary backup in progress
Next
From: Andres Freund
Date:
Subject: Re: pg_dump with postgis extension dumps rules separately