Re: How to reproduce serialization failure for a read only transaction.

From: AK <alkuzo(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: How to reproduce serialization failure for a read only transaction.
Date: 2014-01-06 22:28:19
Message-ID: 1389047299729-5785597.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-01-06 22:50:21 Re: dynamic shared memory and locks
Previous Message Robert Haas 2014-01-06 21:23:34 Re: Convert Datum* to char*