Re: Serializable Isolation without blocking

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Gregory Stark" <stark(at)enterprisedb(dot)com>, "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: <mjc(at)it(dot)usyd(dot)edu(dot)au>,<pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Serializable Isolation without blocking
Date: 2009-05-07 14:07:01
Message-ID: 4A02A4B5.EE98.0025.0@wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark <stark(at)enterprisedb(dot)com> wrote:
> "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at> writes:
>
>> So I think one would have to add intention locks for rows
>> considered in the WHERE clause to guarantee true serializability.
>
> Does the paper explain how to deal with rows "considered" in the
> WHERE clause which don't yet exist? Ie, "SELECT count(*) WHERE foo"
> needs to take out a lock which would cause any transaction which
> inserts a new record where foo is true to be abort.

The issue is mentioned, along with the note, quoted in my original
post, of why they were able to dodge the issue in the Berkeley DB
implementation.

> In MSSQL this requires locking the page of the index where such
> records would be inserted (or the entire table if there's no index).

This is the only form of predicate locking I've seen in real-world
production databases which provide true serializable behavior.

> In Predicate locking schemes this requires a separate storage
> structure for storing such predicates which can be arbitrarily
> complex expressions to check any new tuple being inserted against.

I've never seen that done in real-world production databases, although
I'm sure it's pretty in theory.

> Are these intention locks predicate locks, in that they're not
> associated with actual pages or records but with potential records
> which might be inserted in the future?

They are predicate locks in the sense that they detect all conflicts
which could occur based on the actual predicate, though they tend to
indicate conflicts in some situations where a rigorous (and expensive)
analisys of the actual predicates might not; but please note that such
locks would be SIREAD locks, which don't block any data modification,
but are only used to detect dangerous update patterns.

-Kevin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2009-05-07 14:12:07 Re: Patch to fix search_path defencies with pg_bench
Previous Message Kevin Grittner 2009-05-07 13:55:19 Re: Serializable Isolation without blocking