# US 11,113,262 B2 · Time-efficient lock release in database systems

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 11,113,262 B2
- Document ID: US11113262B2
- Status: Granted
- Kind: B2
- Application number: 16/371,234
- Filed: 2019-04-01
- Published: 2020-10-01
- Granted: 2021-09-07
- Earliest claimed: 2019-04-01
- Assignees: Sap SE
- Applicants: Sap SE
- Inventors: Changgyoo Park; Byunghoon Kim
- Web page: https://patentgrep.com/patent/US11113262B2

## CPC

- G06F 16/2343: {Locking methods, e.g. distributed locking or locking implementation details}
- G06F 9/466: {Transaction processing}
- G06F 16/1774: {Locking methods, e.g. locking methods for file systems allowing shared and concurrent access to files}
- G06F 16/2228: {Indexing structures}
- G06F 16/2282: {Tablespace storage structures; Management thereof}
- G06F 16/2365: {Ensuring data consistency and integrity}
- G06F 16/2379: {Updates performed during online database operations; commit processing}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Implementations of the present disclosure include associating a first transaction executed within a database system with a first transaction control block (TCB) index, setting a status of the first transaction to active and a lock status of the first transaction to holding in response to a first set of locks being established for the first transaction, the first set of locks including one or more locks that each inhibit access to a respective resource within the database system, providing a lock table that records, for a set of locks within the database system, a set of lock owners including one or more transactions identified based on respective TCB indexes and a wait queue, and determining that the first transaction has completed, and in response setting the status of the first transaction to indicate completion of the transaction and the lock status of the first transaction to released.

## Claims

### Claim 1

A computer-implemented method for releasing transaction locks in constant time for transactions executed in database systems, the method comprising:
executing, within a database system, a first transaction on resources in the database system;
in response to executing the first transaction, establishing a first set of locks, each lock corresponding to a resource the first transaction is executed on and each lock prohibiting accesses from other transactions to the respective resource within the database system;
associating the first transaction with a first transaction control block (TCB) index of a transaction control table, each entry of the transaction control table comprising a transaction control index associated with a respective transaction, a transaction status and a lock status of the respective transaction;
setting, within the transaction control table, the transaction status of the first transaction to active in response to executing the first transaction and the lock status of the first transaction to holding in response to the first set of locks being established for the first transaction;
providing a lock table that records, for a set of locks within the database system, a set of lock owners comprising one or more transactions identified based on respective TCB indexes and a wait queue;
determining that the first transaction has completed, and in response setting the transaction status of the first transaction to indicate completion of the transaction and the lock status of the first transaction to released; and
releasing the first set of locks in response to the setting of the lock status of the first transaction to released.

### Claim 2 (depends on 1)

The method of claim 1, further comprising, in response to determining that the first transaction has completed and that a lock of the first transaction is identified within a lock owners map (LOM):
waking a second transaction for execution; and
transferring ownership of the lock to the second transaction by updating a status of the lock within the lock table to associate the lock with the second transaction and to remove the second transaction from a wait queue of the lock.

### Claim 3 (depends on 2)

The method of claim 2, wherein the second transaction adds the lock of the first transaction to the LOM.

### Claim 4 (depends on 1)

The method of claim 1, further comprising, for each lock in the lock table, determining a status of a transaction indicated as an owner of the lock, and removing the lock from the lock table in response to determining that the status of the transaction is complete.

### Claim 5 (depends on 4)

The method of claim 4, wherein, for each lock in the lock table, determining a status of a transaction indicated as an owner of the lock is periodically executed.

### Claim 6 (depends on 1)

The method of claim 1, wherein setting the transaction status of the first transaction to indicate completion of the transaction comprises setting the transaction status of the first transaction to one of committed and rolled back.

### Claim 7 (depends on 1)

The method of claim 1, wherein resources within the database system comprise a table and a record in a table.

### Claim 8

A non-transitory computer-readable storage medium coupled to one or more processors and having instructions stored thereon which, when executed by the one or more processors, cause the one or more processors to perform operations for releasing transaction locks in constant time for transactions executed in database systems, the operations comprising:
executing, within a database system, a first transaction on resources in the database system;
in response to executing the first transaction, establishing a first set of locks, each lock corresponding to a resource the first transaction is executed on and each lock prohibiting accesses from other transactions to the respective resource within the database system;
associating the first transaction with a first transaction control block (TCB) index of a transaction control table, each entry of the transaction control table comprising a transaction control index associated with a respective transaction, a transaction status and a lock status of the respective transaction;
setting, within the transaction control table, the transaction status of the first transaction to active in response to executing the first transaction and the lock status of the first transaction to holding in response to the first set of locks being established for the first transaction;
providing a lock table that records, for a set of locks within the database system, a set of lock owners comprising one or more transactions identified based on respective TCB indexes and a wait queue;
determining that the first transaction has completed, and in response setting the transaction status of the first transaction to indicate completion of the transaction and the lock status of the first transaction to released; and
releasing the first set of locks in response to the setting of the lock status of the first transaction to released.

### Claim 9 (depends on 8)

The computer-readable storage medium of claim 8, wherein operations further comprise, in response to determining that the first transaction has completed and that a lock of the first transaction is identified within a lock owners map (LOM):
waking a second transaction for execution; and
transferring ownership of the lock to the second transaction by updating a status of the lock within the lock table to associate the lock with the second transaction and to remove the second transaction from a wait queue of the lock.

### Claim 10 (depends on 9)

The computer-readable storage medium of claim 9, wherein the second transaction adds the lock of the first transaction to the LOM.

### Claim 11 (depends on 8)

The computer-readable storage medium of claim 8, wherein operations further comprise, for each lock in the lock table, determining a status of a transaction indicated as an owner of the lock, and removing the lock from the lock table in response to determining that the status of the transaction is complete.

### Claim 12 (depends on 11)

The computer-readable storage medium of claim 11, wherein, for each lock in the lock table, determining a status of a transaction indicated as an owner of the lock is periodically executed.

### Claim 13 (depends on 8)

The computer-readable storage medium of claim 8, wherein setting the transaction status of the first transaction to indicate completion of the transaction comprises setting the transaction status of the first transaction to one of committed and rolled back.

### Claim 14 (depends on 8)

The computer-readable storage medium of claim 8, wherein resources within the database system comprise a table and a record in a table.

### Claim 15

A system, comprising:
one or more computers; and
a computer-readable storage device coupled to the computing device and having instructions stored thereon which, when executed by the computing device, cause the computing device to perform operations for releasing transaction locks in constant time for transactions executed in database systems, the operations comprising:
executing, within a database system, a first transaction on resources in the database system;
in response to executing the first transaction, establishing a first set of locks, each lock corresponding to a resource the first transaction is executed on and each lock prohibiting accesses from other transactions to the respective resource within the database system;
associating the first transaction with a first transaction control block (TCB) index of a transaction control table, each entry of the transaction control table comprising a transaction control index associated with a respective transaction, a transaction status and a lock status of the respective transaction;
setting, within the transaction control table, the transaction status of the first transaction to active in response to executing the first transaction and the lock status of the first transaction to holding in response to the first set of locks being established for the first transaction;
providing a lock table that records, for a set of locks within the database system, a set of lock owners comprising one or more transactions identified based on respective TCB indexes and a wait queue;
determining that the first transaction has completed, and in response setting the transaction status of the first transaction to indicate completion of the transaction and the lock status of the first transaction to released; and
releasing the first set of locks in response to the setting of the lock status of the first transaction to released.

### Claim 16 (depends on 15)

The system of claim 15, wherein operations further comprise, in response to determining that the first transaction has completed and that a lock of the first transaction is identified within a lock owners map (LOM):
waking a second transaction for execution; and
transferring ownership of the lock to the second transaction by updating a status of the lock within the lock table to associate the lock with the second transaction and to remove the second transaction from a wait queue of the lock.

### Claim 17 (depends on 16)

The system of claim 16, wherein the second transaction adds the lock of the first transaction to the LOM.

### Claim 18 (depends on 15)

The system of claim 15, wherein operations further comprise, for each lock in the lock table, determining a status of a transaction indicated as an owner of the lock, and removing the lock from the lock table in response to determining that the status of the transaction is complete.

### Claim 19 (depends on 18)

The system of claim 18, wherein, for each lock in the lock table, determining a status of a transaction indicated as an owner of the lock is periodically executed.

### Claim 20 (depends on 15)

The system of claim 15, wherein setting the transaction status of the first transaction to indicate completion of the transaction comprises setting the transaction status of the first transaction to one of committed and rolled back.
