IP Library › Granted Patent US 12,189,598
Granted Patent B2
US 12,189,598 · App. 18/390,739 · Granted Jan 7, 2025

Writing graph data

Inventor: Kaihang Dai (Hangzhou, CN)
Assignee: Alipay (Hangzhou) Information Technology Co., Ltd.
G06F16/2272
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 12,189,598
App. No.
18/390,739
Granted
Jan 7, 2025
Kind
B2
Abstract

Methods, computer-readable media and apparatuses are disclosed for graph data write. In an example, in response to receiving a first graph data write request, row lock indexes of corresponding row locks of target write objects are determined based on object identification information of the target write objects in the first graph data write request, where each target write object corresponds to a row lock. The target write objects are locked based on the row lock indexes of the target write objects; graph data write is performed for the first graph data write request after the target write objects are locked; the row locks held by the first graph data write request are unlocked after graph data of the target write objects is written; and a graph data write result is provided to a user after all the row locks held by the first graph data write request are unlocked.

Claims (85)

1. A computer-implemented method, comprising:

determining, in response to receiving a first graph data write request initiated by a user, row lock indexes of corresponding row locks of target write objects based on object identification information of the target write objects in the first graph data write request, wherein the target write object comprises at least one of a target write vertex or a target write edge, and each target write object corresponds to a row lock;

locking the target write objects in the first graph data write request based on the row lock indexes of the target write objects;

performing graph data write for the first graph data write request after the target write objects in the first graph data write request are locked;

unlocking the row locks held by the first graph data write request after graph data of the target write objects in the first graph data write request is written; and

providing a graph data write result to the user after all the row locks held by the first graph data write request are unlocked.

2. The computer-implemented method according to claim 1 , wherein the locking the target write objects in the first graph data write request based on the row lock indexes of the target write objects comprises:

determining a locking sequence of the target write objects based on the row lock indexes of the target write objects in the first graph data write request;

locking the target write objects in the first graph data write request based on the locking sequence; and

recording locked row lock information in a write request record, wherein the locked row lock information comprises at least a row lock index of a row lock.

3. The computer-implemented method according to claim 2 , wherein the locking the target write objects in the first graph data write request based on the locking sequence comprises:

iteratively performing the following locking process for the first graph data write request until the target write objects are locked or the first graph data write request is put in a row lock wait list:

sequentially extracting a target write object not currently locked from the first graph data write request based on the locking sequence;

querying, for the target write object not currently locked based on the row lock index of the target write object, whether a corresponding row lock exists in a latch that comprises the row lock index; and

creating a row lock for the target write object not currently locked in the latch that comprises the row lock index when the corresponding row lock does not exist in the latch that comprises the row lock index; or

putting the first graph data write request in a row lock wait list of the row lock when the corresponding row lock exists in the latch that comprises the row lock index.

4. The computer-implemented method according to claim 2 , wherein the unlocking the row locks held by the first graph data write request after graph data of the target write objects in the first graph data write request is written comprises:

iteratively performing the following unlocking process for the first graph data write request until all the row locks held by the first graph data write request are unlocked:

extracting unlocked row lock information from the write request record of the first graph data write request;

querying, based on a row lock index in the unlocked row lock information, whether a graph data write request to be written exists in a corresponding row lock wait list; and

transferring an ownership of a row lock corresponding to the row lock index to a second graph data write request located at a head of the row lock wait list when the graph data write request to be written exists in the row lock wait list; or

deleting the row lock corresponding to the row lock index from a latch that comprises the row lock index when the second graph data write request to be written does not exist in the row lock wait list.

5. The computer-implemented method according to claim 4 , further comprising:

triggering an asynchronous retry of the second graph data write request to perform graph data write for the second graph data write request.

6. The computer-implemented method according to claim 5 , further comprising:

accessing a row lock wait list that comprises the second graph data write request in response to that the asynchronous retry of the second graph data write request is triggered, to determine whether a third graph data write request that can be combined for processing exists in the row lock wait list; and

combining the second graph data write request and the third graph data write request into a new graph data write request to write graph data when the third graph data write request that can be combined for processing exists in the row lock wait list.

7. The computer-implemented method according to claim 6 , wherein when graph data write is performed for the new graph data write request, a target write object that has been locked in the new graph data write request is not locked again.

8. The computer-implemented method according to claim 5 , wherein when graph data write is performed for the second graph data write request, a target write object that has been locked in the second graph data write request is not locked again.

9. A non-transitory, computer-readable medium storing one or more instructions executable by a computer system to perform operations comprising:

determining, in response to receiving a first graph data write request initiated by a user, row lock indexes of corresponding row locks of target write objects based on object identification information of the target write objects in the first graph data write request, wherein the target write object comprises at least one of a target write vertex or a target write edge, and each target write object corresponds to a row lock;

locking the target write objects in the first graph data write request based on the row lock indexes of the target write objects;

performing graph data write for the first graph data write request after the target write objects in the first graph data write request are locked;

unlocking the row locks held by the first graph data write request after graph data of the target write objects in the first graph data write request is written; and

providing a graph data write result to the user after all the row locks held by the first graph data write request are unlocked.

10. The non-transitory, computer-readable medium according to claim 9 , wherein the locking the target write objects in the first graph data write request based on the row lock indexes of the target write objects comprises:

determining a locking sequence of the target write objects based on the row lock indexes of the target write objects in the first graph data write request;

locking the target write objects in the first graph data write request based on the locking sequence; and

recording locked row lock information in a write request record, wherein the locked row lock information comprises at least a row lock index of a row lock.

11. The non-transitory, computer-readable medium according to claim 10 , wherein the locking the target write objects in the first graph data write request based on the locking sequence comprises:

iteratively performing the following locking process for the first graph data write request until the target write objects are locked or the first graph data write request is put in a row lock wait list:

sequentially extracting a target write object not currently locked from the first graph data write request based on the locking sequence;

querying, for the target write object not currently locked based on the row lock index of the target write object, whether a corresponding row lock exists in a latch that comprises the row lock index; and

creating a row lock for the target write object not currently locked in the latch that comprises the row lock index when the corresponding row lock does not exist in the latch that comprises the row lock index; or

putting the first graph data write request in a row lock wait list of the row lock when the corresponding row lock exists in the latch that comprises the row lock index.

12. The non-transitory, computer-readable medium according to claim 10 , wherein the unlocking the row locks held by the first graph data write request after graph data of the target write objects in the first graph data write request is written comprises:

iteratively performing the following unlocking process for the first graph data write request until all the row locks held by the first graph data write request are unlocked:

extracting unlocked row lock information from the write request record of the first graph data write request;

querying, based on a row lock index in the unlocked row lock information, whether a graph data write request to be written exists in a corresponding row lock wait list; and

transferring an ownership of a row lock corresponding to the row lock index to a second graph data write request located at a head of the row lock wait list when the graph data write request to be written exists in the row lock wait list; or

deleting the row lock corresponding to the row lock index from a latch that comprises the row lock index when the second graph data write request to be written does not exist in the row lock wait list.

13. The non-transitory, computer-readable medium according to claim 12 , wherein the operations further comprise:

triggering an asynchronous retry of the second graph data write request to perform graph data write for the second graph data write request.

14. The non-transitory, computer-readable medium according to claim 13 , wherein the operations further comprise:

accessing a row lock wait list that comprises the second graph data write request in response to that the asynchronous retry of the second graph data write request is triggered, to determine whether a third graph data write request that can be combined for processing exists in the row lock wait list; and

combining the second graph data write request and the third graph data write request into a new graph data write request to write graph data when the third graph data write request that can be combined for processing exists in the row lock wait list.

15. An apparatus, comprising:

one or more processors; and

one or more memory devices interoperably coupled with the one or more processors and having tangible, non-transitory, machine-readable media storing one or more instructions that, when executed by the one or more processors, perform operations comprising:

determining, in response to receiving a first graph data write request initiated by a user, row lock indexes of corresponding row locks of target write objects based on object identification information of the target write objects in the first graph data write request, wherein the target write object comprises at least one of a target write vertex or a target write edge, and each target write object corresponds to a row lock;

locking the target write objects in the first graph data write request based on the row lock indexes of the target write objects;

performing graph data write for the first graph data write request after the target write objects in the first graph data write request are locked;

unlocking the row locks held by the first graph data write request after graph data of the target write objects in the first graph data write request is written; and

providing a graph data write result to the user after all the row locks held by the first graph data write request are unlocked.

16. The apparatus according to claim 15 , wherein the locking the target write objects in the first graph data write request based on the row lock indexes of the target write objects comprises:

determining a locking sequence of the target write objects based on the row lock indexes of the target write objects in the first graph data write request;

locking the target write objects in the first graph data write request based on the locking sequence; and

recording locked row lock information in a write request record, wherein the locked row lock information comprises at least a row lock index of a row lock.

17. The apparatus according to claim 16 , wherein the locking the target write objects in the first graph data write request based on the locking sequence comprises:

iteratively performing the following locking process for the first graph data write request until the target write objects are locked or the first graph data write request is put in a row lock wait list:

sequentially extracting a target write object not currently locked from the first graph data write request based on the locking sequence;

querying, for the target write object not currently locked based on the row lock index of the target write object, whether a corresponding row lock exists in a latch that comprises the row lock index; and

creating a row lock for the target write object not currently locked in the latch that comprises the row lock index when the corresponding row lock does not exist in the latch that comprises the row lock index; or

putting the first graph data write request in a row lock wait list of the row lock when the corresponding row lock exists in the latch that comprises the row lock index.

18. The apparatus according to claim 16 , wherein the unlocking the row locks held by the first graph data write request after graph data of the target write objects in the first graph data write request is written comprises:

iteratively performing the following unlocking process for the first graph data write request until all the row locks held by the first graph data write request are unlocked:

extracting unlocked row lock information from the write request record of the first graph data write request;

querying, based on a row lock index in the unlocked row lock information, whether a graph data write request to be written exists in a corresponding row lock wait list; and

transferring an ownership of a row lock corresponding to the row lock index to a second graph data write request located at a head of the row lock wait list when the graph data write request to be written exists in the row lock wait list; or

deleting the row lock corresponding to the row lock index from a latch that comprises the row lock index when the second graph data write request to be written does not exist in the row lock wait list.

19. The apparatus according to claim 18 , wherein the operations further comprise:

triggering an asynchronous retry of the second graph data write request to perform graph data write for the second graph data write request.

20. The apparatus according to claim 19 , wherein the operations further comprise:

accessing a row lock wait list that comprises the second graph data write request in response to that the asynchronous retry of the second graph data write request is triggered, to determine whether a third graph data write request that can be combined for processing exists in the row lock wait list; and

combining the second graph data write request and the third graph data write request into a new graph data write request to write graph data when the third graph data write request that can be combined for processing exists in the row lock wait list.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 17, 2024
From: DAI, KAIHANG
To: ALIPAY (HANGZHOU) INFORMATION TECHNOLOGY CO., LTD.
Reel/Frame 066148/0092 →
Priority Claims (1)
CN 202111224487.8 · Oct 21, 2021 · national
Continuity (2)
Continuation PCTCN2022125736 · Oct 17, 2022
Related Publication 20240119039A1 · Apr 11, 2024
References Cited (15)
US 11093497B1 · Gupta · 2021 [cited by examiner]
US 20100242043A1 · Shorb · 2010 [cited by applicant]
US 20110246503A1 · Bender · 2011 [cited by examiner]
US 20190303410A1 · Beaumont et al. · 2019 [cited by applicant]
CN 103886109 · 2014 [cited by applicant]
CN 106354729 · 2017 [cited by applicant]
CN 108595251 · 2018 [cited by applicant]
CN 108959403 · 2018 [cited by applicant]
CN 110730958 · 2020 [cited by applicant]
CN 112084206 · 2020 [cited by applicant]
CN 113672636 · 2021 [cited by applicant]
International Preliminary Report on Patentability in International Appln. No. PCT/CN2022/125736, mailed on May 2, 2024, 12 pages (with English translation). [cited by applicant]
International Search Report and Written Opinion in International Appln. No. PCT/CN2022/125736, mailed on Jan. 5, 2023, 15 pages (with English translation). [cited by applicant]
Mao et al., “Relative position optimism locking mechanism and its application in collaborative editing,” Journal of Computer-Aided Design and Graphics, Sep. 30, 2004, p. 1307-1312 (with English Abstract only). [cited by applicant]
Xie et al., “High-performance Acid via modular concurrency control,” In Proceedings of the 25th Symposium on Operating Systems Principles, Oct. 31, 2015, p. 279-294. [cited by applicant]