System and method for selective partition locking
AssigneeInternational Business Machines Corporation
InventorsKarelle L. Cornwell, Tanya Couch, Robert W. Lyle, James Zu-Chia Teng, Julie A. Watts
Life of this patent
Estimating the term…
Abstract
A method and system for controlling concurrency of access to data in a database system, includes: partitioning a table in the database system into a plurality of partitions; receiving a request for access to data; determining a partition of the plurality of partitions that contains the data; determining if the data has been committed; and if so, avoiding locking the partition in response to the request. By avoiding locking the partition when the data has been committed, the number of partition locks that need to be requested from a local resource lock manager is reduced, improving performance.
Claims24
A method for controlling concurrency of access to data in a database system having a database engine, data manager and database, the method comprising:
- providing for enabling and indexing of selective partition locking of a table;
- partitioning the table in the database system into a plurality of partitions;
- receiving a lock request having one or more statements for access to data in the database system, the lock request being a request for a page lock or a row lock for a corresponding row or page in the database system containing the data;
- determining a minimum lock state for each statement of the request;
- wherein the determining a minimum lock state for each statements of the request further comprises creating one or more control blocks for a called operation in relation to the one or more statements and copying to the one or more control blocks in relation to the table, one or more of:
- state of a selective partition locking, selected locking granularity, a lockmax value;
- identifying a partition of the plurality of partitions that contains the row or the page in the database system containing the data;
- associating the lock request with a partition lock on the partition that contains the row or the page in the database system containing the data, partition lock selectively locking the partition at a the minimum lock state that permits serialized access to data in the partition;
- and serially accessing the data in the partition using the partition lock, responsive to the data being committed at a time of receiving the lock request, accessing the data without using the partition lock, wherein locking by the partition lock is avoided.
A digital computer system including a computer having a central processing unit and a memory unit containing computer software for operating the computer and having executable instructions for, managing access to data in a database system having a database engine, data manager and database, the system comprising executable instructions providing for:
- providing for enabling and indexing of selective partition locking of a table;
- partitioning the table in the system into a plurality of partitions;
- and
- the data manager for managing data in the system configured to:
- receive a lock request having one or more statements for access to data in the database system, the lock request being a request for a page lock or a row lock for a corresponding row or page in the system containing the data;
- determine a minimum lock state for each statement of the request;
- wherein the determining a minimum lock state for each statements of the request further comprises creating one or more control blocks for a called operation in relation to the one or more statements and copying to the one or more control blocks in relation to the table, one or more of:
- state of a selective partition locking, selected locking granularity, a lockmax value;
- identify a partition of the plurality of partitions that contains the row or the page in the system containing the data;
- associate the lock request with a partition lock on the partition that contains the row or the page in the database system containing the data, the partition lock selectively locking the partition at a the minimum lock state that permits serialized access to data in the partition;
- and serially accessing the data in the partition using the partition lock, wherein the data manager is further configured to access the data without using the partition lock responsive to the data being committed at a time the data manager means received the lock request, wherein locking by the partition lock is avoided.
A computer readable medium encoded with a computer program providing for controlling concurrency of access to data in a database system including a computer having a central processing unit and a memory unit containing computer software for operating the computer and the computer program comprising computer executable instructions for:
- providing for enabling and indexing of selective partition locking of a table;
- partitioning the table in the database system into a plurality of partitions;
- receiving a lock request having one or more statements for access to data in the database system, the lock request being a request for a page lock or a row lock for a corresponding row or page in the database system containing the data;
- determining a minimum lock state for each statements of the request;
- wherein the determining a minimum lock state for each statements of the request further comprises creating one or more control blocks for a called operation in relation to the one or more statements and copying to the one or more control blocks in relation to the table, one or more of:
- state of a selective partition locking, selected locking granularity, a lockmax value;
- identifying a partition of the plurality of partitions that contains the row or the page in the database system containing the data;
- associating the lock request with a partition lock on the partition that contains the row or the page in the database system containing the data, the partition lock selectively locking the partition at a the minimum lock state that permits serialized access to data in the partition;
- and serially accessing the data in the partition using the partition lock, wherein the lock state protects against interference in the form of updates to the partition, accessing the data without using the partition lock responsive to the data being committed at a time of receiving the lock request, wherein locking by the partition lock is avoided.
Dependencies are inferred from the claim text.