Re: How to reproduce serialization failure for a read only transaction. - Mailing list pgsql-hackers

From AK
Subject Re: How to reproduce serialization failure for a read only transaction.
Date
Msg-id 1389047299729-5785597.post@n5.nabble.com
Whole thread Raw
In response to Re: How to reproduce serialization failure for a read only transaction.  (Florian Pflug <fgp@phlo.org>)
Responses Re: Re: How to reproduce serialization failure for a read only transaction.  (Florian Pflug <fgp@phlo.org>)
Re: Re: How to reproduce serialization failure for a read only transaction.  (Kevin Grittner <kgrittn@ymail.com>)
List pgsql-hackers
Hi Florian,

can you explain why do you state that "default isolation level is assumed to
be
serializable, of course", when you explicitly specify isolation level for
every session - why should he default matter at all?

When I am trying to reproduce the scenario which you have posted, I am
observing different results. Here is my full scenario:

Session 1. Setting up:

CREATE TABLE cars( license_plate VARCHAR NOT NULL, reserved_by VARCHAR NULL
);
INSERT INTO cars(license_plate)
VALUES ('SUPRUSR'),('MIDLYPH');

Session 2: W1

BEGIN ISOLATION LEVEL SERIALIZABLE;

UPDATE cars SET reserved_by = 'Julia' WHERE license_plate = 'SUPRUSR' AND reserved_by IS NULL;

SELECT * FROM Cars
WHERE license_plate IN('SUPRUSR','MIDLYPH');

Session 3: W2

BEGIN ISOLATION LEVEL SERIALIZABLE;

UPDATE cars SET reserved_by = 'Ryan' WHERE license_plate = 'MIDLYPH' AND reserved_by IS NULL;

COMMIT;

Session 4: R

BEGIN ISOLATION LEVEL SERIALIZABLE READ ONLY;

SELECT * FROM Cars 
WHERE license_plate IN('SUPRUSR','MIDLYPH');

Session 2: W1

COMMIT;

ERROR:  could not serialize access due to read/write dependencies among
transactions

What am I doing wrong?

Thank you for your help!



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/How-to-reproduce-serialization-failure-for-a-read-only-transaction-tp5785569p5785597.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Convert Datum* to char*
Next
From: Robert Haas
Date:
Subject: Re: dynamic shared memory and locks