Re: Write skew observed under serializable isolation - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: Write skew observed under serializable isolation
Date
Msg-id CAJ7c6TMEJ7sZhASiK5_VjnO6yfr-yawZ_FFzFYBVRFQWNPm7ig@mail.gmail.com
Whole thread
In response to Re: Write skew observed under serializable isolation  (Zsolt Parragi <zsolt.parragi@percona.com>)
Responses Re: Write skew observed under serializable isolation
List pgsql-hackers
Hi Zsolt,

> An isolation test reproducing the problem:
>
> setup
> {
>  create table ta (id int);
>  insert into ta values (1), (2);
>  create table tb (id int);
>  insert into tb values (1), (2);
> }
> teardown { drop table ta; drop table tb; }
>
> session s1
> setup { begin isolation level serializable; set enable_seqscan = off; }
> step r1 { select count(*) from tb where ctid = '(0,3)'; }
> step w1 { insert into ta values (100); }
> step c1 { commit; }
>
> session s2
> setup { begin isolation level serializable; set enable_seqscan = off; }
> step r2 { select count(*) from ta where ctid = '(0,3)'; }
> step w2 { insert into tb values (200); }
> step c2 { commit; }
>
> permutation r1 r2 w1 w2 c1 c2

Great find, thanks for reporting.

Technically this is another bug since it affects Tid Scans, not Tid
Range Scans. This being said I see no reason not to fix it in the
scope of this discussion. The proper fix is to acquire SIREAD on the
relation.

Implemented as a separate patch.

-- 
Best regards,
Aleksander Alekseev

Attachment

pgsql-hackers by date:

Previous
From: Sagar Shedge
Date:
Subject: Re: postgres_fdw: push down FETCH FIRST .. WITH TIES when server version allows
Next
From: Ayush Tiwari
Date:
Subject: Re: [PATCH] Two remaining shmem attachment issues in single-user mode