Re: Synchronous commit not... synchronous? - Mailing list pgsql-hackers

From David Fetter
Subject Re: Synchronous commit not... synchronous?
Date
Msg-id 20121101040303.GB625@fetter.org
Whole thread Raw
In response to Synchronous commit not... synchronous?  (Peter van Hardenberg <pvh@pvh.ca>)
Responses Re: Synchronous commit not... synchronous?  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
On Wed, Oct 31, 2012 at 06:39:20PM -0700, Peter van Hardenberg wrote:
> This was rather surprising - my synchronous commit was... not
> cancelled.  Is this expected behaviour?

I believe it is.

Does the following do the right thing?

SET synchronous_commit='on';
BEGIN;
INSERT INTO data VALUES ('baz');
COMMIT;^c

Oh, and how did you get that cancel in?

Cheers,
David.
> 
> d5r5fdj6u5ieml=> begin;
> BEGIN
> d5r5fdj6u5ieml=> set synchronous_commit = 'on';
> SET
> d5r5fdj6u5ieml=> insert into data values ('baz');
> INSERT 0 1
> d5r5fdj6u5ieml=> commit;
> ^CCancel request sent
> WARNING:  canceling wait for synchronous replication due to user request
> DETAIL:  The transaction has already committed locally, but might not have
> been replicated to the standby.
> COMMIT
> d5r5fdj6u5ieml=> select * from data;
>  foo
> -----
>  bar
>  baz
> (2 rows)
> 
> d5r5fdj6u5ieml=> rollback;
> NOTICE:  there is no transaction in progress
> ROLLBACK
> d5r5fdj6u5ieml=>
> 
> 
> -- 
> Peter van Hardenberg
> San Francisco, California
> "Everything was beautiful, and nothing hurt." -- Kurt Vonnegut

-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate



pgsql-hackers by date:

Previous
From: Amit kapila
Date:
Subject: Re: Proposal for Allow postgresql.conf values to be changed via SQL
Next
From: Peter Eisentraut
Date:
Subject: Re: [COMMITTERS] pgsql: Preserve intermediate .c files in coverage mode