EP0471282A2

Maintaining consistency of cached data in a database system.

Abstract

A method of maintaining the consistency of cached data in a client-server database system. Three new locks--a cache lock, a pending lock and an out-of-date lock--are added to a two-lock concurrency control system. A new long-running envelope transaction (69) holds a cache lock (45) on each object cached by a given client. A working transaction of the client works only with the cached object until commit time. If a second client's working transaction acquires an "X" lock on the object (167) the cache lock is changed to a pending lock (51); if the transaction thereafter commits (171) the pending lock is changed to an out-of-date lock (47). If the first client's working transaction thereafter attempts to commit, it waits for a pending lock to change (67); it aborts if it encounters an out-of-date lock (49); and otherwise it commits (61).

EP0471282A2, drawing sheet 1
Sheet 1 of 11

Term

Term ended

Projected expiry passed 8 August 2011, 15.1 years ago.

  1. Priority
  2. Filed
  3. Published
  4. Projected expiry
  5. Today

9 claims: 7 independent, 2 dependent

  1. 1
    A method of maintaining consistency of cached data in a computerized database system of the kind having a database of objects in a server memory (13) and a cache of objects in a client memory (39), each object in the cache corresponding with an object in the database, the method comprising the steps of:acquiring (41, 45) a cache lock on a database object that has been copied into the cache for use by a first client application;and    changing (47) the cache lock to an out-of-date lock if the database object is altered.
  2. 2
    A method as in claim 1 and further comprising the step of aborting (49) a working transaction that has accessed a cached object if the corresponding database object has an out-of-date lock at commit time.
  3. 4
    A method as in any preceding claim and further comprising the steps of:designating (55) any cached objects that are accessed by a working transaction of the first client application as read or write objects;acquiring (57) an exclusive lock on each database object that has a cache lock and that corresponds with a write object;acquiring (59) a share lock on each database object that has a cache lock and that corresponds with a read object;and    committing (61) the transaction unless (63, 65) a database object that corresponds with any read or write object has an out-of-date lock.
  4. 5
    A method as in claim 4 and further comprising, after the step of designating objects as read or write objects, the step of waiting (67) for any pending lock on a database object that corresponds with a write object to change to a cache lock or to an out-of-date lock.
  5. 7
    A method as in any preceding claim and further comprising the step of including in a message (73) to the first client application a report indicating which cache locks on database objects that have been copied into the client's cache have been changed to out-of-date locks.
  6. 8
    A method as in any preceding claim wherein the step of acquiring a cache lock comprises commencing (69) an envelope transaction for the first client application and accquiring (41, 45) the cache lock for the envelope transaction.
  7. 9
    A method as in claim 8 and further comprising the step of continuing the envelope transaction (112, 71) until after a working transaction of the client application has committed.