Graph data processing method, electronic device and computer readable storage medium

By employing the collaborative operation of the storage engine layer and the index engine layer in the JanusGraph graph database, aggregated storage and full-coverage writing of vertex business attributes are achieved, solving the problem of attribute deletion residue, improving write performance and storage efficiency, and ensuring data accuracy and consistency.

CN123138265APending Publication Date: 2026-11-20ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611332237.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-31
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

The existing JanusGraph graph database suffers from attribute deletion remnants in its storage and update mechanisms, leading to inconsistencies between the index and storage. Furthermore, write performance decreases as the number of attributes increases, making it difficult to meet the real-time update requirements in scenarios with high attribute dimensions.

Method used

By employing the collaborative operation of the storage engine layer and the index engine layer, all business attributes of a vertex are aggregated and stored in the same storage unit. During updates, a full overwrite is performed to eliminate attribute deletion residues, ensuring strong consistency between the index and the storage, and reducing the write complexity from multiple times to one time.

Benefits of technology

It significantly improves write performance and storage efficiency, completely eliminates attribute deletion residues, ensures data accuracy and consistency, and improves query response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123138265A_ABST
    Figure CN123138265A_ABST
Patent Text Reader

Abstract

The application discloses a kind of graph data processing method, electronic equipment and computer readable storage medium, applied to graph database, graph database includes storage engine layer and index engine layer, the method comprises: in response to obtaining update request, determine the current all business attributes corresponding to the vertex needing to be updated carried by update request;The current all business attributes corresponding to the vertex needing to be updated in storage engine layer and index engine layer are replaced by the existing business attribute corresponding to the vertex needing to be updated;Vertex matches with identification, in storage engine layer, all business attributes of vertex are stored in the same storage unit;In response to obtaining query request, determine the identification matched with query request in index engine layer, based on identification, query target attribute corresponding to target vertex from storage engine layer is obtained.The above scheme can fundamentally eliminate attribute deletion residue, and while guaranteeing the strong consistency of index and storage, significantly improve the write performance and storage efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of distributed graph database and big data storage technology, and in particular to a graph data processing method, electronic device and computer-readable storage medium. Background Technology

[0002] Graph databases are widely used in numerous fields, such as social network analysis, knowledge graph construction, recommendation systems, and intelligent transportation. These applications place particularly high demands on the real-time, efficient, and consistent storage and querying of graph data. JanusGraph (an open-source distributed graph database) is renowned for its strong scalability and well-developed ecosystem. However, current JanusGraph graph databases have inherent flaws in their storage and update mechanisms. They cannot eliminate attribute deletion residues, leading to data inconsistencies between the index and storage. Furthermore, write performance decreases linearly with the number of attributes, making it difficult to meet the real-time update requirements of high-attribute-dimensional scenarios. Therefore, how to fundamentally eliminate attribute deletion residues and significantly improve write performance and storage efficiency while ensuring strong consistency between the index and storage has become an urgent problem to be solved. Summary of the Invention

[0003] The main technical problem addressed by this application is to provide a graph data processing method, electronic device, and computer-readable storage medium that can fundamentally eliminate attribute deletion residues and significantly improve write performance and storage efficiency while ensuring strong consistency between index and storage.

[0004] To address the aforementioned technical problems, this application provides a graph data processing method applied to a graph database, the graph database including a storage engine layer and an index engine layer. The method includes: in response to receiving an update request, determining all current business attributes corresponding to the vertex to be updated carried in the update request; replacing the existing business attributes corresponding to the vertex to be updated with all current business attributes corresponding to the vertex to be updated in the storage engine layer and the index engine layer; wherein, the vertex is matched with an identifier, the identifier is stored in the storage engine layer and the index engine layer, and in the storage engine layer, all business attributes of the vertex are stored in the same storage unit; in response to receiving a query request, determining the identifier in the index engine layer that matches the query request, and querying the target attribute corresponding to the target vertex from the storage engine layer based on the identifier.

[0005] To address the aforementioned technical problems, a second aspect of this application provides an electronic device including a memory and a processor coupled to each other, wherein the memory stores program data and the processor executes the program data to implement the method described in the first aspect.

[0006] To address the aforementioned technical problems, a third aspect of this application provides a computer-readable storage medium storing program data that can be executed by a processor, the program data being used to implement the method described in the first aspect.

[0007] The above scheme, when receiving an update request, determines all current business attributes corresponding to the vertex that needs to be updated, carried in the update request. Vertex matching has an identifier, which is stored in the storage engine layer and the index engine layer. In the storage engine layer, all business attributes of the vertex are stored in the same storage unit. Using all current business attributes corresponding to the vertex that needs to be updated, all existing business attributes corresponding to the vertex originally stored in the storage engine layer are replaced. In the index engine layer, using all current business attributes corresponding to the vertex that needs to be updated, all existing business attributes corresponding to the vertex originally stored in the index engine layer are replaced. When receiving a query request, determines the identifier in the index engine layer that matches the query request. Based on the identifier, the target attribute corresponding to the target vertex is retrieved from the storage engine layer. By aggregating and storing all business attributes of the vertex in the same storage unit and performing a full overwrite, the scheme can fundamentally eliminate the attribute deletion residue caused by the inability to automatically clean up old attributes during overwrite updates in the distributed storage model. While ensuring strong consistency between the index and storage, it reduces the write complexity from multiple times to one time, significantly improving write performance and storage efficiency. Attached Figure Description

[0008] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein: Figure 1 This is a flowchart illustrating one embodiment of the image data processing method of this application; Figure 2 This is a flowchart illustrating another embodiment of the image data processing method of this application; Figure 3 This is a schematic diagram of the structure of one embodiment of the electronic device of this application; Figure 4 This is a schematic diagram of one embodiment of the computer-readable storage medium of this application. Detailed Implementation

[0009] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments, and different implementation methods can be adaptively combined. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0010] In this paper, the terms "system" and "network" are often used interchangeably. The term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this paper means two or more.

[0011] To clearly illustrate this invention, the technical terms related to graph databases are briefly introduced below. The graph data processing method provided in this invention is applied to the JanusGraph graph database, using Apache HBase (an open-source, distributed, column-oriented database) as the storage engine layer and Elasticsearch (a distributed search and analytics engine) as the indexing engine layer. Graph data includes vertices, edges, business attributes, and label attributes. Vertices are the basic elements in graph data, representing an entity or object. Edges are directed elements connecting two vertices, representing relationships between entities. Business attributes are attached to vertices or edges in key-value pairs to describe their characteristics. Label attributes are used to classify vertices or edges. In the Apache HBase storage engine layer, a distributed storage approach is typically used, with one attribute corresponding to one storage unit.

[0012] This application is described in detail below; please refer to [link / reference]. Figure 1 , Figure 1 This is a flowchart illustrating one embodiment of the graph data processing method of this application. The method is applied to a graph database, which includes a storage engine layer and an index engine layer. The method includes: S101: In response to receiving an update request, determine all current business attributes corresponding to the vertex that needs to be updated, as carried in the update request.

[0013] Specifically, when an update request is received, all current business attributes corresponding to the vertices that need to be updated, carried in the update request, are determined.

[0014] In one application approach, the graph database has a pre-set update cycle. When the update time arrives, an update request is received, and the update request is parsed to determine all the current business attributes corresponding to the vertices that need to be updated in the update request.

[0015] In another application, when the upstream business system detects a change in the business attributes of a vertex (entity), it immediately encapsulates all the latest current business attributes of that vertex into an update request and pushes it to the graph database in real time through a message queue. The graph database receives the update request, parses it, and determines all the current business attributes of the vertex that need to be updated.

[0016] S102: Replace all current business attributes corresponding to the vertices that need to be updated in the storage engine layer and index engine layer with the existing business attributes corresponding to the vertices that need to be updated.

[0017] Specifically, vertex matching has an identifier, which is stored in the storage engine layer and the index engine layer. In the storage engine layer, all business attributes of a vertex are stored in the same storage unit. Using all the current business attributes corresponding to the vertex that needs to be updated, all the existing business attributes corresponding to that vertex that were originally stored in the storage engine layer are replaced. In the index engine layer, using all the current business attributes corresponding to the vertex that needs to be updated, all the existing business attributes corresponding to that vertex that were originally stored in the index engine layer are replaced.

[0018] In one application approach, a coprocessing module is deployed in the storage engine layer. During the preprocessing stage of data writing to the storage engine layer, this coprocessing module intercepts multiple scattered write operations for the same vertex, aggregates them into a single aggregate write operation in real time, and uses the aggregate write operation to aggregate all current business attributes into the same storage unit. It also deletes all existing business attributes corresponding to the vertex that were previously stored in the storage unit. After the aggregate write operation is completed, the coprocessing module writes all current business attributes corresponding to the vertices that need to be updated in the index engine layer and deletes the existing business attributes that were previously stored, thereby ensuring consistency between the index and the storage.

[0019] In another application approach, the graph database also includes a graph semantic layer. The serialization and storage adaptation logic is directly modified in the graph semantic layer, so that when the graph semantic layer generates a write operation, it serializes all business attributes and writes them as a large field to the same storage unit of the storage engine layer, and deletes all existing business attributes corresponding to the vertex that were originally stored in the storage unit. After the graph semantic layer completes the write to the storage engine layer, it writes all the current business attributes corresponding to the vertices that need to be updated in the index engine layer, and deletes the existing business attributes that were originally stored, thereby ensuring consistency between the index and the storage.

[0020] S103: In response to receiving a query request, determine the identifier in the index engine layer that matches the query request, and based on the identifier, query the target attribute corresponding to the target vertex from the storage engine layer.

[0021] Specifically, when a query request is received, the identifier that matches the query request in the index engine layer is determined, and based on the identifier, the target attribute corresponding to the target vertex is retrieved from the storage engine layer.

[0022] It's important to note that during the query phase, the query request initiated by the object typically doesn't directly specify which vertex to read. Instead, it provides filtering conditions based on business attributes. Data in the storage engine layer is stored according to vertex identifiers, with all business attributes of each vertex stored in the same storage unit. Directly traversing the storage engine layer based on the attribute conditions in the query request would involve scanning a large number of irrelevant vertices, resulting in extremely low query performance. However, the index engine layer maintains an index mapping between vertex identifiers and business attributes, enabling it to quickly determine the identifiers of vertices that meet the filtering conditions based on business attributes. Therefore, when a query request is received, the index engine layer first determines the matching identifier based on the filtering conditions of the business attributes in the query request. Then, based on this identifier, the corresponding vertex is located in the storage engine layer, and all business attributes stored for that vertex are read to obtain the target attribute. Through the collaborative work of the index engine layer and the storage engine layer, both rapid response to attribute condition queries and complete and accurate vertex attribute information are obtained, avoiding a full scan of massive vertex data. This ensures both query efficiency and data accuracy and consistency.

[0023] In one application approach, a coprocessing module is deployed in the storage engine layer. When a query request is received, the identifier matching the query request in the index engine layer is determined. In the preprocessing stage, the coprocessing module rewrites the multi-column read request into a read of the same storage unit corresponding to the identifier. After reading the aggregated data, it is decomposed and restored into multiple independent business attributes in the postprocessing stage. Based on the identifier, the target attribute corresponding to the target vertex is obtained from the storage engine layer.

[0024] In another application, the graph database also includes a graph semantic layer. A proxy middleware is set between the graph semantic layer and the storage engine layer. When a query request is received, the middleware intercepts the query request and determines the query attribute conditions contained in the query request. Based on the conditions, it first queries the index engine layer to obtain the corresponding identifier, and then constructs an aggregation read request for the storage engine layer with the identifier. After obtaining the aggregated data according to the aggregation read request, it decomposes and restores it into multiple independent business attributes. Based on the identifier, it queries the storage engine layer to obtain the target attribute corresponding to the target vertex.

[0025] In a specific application scenario, for ease of understanding, the following explanation uses e-commerce products as an example. The graph database stores product information for an e-commerce platform. Vertices represent products, and the label attribute is "product." Each product has a unique identifier, i.e., product ID. A certain product currently has the following attributes: ID: P123456, Name: AB, Category: Shoes / Sports Shoes, Brand: XX Brand, Price: 599.00 yuan, Promotion: Double 11 Special Offer, Target Audience: Men. When the business changes, i.e., the Double 11 event ends, the product is removed from the promotion, and it is decided that the target audience will no longer be individually labeled. The upstream product management system pushes an update to all business attributes of the product: ID: P123456, Name: AB, Category: Sports Shoes, Brand: XX Brand, Price: 799.00 yuan. The business attributes "Double 11 Special Offer" and "Target: Men" are completely removed.

[0026] At this point, if the original distributed storage method of the storage engine layer is used, during updates, the graph database locates row P123456 based on the identifier ID and only writes the existing business attributes (name, category, brand, and price), without actively deleting the removed business attributes (promotion and target). However, in the index engine layer, index updates use document-level overwrite, with documents located and replaced using the identifier ID as the document ID. The old index document is completely replaced, and promotion and target automatically disappear. If an object needs to query the current product details, it sends a query request to the graph database. After receiving the query request, the graph database determines the identifier ID matching the query request in the index engine layer: P123456, and uses this ID to locate the product vertex in the storage engine layer, reading all the product's business attributes. At this time, the product's business attributes still retain residual promotion and target, which may cause the object to mistakenly believe that the product is still on promotion, affecting subsequent decisions.

[0027] However, if the aggregated storage method of the storage engine layer of this invention is adopted, all business attributes (name, category, brand, price, promotion, and target) are aggregated and stored in the same storage unit corresponding to the identifier ID: P123456. During updates, name, category, brand, and price are written into this storage unit as a whole, while promotion and target automatically disappear without any residue because they do not exist in the upstream product management system. In the index engine layer, index updates adopt document-level overwrite, and documents are located and replaced using the identifier ID as the document ID. The old index documents are replaced as a whole, promoting... The `n` and `target` disappear automatically. At this point, if the user needs to query the current product details, a query request is sent to the graph database, for example, "I want to know the current product details of AB sports shoes". After receiving the query request, the graph database parses and performs semantic analysis on the query request, determines the identifier ID (P123456) in the index engine layer that matches "AB" in the query request, and locates the product vertex in the storage engine layer through this ID. Since all the business attributes of the product are in one storage unit, the current status of the product, namely name, category, brand, and price, as well as the corresponding latest attribute values, can be accurately reflected, thus completely avoiding the impact of residual data on the business.

[0028] It should be noted that if there is no pre-declared query attribute condition in the index engine layer, the corresponding identifier does not need to be determined from the index engine layer. Instead, the storage engine layer can be directly traversed to find the identifier id that matches "AB": P123456.

[0029] The above scheme, when receiving an update request, determines all current business attributes corresponding to the vertex that needs to be updated, carried in the update request. Vertex matching has an identifier, which is stored in the storage engine layer and the index engine layer. In the storage engine layer, all business attributes of the vertex are stored in the same storage unit. Using all current business attributes corresponding to the vertex that needs to be updated, all existing business attributes corresponding to the vertex originally stored in the storage engine layer are replaced. In the index engine layer, using all current business attributes corresponding to the vertex that needs to be updated, all existing business attributes corresponding to the vertex originally stored in the index engine layer are replaced. When receiving a query request, determines the identifier in the index engine layer that matches the query request. Based on the identifier, the target attribute corresponding to the target vertex is retrieved from the storage engine layer. By aggregating and storing all business attributes of the vertex in the same storage unit and performing a full overwrite, the scheme can fundamentally eliminate the attribute deletion residue caused by the inability to automatically clean up old attributes during overwrite updates in the distributed storage model. While ensuring strong consistency between the index and storage, it reduces the write complexity from multiple times to one time, significantly improving write performance and storage efficiency.

[0030] Please see Figure 2 , Figure 2 This is a flowchart illustrating another embodiment of the graph data processing method of this application. The method is applied to a graph database, which includes a storage engine layer and an index engine layer. The method includes: S201: In response to receiving an update request, determine all current business attributes corresponding to the vertex that needs to be updated, as carried in the update request.

[0031] Specifically, when an update request is received, all current business attributes corresponding to the vertices that need to be updated, carried in the update request, are determined.

[0032] S202: Replace all current business attributes corresponding to the vertices that need to be updated in the storage engine layer and index engine layer with the existing business attributes corresponding to the vertices that need to be updated.

[0033] Specifically, vertex matching has an identifier, which is stored in the storage engine layer and the index engine layer. In the storage engine layer, all business attributes of a vertex are stored in the same storage unit. Using all the current business attributes corresponding to the vertex that needs to be updated, all the existing business attributes corresponding to that vertex that were originally stored in the storage engine layer are replaced. In the index engine layer, using all the current business attributes corresponding to the vertex that needs to be updated, all the existing business attributes corresponding to that vertex that were originally stored in the index engine layer are replaced.

[0034] In one embodiment, the vertices in the storage engine layer are stored based on the following steps: storing the identifier in the corresponding storage unit, and storing all business attributes in the same storage unit other than the storage unit corresponding to the identifier.

[0035] Specifically, in the storage engine layer, each vertex corresponds to a storage record, which contains both basic information for identifying and managing the vertex and business attributes describing the vertex's business characteristics. During storage, the identifier and all business attributes corresponding to the vertex are first retrieved. The identifier is a unique identifier for the vertex, used to distinguish different vertices, while the business attributes are a collection of specific business characteristics of the entity represented by the vertex, such as the name, price, and category of a product. During writing, the identifier is stored in the corresponding storage unit, and all business attributes of the vertex are stored together in the same storage unit, distinct from the storage unit corresponding to the identifier. This merges business attributes that might otherwise be scattered across multiple storage units into one, eliminating remnants and improving write performance by aggregating and storing business attributes, thus achieving a balance between storage efficiency and system reliability.

[0036] In one implementation scenario, the vertex also includes system attributes, which include at least state attributes and label attributes. The state attributes are used to indicate the current existence state of the vertex, and the label attributes are used to identify the type of the vertex. The state attributes and label attributes are stored in their respective storage units. In other implementation scenarios, the system attributes also include attributes used for system data management, such as creation time, last update time, and data version number. This application does not impose specific restrictions on these attributes.

[0037] In one embodiment, a coprocessing module is provided in the storage engine layer. Step S202 specifically includes: in response to the coprocessing module detecting multiple scattered write operations generated in the storage engine layer for the same vertex that needs to be updated, aggregating the multiple scattered write operations into a single aggregated write operation for the same storage unit; wherein, the scattered write operation carries the attribute names and attribute values ​​of all current business attributes corresponding to the vertex that needs to be updated; based on the aggregated write operation, replacing the existing attribute names and attribute values ​​of all current business attributes corresponding to the vertex that needs to be updated in the storage engine layer with the attribute names and attribute values ​​of the existing business attributes; and replacing the existing business attributes of all current business attributes corresponding to the vertex that needs to be updated in the index engine layer with the existing business attributes.

[0038] Specifically, the storage engine layer deploys a coprocessing module, such as RegionObserver. This coprocessing module pre-registers a first preprocessing hook function (e.g., prePut hook) that operates before data write operations. When multiple scattered write operations generated for the same vertex that needs to be updated enter the storage engine layer, the coprocessing module intercepts them all before the data is actually written to disk through this hook function, and aggregates them into a single aggregate write operation for the same storage unit. Based on the aggregate write operation, the coprocessing module extracts the attribute names and values ​​of all current business attributes corresponding to the vertex that needs to be updated in the storage engine layer from each intercepted scattered write operation, and replaces the existing attribute names and values ​​of the business attributes. By aggregating multiple scattered writes for the same vertex into a single write before the data is written to disk, multiple repeated writes to the same vertex are avoided, thereby improving write performance and reducing storage overhead.

[0039] Furthermore, by utilizing the coprocessing module, all current business attributes corresponding to the vertices that need to be updated in the index engine layer are replaced with existing business attributes, thereby ensuring the consistency between the data in the storage engine layer and the data in the index engine layer.

[0040] In one implementation scenario, the coprocessing module is pre-configured with a serialization data structure protocol. Based on the aggregate write operation, the steps of replacing the attribute names and values ​​of existing business attributes with the attribute names and values ​​of all current business attributes corresponding to the vertex that needs to be updated in the storage engine layer specifically include: using the serialization data structure protocol to encode the attribute names and values ​​to generate an aggregated attribute byte stream; based on the aggregate write operation, writing the aggregated attribute byte stream into the same storage unit, and deleting the attribute names and values ​​of existing business attributes.

[0041] Specifically, a pre-defined serialization data structure protocol is invoked to encode all attribute names and values ​​according to the protocol's specified format, generating a compact aggregated attribute byte stream. This byte stream contains complete information about all business attributes of the vertex. Thanks to the protocol's efficient encoding capabilities, storage space usage is significantly optimized. Finally, the coprocessor module, based on the aggregated write operation, writes this byte stream into the storage unit all at once, deleting the attribute names and values ​​of existing business attributes previously stored in the storage unit. The newly written data is assigned the latest timestamp and takes precedence over older data in version sorting, thus taking effect logically immediately. Since the aggregated byte stream only contains business attributes existing in the current snapshot, deleted old attributes are not rewritten and automatically become invalid along with the old version, requiring no additional explicit deletion operation. The entire write process replaces the existing business attribute data in the storage unit with a single atomic overwrite, eliminating attribute remnants and merging multiple writes into one, significantly improving write efficiency.

[0042] In one implementation scenario, the steps of replacing the existing business attributes with the current business attributes corresponding to the vertex that needs to be updated in the index engine layer specifically include: in response to the coprocessing module detecting that the aggregate write operation to the same storage unit is completed, writing the current business attributes corresponding to the vertex that needs to be updated in the index engine layer into the index engine layer, and deleting the existing business attributes.

[0043] Specifically, after the coprocessing module completes the writing of the aggregated attribute byte stream through the first preprocessing hook function, the first postprocessing hook function (e.g., the postPut hook) is triggered. When the coprocessing module detects that the aggregated write operation on the same storage unit is completed through this hook function, it writes all the current business attributes corresponding to the vertex that needs to be updated in the index engine layer into the index engine layer and deletes the existing business attributes, thereby ensuring the consistency between the data in the storage engine layer and the data in the index engine layer.

[0044] S203: In response to receiving a query request, determine the query attributes carried in the query request.

[0045] Specifically, the query attribute is the business attribute stored in the index engine layer. When the graph database receives a query request from an external source, it parses and performs semantic analysis on the query request to extract the attribute information involved in the query request. Through the definition of the query graph pattern, it determines which of these attributes are business attributes stored in the index engine layer. This identification step allows subsequent queries to preferentially utilize the acceleration capabilities of the index engine layer, rather than directly performing a full scan of the storage engine layer. For example, in the query "I want to know the current product details of AB sneakers", multiple attribute information is obtained through parsing, including "AB" and "sneakers". "AB" is a business attribute already stored in the index engine layer, while "sneakers" is not stored in the index engine layer. Therefore, the query attribute carried by this query request is determined to be "AB".

[0046] S204: Based on the query attribute, determine the identifier that matches the query attribute from the index engine layer, and based on the identifier, query the target attribute corresponding to the target vertex from the storage engine layer.

[0047] Specifically, based on the query attributes, the corresponding identifier is quickly retrieved from the index engine layer. It should be noted that the index engine layer only returns the identifier at this stage and does not directly provide all the business attributes of the vertex, because the index engine layer only stores the information of the query attributes. Therefore, based on the returned identifier, the target attributes corresponding to the target vertex are retrieved from the storage engine layer.

[0048] In one implementation scenario, step S204 specifically includes: determining an identifier that matches the query attribute from the index engine layer based on the query attribute; confirming the target vertex from the storage engine layer based on the identifier, reading the aggregate attribute byte stream corresponding to the target vertex, and extracting the target attribute from the aggregate attribute byte stream.

[0049] Specifically, during a query, the index engine layer first quickly matches the vertex identifier based on the query attributes, avoiding a full scan. Then, the target vertex is located in the storage engine layer based on the identifier. Since all business attributes of the vertex have been aggregated into an aggregate attribute byte stream during the write phase, they can be read all at once. Finally, the target attribute is extracted from the byte stream, avoiding the extra overhead of parsing all irrelevant attributes, thereby improving query efficiency.

[0050] In one implementation scenario, based on the identifier, the target vertex is identified from the storage engine layer, and the aggregated attribute byte stream corresponding to the target vertex is read. The specific steps of extracting the target attribute from the aggregated attribute byte stream include: based on the identifier, constructing an attribute read request for the storage engine layer; converting the scattered read operations for multiple attributes of the target vertex in the attribute read request into an aggregated read operation for the same storage unit corresponding to the target vertex in the storage engine layer; reading the aggregated attribute byte stream based on the aggregated read operation, decomposing the aggregated attribute byte stream to obtain multiple independent business attributes, and extracting the target attribute that matches the query request from the multiple independent business attributes.

[0051] Specifically, after obtaining the vertex identifier, an attribute read request for that vertex in the storage engine layer is constructed. Using a pre-registered second preprocessing hook function (such as the preGet hook), the attribute read request is intercepted after it arrives at the storage engine layer but before the actual read is executed. This hook function identifies that the current read request is a scattered read operation for multiple business attributes corresponding to the target vertex. Then, these scattered read operations are converted into an aggregate read operation for the same storage unit corresponding to the target vertex in the storage engine layer. Through this conversion, the scattered reads that may have been performed multiple times are simplified into a single accurate aggregate read, which significantly reduces the read overhead.

[0052] Furthermore, after the aggregated attribute byte stream is read based on the aggregated read operation, the second post-processing hook function (such as the postGet hook) is triggered. This hook function uses the same serialization data structure protocol used during writing to deserialize and deconstruct the byte stream, restoring it to multiple independent business attributes, and extracting the corresponding target attributes according to the original query request. The whole process is completely transparent to the upper-layer query logic, and the application does not need to know that the underlying storage model has changed from distributed storage to aggregated storage.

[0053] In one implementation scenario, business attributes correspond to attribute identifiers. The graph data processing method provided in this application further includes: serializing the attribute identifiers using the encoding format defined in the serialization data structure protocol to obtain optimized attribute identifiers.

[0054] Specifically, the original attribute identifiers corresponding to business attributes were stored in a fixed 8-byte format. Since the number of business attributes in a business graph is usually more than 1,000, this can easily lead to wasted space in practical applications. Therefore, the attribute identifiers can be serialized using the encoding format defined in the serialization data structure protocol. Regardless of whether the attribute identifier is declared as uint32 or uint64, it can dynamically occupy 1 to 10 bytes of storage space according to its actual value during serialization. This enables a fundamental shift from fixed redundancy to on-demand compactness, further reducing storage overhead.

[0055] Please see Figure 3 , Figure 3 This is a schematic diagram of an embodiment of the electronic device of this application. The electronic device 30 includes a memory 300 and a processor 302 coupled to each other. The memory 300 stores program data (not shown). The processor 302 calls the program data to implement the method in any of the above embodiments. For related descriptions, please refer to the detailed description of the above method embodiments, which will not be repeated here. Specifically, the electronic device 30 includes: desktop computers, laptops, tablet computers, servers, etc., which are not limited here. In addition, the processor 302 can also be called a central processing unit (CPU). The processor 302 may be an integrated circuit chip with signal processing capabilities. The processor 302 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor. In addition, the processor 302 can be implemented by integrated circuit chips.

[0056] Please see Figure 4 , Figure 4 This is a schematic diagram of a computer-readable storage medium according to an embodiment of the present application. The computer-readable storage medium 40 stores program data 400. When the program data 400 is executed by a processor, it implements the method in any of the above embodiments. For a detailed description of the relevant content, please refer to the detailed description of the above method embodiments, which will not be repeated here.

[0057] It should be noted that the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0058] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0059] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0060] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A graph data processing method, characterized in that, Applied to a graph database, which includes a storage engine layer and an index engine layer, the method includes: In response to receiving an update request, determine all current business attributes corresponding to the vertex that needs to be updated carried in the update request; Replace the existing business attributes of the vertex that needs to be updated with all current business attributes of the vertex that needs to be updated in the storage engine layer and the index engine layer; wherein, the vertex is matched with an identifier, the identifier is stored in the storage engine layer and the index engine layer, and in the storage engine layer, all business attributes of the vertex are stored in the same storage unit; In response to a query request, an identifier matching the query request is determined in the index engine layer, and the target attribute corresponding to the target vertex is retrieved from the storage engine layer based on the identifier.

2. The method according to claim 1, characterized in that, The storage engine layer is equipped with a coprocessing module. The step of replacing all current business attributes corresponding to the vertex that needs updating with the existing business attributes corresponding to the vertex that needs updating in the storage engine layer and the index engine layer includes: In response to the coprocessing module detecting multiple scattered write operations generated in the storage engine layer for the same vertex that needs to be updated, the multiple scattered write operations are aggregated into a single aggregate write operation for the same storage unit; wherein, the scattered write operation carries the attribute names and attribute values ​​of all current business attributes corresponding to the vertex that needs to be updated; based on the aggregate write operation, the attribute names and attribute values ​​of all current business attributes corresponding to the vertex that needs to be updated in the storage engine layer are used to replace the existing attribute names and attribute values ​​of the business attributes. Replace the existing business attributes with all current business attributes corresponding to the vertices that need to be updated in the index engine layer.

3. The method according to claim 2, characterized in that, The coprocessing module is pre-configured with a serialization data structure protocol. Based on the aggregated write operation, the attribute names and values ​​of all current business attributes corresponding to the vertices that need updating in the storage engine layer are replaced with the existing attribute names and values, including: The attribute name and the attribute value are encoded using the serialization data structure protocol to generate the aggregated attribute byte stream; Based on the aggregated write operation, the aggregated attribute byte stream is written into the same storage unit, and the attribute name and attribute value of the existing business attributes are deleted.

4. The method according to claim 2, characterized in that, The step of replacing all existing business attributes corresponding to the current vertices that need to be updated in the index engine layer with the existing business attributes includes: In response to the coprocessing module detecting the completion of the aggregate write operation on the same storage unit, all current business attributes corresponding to the vertices that need to be updated in the index engine layer are written to the index engine layer, and existing business attributes are deleted.

5. The method according to claim 2, characterized in that, In response to receiving a query request, the process involves determining an identifier in the indexing engine layer that matches the query request, and based on the identifier, retrieving the target attribute corresponding to the target vertex from the storage engine layer, including: In response to receiving the query request, the query attributes carried by the query request are determined; wherein, the query attributes are business attributes stored in the index engine layer; Based on the query attribute, an identifier matching the query attribute is determined from the index engine layer, and based on the identifier, the target attribute corresponding to the target vertex is retrieved from the storage engine layer.

6. The method according to claim 5, characterized in that, The step of determining an identifier matching the query attribute from the index engine layer based on the query attribute, and querying the target attribute corresponding to the target vertex from the storage engine layer based on the identifier, includes: Based on the query attribute, an identifier matching the query attribute is determined from the index engine layer; Based on the identifier, the target vertex is identified from the storage engine layer, and the aggregated attribute byte stream corresponding to the target vertex is read, and the target attribute is extracted from the aggregated attribute byte stream.

7. The method according to claim 6, characterized in that, The step of identifying the target vertex from the storage engine layer based on the identifier, reading the aggregated attribute byte stream corresponding to the target vertex, and extracting the target attribute from the aggregated attribute byte stream includes: Based on the identifier, construct an attribute read request for the storage engine layer; The scattered reading operations for multiple attributes of the target vertex in the attribute reading request are converted into an aggregate reading operation for the same storage unit corresponding to the target vertex in the storage engine layer. The aggregated attribute byte stream is read based on the aggregated read operation, the aggregated attribute byte stream is decomposed to obtain multiple independent business attributes, and the target attribute matching the query request is extracted from the multiple independent business attributes.

8. The method according to claim 1, characterized in that, The vertices in the storage engine layer are stored based on the following steps: The identifier is stored in the corresponding storage unit, and all the business attributes are stored in the same storage unit other than the storage unit corresponding to the identifier.

9. An electronic device, characterized in that, The method includes a memory and a processor coupled to each other, the memory storing program data, and the processor executing the program data to implement the method of any one of claims 1-8.

10. A computer-readable storage medium, characterized in that, The system stores program data that can be executed by a processor, the program data being used to implement the method according to any one of claims 1-8.