# US 11,119,997 B2 · Lock-free hash indexing

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

- Number: US 11,119,997 B2
- Document ID: US11119997B2
- Status: Granted
- Kind: B2
- Application number: 15/908,727
- Filed: 2018-02-28
- Published: 2018-12-06
- Granted: 2021-09-14
- Earliest claimed: 2017-03-01
- Assignees: Sap SE
- Applicants: Sap SE
- Inventors: Aditya Gurajada; Zhan-feng Ma; Zhi-ping Xiong
- Web page: https://patentgrep.com/patent/US11119997B2

## CPC

- G06F 16/2255: {Hash tables}
- G06F 3/0604: {Improving or facilitating administration, e.g. storage management}
- G06F 3/061: {Improving I/O performance}
- G06F 3/0644: {Management of space entities, e.g. partitions, extents, pools}
- G06F 3/065: {Replication mechanisms}
- G06F 3/0653: {Monitoring storage devices or systems}
- G06F 3/0673: {Single storage device}
- G06F 11/1471: involving logging of persistent data for recovery
- G06F 11/1474: in transactions (updating of structured data in databases G06F16/23)
- G06F 12/0253: {Garbage collection, i.e. reclamation of unreferenced memory}
- G06F 16/22: Indexing; Data structures therefor; Storage structures
- G06F 16/2272: {Management thereof}
- G06F 16/2282: {Tablespace storage structures; Management thereof}
- G06F 16/2379: {Updates performed during online database operations; commit processing}
- G06F 16/27: Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- G06F 2201/80: Database-specific techniques
- G06F 2201/82: Solving problems relating to consistency
- G06F 2212/1044: Space efficiency improvement
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A system for an in-memory row storage architecture can be provided. In some implementations, the system performs operations comprising adding a data row to an in-memory row store at a row location based on a database operation, indexing the row location in an index table comprising a plurality of nodes for a plurality of rows in the in-memory row store, the plurality of nodes organized across a plurality of buckets, and accessing the data row at the row location in the in-memory row store based on the index table to perform another database operation on the data row Related systems, methods, and articles of manufacture are also described.

## Claims

### Claim 1

A system comprising:
at least one processor; and
at least one memory storing instructions which, when executed by the at least one processor, cause operations comprising:
adding, based on a database operation, a data row to an in-memory row store at a row location, wherein the database operation comprises at least one of an insert of the data row, an update of the data row, or a selection of the data row;
indexing the row location in a first index table and a second index table, the first index table comprising a lock-free hash index that is stored in-memory to provide an index for the in-memory row store and the second index table provided for a page based persistent store, the first index table comprising a plurality of nodes for a plurality of rows in the in-memory row store, the plurality of nodes organized across a plurality of buckets, the row location indexed based on:
determining a hash value based on a key for the data row,
determining, based on the hash value, a bucket location from among the plurality of buckets, and
adding, within the bucket location, a node within the index table for the data row;
in response to another database operation on the data row, accessing the data row at the row location in the in-memory row store, when the data row location is determined from the first index table comprising the lock-free hash cache; and
in response to the another database operation on the data row and the data row location not being determined from the first index table, accessing, based on the second index, the data row at the row location in the page based persistent store.

### Claim 2 (depends on 1)

The system of claim 1, wherein the node comprises one or more of:
a pointer to a next node in list of active nodes within the bucket location;
a pointer to a next node in a list of nodes marked for deletion within the bucket list;
an indication of an identifier for the data row;
an indication of a most recent time at which the node was updated; and
an indication of the hash value.

### Claim 3 (depends on 2)

The system of claim 2, wherein accessing the data row to perform the another database operation comprises:
determining a second hash value based on the key for the data row;
searching, based on the second hash vale, for the node; and
accessing, based on the indication of the identifier for the data row, the data row at the row location within the in-memory row store.

### Claim 4 (depends on 1)

The system of claim 1, wherein the first index table is stored in the in-memory row store, and wherein the second index table is stored in the persistent page store.

### Claim 5 (depends on 1)

The system of claim 1, wherein the bucket location comprises a linked list of nodes organized in order of row identifiers, and wherein adding the node within the index table comprises adding the node to the linked list of nodes based on:
modifying at least one node in the linked list of nodes to include a pointer to the node; or
including a pointer within the node to at least one node in the linked list of nodes.

### Claim 6 (depends on 1)

The system of claim 1, wherein the operations further comprise:
marking, in response to determining that the data row is not transactionally active or that the second operation comprises a delete of the data row, the node for deletion, wherein marking the node for deletion comprises placing the node into a linked list of nodes to be deleted; and
deleting, based on a background thread traversing the linked list, the node from the in-memory row store.

### Claim 7 (depends on 1)

The system of claim 1, wherein the operations further comprise:
determining, at a start of execution of the another database operation, a first value of information stored within the row location;
generating, based on the another database operation and the first value, replacement information;
comparing, at an end of execution of the another database operation, the first value to a second value of information stored within the row location; and
updating, based on the first value being equal to the second value, the row location to include the replacement information.

### Claim 8 (depends on 1)

The system of claim 1, wherein the operations further comprise:
performing, based on determining that an error affecting a database transaction comprising the database operation has occurred, a rollback of the database transaction, wherein the rollback comprises removing the data row from the in-memory row store and deleting the node from the index table.

### Claim 9 (depends on 1)

The system of claim 1, wherein the operations further comprise:
determining whether a count of the plurality of buckets exceeds a threshold value; and
allocating, when the count exceeds the threshold value, first memory for a first layer of buckets and second memory for a second layer of buckets, wherein each bucket within the second layer of buckets includes at least one pointer to at least one bucket in the first layer of buckets, and wherein the second memory is configured for storage of the plurality of nodes.

### Claim 10

A non-transitory computer readable medium storing instructions which, when executed by at least one processor, cause operations comprising:
adding, based on a database operation, a data row to an in-memory row store at a row location, wherein the database operation comprises at least one of an insert of the data row, an update of the data row, or a selection of the data row;
indexing the row location in a first index table and a second index table, the first index table comprising a lock-free hash index that is stored in-memory to provide an index for the in-memory row store and the second index table provided for a page based persistent store, the first index table comprising a plurality of nodes for a plurality of rows in the in-memory row store, the plurality of nodes organized across a plurality of buckets, the row location indexed based on:
determining a hash value based on a key for the data row,
determining, based on the hash value, a bucket location from among the plurality of buckets, and
adding, within the bucket location, a node within the index table for the data row;
in response to another database operation on the data row, accessing the data row at the row location in the in-memory row store, when the data row location is determined from the first index table comprising the lock-free hash cache; and
in response to the another database operation on the data row and the data row location not being determined from the first index table, accessing, based on the second index, the data row at the row location in the page based persistent store.

### Claim 11 (depends on 10)

The non-transitory computer readable medium of claim 10, wherein the node comprises one or more of:
a pointer to a next node in list of active nodes within the bucket location;
a pointer to a next node in a list of nodes marked for deletion within the bucket list;
an indication of an identifier for the data row;
an indication of a most recent time at which the node was updated; and
an indication of the hash value.

### Claim 12 (depends on 10)

The non-transitory computer readable medium of claim 10, wherein accessing the data row to perform the another database operation comprises:
determining a second hash value based on the key for the data row;
searching, based on the second hash vale, for the node; and
accessing, based on the indication of the identifier for the data row, the data row at the row location within the in-memory row store.

### Claim 13 (depends on 10)

The non-transitory computer readable medium of claim 10, wherein the bucket location comprises a linked list of nodes organized in order of row identifiers, and wherein adding the node within the index table comprises adding the node to the linked list of nodes based on:
modifying at least one node in the linked list of nodes to include a pointer to the node; or
including a pointer within the node to at least one node in the linked list of nodes.

### Claim 14

A method comprising:
adding, based on a database operation, a data row to an in-memory row store at a row location, wherein the database operation comprises at least one of an insert of the data row, an update of the data row, or a selection of the data row;
indexing the row location in a first index table and a second index table, the first index table comprising a lock-free hash index that is stored in-memory to provide an index for the in-memory row store and the second index table provided for a page based persistent store, the first index table comprising a plurality of nodes for a plurality of rows in the in-memory row store, the plurality of nodes organized across a plurality of buckets, the row location indexed based on:
determining a hash value based on a key for the data row,
determining, based on the hash value, a bucket location from among the plurality of buckets, and
adding, within the bucket location, a node within the index table for the data row;
in response to another database operation on the data row, accessing the data row at the row location in the in-memory row store, when the data row location is determined from the first index table comprising the lock-free hash cache; and
in response to the another database operation on the data row and the data row location not being determined from the first index table, accessing, based on the second index, the data row at the row location in the page based persistent store.

### Claim 15 (depends on 14)

The method of claim 14, wherein the node comprises one or more of:
a pointer to a next node in list of active nodes within the bucket location;
a pointer to a next node in a list of nodes marked for deletion within the bucket list;
an indication of an identifier for the data row;
an indication of a most recent time at which the node was updated; and
an indication of the hash value.

### Claim 16 (depends on 15)

The method of claim 15, wherein accessing the data row to perform the another database operation comprises:
determining a second hash value based on the key for the data row;
searching, based on the second hash vale, for the node; and
accessing, based on the indication of the identifier for the data row, the data row at the row location within the in-memory row store.

### Claim 17 (depends on 14)

The method of claim 14, wherein the bucket location comprises a linked list of nodes organized in order of row identifiers, and wherein adding the node within the index table comprises adding the node to the linked list of nodes based on:
modifying at least one node in the linked list of nodes to include a pointer to the node; or
including a pointer within the node to at least one node in the linked list of nodes.
