Claims and drain locks are used to control currency between SQL processes and utilities, with partition independence being a major focus. Utilities and SQL can concurrently access and update different partitions, including different logical partitions of nonpartitioned indexes. A logical partition refers to the set of index entries that point to rows in a particular data partition. Logical partitions exist only in nonpartitioned indexes of partitioned tables. An index entry belongs to one and only one logical partition. ClaimsWhen it first accesses an object within a unit of work, an application makes a claim on the object and releases the claim at the next commit point. Unlike a transaction lock, the claim cannot persist past the commit point. To access the object in the next unit of work, the application must make a new claim. Claims can be acquired on
The three claim classes are write, repeatable read, and cursor stability and are described in Table 16-6. Claims are released at COMMIT except for utilities and cursors defined WITH HOLD that are still positioned on an object. All SQL processes are claimers, but only occasionally is a utility a claimer, such as an online load resume.
NOTE DB2 has no limit on the number of concurrent claimers. DrainsDrain locks are used to serialize access to partitions and page sets among utilities, commands, and SQL applications. The drain is initiated at any time, but the takeover of an object occurs only when all access to the object has been quiesced. The drain process acquires a lock to prevent subsequent access from occurring until the lock is released. To drain a resource, a utility or a command first acquires a drain lock and then waits until all claimers of a particular class on the resource are released. Only then is the resource considered drained. A utility trying to take over can time out if a long-running SQL process does not release the claim quickly enough. A utility that needs only read-only access will drain on the write class, which will prevent any new updating claimers. A utility that needs to change data will drain all claim classes. |