IP Library › Granted Patent US 10,733,171
Granted Patent B2
US 10,733,171 · App. 15/944,447 · Granted Aug 4, 2020

Database lock management with cache-optimized hash table

Inventor: Chang Gyoo Park (Seoul, KR)
Assignee: SAP SE
G06F16/2343G06F16/2255G06F16/2272G06F16/24552
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,733,171
App. No.
15/944,447
Granted
Aug 4, 2020
Kind
B2
Abstract

Lock table management is provided for a lock manager of a database system, in which lock management is provided in a manner that is fast and efficient, and that conserves processing, memory, and other computational resources. For example, the lock table management can use a hashmap in which keys and values are stored in separate arrays, which can be loaded into separate CPU cache lines.

Claims (51)

1. A computer program product, the computer program product being tangibly embodied on a non-transitory computer-readable storage medium and comprising instructions that, when executed, are configured to cause at least one computing device to:

receive a lock request for a database element used in a database transaction, specified with respect to a lock table configured to selectively restrict database access to maintain database consistency;

determine a lock table entry of the lock table for the lock request, the lock table entry stored in a memory and having an array index value, and including a lock key stored in a key array, and further including at least one lock data value stored in a data array;

load a portion of the key array from the memory to a first cache line of a cache memory, including the lock key associated with the array index value;

load a portion of the data array from the memory to a second cache line of the cache memory, including the lock data value associated with the array index value; and

execute the lock request, using at least one of the lock key and the lock data value read from the cache memory.

2. The computer program product of claim 1 , wherein the instructions, when executed, are further configured to cause the at least one computing device to:

determine a first lock table entry having a first array index value, including hashing the lock key using a hashing function to determine the first array index value;

load the portion of the key array from the memory to the first cache line, including the first lock key corresponding to the first array index value;

determine from reading the first cache line that the lock key is not stored at the first array index value; and

determine that the lock key is stored at the array index value within the first cache line and within the portion of the key array.

3. The computer program product of claim 2 , wherein the lock key is located within the first cache line using first key metadata stored with the first lock key that identifies the array index value.

4. The computer program product of claim 1 , wherein the lock key is stored within the memory, and loaded to the first cache line, with key metadata that includes a hash value of the lock key.

5. The computer program product of claim 1 , wherein the lock key is stored within the memory, and loaded to the first cache line, with key metadata that includes a lock flag indicating whether the database element is locked.

6. The computer program product of claim 1 , wherein the portion of the key array includes the lock key and at least a second lock key of a second lock table entry having a second array index value.

7. The computer program product of claim 1 , wherein the key array is stored in a first column of the lock table, and the data array is stored as a second column of the lock table.

8. The computer program product of claim 1 , wherein the instructions, when executed, are further configured to cause the at least one computing device to:

determine that a size of the lock table has exceeded a load factor characterizing a proportion of the lock table that is filled; and

resize the lock table.

9. The computer program product of claim 8 , wherein the instructions, when executed, are further configured to cause the at least one computing device to resize the lock table including causing the at least one computing device to:

allocate a new key array and a new data array having a new array size;

read or erase existing lock table entries from the key array and data array when requested;

write new lock table entries to the new key array and the new data array; and

delete the key array and data array when empty.

10. The computer program product of claim 1 , wherein the lock request includes at least one of: a request to change a lock status of the database element, a request to erase the lock data value, a request to erase the lock table entry, a request to insert a new lock table entry, and a request to insert a new lock data value.

11. A computer-implemented method, comprising:

receiving a lock request for a database element used in a database transaction, specified with respect to a lock table configured to selectively restrict database access to maintain database consistency;

determining a lock table entry of the lock table for the lock request, the lock table entry stored in a memory and having an array index value, and including a lock key stored in a key array, and further including at least one lock data value stored in a data array;

loading a portion of the key array from the memory to a first cache line of a cache memory, including the lock key associated with the array index value;

loading a portion of the data array from the memory to a second cache line of the cache memory, including the lock data value associated with the array index value; and

executing the lock request, using at least one of the lock key and the lock data value read from the cache memory.

12. The method of claim 11 , wherein the lock key is stored within the memory, and loaded to the first cache line, with key metadata that includes a hash value of the lock key.

13. The method of claim 11 , wherein the portion of the key array includes the lock key and at least a second lock key of a second lock table entry having a second array index value.

14. The method of claim 11 , wherein the key array is stored in a first column of the lock table, and the data array is stored as a second column of the lock table.

15. The method of claim 11 , further comprising:

determining that a size of the lock table has exceeded a load factor characterizing a proportion of the lock table that is filled; and

resizing the lock table.

16. The method of claim 15 , wherein resizing the lock table comprises:

allocating a new key array and a new data array having a new array size;

reading or erasing existing lock table entries from the key array and data array when requested;

writing new lock table entries to the new key array and the new data array; and

deleting the key array and data array when empty.

17. A computer program product, the computer program product being tangibly embodied on a non-transitory computer-readable storage medium and comprising instructions that, when executed, are configured to cause at least one computing device to:

receive a lock key for a database element to be stored within a lock table configured to selectively restrict database access to maintain database consistency;

receive at least one lock data value corresponding to the lock key;

determine a lock table entry of the lock table, the lock table entry stored in a memory and having an array index value, a key array stored in a first column of the lock table, and a data array stored in a second column of the lock table;

store the lock key within the key array at the array index value;

store the at least one lock data value within the data array at the array index value

receive a request for the lock key;

load a portion of the key array from a memory in which the lock table is stored to a cache line of a cache memory without loading the at least one lock data value from the memory to the cache, the portion of the key array including the lock key and at least a second lock key of the key array at an adjacent array index value; and

read the lock key from the cache line.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 5, 2018
From: PARK, CHANG GYOO
To: SAP SE
Reel/Frame 045440/0456 →
Continuity (1)
Related Publication 20190303468A1 · Oct 3, 2019
Cited By (3)
US 12,236,120 US 12,360,941 US 12,386,616