Patent ID: 11860860
Assignee: COCKROACH LABS, INC.
Field: Computer technology (Electrical engineering)
Classification: CPC G | IPC G

Claim 0:
1. A computer-implemented method, comprising:
receiving a write transaction for a database, wherein the write transaction is configured to write to data of a partition stored by a cluster of database nodes;
calculating, at a database node of the cluster, a duration by adding at least (i) a latency between a pair of database nodes of the cluster and (ii) a maximum clock offset between a pair of clocks corresponding to respective database nodes of the cluster, wherein the duration is greater than or equal to a sum of the latency and maximum clock offset;
generating and associating, at the database node of the cluster, a synthetic timestamp with the write transaction, wherein the synthetic timestamp is generated by adding (i) a first timestamp corresponding to a present time indicated by a clock corresponding to the database node and (ii) the duration, wherein the synthetic timestamp exceeds the first timestamp by the duration;
executing, based on determining the synthetic timestamp and during the duration between the first timestamp and the synthetic timestamp, one or more operations of the write transaction by writing to the data of the partition at one or more replicas of the partition, wherein the one or more replicas comprise a leader replica and one or more follower replicas;
sending, from the leader replica to the one or more follower replicas, the write transaction and a closed timestamp update comprising the synthetic timestamp, wherein based on receiving the closed timestamp update and before the synthetic timestamp, the leader replica and the one or more follower replicas are each configured to serve a first read transaction directed to reading the data of the partition at a timestamp that is during the execution of the one or more operations of the write transaction and before the synthetic timestamp;
committing, based on a threshold number of the one or more replicas acknowledging the write transaction, the one or more operations of the write transaction at the one or more replicas before the synthetic timestamp, wherein the committing further comprises:
committing, at the leader replica, the one or more operations of the write transaction before the synthetic timestamp;
sending, from the leader replica, an indication to commit the one or more operations of the write transaction to the one or more follower replicas; and

sending, based on a second timestamp associated with the cluster of database nodes exceeding the synthetic timestamp, an indication of success of the write transaction to a client device.