CPC G06F 16/2379 (2019.01) [G06F 9/547 (2013.01); G06F 16/215 (2019.01); G06F 16/27 (2019.01)] | 18 Claims |
1. A non-transitory computer-readable storage medium for storing instructions that when executed by a computer processor cause the computer processor to perform steps comprising:
receiving a request to execute a transaction at a database node of a plurality of database nodes of a distributed database system, the transaction describing a mutation of a record stored at the database node, wherein the record is associated with a check-and-set (CAS) value that is updated responsive to modifications to the record, and wherein the CAS value is stored with the record at the database node; and
responsive to the request to execute the transaction, performing an attempt to execute the transaction, comprising:
retrieving information corresponding to the record from the database node, the information comprising a first CAS value associated with the record;
sending a request for mutation of the record;
receiving a second CAS value associated with the record from the database node subsequent to sending the request for mutation;
detecting whether a mismatch between the second CAS value and the first CAS value is present, the mismatch indicating that an additional mutation corresponding to an additional transaction has been staged for the record at the database node, the additional mutation conflicting with the mutation;
responsive to detecting the mismatch between the second CAS value and the first CAS value, aborting the attempt to execute the transaction;
responsive to detecting no mismatch,
executing the transaction; and
causing the CAS value associated with the record to be updated to a third CAS value, wherein updating the CAS value of the record includes causing the third CAS value to be stored with the record at the database node.
|