# US 10,956,397 B2 · Method and apparatus for processing concurrent transactions, and storage medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 10,956,397 B2
- Document ID: US10956397B2
- Status: Granted
- Kind: B2
- Application number: 16/680,595
- Filed: 2019-11-12
- Published: 2020-10-22
- Granted: 2021-03-23
- Earliest claimed: 2019-04-16
- Assignees: Wuxi Research Institute of Applied Technologies Tsinghua University
- Applicants: Wuxi Research Institute of Applied Technologies Tsinghua University
- Inventors: Leibo Liu; Zhaoshi Li; Shaojun Wei
- Web page: https://patentgrep.com/patent/US10956397B2

## CPC

- G06F 16/2315: {Optimistic concurrency control}
- G06F 16/285: {Clustering or classification}
- G06F 16/9024: {Graphs; Linked lists (G06F16/9027 takes precedence)}
- G06F 17/10: Complex mathematical operations {(function generation by table look-up G06F1/03; evaluation of elementary functions by calculation G06F7/544)}
- G06F 17/16: Matrix or vector computation {, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization (matrix transposition G06F7/78)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The present disclosure provides a method and an apparatus for processing concurrent transactions, and a non-transitory computer readable storage medium. The method includes: determining whether a two-dimensional digraph for a set of concurrent transactions has a cyclic structure, wherein the set of concurrent transactions comprises a transaction to be committed and at least one committed transaction, the two-dimensional digraph comprises a plurality of nodes corresponding respectively to the transactions in the set, and directed edges between the nodes of the two-dimensional digraph indicate a serializability relation among the transactions in the set; aborting the transaction to be committed if it is determined that the two-dimensional digraph has the cyclic structure; and committing the transaction to be committed if it is determined that the two-dimensional digraph does not have the cyclic structure. Embodiments of the present disclosure can improve the performance of a concurrent system.

## Claims

### Claim 1

A method of processing concurrent transactions, the method comprising:
determining whether a two-dimensional digraph for a set of concurrent transactions has a cyclic structure, wherein the set of concurrent transactions comprises a transaction to be committed and at least one committed transaction, the two-dimensional digraph comprises a plurality of nodes corresponding respectively to the transactions in the set, and directed edges between the nodes of the two-dimensional digraph indicate a serializability relation among the transactions in the set;
aborting the transaction to be committed if it is determined that the two-dimensional digraph has the cyclic structure; and
committing the transaction to be committed if it is determined that the two-dimensional digraph does not have the cyclic structure;
wherein determining whether the two-dimensional digraph for the set of concurrent transactions has the cyclic structure comprises:
determining whether a combination of a first node and a second node exists among the nodes of the two-dimensional digraph, wherein the first node can reach the second node along one or more directed edges, and the second node can reach the first node along one or more directed edges;
determining that the two-dimensional digraph has the cyclic structure if the combination of the first node and the second node exists among the nodes of the two-dimensional digraph; and
determining that the two-dimensional digraph does not have the cyclic structure if the combination of the first node and the second node does not exist among the nodes of the two-dimensional digraph;
wherein determining whether the combination of the first node and the second node exists among the nodes of the two-dimensional digraph comprises:
determining a forward adjacent vector and a backward adjacent vector between the transaction to be committed and the at least one committed transaction, wherein the forward adjacent vector indicates whether a directed edge directed away from the transaction to be committed exists between the transaction to be committed and each of the at least one committed transaction, and the backward adjacent vector indicates whether a directed edge directed toward the transaction to be committed exists between the transaction to be committed and each of the at least one committed transaction; and
determining whether the combination of the first node and the second node exists among the nodes of the two-dimensional digraph according to the forward adjacent vector, the backward adjacent vector, and a reachability relation matrix of the at least one committed transaction, wherein the reachability relation matrix indicates a reachability relation between the transactions of the at least one committed transaction; and
wherein determining whether the combination of the first node and the second node exists among the nodes of the two-dimensional digraph according to the forward adjacent vector, the backward adjacent vector, and the reachability relation matrix of the at least one committed transaction comprises:
determining whether the combination of the first node and the second node exists according to formulas (1) and (2):
p=f+RT×f (1);
s=b+R×b (2);
if pT×s≠0, determining that the combination of the first node and the second node exists among the nodes of the two-dimensional digraph; and
if pT×s=0, determining that the combination of the first node and the second node does not exist among the nodes of the two-dimensional digraph;
wherein f denotes the forward adjacent vector, b denotes the backward adjacent vector, R denotes the reachability relation matrix, RT denotes a transposed matrix of the reachability relation matrix R, p denotes a forward reaching vector, s denotes a backward reaching vector, pT denotes a transposed vector of the forward reaching vector p, + denotes matrix addition in Boolean algebra, and x denotes matrix multiplication in Boolean algebra.

### Claim 2 (depends on 1)

The method of claim 1,
wherein determining the forward adjacent vector and the backward adjacent vector between the transaction to be committed and the at least one committed transaction comprises:
determining the forward adjacent vector and the backward adjacent vector according to a read-write collision or a write-write collision for a shared object between a read/write operation in the transaction to be committed and a read/write operation in each of the at least one committed transaction.

### Claim 3 (depends on 2)

The method of claim 2,
wherein the shared object is a memory address or a primary key value of a relation database.

### Claim 4 (depends on 1)

The method of claim 1,
wherein the method further comprises, after committing the transaction to be committed,
updating the reachability relation matrix according to the forward reaching vector and the backward reaching vector by utilizing transitivity of the reachability relation between transactions.

### Claim 5

An apparatus for processing concurrent transactions, comprising:
one or more processors;
a memory for storing one or more programs;
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform operations comprising:
determining whether a two-dimensional digraph for a set of concurrent transactions has a cyclic structure, wherein the set of concurrent transactions comprises a transaction to be committed and at least one committed transaction, the two-dimensional digraph comprises a plurality of nodes corresponding respectively to the transactions in the set, and directed edges between the nodes of the two-dimensional digraph indicates a serializability relation among the transactions in the set;
aborting the transaction to be committed if it is determined that the two-dimensional digraph has the cyclic structure; and
committing the transaction to be committed if it is determined that the two-dimensional digraph does not have the cyclic structure;
wherein determining whether the two-dimensional digraph for the set of concurrent transactions has the cyclic structure comprises:
determining whether a combination of a first node and a second node exists among the nodes of the two-dimensional digraph, wherein the first node can reach the second node along one or more directed edges, and the second node can reach the first node along one or more directed edges;
determining that the two-dimensional digraph has the cyclic structure if the combination of the first node and the second node exists among the nodes of the two-dimensional digraph; and
determining that the two-dimensional digraph does not have the cyclic structure if the combination of the first node and the second node does not exist among the nodes of the two-dimensional digraph;
wherein determining whether the combination of the first node and the second node exists among the nodes of the two-dimensional digraph comprises:
determining a forward adjacent vector and a backward adjacent vector between the transaction to be committed and the at least one committed transaction, wherein the forward adjacent vector indicates whether a directed edge directed away from the transaction to be committed exists between the transaction to be committed and each of the at least one committed transaction, and the backward adjacent vector indicates whether a directed edge directed toward the transaction to be committed exists between the transaction to be committed and each of the at least one committed transaction; and
determining whether the combination of the first node and the second node exists among the nodes of the two-dimensional digraph according to the forward adjacent vector, the backward adjacent vector, and a reachability relation matrix of the at least one committed transaction, wherein the reachability relation matrix indicates a reachability relation between the transactions of the at least one committed transaction; and
wherein determining whether the combination of the first node and the second node exists among the nodes of the two-dimensional digraph according to the forward adjacent vector, the backward adjacent vector, and the reachability relation matrix of the at least one committed transaction comprises:
determining whether the combination of the first node and the second node exists according to formulas (1) and (2):
p=f+RT×f (1):
s=b+R×b (2);
if pT×s≠0, determining that the combination of the first node and the second node exists among the nodes of the two-dimensional digraph; and
if pT×s=0, determining that the combination of the first node and the second node does not exist among the nodes of the two-dimensional digraph;
wherein f denotes the forward adjacent vector, b denotes the backward adjacent vector, R denotes the reachability relation matrix, RT denotes a transposed matrix of the reachability relation matrix R, p denotes a forward reaching vector, s denotes a backward reaching vector, pT denotes a transposed vector of the forward reaching vector p, + denotes matrix addition in Boolean algebra, and x denotes matrix multiplication in Boolean algebra.

### Claim 6 (depends on 5)

The apparatus of claim 5,
wherein determining the forward adjacent vector and the backward adjacent vector between the transaction to be committed and the at least one committed transaction comprises:
determining the forward adjacent vector and the backward adjacent vector according to a read-write collision or a write-write collision for a shared object between a read/write operation in the transaction to be committed and a read/write operation in each of the at least one committed transaction.

### Claim 7 (depends on 6)

The apparatus of claim 6,
wherein the shared object is a memory address or a primary key value of a relation database.

### Claim 8 (depends on 5)

The apparatus of claim 5,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform operations further comprising:
updating, after committing the transaction to be committed, the reachability relation matrix according to the forward reaching vector and the backward reaching vector by utilizing transitivity of the reachability relation between transactions.

### Claim 9

A non-transitory computer readable storage medium, wherein the non-transitory computer readable storage medium stores instructions, when executed by one or more processors, cause the one or more processors to perform operations comprising:
determining whether a two-dimensional digraph for a set of concurrent transactions has a cyclic structure, wherein the set of concurrent transactions comprises a transaction to be committed and at least one committed transaction, the two-dimensional digraph comprises a plurality of nodes corresponding respectively to the transactions in the set, and directed edges between the nodes of the two-dimensional digraph indicate a serializability relation among the transactions in the set;
aborting the transaction to be committed if it is determined that the two-dimensional digraph has the cyclic structure; and
committing the transaction to be committed if it is determined that the two-dimensional digraph does not have the cyclic structure;
wherein determining whether the two-dimensional digraph for the set of concurrent transactions has the cyclic structure comprises:
determining whether a combination of a first node and a second node exists among the nodes of the two-dimensional digraph, wherein the first node can reach the second node along one or more directed edges, and the second node can reach the first node along one or more directed edges;
determining that the two-dimensional digraph has the cyclic structure if the combination of the first node and the second node exists among the nodes of the two-dimensional digraph; and
determining that the two-dimensional digraph does not have the cyclic structure if the combination of the first node and the second node does not exist among the nodes of the two-dimensional digraph;
wherein determining whether the combination of the first node and the second node exists among the nodes of the two-dimensional digraph comprises:
determining a forward adjacent vector and a backward adjacent vector between the transaction to be committed and the at least one committed transaction, wherein the forward adjacent vector indicates whether a directed edge directed away from the transaction to be committed exists between the transaction to be committed and each of the at least one committed transaction, and the backward adjacent vector indicates whether a directed edge directed toward the transaction to be committed exists between the transaction to be committed and each of the at least one committed transaction; and
determining whether the combination of the first node and the second node exists among the nodes of the two-dimensional digraph according to the forward adjacent vector, the backward adjacent vector, and a reachability relation matrix of the at least one committed transaction, wherein the reachability relation matrix indicates a reachability relation between the transactions of the at least one committed transaction; and
wherein determining whether the combination of the first node and the second node exists among the nodes of the two-dimensional digraph according to the forward adjacent vector, the backward adjacent vector, and the reachability relation matrix of the at least one committed transaction comprises:
determining whether the combination of the first node and the second node exists according to formulas (1) and (2):
p=f+RT×f (1):
s=b+R×b (2);
if pT×s≠0, determining that the combination of the first node and the second node exists among the nodes of the two-dimensional digraph; and
if pT×s=0, determining that the combination of the first node and the second node does not exist among the nodes of the two-dimensional digraph;
wherein f denotes the forward adjacent vector, b denotes the backward adjacent vector, R denotes the reachability relation matrix, RT denotes a transposed matrix of the reachability relation matrix R, p denotes a forward reaching vector, s denotes a backward reaching vector, pT denotes a transposed vector of the forward reaching vector p, + denotes matrix addition in Boolean algebra, and x denotes matrix multiplication in Boolean algebra.

### Claim 10 (depends on 9)

The non-transitory computer readable storage medium of claim 9,
wherein determining the forward adjacent vector and the backward adjacent vector between the transaction to be committed and the at least one committed transaction comprises:
determining the forward adjacent vector and the backward adjacent vector according to a read-write collision or a write-write collision for a shared object between a read/write operation in the transaction to be committed and a read/write operation in each of the at least one committed transaction.

### Claim 11 (depends on 9)

The non-transitory computer readable storage medium of claim claim 9,
wherein the instructions, when executed by the one or more processors, cause the one or more processors to performing operations further comprising:
updating, after committing the transaction to be committed, the reachability relation matrix according to the forward reaching vector and the backward reaching vector by utilizing transitivity of the reachability relation between transactions.
