From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi> |
Cc: | Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Transaction-scope advisory locks |
Date: | 2011-01-20 15:35:01 |
Message-ID: | 14232.1295537701@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Marko Tiikkaja <marko(dot)tiikkaja(at)cs(dot)helsinki(dot)fi> writes:
> Another thing I now see is this:
> BEGIN;
> SELECT pg_advisory_xact_lock(1);
> -- do something here
> -- upgrade to session lock
> SELECT pg_advisory_lock(1);
> COMMIT;
> This seems useful, since the xact lock would be automatically released
> if an error happens during "-- do something here" so you wouldn't need
> to worry about releasing the lock elsewhere. But I'm not sure this is
> safe. Can anyone see a problem with it?
I think the POLA dictates that the behavior of that should be that you
now have both a transactional and a nontransactional hold on the lock;
and only the transactional hold goes away at commit.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2011-01-20 15:45:23 | Re: pg_basebackup for streaming base backups |
Previous Message | Florian Pflug | 2011-01-20 15:34:16 | Re: pg_dump directory archive format / parallel pg_dump |