IP Library Granted Patent US 11,620,277
Granted Patent B2
US 11,620,277 · App. 16/810,366 · Granted Apr 4, 2023

Transaction processing at non-relational databases

Inventors: Songshu Zhang (Hangzhou, CN); Yu Jiang (Beijing, CN)
G06F16/2379G06F11/1474G06F2201/87
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,620,277
App. No.
16/810,366
Granted
Apr 4, 2023
Kind
B2
Abstract

Transaction processing at non-relational databases is disclosed, including: receiving, at a non-relational database, a transaction request to perform a transaction branch from a client, wherein the transaction branch is related to a distributed transaction; sending the global transaction ID to a transaction coordinator to indicate that the transaction branch to be performed at the non-relational database is associated with the distributed transaction; receiving, at the non-relational database, a branch ID corresponding to the transaction branch from the transaction coordinator; determining one or more transaction operations to be performed at the non-relational database from the operation content associated with the transaction branch; executing the one or more transaction operations at the non-relational database; and sending a branch status message indicating execution success or failure of the transaction branch to the transaction coordinator.

Claims (86)

1. A system, comprising:

one or more processors configured to:

receive, at a non-relational database, a transaction request to perform a transaction branch from a client, wherein the non-relational database comprises a key-value store; wherein:

the transaction branch is related to a distributed transaction; and

the transaction request comprises operation content associated with the transaction branch and a global transaction ID associated with the distributed transaction;

send the global transaction ID to a transaction coordinator to indicate that the transaction branch to be performed at the non-relational database is associated with the distributed transaction;

receive, at the non-relational database, a branch ID corresponding to the transaction branch from the transaction coordinator;

determine one or more transaction operations to be performed at the non-relational database from the operation content associated with the transaction branch;

execute the one or more transaction operations at the non-relational database;

generate a transaction log corresponding to the transaction branch, wherein the transaction log comprises a specified primary key name associated with the operation content, a specified primary key value associated with the operation content, and the branch ID;

send a branch status message indicating execution success or failure of the transaction branch to the transaction coordinator, wherein the branch status message includes the branch ID corresponding to the transaction branch;

receive, at the non-relational database, from the transaction coordinator a transaction roll back instruction to roll back the transaction branch, wherein the transaction roll back instruction includes the branch ID corresponding to the transaction branch; and

in response to the transaction roll back instruction, roll back at the non-relational database the transaction branch corresponding to the branch ID, including to:

locate the transaction log corresponding to the transaction branch using the branch ID;

locate an entry in the key-value store that matches the specified primary key name associated with the transaction log; and

determine whether a currently stored primary key value in the entry matches the specified primary key value associated with the transaction log; and

one or more memories coupled to the one or more processors and configured to provide instructions to the one or more processors.

2. The system of claim 1 , wherein the global transaction ID is assigned to the distributed transaction by the transaction coordinator.

3. The system of claim 1 , wherein the one or more processors are further configured to record the branch ID corresponding to the transaction branch.

4. The system of claim 1 , wherein the one or more processors are further configured to:

store the transaction log at the non-relational database.

5. The system of claim 1 , wherein the transaction request comprises a first transaction request, wherein the distributed transaction comprises a first distributed transaction, wherein the transaction branch comprises a first transaction branch associated with the first transaction request, wherein the branch ID comprises a first branch ID, wherein the transaction log comprises a first transaction log, and wherein the one or more processors are further configured to:

receive, at the non-relational database, a second branch ID corresponding to a second transaction branch from the transaction coordinator, wherein the second transaction branch is associated with a second distributed transaction;

receive, at the non-relational database, from the transaction coordinator a transaction commit instruction to commit the second transaction branch, wherein the transaction commit instruction includes the second branch ID corresponding to the second transaction branch; and

in response to the transaction commit instruction, commit at the non-relational database the second transaction branch corresponding to the second branch ID, including to delete a second transaction log associated with the second branch ID.

6. The system of claim 5 , wherein the second distributed transaction comprises a plurality of transaction branches, wherein the transaction commit instruction was sent from the transaction coordinator in response to the transaction coordinator receiving a plurality of branch status messages corresponding to respective ones of the plurality of transaction branches, and wherein the plurality of branch status messages indicates execution successes.

7. The system of claim 5 , wherein the one or more processors are further configured to locate the second transaction log corresponding to the second transaction branch using the second branch ID.

8. The system of claim 4 , wherein the one or more processors are further configured to:

in the event that the currently stored primary key value in the entry matches the specified primary key value:

revert a data value affected by the transaction branch to a state prior to an execution of the one or more transaction operations; and

delete the transaction log.

9. The system of claim 8 , wherein the distributed transaction comprises a plurality of transaction branches, wherein the transaction roll back instruction was sent from the transaction coordinator in response to the transaction coordinator receiving a plurality of branch status messages corresponding to respective ones of the plurality of transaction branches, and wherein the plurality of branch status messages indicates at least one execution failure.

10. The system of claim 8 , wherein the one or more processors are further configured to:

in the event that the currently stored primary key value in the entry matches the specified primary key value:

set the one or more transaction operations to invalid; and

update the currently stored primary key value to a previously stored primary key value.

11. The system of claim 8 , wherein the one or more processors are further configured to:

locate the transaction log corresponding to the transaction branch using the branch ID; and

in the event that the currently stored primary key value in the entry does not match the specified primary key value associated with the transaction log, send an alert to an administrator.

12. A method, comprising:

receiving, at a non-relational database, a transaction request to perform a transaction branch from a client, wherein the non-relational database comprises a key-value store, wherein:

the transaction branch is related to a distributed transaction; and

the transaction request comprises operation content associated with the transaction branch and a global transaction ID associated with the distributed transaction;

sending the global transaction ID to a transaction coordinator to indicate that the transaction branch to be performed at the non-relational database is associated with the distributed transaction;

receiving, at the non-relational database, a branch ID corresponding to the transaction branch from the transaction coordinator;

determining one or more transaction operations to be performed at the non-relational database from the operation content associated with the transaction branch;

executing the one or more transaction operations at the non-relational database;

generating a transaction log corresponding to the transaction branch, wherein the transaction log comprises a specified primary key name associated with the operation content, a specified primary key value associated with the operation content, and the branch ID;

sending a branch status message indicating execution success or failure of the transaction branch to the transaction coordinator, wherein the branch status message includes the branch ID corresponding to the transaction branch;

receiving, at the non-relational database, from the transaction coordinator a transaction roll back instruction to roll back the transaction branch, wherein the transaction roll back instruction includes the branch ID corresponding to the transaction branch; and

in response to the transaction roll back instruction, rolling back at the non-relational database the transaction branch corresponding to the branch ID, including:

locating the transaction log corresponding to the transaction branch using the branch ID;

locating an entry in the key-value store that matches the specified primary key name associated with the transaction log; and

determining whether a currently stored primary key value in the entry matches the specified primary key value associated with the transaction log.

13. The method of claim 12 , further comprising:

storing the transaction log at the non-relational database.

14. The method of claim 12 , wherein the transaction request comprises a first transaction request, wherein the distributed transaction comprises a first distributed transaction, wherein the transaction branch comprises a first transaction branch associated with the first transaction request, wherein the branch ID comprises a first branch ID, wherein the transaction log comprises a first transaction log, and the method further comprising:

receiving, at the non-relational database, a second branch ID corresponding to a second transaction branch from the transaction coordinator, wherein the second transaction branch is associated with a second distributed transaction;

receiving, at the non-relational database, from the transaction coordinator a transaction commit instruction to commit the second transaction branch, wherein the transaction commit instruction includes the second branch ID corresponding to the second transaction branch; and

in response to the transaction commit instruction, committing at the non-relational database the second transaction branch corresponding to the second branch ID, including deleting a second transaction log associated with the second branch ID.

15. The method of claim 14 , wherein the second distributed transaction comprises a plurality of transaction branches, wherein the transaction commit instruction was sent from the transaction coordinator in response to the transaction coordinator receiving a plurality of branch status messages corresponding to respective ones of the plurality of transaction branches, and wherein the plurality of branch status messages indicates execution successes.

16. The method of claim 14 , further comprising locating the second transaction log corresponding to the second transaction branch using the second branch ID.

17. The method of claim 13 , further comprising:

in the event that the currently stored primary key value in the entry matches the specified primary key value:

reverting a data value affected by the transaction branch to a state prior to an execution of the one or more transaction operations; and

deleting the transaction log.

18. The method of claim 17 , wherein the distributed transaction comprises a plurality of transaction branches, wherein the transaction roll back instruction was sent from the transaction coordinator in response to the transaction coordinator receiving a plurality of branch status messages corresponding to respective ones of the plurality of transaction branches, and wherein the plurality of branch status messages indicates at least one execution failure.

19. The method of claim 17 , further comprising:

in the event that the currently stored primary key value in the entry matches the specified primary key value:

setting the one or more transaction operations to invalid; and

updating the currently stored primary key value to a previously stored primary key value.

20. A computer program product, the computer program product being embodied in a non-transitory computer-readable storage medium and comprising computer instructions for:

receiving, at a non-relational database, a transaction request to perform a transaction branch from a client, wherein the non-relational database comprises a key-value store, wherein:

the transaction branch is related to a distributed transaction: and

the transaction request comprises operation content associated with the transaction branch and a global transaction ID associated with the distributed transaction;

sending the global transaction ID to a transaction coordinator to indicate that the transaction branch to be performed at the non-relational database is associated with the distributed transaction;

receiving, at the non-relational database, a branch ID corresponding to the transaction branch from the transaction coordinator;

determining one or more transaction operations to be performed at the non-relational database from the operation content associated with the transaction branch;

executing the one or more transaction operations at the non-relational database;

generating a transaction log corresponding to the transaction branch, wherein the transaction log comprises a specified primary key name associated with the operation content, a specified primary key value associated with the operation content, and the branch ID;

sending a branch status message indicating execution success or failure of the transaction branch to the transaction coordinator, wherein the branch status message includes the branch ID corresponding to the transaction branch;

receiving, at the non-relational database, from the transaction coordinator a transaction roll back instruction to roll back the transaction branch, wherein the transaction roll back instruction includes the branch ID corresponding to the transaction branch; and

in response to the transaction roll back instruction, rolling back at the non-relational database the transaction branch corresponding to the branch ID, including:

locating the transaction log corresponding to the transaction branch using the branch ID;

locating an entry in the key-value store that matches the specified primary key name associated with the transaction log; and

determining whether a currently stored primary key value in the entry matches the specified primary key value associated with the transaction log.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 1, 2020
From: JIANG, YU
To: ALIBABA GROUP HOLDING LIMITED
Reel/Frame 053946/0474 →
Priority Claims (1)
CN 201710807134.8 · Sep 8, 2017 · national
Continuity (2)
Continuation In Part PCTCN2018102921 · Aug 29, 2018
Related Publication 20200272620A1 · Aug 27, 2020
Cited By (2)
US 12,353,403 US 12,475,463