Re: detecting binary backup in progress

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Christoph Moench-Tegeder <cmt(at)burggraben(dot)net>, "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: detecting binary backup in progress
Date: 2013-06-01 15:31:39
Message-ID: 20130601153139.GC6732@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-06-01 15:32:59 Re: pg_dump with postgis extension dumps rules separately
Previous Message Tom Lane 2013-06-01 15:31:05 Re: pg_dump with postgis extension dumps rules separately