Patent ID: 11934373
Assignee: LEANXCALE, S.L.
Field: Computer technology (Electrical engineering)
Classification: CPC G | IPC G

Claim 0:
1. A computer based transactional Semantic Concurrency Control System for managing a database, wherein
the system comprises a data store engine which is adapted to manage the database comprising rows, and each row comprising at least a primary key uniquely identifying each row, and
wherein a first type of row is a value row comprising at least one semantic column, being the semantic column a column of any type which is modified by any set of operations that all commute among them and a commit timestamp and,
wherein a second type row is an operation row, comprising at least one operation to be applied over at least one semantic column of a value row identified by the primary key and a commit timestamp;
wherein the data store engine is further adapted to:
manage operation rows;
store the value rows and the operation rows;
generate an operation row when it receives an operation that inserts, updates, upserts, and/or deletes a row of the database with the commit timestamp of the operation; and
apply the operations of at least one operation row when a trigger condition is satisfied;

wherein the data store engine is further adapted to:
read a row with a primary key at a given snapshot with snapshot isolation;
read a set of rows within a range of primary keys at a given snapshot with snapshot isolation;
read a row with a primary key with read committed isolation;
read a set of rows within a range of primary keys with read committed isolation;
insert, update, or upsert a row with a primary key and a given commit timestamp, if the row does not exist the value row generated is computed by applying the update over a default value row with default values in the columns;
the insert behaves like an upsert, but it is only executed if the primary key does not exist in the table;
the update behaves like an upsert, but it is only executed if the primary key already exists in the table;
delete a row with a primary key and a given commit timestamp, wherein the delete operation generates a tombstone value row indicating that the row ceases to exist from that commit timestamp;

wherein the system is a multi-version system adapted to store for each primary key multiple rows, each row being a different version labelled with a different commit timestamp, wherein the substitution process triggered by the data store engine is an iterative process over the operation rows with a commit timestamp lower or equal than the new highest snapshot, said substitution process comprising the following steps that are performed for each primary key:
identify the value row with the same primary key and the highest commit timestamp, if it does not exist a default row with default values is generated;
identify the operation row with the same primary key and the lowest commit timestamp, if there are two or more with the same timestamp taking first the one that was first inserted;
if the identified operation row with lowest commit timestamp is an insert, an update or an upsert operation then a new value row with the same commit timestamp of the identified operation row is generated, the operations on the identified operation row are applied over the values of the corresponding columns in the identified value row with highest commit timestamp and the result is stored in the corresponding column of the new generated value row, and the identified operation row is substituted by the new generated value row;
if the identified operation row with the lowest commit timestamp is a delete operation, the delete operation row is substituted by a tombstone row with the same primary key and the commit timestamp of the delete operation;

wherein the data store engine is further adapted to provide for a plurality of tables of the database:
snapshot isolation level, or
read committed isolation level, or
a combination of them;

wherein the data store engine is further adapted to:
receive a read operation;
determining a target snapshot, a snapshot being a static view of the database at a precise moment of time and a target snapshot being the snapshot that is intended to be read; wherein
if the read operation is with read committed isolation the target snapshot is the current one, otherwise the target snapshot is the provided in the read operation;
keep the value of a highest known snapshot as the maximum among all the snapshots received, being initially zero;

upon the reception of a read operation, checking whether the target snapshot of the read operation is higher than the highest known snapshot wherein
if the checking is positive, the data store engine is adapted to trigger a substitution process over all the operation rows with commit timestamp lower or equal to the target snapshot of the read operation and, once the substitution process is completed, the read operation is executed and if the read operation is with snapshot isolation the highest known snapshot is updated to the snapshot associated to the read operation,
if the checking is negative, the data store engine is adapted to execute the read operation at the target snapshot;

retrieving the value row or value rows with the primary keys of the read operation;

and wherein the data store engine is further adapted to:
receive a snapshot notification, the snapshot notification being a notification received by the data store engine to advance the highest known snapshot;
upon the reception of a snapshot notification, being the snapshot received higher than the highest known snapshot, the data store engine is adapted to trigger the substitution process over the operation rows with commit timestamp lower or equal to the snapshot received, the substitution process can be executed over none, one or more operation rows in the order of their commit timestamp, and the highest known snapshot is updated to the snapshot associated to the read operation in the notification.