# US 2022/0067011 A1 · Data processing method and system of a distributed graph database

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

- Number: US 2022/0067011 A1
- Document ID: US20220067011A1
- Status: Published application
- Kind: A1
- Application number: 17/303,669
- Filed: 2021-06-04
- Published: 2022-03-03
- Earliest claimed: 2020-08-31
- Assignees: Vesoft. Inc
- Applicants: Vesoft Inc.
- Inventors: Tong YUE; Bosheng CHEN; Xiaomeng YE
- Web page: https://patentgrep.com/patent/US20220067011A1

## CPC

- G06F 16/235: {Update request formulation}
- G06F 16/2365: {Ensuring data consistency and integrity}
- G06F 16/248: Presentation of query results
- G06F 16/278: {Data partitioning, e.g. horizontal or vertical partitioning}
- G06F 16/28: Databases characterised by their database models, e.g. relational or object models
- G06F 16/2255: {Hash tables}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The present application relates to a data processing method and system of a distributed graph database. The present application solves the problem of how to improve the efficiency of adding, deleting, modifying and checking data in a graph database, realizes balanced storage and concurrent computing of distributed index, reduces network overhead caused by data operation, and improves the efficiency of data operation effectively.

## Claims

### Claim 1

A data processing method of a distributed graph database, comprising:
obtaining a write request of a Vertex or an Edge;
generating a Vertex Index of the Vertex according to a TagID of the Vertex, wherein, the Vertex comprises a VertexID and the TagID; writing the Vertex and the Vertex Index into a same Graph Partition by performing a hash operation on the VertexID and storing the Vertex and the Vertex Index in the Graph Partition;
generating an Edge Index of the Edge according to an EdgeType of the Edge, wherein, the Edge comprises a Source VertexID and the EdgeType; writing the Edge and the Edge Index into same Graph Partition by performing a hash operation on the Source VertexID and storing the Edge and the Edge Index in the Graph Partition;
obtaining a data update request of the Vertex or the Edge, wherein, the data update request comprises a data record to be updated and data update information;
detecting whether the data record is valid;
returning update failure information if the data record is invalid; and
updating the Vertex or the Edge according to the data update information if the data record is valid.

### Claim 2 (depends on 1)

The method according to claim 1, wherein, the step of generating a Vertex Index of the Vertex according to a TagID of the Vertex and the step of generating an Edge Index of the Edge according to an EdgeType of the Edge comprises:
creating a Vertex IndexID according to the TagID on the basis of a Tag Schema, wherein, the Vertex Index comprises the Vertex IndexID, a Graph PartitionID, a Data Type and a Property; and
creating an Edge IndexID according to the EdgeType on the basis of an Edge Schema, wherein, the Edge Index comprises the Edge IndexID, a Graph PartitionID, a Data Type and a Property.

### Claim 3 (depends on 1)

The method according to claim 1, wherein, the step of detecting whether the data record is valid comprises:
detecting whether the data record exists;
determining whether the data record has expired if the data record exists;
determining the data record is valid if the data record exists and the data record has not expired; and
determining the data record is invalid if the data record does not exist or the data record has expired.

### Claim 4 (depends on 1)

The method according to claim 1, wherein, the step of detecting whether the data record is valid and the step of updating the Vertex or the Edge according to the data update information if the data record is valid comprises:
detecting whether the data record is valid;
determining whether the data record meets a preset filter condition if the data record is valid;
returning filtering failure information if the data record does not meet the preset filter condition; and
updating the Vertex or the Edge according to the data update information if the data record meets the preset filter condition.

### Claim 5 (depends on 1)

The method according to claim 1, wherein, the step of obtaining a data update request of a Vertex or an Edge and the step of updating the Vertex or the Edge according to the data update information comprises:
determining a Graph Partition of the data update request by performing a hash operation on the VertexID or the Source VertexID after obtaining the data update request of the Vertex or the Edge;
updating the Vertex and the Vertex Index by the Graph Partition sequentially according to the data update information; or
updating the Edge and the Edge Index by the Graph Partition sequentially according to the data update information.

### Claim 6 (depends on 5)

The method according to claim 5, wherein, before the step of updating the Vertex or the Edge according to the data update information, the method further comprises:
detecting whether Vertex Index information or Edge Index information exists in the data update request;
updating the Vertex Index information or the Edge Index information synchronously if the Vertex Index information or the Edge Index information exists; and
skipping updating the Vertex Index information or the Edge Index information if the Vertex Index information or the Edge Index information does not exist.

### Claim 7 (depends on 1)

The method according to claim 1, wherein, the data update request comprises the data record to be updated and data update information, and the method further comprises:
if the data record is an edge update record, when it is determined that the Edge has a related edge, updating data of the Edge according to the data update information; and
updating the related edge synchronously by the edge update record.

### Claim 8 (depends on 1)

The method according to claim 1, wherein, after the step of writing the Vertex and the Vertex Index into a same Graph Partition or the step of the Edge and the Edge Index are written into same Graph Partition, the method further comprises:
obtaining a data query request sent by an API Client, verifying the validity of the data query request by calling a Metadata Server, sending the data query request to a Graph Partition in a Storage Server by a Storage Client, performing parallel index scanning on the Graph Partition according to the data query request, wherein, a query range of the data query request is determined by a Graph PartitionID and the TagID, or determined by a Graph PartitionID and the EdgeType; and
obtaining result set by querying the Storage Server, summarizing the result set and returning summarized result set to the API Client.

### Claim 9 (depends on 8)

The method according to claim 8, wherein, the step of performing parallel index scanning on the Graph Partition according to the data query request comprises:
generating an Error Code by the Storage Server when an error occurs in performing parallel index scanning on the Graph Partition; and
locating the Graph Partition where the error occurs in the index scan according to the Error Code.

### Claim 10 (depends on 1)

The method according to claim 1, wherein, after the step of writing the Vertex and the Vertex Index into a same Graph Partition or the step of writing the Edge and the Edge Index into a same Graph Partition, the method further comprises:
obtaining a data deletion request;
determining a Graph Partition for the data deletion request by performing a hash operation on the VertexID of the Vertex or the Source VertexID of the Edge of the data deletion request;
obtaining preset deletion data in the data deletion request in the Graph Partition according to the VertexID of the Vertex or the Edge Type of the Edge; and
performing atomic deletion operation on the preset deletion data.

### Claim 11

A data processing system of a distributed graph database, comprising a Graph Server, a Meta Server, and a Storage Server; wherein:
the Graph Server obtains a write request of a Vertex or an Edge;
the Meta Server generates a Vertex Index of the Vertex according to a TagID of the Vertex, wherein, the Vertex comprises a VertexID and the TagID, and writes the Vertex and the Vertex Index into a same Graph Partition by performing a hash operation on the VertexID;
the Storage Server stores the Vertex and the Vertex Index in the Graph Partition;
the Meta Server generates an Edge Index of the Edge according to an EdgeType of the Edge, wherein, the Edge comprises a Source VertexID and the EdgeType, and writes the Edge and the Edge Index into a same Graph Partition by performing hash a operation on the Source VertexID;
the Storage Server stores the Edge and the Edge Index in the Graph Partition;
the Graph Server obtains a data update request of the Vertex or the Edge, wherein, the data update request comprises a data record to be updated and data update information;
the Storage Server detects whether the data record is valid;
the Storage Server returns update failure information if the data record is invalid; and
the Storage Server updates the Vertex or the Edge according to the data update information if the data record is valid.

### Claim 12 (depends on 11)

The system according to claim 11, wherein the Meta Server generates a Vertex Index of the Vertex according to a TagID of the Vertex and the Meta Server generates an Edge Index of the Edge according to an EdgeType of the Edge includes:
the Meta Server creates a Vertex IndexID according to the TagID on the basis of a Tag Schema, wherein, the Vertex Index comprises the Vertex IndexID, a Graph PartitionID, a Data Type and a Property; and
the Meta Server creates an Edge IndexID according to the EdgeType on the basis of an Edge Schema, wherein, the Edge Index comprises the Edge IndexID, a Graph PartitionID, Data Type, and a Property.

### Claim 13 (depends on 11)

The system according to claim 11, wherein the Storage Server detects whether the data record is valid comprises:
the Storage Server detects whether the data record exists;
the Storage Server determines whether the data record has expired if the data record exists;
the Storage Server determines the data record is valid if the data record exists and the data record has not expired; and
the Storage Server determines the data record is invalid if the data record does not exist or the data record has expired.

### Claim 14 (depends on 11)

The system according to claim 11, wherein the Storage Server detects whether the data record is valid, the Storage Server updates the Vertex or the Edge according to the data update information if the data record is valid includes:
the Storage Server detects whether the data record is valid;
the Storage Server determines whether the data record meets a preset filter condition if the data record is valid;
the Storage Server returns filtering failure information if the data record does not meet the preset filter condition; and
the Storage Server updates the Vertex or the Edge according to the data update information if the data record meets the preset filter condition.

### Claim 15 (depends on 11)

The system according to claim 11, wherein the Graph Server obtains a data update request of the Vertex or the Edge, the Storage Server updates the Vertex or the Edge according to the data update information if the data record is valid comprises:
the Graph Server determines a Graph Partition of the data update request by performing a hash operation on the VertexID or the Source VertexID after obtaining a data update request of the Vertex or the Edge;
the Storage Server updates the Vertex and the Vertex Index by the Graph Partition sequentially according to the data update information; or
the Storage Server updates the Edge and the Edge Index by the Graph Partition sequentially according to the data update information.

### Claim 16 (depends on 15)

The system according to claim 15, wherein, before the Storage Server updates the Vertex or the Edge according to the data update information, the system further comprises:
the Storage Server detects whether Vertex Index information or Edge Index information exists in the data update request;
the Storage Server updates the Vertex Index information or the Edge Index information synchronously if the Vertex Index information or the Edge Index information exists; and
the Storage Server does not update the Vertex Index information or the Edge Index information if the Vertex Index information or the Edge Index information does not exist.

### Claim 17 (depends on 11)

The system according to claim 11, wherein the data update request comprises a data record to be updated and data update information, the system further comprises:
if the data record is an edge update record, when it is determined that the Edge has a related edge, the Storage Server updates data of the Edge according to the data update information, and updates the related edge synchronously by the edge update record.

### Claim 18 (depends on 11)

The system according to claim 11, wherein after the Meta Server writes the Vertex and the Vertex Index into a same Graph Partition and writes the Edge and the Edge Type into a same Graph Partition, the system further comprises:
the Graph Server obtains a data query request sent by an API Client;
the Mega Server verifies the validity of the data query request;
the Mega Server sends the data query request to a Graph Partition in the Storage Server by the Storage Client;
the Storage Server performs parallel index scanning on the Graph Partition according to the data query request, wherein, a query range of the data query request is determined by a Graph PartitionID and the TagID, or determined by a Graph PartitionID and the EdgeType; and
the Graph Server obtains result set by querying the Storage Server, summarizes the result set and returns summarized result set to the API Client.

### Claim 19 (depends on 18)

The system according to claim 18, wherein the Storage Server performs parallel index scanning on the Graph Partition according to the data query request comprises:
the Storage Server generates an Error Code when an error occurs in performing parallel index scanning on the Graph Partition; and
the Storage Server locates the Graph Partition where the error occurs in the index scan according to the Error Code.

### Claim 20 (depends on 11)

The system according to claim 11, wherein after the Meta Server writes the Vertex and the Vertex Index into a same Graph Partition and writes the Edge and the Edge Type into a same Graph Partition, the system further comprises:
the Graph Server obtains a data deletion request;
the Mega Server determines a Graph Partition for the data deletion request by performing a hash operation on the VertexID of the Vertex or the Source VertexID of the Edge of the data deletion request;
the Mega Server obtains preset deletion data in the data deletion request in the Graph Partition according to the VertexID of the Vertex or the Edge Type of the Edge; and
the Mega Server performs atomic deletion operation on the preset deletion data.
