System and method for avoiding deadlock situations due to pseudo-deleted entries
First Claim
1. A database management system (DBMS) for managing a database application, the database application including a database having at least one table, and an index having at least one unique key index table corresponding to the at least one table, the DBMS comprising:
- a data manager for managing updates of the database;
an index manager for managing updates of the unique key table index;
a transaction manager for executing database transactions in cooperation with the data manager and the index manager; and
, a lock manager cooperative with the index manager and the data manager for restricting access to a first table element of said at least one table by assigning one or more locks thereto, said locks being selected from a plurality of lock types including at least, an exclusive X-lock that enables exclusive access to the first table element, the exclusive X-lock including a Delete X-lock attribute logically associated therewith, a SET state of the Delete X-lock attribute being indicative of a transaction holding the X-lock being a delete transaction;
an unconditional S-lock that enables shared access to the first table element and is selectively assigned by the lock manager to the first table element only when the first table element is without an exclusive X-lock previously assigned thereto; and
a conditional S-lock that enables shared access to the first table element and is selectively assigned by the lock manager to the first table element only when the first table element is either without an exclusive X-lock previously assigned thereto or is without an exclusive X-lock having its Delete X-lock attribute SET assigned thereto.
1 Assignment
0 Petitions
Accused Products
Abstract
In a database management system (DBMS) (60) for a database application (10) including a database (12) having a table (14, 16, 18) and a unique key index (42) having indexes (44, 46, 48) therefor, the DBMS (60) includes a data manager (64), an index manager (66), a transaction manager (62), and a lock manager (68) which restricts access to the table by assigning locks to elements thereof. In order to avoid deadlock in the database application due to the pseudo-deleted entries, the lock categories include an X-lock and a Conditional S-lock, and have lock attributes including at least a Delete attribute for the X-lock. The Conditional S-lock is compatible (granted by the lock manager) with an X-lock whose Delete attribute is NOT SET, but is not compatible (granted) with an X-lock whose Delete attribute is SET. Each index entry includes a pseudo-delete flag which is SET by the index manager (66) to indicate deletion of the indexed row. Conditional upon locating a pseudo-deleted index key corresponding to a key to be added to the index, the index manager (66) requests a Conditional S-lock on the row indexed thereby, whereby the index manager (66) verifies the Delete transaction which set the pseudo-delete flag has committed.
-
Citations
15 Claims
-
1. A database management system (DBMS) for managing a database application, the database application including a database having at least one table, and an index having at least one unique key index table corresponding to the at least one table, the DBMS comprising:
-
a data manager for managing updates of the database;
an index manager for managing updates of the unique key table index;
a transaction manager for executing database transactions in cooperation with the data manager and the index manager; and
,a lock manager cooperative with the index manager and the data manager for restricting access to a first table element of said at least one table by assigning one or more locks thereto, said locks being selected from a plurality of lock types including at least, an exclusive X-lock that enables exclusive access to the first table element, the exclusive X-lock including a Delete X-lock attribute logically associated therewith, a SET state of the Delete X-lock attribute being indicative of a transaction holding the X-lock being a delete transaction;
an unconditional S-lock that enables shared access to the first table element and is selectively assigned by the lock manager to the first table element only when the first table element is without an exclusive X-lock previously assigned thereto; and
a conditional S-lock that enables shared access to the first table element and is selectively assigned by the lock manager to the first table element only when the first table element is either without an exclusive X-lock previously assigned thereto or is without an exclusive X-lock having its Delete X-lock attribute SET assigned thereto. - View Dependent Claims (2, 3, 4, 5)
-
-
6. A database management method for entering a key and a new row identification RID into a unique key table index of a database application that uses pseudo-deletion of table index entries, comprising:
-
searching the unique key table index for the key;
when a pseudo-deleted table index entry corresponding to the key is located during the searching step;
requesting a Conditional S-lock on a table row indexed by the pseudo-deleted table index entry, said Conditional S-lock having compatibility characteristics respective to an X-lock including;
the Conditional S-lock not being compatible with an X-lock having a Delete attribute logically associated with the X-lock that is SET or ON, and the Conditional S-lock being compatible with an X-lock having a Delete attribute logically associated with the X-lock that is NOT SET or OFF; and
,conditional upon receiving an indication that the Conditional S-lock is granted, updating the table index entry with the new row identification RID and resetting the pseudo-delete flag; and
,conditional upon not locating a table index entry corresponding to the key during the searching step, updating the table index by adding the key and the new row identification RID. - View Dependent Claims (7, 8)
-
-
9. An article of manufacture comprising a program storage medium readable by a computer and embodying one or more instructions executable by the computer to perform method steps for entering a key and a new row RID into a unique key table index of a database stored on a data store connected to the computer, the unique key table index using pseudo-deletion of table index entries, the method comprising the steps of:
-
searching the unique key table index for the key;
conditional upon locating a pseudo-deleted table index entry corresponding to the key during the searching step;
requesting a Conditional S-lock on a table row indexed by the pseudo-deleted table index entry, said Conditional S-lock being incompatible with an X-lock acquired by a delete operation and being compatible with an X-lock not acquired by a delete operation, based on a Delete attribute logically associated with the X-lock, and conditional upon receiving an indication that the Conditional S-lock is granted, updating the table index entry with the new row identification RID and resetting the pseudo-delete flag; and
,conditional upon not locating a table index entry corresponding to the key during the searching step, updating the table index by adding the key and the new row identification RID. - View Dependent Claims (10, 11)
-
- 12. A lock manager for use in a database management system (DBMS) managing a database application including a database having at least one table and cooperative with an index manager and a data manager for restricting access to a first table element of said at least one table by assigning one or more locks thereto including at least an exclusive X-lock that enables exclusive access to the first table element, the exclusive X-lock including a Delete attribute logically associated therewith, a SET state of the Delete attribute being indicative of a transaction holding the X-lock being a delete transaction.
Specification