Portions of a B-tree index in a database are locked for concurrency control. In one example, hierarchical lock modes are provided that permit locking a key, a gap between the key and the next key, and a combination of the key and the gap. In another example, key range locking may be applied to the B-tree index using locks on separator keys of index nodes. In another example, key range locking may be applied to the B-tree index using locks on key prefixes.
Legal claims defining the scope of protection, as filed with the USPTO.
1. A method, comprising: placing a lock on a separator key of an index node of a B-tree index, wherein the lock locks a key range from the separator key to a next separator key; and at least one additional set of features selected from the group consisting of: (a) splitting a child node of the index node, wherein splitting the child node includes inserting a new separator key in the index node; duplicating the lock on the separator key; and applying the lock to the new separator key; (b) escalating the lock on the separator key including: upgrading the lock from a first intention lock to a first absolute lock; and eliminating locks on keys in the child nodes of the index node; (c) de-escalating the lock on the separator key including downgrading the lock from a second absolute lock to a second intention lock and placing locks on keys in child nodes of the index node; and (d) locking separator keys in only a subset of index nodes within the B-tree index, wherein the index node is in the subset of index nodes; and changing the set of index nodes in which separator keys are locked.
2. The method of claim 1 , the additional set of features comprising: splitting the child node of the index node, wherein splitting the child node includes inserting the new separator key in the index node; duplicating the lock on the separator key; and applying the lock to the new separator key.
3. The method of claim 1 , the additional set of features comprising: escalating the lock on the separator key including: upgrading the lock from the first intention lock to the first absolute lock; and eliminating locks on keys in the child nodes of the index node.
4. The method of claim 1 , the additional set of features comprising: de-escalating the lock on the separator key including downgrading the lock from the second absolute lock to the second intention lock and placing locks on keys in child nodes of the index node.
5. The method of claim 1 , the additional set of features comprising: locking separator keys in only the subset of index nodes within the B-tree index, wherein the index node is in the subset of index nodes; and changing the set of index nodes in which separator keys are locked.
6. One or more computer readable storage media including computer readable instructions that, when executed by a computing device, perform the method of claim 1 .
7. A method, comprising: placing a lock on a key prefix of a B-tree index, wherein the lock locks each key in a key range having the key prefix; and at least one additional set of features selected from the group consisting of: (a) deleting a key having the key prefix from the key range, wherein deleting the key includes: marking the key as a ghost record by a user transaction, the user transaction not requiring locking of the key's neighboring objects, the user transaction not requiring locking of any of the components of the key's neighboring objects; and eliminating the ghost record by a system transaction; (b) escalating the lock on the key prefix including upgrading the lock from a first intention lock to a first absolute lock; (c) de-escalating the lock on the key prefix including downgrading the lock from a second absolute lock to a second intention lock; (d) locking a subset of key prefixes for the B-tree index, wherein the key prefix is in the subset of key prefixes; and changing the subset of key prefixes to lock.
8. The method of claim 7 , the additional set of features comprising: deleting the key having the key prefix from the key range, wherein deleting the key includes: marking the key as the ghost record by the user transaction, the user transaction not requiring locking of the key's neighboring objects, the user transaction not requiring locking of any of the components of the key's neighboring objects; and eliminating the ghost record by the system transaction.
9. The method of claim 7 , the additional set of features comprising: escalating the lock on the key prefix including upgrading the lock from the first intention lock to the first absolute lock.
10. The method of claim 7 , the additional set of features comprising: de-escalating the lock on the key prefix including downgrading the lock from the second absolute lock to the second intention lock.
11. The method of claim 7 , the additional set of features comprising: locking the subset of key prefixes for the B-tree index, wherein the key prefix is in the subset of key prefixes; and changing the subset of key prefixes to lock.
12. One or more computer readable storage media including computer readable instructions that, when executed by a computing device, perform the method of claim 7 .
13. The method of claim 11 , the changing the subset of key prefixes to lock comprising a delayed granularity change.
14. The method of claim 11 , the changing the subset of key prefixes to lock comprising an immediate granularity change.
Cooperative Patent Classification codes for this invention. Click any code to explore related patents in that topic.
May 4, 2011
May 8, 2012
Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.