Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#264 Allow LOCK TABLE statement to work in READ COMMITTED

open
nobody
engine (144)
5
2011-04-30
2011-04-30
Alex Yekushev
No

Read locks obtained using LOCK TABLE statement are not held until the end of transaction in READ COMMITTED transaction isolation level (see bug report 3294772). Currently "shared readers/exclusive writer" pattern works only in SERIALIZABLE isolation level.

Explicit locks obtained within LOCK TABLE statement must be held until the end of transaction regardless of the isolation level (and if possible concurrency control mode, e.g. locks, mvcc) to provide consistent behavior similar to LOCK TABLE implementations in other databases.

Discussion

  • Fred Toussi
    Fred Toussi
    2011-05-04

    Good idea especially in MVCC.

    For the default LOCKS concurrency model, there is a simple method when you are using the READ COMMITTED isolation level:

    SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
    LOCK TABLES a READ, b READ ...
    ... perform transaction
    COMMIT

    The isolation level now goes back to the default READ COMMITTED level.