Multi-row transactions
First Claim
1. A method for writing data to a plurality of database rows as part of a multi-row transaction, the method comprising the steps of:
- acquiring, from a lock service, a lock on a row of a transaction table;
after acquiring the lock, writing the data to the plurality of database rows;
after writing the data to the plurality of database rows, querying the lock service to determine whether the lock was in fact held by the lock service for the multi-row transaction since the lock was acquired from the lock service and while writing the data to the plurality of database rows; and
adding the row to the transaction table in response to determining, based on the querying, that the lock was in fact held by the lock service for the multi-row transaction since the lock was acquired from the lock service and while writing the data to the plurality of database rows;
wherein the method is performed by one or more computing devices.
9 Assignments
0 Petitions
Accused Products
Abstract
Techniques are provided for more efficient multi-row atomic, consistent, isolated and durable (ACID)-compliant transactions with snapshot isolation semantics (or just “multi-row transactions” for short). In some embodiments, the techniques are implemented in a computing system that includes a client application, a lightweight in-memory lease-based lock service, a multi-row transaction orchestrator, and an underlying database system. The transaction orchestrator implements a read protocol and a write protocol that provides support to the client application for carrying out multi-row transactions against the underlying database system irrespective of whether the database system itself supports multi-row transactions. The transaction orchestrator explicitly maintains transaction-level locks obtained from the lease-based lock service as part of the transaction protocol. Further, the transaction orchestrator is tolerant to lock service failure and unavailability without compromising ACID-compliance and snapshot isolation guarantees to the client application.
-
Citations
23 Claims
-
1. A method for writing data to a plurality of database rows as part of a multi-row transaction, the method comprising the steps of:
-
acquiring, from a lock service, a lock on a row of a transaction table; after acquiring the lock, writing the data to the plurality of database rows; after writing the data to the plurality of database rows, querying the lock service to determine whether the lock was in fact held by the lock service for the multi-row transaction since the lock was acquired from the lock service and while writing the data to the plurality of database rows; and adding the row to the transaction table in response to determining, based on the querying, that the lock was in fact held by the lock service for the multi-row transaction since the lock was acquired from the lock service and while writing the data to the plurality of database rows; wherein the method is performed by one or more computing devices. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
-
-
11. A method for reading data from a cell of a database table as part of a particular transaction, the cell having a plurality of values, each value associated in the cell with a corresponding write timestamp value, the method comprising the steps of:
-
obtaining a first timestamp value from a timestamp service; wherein the first timestamp value represents a start transaction timestamp of the particular transaction; reading a particular value of the plurality of values and the write timestamp value corresponding to the particular value from the cell; wherein the write timestamp value corresponding to the particular value represents a start transaction timestamp of another transaction that wrote the particular value to the cell; using the write timestamp value corresponding the particular value to read a second timestamp value from a transaction table; wherein the second timestamp value represents a commit timestamp of the other transaction that wrote the particular value to the cell; providing the particular value to a client application in response to determining, based on a comparison between the first timestamp value and the second timestamp value, that the other transaction that wrote the particular value to the cell committed before the particular transaction started; wherein the method is performed by one or more computing devices.
-
-
12. A non-transitory computer-readable medium storing instructions which, when executed by one or more computing devices, causes the one or more computing devices to perform a method for writing data to a plurality of database rows as part of a multi-row transaction, the method comprising the steps of:
-
acquiring, from a lock service, a lock on a row of a transaction table; after acquiring the lock, writing the data to the plurality of database rows; after writing the data to the plurality of database rows, querying the lock service to determine whether the lock was in fact held by the lock service for the multi-row transaction since the lock was acquired from the lock service and while writing the data to the plurality of database rows; and adding the row to the transaction table in response to determining, based on the querying, that the lock was in fact held by the lock service for the multi-row transaction since the lock was acquired from the lock service and while writing the data to the plurality of database rows; wherein the method is performed by one or more computing devices. - View Dependent Claims (13, 14, 15, 16, 17, 18, 19, 20, 21)
-
-
22. A non-transitory computer-readable medium storing instructions which, when executed by one or more computing devices, causes the one or more computing devices to perform a method for reading data from a cell of a database table as part of a particular transaction, the cell having a plurality of values, each value associated in the cell with a corresponding write timestamp value, the method comprising the steps of:
-
obtaining a first timestamp value from a timestamp service; wherein the first timestamp value represents a start transaction timestamp of the particular transaction; reading a particular value of the plurality of values and the write timestamp value corresponding to the particular value from the cell; wherein the write timestamp value corresponding to the particular value represents a start transaction timestamp of another transaction that wrote the particular value to the cell; using the write timestamp value corresponding the particular value to read a second timestamp value from a transaction table; wherein the second timestamp value represents a commit timestamp of the other transaction that wrote the particular value to the cell; providing the particular value to a client application in response to determining, based on a comparison between the first timestamp value and the second timestamp value, that the other transaction that wrote the particular value to the cell committed before the particular transaction started; wherein the method is performed by one or more computing devices.
-
-
23. A system comprising:
-
a lock service; one or more processors; and one or more non-transitory computer-readable media storing instructions which, when executed by the one or more processors, cause the one or more processors to perform a method for writing data to a plurality of database rows as part of a multi-row transaction, the method comprising the steps of; acquiring, from the lock service, a lock on a row of a transaction table; after acquiring the lock, writing the data to the plurality of database rows; after writing the data to the plurality of database rows, querying the lock service to determine whether the lock was in fact held by the lock service for the multi-row transaction since the lock was acquired from the lock service and while writing the data to the plurality of database rows; and adding the row to the transaction table in response to determining, based on the querying, that the lock was in fact held by the lock service for the multi-row transaction since the lock was acquired from the lock service and while writing the data to the plurality of database rows.
-
Specification