Method and apparatus for implementing online data definition language operations of a graph database
By introducing multi-version schemas and data mechanisms into graph databases, identifying database operation types and generating schema update tasks, the performance and storage issues of online data definition language operations in graph databases are resolved, achieving efficient data processing and business continuity while reducing resource consumption and storage costs.
Patent Information
- Application Number
- CN202510663071.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-22
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2045-05-22
AI Technical Summary
Existing graph databases suffer from performance degradation, high storage requirements, and limited support for complex DDL operations when performing online data definition language operations. Furthermore, existing methods do not fully utilize the characteristics of graph databases.
By receiving online data definition language operations, identifying database operation types, and generating schema update tasks under preset conditions, the system introduces multi-version schemas and data mechanisms, adopts delayed update and lazy conversion mechanisms, avoids traditional locking mechanisms, and supports online data definition language operations for graph databases.
It significantly improves the performance of large-scale graph data processing, supports continuous business operations, reduces system downtime, lowers storage costs, provides fault recovery and problem diagnosis support, and reduces network overhead and computing resource consumption.
Smart Images

Figure CN120179668B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of graph database data processing technology, and in particular to a method and apparatus for implementing online data definition language operations in graph databases. Background Technology
[0002] Graph databases, as an emerging data storage solution, offer significant advantages in handling highly interconnected data. With ever-changing business needs, the evolution of database schemas has become a common requirement. Traditional schema changes typically require downtime maintenance, which is unacceptable for modern application systems that need continuous operation. In the graph database domain, Online DDL (Data Definition Language) operations face unique challenges. The data model of graph databases differs greatly from traditional relational databases, primarily consisting of nodes, edges, and attributes, significantly increasing the complexity of schema changes. Furthermore, graph databases are typically used to handle large-scale, highly interconnected data, further increasing the difficulty of performing schema changes without impacting performance and consistency. Existing graph database OnlineDDL technologies typically employ a tight integration between a schema manager and a DDL execution engine. Upon receiving a DDL request, the schema manager updates the schema definition and notifies the DDL execution engine to begin execution. A data transformer, connected to the DDL execution engine, is responsible for transforming the affected data according to the requirements of the DDL operation. A concurrency control manager connects to the DDL execution engine and the database's transaction management system, coordinating DDL operations with concurrent DML operations. A rollback mechanism is connected to the entire system, monitoring the execution status of DDL operations. However, existing technologies have some limitations: the data transformation process can lead to significant performance degradation, high storage space requirements, and limited support for complex DDL operations. Furthermore, existing methods are often ported from relational databases and do not fully utilize the characteristics of graph databases. Summary of the Invention
[0003] This invention provides a method and apparatus for implementing online data definition language operations in graph databases, thereby solving the technical problem that graph databases in the prior art have difficulty supporting online DDL.
[0004] According to one aspect of the present invention, a method for implementing online data definition language operations in a graph database is provided, comprising:
[0005] Receive online data definition language operations on the graph database, execute the online data definition language operations, and determine the version of the graph data to be updated corresponding to the online data definition language operations;
[0006] Identify the database operation type corresponding to the online data definition language operation, and generate a schema update task when the database operation type or version control system detects that the graph database meets the preset graph database update conditions.
[0007] The update task updates the graph data version to be updated to the graph database according to the pattern update.
[0008] According to another aspect of the present invention, an apparatus for implementing online data definition language operations in a graph database is provided, comprising:
[0009] The graph database online modification module is used to receive online data definition language operations on the graph database, execute the online data definition language operations, and determine the version of the graph data to be updated corresponding to the online data definition language operations.
[0010] The graph pattern update module is used to identify the database operation type corresponding to the online data definition language operation. When the database operation type or the version control system detects that the graph database meets the preset graph database update conditions, a pattern update task is generated.
[0011] The namespace update module is used to update the version of the graph data to be updated to the graph database according to the pattern update task.
[0012] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0013] At least one processor; and
[0014] A memory communicatively connected to the at least one processor; wherein,
[0015] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the implementation method of online data definition language operations for graph databases according to any embodiment of the present invention.
[0016] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions, the computer instructions being configured to cause a processor to execute and implement the method for implementing online data definition language operations of a graph database as described in any embodiment of the present invention.
[0017] The technical solution of this invention receives and executes online data definition language (DDL) operations on a graph database, determines the version of the graph data to be updated corresponding to the DDL operation, and ensures data consistency by introducing a multi-version mode and multi-version data mechanism, while avoiding traditional locking mechanisms. It identifies the database operation type corresponding to the DDL operation, and generates a schema update task when the database operation type or version control system detects that the graph database meets preset graph database update conditions. Through delayed updates and lazy conversion mechanisms, the DDL operation does not immediately affect all data, greatly reducing the impact on normal business access and significantly reducing resource consumption. The solution updates the graph data version to be updated to the graph database according to the schema update task, mapping complex DDL operations to changes in the graph structure, and then performing more complex operations in the background, reducing the need for manual intervention, achieving data coexistence and incremental migration between old and new versions, and supporting gradual changes and canary releases of complex DDL. This solves the technical problem in existing technologies where graph databases struggle to support Online DDL. This invention significantly improves the performance of large-scale graph data processing, supports continuous business operations during schema changes, minimizes system downtime, reduces redundant storage, lowers storage costs, provides strong support for fault recovery and problem diagnosis through version control mechanisms, and supports more efficient distributed synchronization, reducing network overhead and computing resource consumption.
[0018] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 A flowchart illustrating an implementation method for online data definition language operations in a graph database is provided as an embodiment of the present invention.
[0021] Figure 2 An example diagram is disclosed showing concurrent backfilling of the namespace to be updated to the target namespace;
[0022] Figure 3 A flowchart illustrating an implementation method for online data definition language operations in a graph database, provided as an embodiment of the present invention;
[0023] Figure 4 This invention provides a flowchart illustrating the process of generating a first data update version through a first update operation.
[0024] Figure 5 A flowchart illustrating an implementation method for online data definition language operations in a graph database, provided as an embodiment of the present invention;
[0025] Figure 6 A flowchart illustrating a process for generating a third update graph pattern version through a third update operation, as provided in this embodiment of the invention.
[0026] Figure 7 A flowchart illustrating an implementation method for online data definition language operations in a graph database, provided as an embodiment of the present invention;
[0027] Figure 8 A schematic diagram of the structure of an implementation device for online data definition language operations in a graph database, provided in an embodiment of the present invention;
[0028] Figure 9 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. Detailed Implementation
[0029] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0031] Figure 1This invention provides a flowchart of a method for implementing online data definition language (DDL) operations on a graph database. This embodiment is applicable to situations where online operations are performed on a graph database via online DDL. This method can be executed by a device for implementing online DDL operations on a graph database. This device can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:
[0032] S110. Receive an online data definition language operation on the graph database, execute the online data definition language operation, and determine the version of the graph data to be updated corresponding to the online data definition language operation.
[0033] Online Data Definition Language (ODL) operations refer to data definition language (DDL) operations performed while the database is running. For example, in a graph database, ODL operations can create, modify, or delete graph schemas, modify the attributes of points and edges in the graph database, and add new relationships between points and edges.
[0034] The graph data version to be updated can be the graph database version after performing online data definition language (ODL) operations. It should be noted that when ODL operations are performed on a graph database, the graph database's external online functionality is paused, making it unsuitable for high-concurrency database-related operations and limiting the system's online modification capabilities. This invention, through a version control mechanism, allows the graph data version to be updated to support ODL operations on the graph database without affecting its external online functionality. The graph data version to be updated in this invention includes a graph schema version and a graph data version; multiple graph schema and graph data versions can coexist in the graph database simultaneously.
[0035] Optionally, the online data definition language operations include a first update operation, a second update operation, and a third update operation; the graph data version to be updated includes a first data update version, a second data update version, and a third data update version. The first update operation can simultaneously update the graph schema and graph data of the graph database, generating new graph schema and graph data versions; the second update operation can be a graph database reconstruction operation, generating new graph model and graph data versions; the third update operation can be a graph schema version update operation, used to modify the graph schema of the graph database. For example, the first update operation is used for graph schema version changes and graph data version changes, and can modify vertices and edges: adding and deleting attributes, modifying attribute values, types, and default values; adding or deleting edges between vertices; the second update operation is used for data rebuilding, and can create new vertices, edges, and indexes based on the graph database; the third update operation can be used to modify the attribute names of vertices and edges in the graph database, modify schema names, delete graphs, vertices, edges, and indexes, and truncate graphs, vertices, and edges.
[0036] Specifically, whether the graph data is online or offline, it receives online data definition language operations on the graph database, executes the online data definition language operations, and determines the version of the graph data to be updated corresponding to the online data definition language operations.
[0037] S120. Identify the database operation type corresponding to the online data definition language operation. If the database operation type or version control system detects that the graph database meets the preset graph database update conditions, then generate a schema update task.
[0038] The database operation type can be an online data definition language (ODL) operation that modifies the graph database. It should be noted that the database operation types include graph schema version change, graph database version change, and graph database reconstruction. Graph schema version change indicates an ODL operation that modifies the graph schema version; graph database version change indicates an ODL operation that modifies both the graph schema version and the graph data version of the graph database; and graph database reconstruction indicates an ODL operation that reconstructs both the schema and data of the graph database.
[0039] In this context, the version control system can be a control system used within the graph database to manage the updates of the graph schema version. It's important to note that a version control system (Schema GC) can delay updates to the graph schema and graph data versions, enabling the graph database to simultaneously support online functions and high-concurrency database-related operations while supporting online data definition language operations.
[0040] The preset graph database update conditions can be pre-set conditions used to detect updates to the graph database's graph schema version and / or graph data version. It should be noted that when the version control system detects that the graph database meets the preset graph database update conditions, it can initiate the version control system to update the graph database to its graph schema version and / or graph data version; similarly, when the database operation type corresponding to the online data definition language operation meets the preset graph database update conditions, the version control system can initiate the graph database update to its graph schema version and / or graph data version.
[0041] Optionally, the version control system can detect the number of graph schema versions, the update time of the graph database, and / or graph data requirements. If the number of graph schema versions exceeds a preset graph schema threshold, the graph database is considered to meet the preset graph database update conditions. If the update time of the graph database meets the background scheduled update requirements, the graph database is considered to meet the preset graph database update conditions. If the graph data version of the graph database does not support external data requirements for the graph database, the graph database is considered to meet the preset graph database update conditions. For example, the preset graph schema threshold can be 8. If the version control system detects 9 graph schema versions, the graph database is considered to meet the preset graph database update conditions. The background scheduled update can be set to update every 24 hours. If the number of graph schema versions is no more than 8 and the time since the last update is 24 hours, the graph database is considered to meet the preset graph database update conditions. If the number of graph schema versions is no more than 8 and the time since the last update is less than 24 hours, but the current graph data version of the graph database cannot meet external data requirements, the graph database is considered to meet the preset graph database update conditions.
[0042] The schema update task can be an instruction generated by the task manager of the version control system; the schema update task is used to update the graph data version and graph schema version of the graph database.
[0043] Optionally, if the database operation type corresponding to the online data definition language operation meets the preset graph database update conditions or if the version control system detects that the graph database meets the preset graph database update conditions, the version control system generates a mode update task through the task manager.
[0044] Specifically, the database operation type corresponding to the online data definition language operation is identified. If the database operation type or the version control system detects that the graph database meets the preset graph database update conditions, a schema update task is generated through the version control system.
[0045] S130. Update the graph data version to be updated to the graph database according to the mode update task.
[0046] Specifically, after the version control system generates a schema update task, it scans the original graph data version and graph schema version of the graph database according to the schema update task. Based on the graph data version to be updated, it converts the original graph data version and graph schema version of the graph database to achieve the update of the graph database.
[0047] Optionally, in another optional embodiment of the present invention, updating the graph data version to be updated to the graph database according to the pattern update task includes:
[0048] Identify the namespaces in the graph database that are active and awaiting updates;
[0049] Based on the pattern update task, determine the target namespace and at least one version of graph data to be updated;
[0050] Identify each version of the graph data to be updated and determine the target update information set;
[0051] Scan the graph data and graph patterns to be updated corresponding to the namespace to be updated.
[0052] Based on the target update information set, the graph data to be updated is concurrently backfilled into the target namespace to determine the target graph data and the target graph mode;
[0053] Set the target namespace to active state, and delete the graph data and graph patterns to be updated in the namespace to be updated.
[0054] The namespace to be updated can be either the currently active data storage space of the graph database or the namespace before the update. It's important to note that namespaces control the data visibility of the graph database's storage layer. A graph database can support at least one namespace, each with a corresponding state. Only the data in the active namespace is externally visible, supporting the graph database's external data services. A graph database can only support a maximum of one active namespace for external data services. Namespaces solve the concurrency control problem for external data services, enabling data coexistence between old and new versions and incremental migration, and supporting gradual changes and canary rollouts of complex online data definition language operations.
[0055] Optionally, when a graph database stops supporting external data services, more than one namespace may remain active.
[0056] The graph schema to be updated can be the corresponding graph schema version in the namespace to be updated; the graph data to be updated can be the graph data running in the namespace to be updated. It should be noted that when the namespace of the graph database is not updated, the graph schema version of the graph database is the graph schema to be updated, and the graph data version of the graph database is the graph data to be updated.
[0057] The target namespace can be a namespace created by the graph database based on the schema update task. It should be noted that when executing the schema update task, the graph database creates a new namespace as the target namespace, which is used to update the graph schema and graph data to be updated in the graph database's namespace to be updated, based on the version of the graph data to be updated.
[0058] The target update information set can be a dataset of graph data versions and graph schema versions that need to be updated in the graph database. It should be noted that each schema update task corresponds to at least one graph data version to be updated. For each graph data version to be updated, the changes in the graph schema version and the graph data version are determined sequentially to arrive at the final graph schema version and graph data version. These final graph schema version and graph data version are then defined as the target update information set.
[0059] Optionally, since the graph database can store multiple graph schema versions and graph data versions, the creation time of each graph schema version is identified, and the graph schema version with the shortest creation time is selected as the graph schema version that needs to be updated in the graph database. Similarly, the creation time of each graph data version is identified, and the graph data version with the shortest creation time is selected as the graph data version that needs to be updated in the graph database. Based on the creation times of each graph schema version and graph data version, a target update information set is constructed sequentially. For example, there are three graph schema versions: graph schema version 1, graph schema version 2, and graph schema version 3. Since graph schema version 3 has the shortest creation time, it is determined as the final updated graph schema version. There are also two graph schema versions: graph data version 1 corresponding to graph schema version 1 and graph data version 2 corresponding to graph schema version 3. Graph data version 2 is selected as the final updated graph data version, and thus graph schema version 3 and its corresponding graph data version 2 are determined as the target update information set.
[0060] The target graph data can be the graph data version in the target namespace after the target namespace of the graph database has been updated; the target graph schema can be the graph schema version corresponding to the target namespace after the target namespace has been updated.
[0061] Specifically, the process involves: identifying active namespaces in the graph database that are awaiting updates; determining the target namespace and at least one version of graph data to be updated based on the schema update task; identifying each version of graph data to be updated and determining the target update information set; scanning the graph data and schemas to be updated corresponding to the namespaces to be updated, and concurrently backfilling the graph data to be updated into the target namespaces based on the target update information set to determine the target graph data and target graph schemas; setting the target namespaces to active status and deleting the graph data and schemas to be updated from the namespaces to be updated.
[0062] Optionally, in another optional embodiment of the present invention, the step of identifying each version of the graph data to be updated and determining the target update information set includes:
[0063] If the second updated data version does not exist in the graph data version to be updated, the target update information set is determined in at least one of the first data update versions and / or the third updated graph pattern version;
[0064] If the second updated data version exists in the version of graph data to be updated, then the second updated data version is determined as the target updated information set.
[0065] Optionally, it can be determined whether there is a second updated data version for the graph data version to be updated. If there is a second updated data version, it is determined that the update of the graph database is a graph database reconstruction. Then, the second updated graph pattern version and the second updated data version corresponding to the second updated data version are directly used as the target update information set.
[0066] Optionally, identify whether there is a second updated data version in the version of graph data to be updated. If there is no second updated data version, it is determined that the update of the graph database is not a graph database reconstruction. Identify at least one first data update version and / or a third updated graph pattern version in the version of data to be updated. Based on the creation time corresponding to at least one first data update version and / or a third updated graph pattern version in the version of data to be updated, take the graph pattern version and graph data version with the latest creation time as the target update information set.
[0067] Figure 2 An example diagram illustrating concurrent backfilling of the namespace to be updated to the target namespace is disclosed. For example... Figure 2As shown: During the execution of the DDL operator, graph data is updated based on the schema update task. Data is backfilled from the namespace to be updated to the target namespace. The specific process of data backfilling is as follows: Stage 1: Concurrent Backfilling: The graph database starts multiple background tasks to concurrently scan the data of the graph schema to be updated, converts the data of the graph schema to be updated to the format of the target graph schema, and writes it into the new target graph schema; Stage 2: Incremental Processing: During the concurrent backfilling process, if the graph database receives a write operation from an external business, the new write operation will be directly written to the new target graph schema; if the write operation cannot be executed in real time, the write operation is recorded through the graph database's log system, and the write operation is executed when the graph database detects that the write operation can be executed; In the implementation of concurrent backfilling, because there are multiple graph data schemas and graph data versions between the data of the graph schema to be updated and the target graph schema, and because there are deletion and update operations between the graph data schemas and graph data versions, there may be conflicts when directly converting the graph data from the data of the graph schema to be updated to the target graph schema; for example, there may be invalid points, edges, and attribute data. Phase 3 involves conflict handling: handling conflicts during concurrent backfilling; for example, deleting invalid point and edge attribute data; Phase 4 involves switching and cleaning up, adding an exclusive lock to the graph mode to be updated, converting the target namespace to the active state, and cleaning up the data and lock resources of the namespace to be updated.
[0068] Optionally, since direct conversion from the data of the graph schema to be updated to the target graph schema may cause conflicts during concurrent backfilling, based on the creation time of the graph data versions to be updated, at least one graph data version existing between the graph schema to be updated and the target graph schema is sequentially identified as the stage update graph schema version and the stage update graph data version. The concurrent backfilling process can be as follows: based on the creation time of each stage update graph schema version and stage update graph data version, the graph schema to be updated and the graph data to be updated are gradually updated to each stage update graph schema version and stage update graph data version, and then the last stage update graph schema version and stage update graph data version are used to update the target graph data and the target graph schema. Furthermore, in each update process, existing conflicts are directly handled to improve the accuracy of graph database updates. For example, there are three phased update graph pattern versions and two phased update graph data versions between the graph pattern to be updated and the target graph pattern, namely phased update graph pattern version 1, phased update graph pattern version 2, and phased update graph pattern version 3, as well as phased update graph data version 1 corresponding to phased update graph pattern version 1 and phased update graph data version 2 corresponding to phased update graph pattern version 2. The process involves first updating the graph pattern to be updated and the graph data to be updated to phased update graph pattern version 1 and phased update graph data version 1, then updating phased update graph pattern version 1 and phased update graph data version 1 to phased update graph pattern version 2 and phased update graph data version 2, then updating phased update graph pattern version 2 to phased update graph pattern version 3, and finally updating the target graph pattern and target graph data with phased update graph pattern version 3 and phased update graph data version 2.
[0069] The technical solution of this invention receives and executes online data definition language (DDL) operations on a graph database, determines the version of the graph data to be updated corresponding to the DDL operation, and ensures data consistency by introducing a multi-version mode and multi-version data mechanism, while avoiding traditional locking mechanisms. It identifies the database operation type corresponding to the DDL operation, and generates a schema update task when the database operation type or version control system detects that the graph database meets preset graph database update conditions. Through delayed updates and lazy conversion mechanisms, the DDL operation does not immediately affect all data, greatly reducing the impact on normal business access and significantly reducing resource consumption. The solution updates the graph data version to be updated to the graph database according to the schema update task, mapping complex DDL operations to changes in the graph structure, and then performing more complex operations in the background, reducing the need for manual intervention, achieving data coexistence and incremental migration between old and new versions, and supporting gradual changes and canary releases of complex DDL. This solves the technical problem in existing technologies where graph databases struggle to support Online DDL. This invention significantly improves the performance of large-scale graph data processing, supports continuous business operations during schema changes, minimizes system downtime, reduces redundant storage, lowers storage costs, provides strong support for fault recovery and problem diagnosis through version control mechanisms, and supports more efficient distributed synchronization, reducing network overhead and computing resource consumption.
[0070] Figure 3 This is a flowchart illustrating an implementation method for online data definition language operations in a graph database, provided as an embodiment of the present invention. The relationship between this embodiment and the previous embodiments is explained, describing the update process of the graph database when the online data definition language operation is the first update operation. For example... Figure 3 As shown, the method includes:
[0071] S310. Receive an online data definition language operation on the graph database. If the online data definition language operation is the first update operation, execute the first update operation and determine the first data update version corresponding to the first update operation.
[0072] The first data update version can be a graph schema version and a graph data version generated by the graph database when performing the first update operation; the first data update version includes a first updated graph schema version and a first updated data version; the first updated graph schema version can be a graph schema version generated by the graph database when performing the first update operation; the first updated data version can be a graph data version generated by the graph database when performing the first update operation.
[0073] Optionally, the graph database performs the first update operation to generate a first updated graph pattern version and a first updated data version, and stores the first updated graph pattern version in the cache of the running memory.
[0074] Specifically, it receives online data definition language operations on the graph database. If the online data definition language operation is a first update operation, it executes the first update operation and determines the first update data version corresponding to the first update operation.
[0075] Figure 4 A flowchart illustrating a process for generating a first data update version through a first update operation, as provided in an embodiment of the present invention; Figure 4 As shown, the first update operation can be "add age" or "drop name". During the first update operation on the graph data Person, the graph schema version is incremented by 1 to obtain the first updated graph schema version; the graph data version is incremented by 1 to obtain the first updated data version.
[0076] S320. Identify the database operation type of the first update operation and determine that the database operation type of the first update operation is a graph database version change.
[0077] Specifically, identify the database operation type of the first update operation and determine that the database operation type of the first update operation is a graph database version change.
[0078] S330. If the version control system detects that the number of graph schema versions in the graph database is greater than the graph schema threshold, then the version control system is considered to meet the preset graph database update conditions.
[0079] The graph pattern threshold can be a pre-set data threshold used to determine whether the graph database needs to be updated. It should be noted that the graph pattern threshold can be set manually through a version control system and can be freely adjusted according to the business needs of different graph databases.
[0080] Specifically, the graph database uses a version control system to detect if the number of graph schema versions in the graph database is greater than the graph schema threshold. If so, the version control system is considered to meet the preset graph database update conditions.
[0081] Optionally, since the graph schema versions of the graph data are stored in the cache of the running memory, the graph database can detect the cache of the running memory occupied by at least one graph schema version through the version control system. By setting the upper limit of the running memory cache, when the cache of the running memory occupied by the graph schema version reaches the upper limit, the schema update task is directly generated through the version control system.
[0082] S340, Generate a mode update task through the version control system.
[0083] S350: Update the graph data version to be updated to the graph database according to the pattern update task.
[0084] Optionally, identify the active namespaces in the graph database that need updating; determine the target namespace and at least one version of graph data to be updated based on the schema update task; identify each version of graph data to be updated and determine the target update information set; scan the graph data and schema to be updated corresponding to the namespaces to be updated, and concurrently backfill the graph data to be updated into the target namespaces based on the target update information set to determine the target graph data and target graph schema; set the target namespaces to be active and delete the graph data and schema to be updated in the namespaces to be updated.
[0085] Optionally, identify whether there is a second updated data version in the graph data version to be updated. If there is no second updated data version, it is determined that the update of the graph database is not a graph database reconstruction. Identify at least one first data update version and / or a third updated graph pattern version in the data version to be updated. Based on the creation time corresponding to at least one first data update version and / or a third updated graph pattern version in the data version to be updated, take the graph pattern version and graph data version with the latest creation time as the target update information set.
[0086] The technical solution of this invention receives and executes online data definition language (DDL) operations on a graph database, determines the version of the graph data to be updated corresponding to the DDL operation, and ensures data consistency by introducing a multi-version mode and multi-version data mechanism, while avoiding traditional locking mechanisms. It identifies the database operation type corresponding to the DDL operation, and generates a schema update task when the database operation type or version control system detects that the graph database meets preset graph database update conditions. Through delayed updates and lazy conversion mechanisms, the DDL operation does not immediately affect all data, greatly reducing the impact on normal business access and significantly reducing resource consumption. The solution updates the graph data version to be updated to the graph database according to the schema update task, mapping complex DDL operations to changes in the graph structure, and then performing more complex operations in the background, reducing the need for manual intervention, achieving data coexistence and incremental migration between old and new versions, and supporting gradual changes and canary releases of complex DDL. This solves the technical problem in existing technologies where graph databases struggle to support Online DDL. This invention significantly improves the performance of large-scale graph data processing, supports continuous business operations during schema changes, minimizes system downtime, reduces redundant storage, lowers storage costs, provides strong support for fault recovery and problem diagnosis through version control mechanisms, and supports more efficient distributed synchronization, reducing network overhead and computing resource consumption.
[0087] Figure 5 This is a flowchart illustrating an implementation method for online data definition language operations in a graph database, provided as an embodiment of the present invention. The relationship between this embodiment and the previous embodiments is explained, describing the update process of the graph database when the online data definition language operation is the third update operation. For example... Figure 5 As shown, the method includes:
[0088] S510. Receive an online data definition language operation on the graph database. If the online data definition language operation is the third update operation, execute the third update operation and determine the third update graph mode version corresponding to the third update operation.
[0089] The third graph schema version can be the graph schema version generated by the graph database during the third update operation. It should be noted that the third update operation only updates the graph schema version of the graph database, and does not update the graph data version. Optionally, the third updated graph schema version and the third updated data version generated by the graph database during the third update operation are stored in the cache of runtime memory.
[0090] Specifically, it receives online data definition language operations on the graph database. If the online data definition language operation is a third update operation, it executes the third update operation and determines the third update graph mode version corresponding to the third update operation.
[0091] Figure 6 A flowchart illustrating a process for generating a third update graph pattern version through a third update operation, as provided in this embodiment of the invention; Figure 6 As shown, the third update operation is the "alter comment" operation, which modifies the comment information of the Person point. During the third update operation on the graph data Person, the graph schema version is incremented by 1 to obtain the third updated graph schema version; the graph data version Data Version remains unchanged, and the graph data Person is updated from comment: version 1 to comment: version 2.
[0092] S520. Identify the database operation type of the third update operation and determine that the database operation type of the third update operation is a graph pattern version change.
[0093] Specifically, identify the database operation type of the third update operation and determine that the database operation type of the third update operation is a graph pattern version change.
[0094] S530. If the version control system detects that the number of graph pattern versions in the graph database is greater than the graph pattern threshold, then the version control system is considered to meet the preset graph database update conditions.
[0095] Specifically, the graph database uses a version control system to detect if the number of graph schema versions in the graph database is greater than the graph schema threshold. If so, the version control system is considered to meet the preset graph database update conditions.
[0096] S540, Generate pattern update tasks through the version control system.
[0097] S550: Update the graph data version to be updated to the graph database according to the pattern update task.
[0098] Optionally, identify the active namespaces in the graph database that need updating; determine the target namespace and at least one version of graph data to be updated based on the schema update task; identify each version of graph data to be updated and determine the target update information set; scan the graph data and schema to be updated corresponding to the namespaces to be updated, and concurrently backfill the graph data to be updated into the target namespaces based on the target update information set to determine the target graph data and target graph schema; set the target namespaces to be active and delete the graph data and schema to be updated in the namespaces to be updated.
[0099] Optionally, identify whether there is a second updated data version in the version of graph data to be updated. If there is no second updated data version, it is determined that the update of the graph database is not a graph database reconstruction. Identify at least one first data update version and / or a third updated graph pattern version in the version of data to be updated. Based on the creation time corresponding to at least one first data update version and / or a third updated graph pattern version in the version of data to be updated, take the graph pattern version and graph data version with the latest creation time as the target update information set.
[0100] The technical solution of this invention receives and executes online data definition language (DDL) operations on a graph database, determines the version of the graph data to be updated corresponding to the DDL operation, and ensures data consistency by introducing a multi-version mode and multi-version data mechanism, while avoiding traditional locking mechanisms. It identifies the database operation type corresponding to the DDL operation, and generates a schema update task when the database operation type or version control system detects that the graph database meets preset graph database update conditions. Through delayed updates and lazy conversion mechanisms, the DDL operation does not immediately affect all data, greatly reducing the impact on normal business access and significantly reducing resource consumption. The solution updates the graph data version to be updated to the graph database according to the schema update task, mapping complex DDL operations to changes in the graph structure, and then performing more complex operations in the background, reducing the need for manual intervention, achieving data coexistence and incremental migration between old and new versions, and supporting gradual changes and canary releases of complex DDL. This solves the technical problem in existing technologies where graph databases struggle to support Online DDL. This invention significantly improves the performance of large-scale graph data processing, supports continuous business operations during schema changes, minimizes system downtime, reduces redundant storage, lowers storage costs, provides strong support for fault recovery and problem diagnosis through version control mechanisms, and supports more efficient distributed synchronization, reducing network overhead and computing resource consumption.
[0101] Figure 7 This is a flowchart illustrating an implementation method for online data definition language operations in a graph database, provided as an embodiment of the present invention. The relationship between this embodiment and the previous embodiments describes the update process of the graph database when the online data definition language operation is the second update operation. For example... Figure 7 As shown, the method includes:
[0102] S710. Receive an online data definition language operation on the graph database. If the online data definition language operation is the second update operation, execute the second update operation and determine the second update data version corresponding to the second update operation.
[0103] The second updated data version can be a graph schema version and a graph data version generated by the graph database when performing the second update operation; the second updated data version includes a second updated graph schema version and a second updated data version; the second updated graph schema version can be a graph schema version generated by the graph database when performing the second update operation; the second updated data version can be a graph data version generated by the graph database when performing the second update operation.
[0104] Optionally, the graph database performs a second update operation to generate a second updated graph pattern version and a second updated data version, and stores the second updated graph pattern version in the cache of runtime memory.
[0105] Specifically, it receives online data definition language operations on the graph database. If the online data definition language operation is a second update operation, it executes the second update operation and determines the second update data version corresponding to the second update operation.
[0106] S720. Identify the second update operation and determine that the database operation type of the second update operation is graph database reconstruction.
[0107] Specifically, the second update operation is identified, and the database operation type of the second update operation is determined to be graph database reconstruction.
[0108] S730. If the database operation type is graph database reconstruction, then the database operation type is considered to meet the preset graph database update conditions.
[0109] Optionally, "graph database reconstruction" is used to indicate that the online data definition language operation performs schema and data reconstruction operations on the graph database. When the online data definition language operation performs graph database reconstruction, the graph database needs to be updated immediately, and it is then assumed that the database operation type of the online data definition language operation meets the preset graph database update conditions.
[0110] S740, Generate a mode update task based on the second update operation.
[0111] Optionally, if the database operation type of the online data definition language operation is graph database reconstruction, the online data definition language operation is executed immediately to determine the second updated graph schema version and the second updated data version. The second updated graph schema version is stored in the cache of the running memory, and the schema update task is established by the second update operation.
[0112] S750: Update the graph data version to be updated to the graph database according to the pattern update task.
[0113] Optionally, identify the active namespaces in the graph database that need updating; determine the target namespace and at least one version of graph data to be updated based on the schema update task; identify each version of graph data to be updated and determine the target update information set; scan the graph data and schema to be updated corresponding to the namespaces to be updated, and concurrently backfill the graph data to be updated into the target namespaces based on the target update information set to determine the target graph data and target graph schema; set the target namespaces to be active and delete the graph data and schema to be updated in the namespaces to be updated.
[0114] Optionally, it can be determined whether there is a second updated data version for the graph data version to be updated. If there is a second updated data version, it is determined that the update of the graph database is a graph database reconstruction. Then, the second updated graph pattern version and the second updated data version corresponding to the second updated data version are directly used as the target update information set.
[0115] The technical solution of this invention receives and executes online data definition language (DDL) operations on a graph database, determines the version of the graph data to be updated corresponding to the DDL operation, and ensures data consistency by introducing a multi-version mode and multi-version data mechanism, while avoiding traditional locking mechanisms. It identifies the database operation type corresponding to the DDL operation, and generates a schema update task when the database operation type or version control system detects that the graph database meets preset graph database update conditions. Through delayed updates and lazy conversion mechanisms, the DDL operation does not immediately affect all data, greatly reducing the impact on normal business access and significantly reducing resource consumption. The solution updates the graph data version to be updated to the graph database according to the schema update task, mapping complex DDL operations to changes in the graph structure, and then performing more complex operations in the background, reducing the need for manual intervention, achieving data coexistence and incremental migration between old and new versions, and supporting gradual changes and canary releases of complex DDL. This solves the technical problem in existing technologies where graph databases struggle to support Online DDL. This invention significantly improves the performance of large-scale graph data processing, supports continuous business operations during schema changes, minimizes system downtime, reduces redundant storage, lowers storage costs, provides strong support for fault recovery and problem diagnosis through version control mechanisms, and supports more efficient distributed synchronization, reducing network overhead and computing resource consumption.
[0116] Figure 8 This is a schematic diagram of the structure of an implementation device for online data definition language operations in a graph database, provided as an embodiment of the present invention. Figure 8 As shown, the device includes: an online graph database modification module 810, a graph schema update module 820, and a namespace update module 830; wherein,
[0117] The graph database online modification module 810 is used to receive online data definition language operations on the graph database, execute the online data definition language operations, and determine the version of the graph data to be updated corresponding to the online data definition language operations.
[0118] The graph pattern update module 820 is used to identify the database operation type corresponding to the online data definition language operation. When the database operation type or the version control system detects that the graph database meets the preset graph database update conditions, a pattern update task is generated.
[0119] The namespace update module 830 is used to update the version of the graph data to be updated to the graph database according to the pattern update task.
[0120] The technical solution of this invention receives and executes online data definition language (DDL) operations on a graph database, determines the version of the graph data to be updated corresponding to the DDL operation, and ensures data consistency by introducing a multi-version mode and multi-version data mechanism, while avoiding traditional locking mechanisms. It identifies the database operation type corresponding to the DDL operation, and generates a schema update task when the database operation type or version control system detects that the graph database meets preset graph database update conditions. Through delayed updates and lazy conversion mechanisms, the DDL operation does not immediately affect all data, greatly reducing the impact on normal business access and significantly reducing resource consumption. The solution updates the graph data version to be updated to the graph database according to the schema update task, mapping complex DDL operations to changes in the graph structure, and then performing more complex operations in the background, reducing the need for manual intervention, achieving data coexistence and incremental migration between old and new versions, and supporting gradual changes and canary releases of complex DDL. This solves the technical problem in existing technologies where graph databases struggle to support Online DDL. This invention significantly improves the performance of large-scale graph data processing, supports continuous business operations during schema changes, minimizes system downtime, reduces redundant storage, lowers storage costs, provides strong support for fault recovery and problem diagnosis through version control mechanisms, and supports more efficient distributed synchronization, reducing network overhead and computing resource consumption.
[0121] Optionally, the graph database online modification module 810 is specifically used for:
[0122] The online data definition language operations include a first update operation, a second update operation, and a third update operation; the graph data version to be updated includes a first data update version, a second data update version, and a third data update version;
[0123] Optionally, the graph database online modification module 810 is also specifically used for:
[0124] When the online data definition language operation is the first update operation, the first update operation is executed, and the first data update version corresponding to the first update operation is determined; the first data update version includes a first update graph mode version and a first update data version.
[0125] When the online data definition language operation is the second update operation, the second update operation is executed, and the second update data version corresponding to the second update operation is determined; the second update data version includes the second update graph pattern version and the second update data version.
[0126] When the online data definition language operation is the third update operation, the third update operation is executed, and the third update graph mode version corresponding to the third update operation is determined.
[0127] Optionally, the graph pattern update module 820 is specifically used for:
[0128] The database operation types include graph schema version change, graph database version change, and graph database reconstruction;
[0129] Identify the database operation type of the first update operation or the third update operation, and determine that the database operation type of the first update operation is the graph database version change and the database operation type of the third update operation is the graph pattern version change.
[0130] If the version control system detects that the number of graph pattern versions in the graph database is greater than the graph pattern threshold, then the version control system is considered to meet the preset graph database update conditions.
[0131] The mode update task is generated through the version control system.
[0132] Optionally, the graph pattern update module 820 is also specifically used for:
[0133] Identify the second update operation and determine that the database operation type of the second update operation is graph database reconstruction;
[0134] If the database operation type is graph database reconstruction, then the database operation type is considered to meet the preset graph database update conditions.
[0135] The pattern update task is generated according to the second update operation.
[0136] Optionally, the namespace update module 830 is specifically used for:
[0137] Identify the namespaces in the graph database that are active and awaiting updates;
[0138] Based on the pattern update task, determine the target namespace and at least one version of graph data to be updated;
[0139] Identify each version of the graph data to be updated and determine the target update information set;
[0140] Scan the graph data and graph patterns to be updated corresponding to the namespace to be updated.
[0141] Based on the target update information set, the graph data to be updated is concurrently backfilled into the target namespace to determine the target graph data and the target graph mode;
[0142] Set the target namespace to active state, and delete the graph data and graph patterns to be updated in the namespace to be updated.
[0143] Optionally, the namespace update module 830 is also specifically used for:
[0144] If the second updated data version does not exist in the graph data version to be updated, the target update information set is determined in at least one of the first data update versions and / or the third updated graph pattern version;
[0145] If the second updated data version exists in the version of graph data to be updated, then the second updated data version is determined as the target updated information set.
[0146] The implementation device for online data definition language operations of graph databases provided in the embodiments of the present invention can execute the implementation method for online data definition language operations of graph databases provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0147] Figure 9 A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their patterns are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0148] like Figure 9As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0149] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of monitors, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer grids such as the Internet and / or various telecommunications grids.
[0150] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the implementation of online data definition language operations for graph databases.
[0151] In some embodiments, the implementation method of online data definition language operations for a graph database can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the implementation method of online data definition language operations for a graph database described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to execute the implementation method of online data definition language operations for a graph database by any other suitable means (e.g., by means of firmware).
[0152] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0153] Computer programs used to implement the methods of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the patterns / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs can be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0154] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0155] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0156] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or grid browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication grid). Examples of communication grids include local area networks (LANs), wide area networks (WANs), blockchain grids, and the Internet.
[0157] A computing system can include clients and servers. Clients and servers are generally geographically separated and typically interact through a communication mesh. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0158] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0159] This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of an online data definition language operation method for graph databases as provided in any embodiment of the present invention. The method includes:
[0160] Receive online data definition language operations on the graph database, execute the online data definition language operations, and determine the version of the graph data to be updated corresponding to the online data definition language operations;
[0161] Identify the database operation type corresponding to the online data definition language operation, and generate a schema update task when the database operation type or version control system detects that the graph database meets the preset graph database update conditions.
[0162] The update task updates the graph data version to be updated to the graph database according to the pattern update.
[0163] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0164] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0165] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0166] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of mesh, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0167] Those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a grid of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computing device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0168] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0169] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for implementing online data definition language operations in a graph database, characterized in that, include: Receive online data definition language operations on the graph database, execute the online data definition language operations, and determine the version of the graph data to be updated corresponding to the online data definition language operations; Identify the database operation type corresponding to the online data definition language operation, and generate a schema update task when the database operation type or version control system detects that the graph database meets the preset graph database update conditions. The graph data version to be updated is updated to the graph database according to the pattern update task; the online data definition language operation includes a first update operation, a second update operation, and a third update operation; the graph data version to be updated includes a first data update version, a second data update version, and a third data update version; The step of executing the online data definition language operation and determining the version of the graph data to be updated corresponding to the online data definition language operation includes: When the online data definition language operation is the first update operation, the first update operation is executed, and the first data update version corresponding to the first update operation is determined; the first data update version includes a first update graph mode version and a first update data version. When the online data definition language operation is the second update operation, the second update operation is executed, and the second update data version corresponding to the second update operation is determined; When the online data definition language operation is the third update operation, the third update operation is executed, and the third update graph mode version corresponding to the third update operation is determined; The database operation types include graph schema version change, graph database version change, and graph database reconstruction; The process of identifying the database operation type corresponding to the online data definition language operation, and generating a schema update task when the database operation type or version control system detects that the graph database meets the preset graph database update conditions, includes: Identify the database operation type of the first update operation or the third update operation, and determine that the database operation type of the first update operation is the graph database version change and the database operation type of the third update operation is the graph pattern version change. If the version control system detects that the number of graph pattern versions in the graph database is greater than the graph pattern threshold, then the version control system is considered to meet the preset graph database update conditions. The mode update task is generated through the version control system.
2. The method according to claim 1, characterized in that, The process of identifying the database operation type corresponding to the online data definition language operation, and generating a schema update task when the database operation type or version control system detects that the graph database meets the preset graph database update conditions, includes: Identify the second update operation and determine that the database operation type of the second update operation is graph database reconstruction; If the database operation type is graph database reconstruction, then the database operation type is considered to meet the preset graph database update conditions. The pattern update task is generated according to the second update operation.
3. The method according to claim 1, characterized in that, The step of updating the graph data version to be updated to the graph database according to the pattern update task includes: Identify the namespaces in the graph database that are active and awaiting updates; Based on the pattern update task, determine the target namespace and at least one version of graph data to be updated; Identify each version of the graph data to be updated and determine the target update information set; Scan the graph data and graph patterns to be updated corresponding to the namespace to be updated. Based on the target update information set, the graph data to be updated is concurrently backfilled into the target namespace to determine the target graph data and the target graph mode; Set the target namespace to active state, and delete the graph data and graph patterns to be updated in the namespace to be updated.
4. The method according to claim 3, characterized in that, The step of identifying each version of the graph data to be updated and determining the target update information set includes: If the second updated data version does not exist in the graph data version to be updated, the target update information set is determined in at least one of the first data update versions and / or the third updated graph pattern version; If the second updated data version exists in the version of graph data to be updated, then the second updated data version is determined as the target updated information set.
5. An apparatus for implementing online data definition language operations in a graph database, characterized in that, include: The graph database online modification module is used to receive online data definition language operations on the graph database, execute the online data definition language operations, and determine the graph data version to be updated corresponding to the online data definition language operations; wherein, the graph data version to be updated is the graph database version after the graph database executes the online data definition language operations, and the graph data version to be updated includes a graph pattern version and a graph data version; The graph pattern update module is used to identify the database operation type corresponding to the online data definition language operation. When the database operation type or the version control system detects that the graph database meets the preset graph database update conditions, a pattern update task is generated. The namespace update module is used to update the version of the graph data to be updated to the graph database according to the pattern update task. The online modification module for the graph database is specifically used for: The online data definition language operations include a first update operation, a second update operation, and a third update operation; the graph data version to be updated includes a first data update version, a second data update version, and a third data update version; The online modification module for the graph database is also specifically used for: When the online data definition language operation is the first update operation, the first update operation is executed, and the first data update version corresponding to the first update operation is determined; the first data update version includes a first update graph mode version and a first update data version. When the online data definition language operation is the second update operation, the second update operation is executed, and the second update data version corresponding to the second update operation is determined; the second update data version includes the second update graph pattern version and the second update data version. When the online data definition language operation is the third update operation, the third update operation is executed, and the third update graph mode version corresponding to the third update operation is determined; The graph pattern update module is specifically used for: The database operation types include graph schema version change, graph database version change, and graph database reconstruction; Identify the database operation type of the first update operation or the third update operation, and determine that the database operation type of the first update operation is the graph database version change and the database operation type of the third update operation is the graph pattern version change. If the version control system detects that the number of graph pattern versions in the graph database is greater than the graph pattern threshold, then the version control system is considered to meet the preset graph database update conditions. The mode update task is generated through the version control system.
6. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the implementation method of the online data definition language operation of the graph database according to any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the method for operating the online data definition language of the graph database as described in any one of claims 1-4.
Citation Information
Patent Citations
Transaction execution method and device, computing equipment and storage medium
CN115113989A