A node routing method, system, device, medium and program product
Patent Information
- Application Number
- CN202511570052.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-30
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2045-10-30
AI Technical Summary
在传统全局唯一标识生成机制下,其值与数据的物理分布无关,导致系统在定位数据时严重依赖外部元数据服务或全局路由表
[0034]本申请通过在全局唯一标识内部嵌入数据所属逻辑数据段的哈希码信息,并通过预定义的哈希环或一致性哈希算法,直接基于哈希码计算出数据应归属的存储节点。由于全局唯一标识生成时即绑定段级分布特征,因此在数据段发生迁移、合并或拆分时,原有全局唯一标识无需修改即可继续使用,系统仅需更新段级路由映射,大幅降低元数据同步开销和全局唯一标识重新生成的资源损耗。更重要的是,在查询处理阶段,系统可直接从全局唯一标识中提取哈希码并快速定位目标节点,实现无依赖、低延迟的数据路由;在执行邻接查询或子图遍历时,可通过邻接边的全局唯一标识上的逻辑数据段的哈希码信息判断是否位于同一节点或邻近区域,从而优化查询,减少跨节点通信。另外不同数据源生成异构数据的全局唯一标识在统一结构下仍可实现一致的路由与管理,提升了系统的兼容性与可扩展性,显著提升了分布式图数据库在动态环境下的自适应能力、查询效率与运维便捷性。
Smart Images

Figure CN121326909B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer networks, and in particular to a node routing method, system, device, medium, and program product. Background Technology
[0002] In distributed graph database systems, data is typically stored in shards based on the logical units to which nodes belong (called data segments) to achieve horizontal scaling and load balancing. As business grows, the system frequently needs to perform topology adjustments such as data segment migration, merging, or splitting. Under traditional globally unique identifier generation mechanisms, the value is independent of the physical distribution of the data, causing the system to heavily rely on external metadata services or global routing tables when locating data. When data segment migration or topology changes occur, a large amount of mapping information must be updated synchronously; otherwise, routing will fail, severely impacting system availability and query performance. Especially in segment merging or splitting scenarios, the lack of a unified identifier management mechanism can also lead to ID conflicts or relationship breaks, increasing the cost of maintaining data consistency. Summary of the Invention
[0003] The purpose of this application is to provide a node routing method, system, computer-readable storage medium, electronic device, and computer program product that achieves dependency-free, low-latency data routing by generating globally unique identifiers.
[0004] To address the aforementioned technical problems, this application provides a node routing method, the specific technical solution of which is as follows:
[0005] Obtain the routing request and determine the starting node of the routing request;
[0006] Read the unique key of the starting node;
[0007] A primary key index lookup is performed based on the unique key to determine the globally unique identifier of the starting node;
[0008] The logical data segment to which the next-hop node belongs is determined based on the hash code of the logical data segment contained in the globally unique identifier;
[0009] The logical data segment and the consistent hash mapping table are used to route to the storage node corresponding to the routing request.
[0010] Optional, also includes:
[0011] Generate a globally unique identifier for each node based on the array ID, table ID, and hash code.
[0012] Optionally, after performing a primary key index lookup based on the unique key to determine the globally unique identifier of the starting node, the method further includes:
[0013] Read the table ID, verify the validity of the node type of the starting node based on the table ID, and locate the data table structure of the starting node;
[0014] Parse the array ID and access the adjacent array storage unit corresponding to the starting node based on the array ID.
[0015] Optionally, generating a globally unique identifier for each node based on the array ID, table ID, and hash code includes:
[0016] When creating a new node, calculate the logical data segment hash code based on the unique key of the new node;
[0017] According to the preset hash mapping strategy, the hash code of the logical data segment is mapped to the corresponding logical data segment, and the node is sent to the service node where the logical data segment is located;
[0018] On the service node, an array ID and a table ID are assigned to the newly added node according to the identifier allocator; each array belongs to a corresponding logical data segment;
[0019] The globally unique identifier is obtained by concatenating the hash code of the logical data segment, the array ID, and the table ID.
[0020] Optionally, when the logical data segment corresponding to the node is migrated, the method further includes:
[0021] Keeping the hash code of the logical data segment unchanged, update the routing mapping table from the logical data segment to the physical node.
[0022] Optionally, when creating nodes in batches, the following may also be included:
[0023] Obtain several globally unique identifiers, map and group nodes according to the hash code and logical data segment corresponding to each globally unique identifier, and assign the corresponding globally unique identifier.
[0024] This application also provides a node routing system, including:
[0025] The request acquisition module is used to acquire routing requests and determine the starting node of the routing requests;
[0026] The node information reading module is used to read the unique key of the starting node;
[0027] The globally unique identifier lookup module is used to perform a primary key index lookup based on the unique key to determine the globally unique identifier of the starting node;
[0028] The logical data segment determination module is used to determine the logical data segment to which the next-hop node belongs based on the logical data segment hash code contained in the globally unique identifier;
[0029] The node routing module is used to route to the storage node corresponding to the routing request based on the logical data segment and the consistent hash mapping table.
[0030] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the node routing method described above.
[0031] This application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor, when calling the computer program in the memory, implements the steps of the node routing method described above.
[0032] This application also provides a computer program product, including a computer program that, when executed, implements the steps of the node routing method described above.
[0033] This application provides a node routing method, comprising: obtaining a routing request and determining the starting node of the routing request; reading the unique key of the starting node; performing a primary key index lookup based on the unique key to determine the globally unique identifier of the starting node; determining the logical data segment to which the next-hop node belongs based on the logical data segment hash code contained in the globally unique identifier; and routing to the storage node corresponding to the routing request based on the logical data segment and a consistent hash mapping table.
[0034] This application embeds the hash code information of the logical data segment to which the data belongs within a globally unique identifier, and directly calculates the storage node to which the data should belong based on the hash code using a predefined hash ring or consistent hashing algorithm. Since the globally unique identifier is bound to segment-level distribution characteristics during generation, the original globally unique identifier can continue to be used without modification when data segments are migrated, merged, or split. The system only needs to update the segment-level routing mapping, significantly reducing metadata synchronization overhead and the resource consumption of regenerating the globally unique identifier. More importantly, during the query processing phase, the system can directly extract the hash code from the globally unique identifier and quickly locate the target node, achieving dependency-free and low-latency data routing. When performing adjacency queries or subgraph traversal, the hash code information of the logical data segment on the globally unique identifier of the adjacent edge can be used to determine whether they are located on the same node or in a nearby region, thereby optimizing the query and reducing cross-node communication. Furthermore, globally unique identifiers generated by different data sources for heterogeneous data can still achieve consistent routing and management under a unified structure, improving the system's compatibility and scalability, and significantly enhancing the distributed graph database's adaptability, query efficiency, and ease of operation and maintenance in dynamic environments.
[0035] This application also provides a node routing system, a computer-readable storage medium, an electronic device, and a computer program product, which have the above-mentioned beneficial effects, and will not be elaborated here. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0037] Figure 1 A flowchart illustrating a node routing method provided in an embodiment of this application;
[0038] Figure 2 This is a schematic diagram of the structure of a globally unique node provided in an embodiment of this application;
[0039] Figure 3 This is a distributed image library deployment cluster diagram provided in an embodiment of this application;
[0040] Figure 4 This is a schematic diagram of the logical data segment distribution provided in the embodiments of this application;
[0041] Figure 5 This is a schematic diagram of data distribution provided in the embodiments of this application;
[0042] Figure 6 This is an example diagram of the logical data segment before it is split, provided in an embodiment of this application.
[0043] Figure 7 This is an example diagram showing the logical data segment after being split according to an embodiment of this application;
[0044] Figure 8 This is an example diagram of the migrated logical data segment provided in the embodiments of this application;
[0045] Figure 9 This is a schematic diagram of a node routing system structure provided in an embodiment of this application;
[0046] Figure 10 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, 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. 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.
[0048] The core of this application lies in enabling the globally unique identifier (GUI) to possess a resolvable logical structure and spatial positioning capability by incorporating semantic information such as structured array IDs, table IDs, and logical partition hash values within the GUI. This mechanism ensures that the generated GUI does not need to be regenerated or modified during or after system expansion, scaling down, or data migration. The original GUI can still accurately point to its respective shard or storage node, achieving the characteristics of "generated immediately, usable immediately, and valid for life." The system can directly complete routing and query optimization based on the GUI structure, avoiding the metadata synchronization overhead and data rebalancing costs caused by topology changes. Furthermore, this GUI mechanism has good forward compatibility and scalability, supports unified identifier management for heterogeneous graph data, significantly improves the elastic scaling capability, data consistency guarantee level, and operational convenience of distributed graph databases in dynamic environments, and provides solid support for the stable operation of large-scale graph data systems.
[0049] See Figure 1 , Figure 1 A flowchart of a node routing method provided in an embodiment of this application is shown. The method includes:
[0050] S101: Obtain the routing request and determine the starting node of the routing request;
[0051] S102: Read the unique key of the starting node;
[0052] S103: Perform a primary key index lookup based on the unique key to determine the globally unique identifier of the starting node;
[0053] S104: Determine the logical data segment to which the next-hop node belongs based on the hash code of the logical data segment contained in the globally unique identifier;
[0054] S105: Routing to the storage node corresponding to the routing request based on the logical data segment and the consistent hash mapping table.
[0055] To better illustrate the above process, the following section will further explain the globally unique identifier and its generation process:
[0056] When creating a node, a globally unique identifier for each node can be generated based on the array ID, table ID, and hash code. Specifically, this can include the following steps:
[0057] The first step is to calculate the logical data segment hash code based on the unique key of the new node when creating a new node.
[0058] The second step is to map the hash code of the logical data segment to the corresponding logical data segment according to the preset hash mapping strategy, and send the node to the service node where the logical data segment is located.
[0059] Third step: On the service node, allocate array ID and table ID to the newly added node according to the identifier allocator; each array belongs to the corresponding logical data segment;
[0060] Fourth step: Concatenate the hash code of the logical data segment, the array ID and the table ID to obtain the globally unique identifier.
[0061] The globally unique identifier in this application consists of a table ID, an array ID, and a hash code for the logical data segment. After locating the logical data segment, it enables efficient routing queries. These efficient queries include quickly locating the logical data segment containing adjacent points, quickly locating the table to which the data belongs, and determining the position of adjacent data. This allows for querying the original data and quickly locating the position of its adjacent array. Querying by passing the globally unique identifier is more efficient than traditional key-value or primary key queries. By encoding the hash code of the logical data segment into the globally unique identifier, it gains "self-location" capability. After topology changes such as data migration, merging, and splitting in the cluster, the globally unique identifier can adapt to the current data topology without change, greatly improving the stability and routing adaptability of the cluster.
[0062] There is no limit to the length of the globally unique identifier. In one feasible implementation, a fixed-length 64-bit (8-byte) structure can be used, consisting of three fields concatenated together: Array ID, Table ID, and logical data segment hash code.
[0063] like Figure 2 As shown, Figure 2 This is a schematic diagram of the structure of a globally unique node provided in an embodiment of this application. The globally unique node organically integrates the physical distribution of data, adjacency storage, and semantic classification to achieve efficient routing and fast access.
[0064] The array ID, occupying 36 bits, identifies an array index within a specific data segment (logical data segment). This array employs a contiguous, index-free storage structure, centrally storing all vertex-edge adjacency data within the logical data segment, supporting high-throughput adjacency traversal operations. The 36-bit design of the array ID can support up to approximately 68.7 billion vertex edges within each logical data segment, meeting the dynamic organization requirements of ultra-large-scale graph data. The table ID, occupying 16 bits, identifies the logical type of a node (e.g., "user," "device," "order," etc.), forming a unified classification system across the entire graph, supporting up to 65,535 node types, and enabling unified management of multimodal data. The hash code occupies 12 bits and is generated by a custom hash algorithm. In a consistent hash sharding, it can support a graph consisting of up to 4096 segments, generating a 12-bit hash code for locating the consistent hash ring. The logical data segment has min_hash and max_hash representations, and the hash value in its globally unique identifier ranges from 0 to 4096. Combined with the segment table in the metadata, the corresponding segment is found, which is used to route data to the corresponding logical data segment.
[0065] Furthermore, in the globally unique identifier, the storage of adjacency relationships is decoupled from node type: the adjacency information of all edges is uniformly located by array ID, maximizing storage locality and traversal efficiency; the table ID is only used for semantic classification and attribute management. As the data scales, horizontal scaling can be achieved by increasing the number of logical data segments. This globally unique identifier structure achieves a good balance between compactness, scalability, and query performance, making it particularly suitable for efficient graph traversal and dynamic expansion scenarios in large-scale distributed graph databases. For example, after splitting a logical data segment into two, each part of the data is divided into two batches, but the globally unique identifier of all data does not need to be modified. The hash code in the globally unique identifier combined with the dynamic metadata of the logical data segment can determine which logical data segment the edge of a given point is located on. Moreover, the globally unique identifier can be extended, for example, to 128 bits, to accommodate future data growth.
[0066] During node routing, the routing request is first obtained, and the starting node of the routing request is determined. After obtaining the starting node, its stored extended edge information (such as an adjacent edge list) is read. Each edge record contains a globally unique identifier for the source or target node. By parsing the hash code of the lower 12 bits of the logical data segment of this globally unique identifier, the system can directly determine the logical data segment to which the next-hop node belongs, and quickly route to its physical storage node using a consistent hash mapping table. If the target node is located locally, memory or disk access is performed directly; if it is across nodes, the request is forwarded to the corresponding node through a lightweight communication protocol to achieve low-latency hopping.
[0067] Using the unique key of the starting node as input, the system first locates the data node containing that node using the primary key index and obtains its complete globally unique identifier. Subsequent traversal operations are all performed based on this globally unique identifier, eliminating the need to rely on external metadata services and significantly improving query efficiency.
[0068] This application embeds the hash code information of the logical data segment to which the data belongs within a globally unique identifier, and directly calculates the storage node to which the data should belong based on the hash code using a predefined hash ring or consistent hashing algorithm. Since the globally unique identifier is bound to segment-level distribution characteristics during generation, the original globally unique identifier can continue to be used without modification when data segments are migrated, merged, or split. The system only needs to update the segment-level routing mapping, significantly reducing metadata synchronization overhead and the resource consumption of regenerating the globally unique identifier. More importantly, during the query processing phase, the system can directly extract the hash code from the globally unique identifier and quickly locate the target node, achieving dependency-free and low-latency data routing. When performing adjacency queries or subgraph traversal, the hash code information of the logical data segment on the globally unique identifier of the adjacent edge can be used to determine whether they are located on the same node or in a nearby region, thereby optimizing the query and reducing cross-node communication. Furthermore, globally unique identifiers generated by different data sources for heterogeneous data can still achieve consistent routing and management under a unified structure, improving the system's compatibility and scalability, and significantly enhancing the distributed graph database's adaptability, query efficiency, and ease of operation and maintenance in dynamic environments.
[0069] In one feasible implementation, after performing a primary key index lookup based on the unique key to determine the globally unique identifier of the starting node, the table ID can also be read. The validity of the node type of the starting node can be verified based on the table ID, and the data table structure of the starting node can be located. Alternatively, the array ID can be parsed, and the adjacent array storage unit corresponding to the starting node can be accessed based on the array ID.
[0070] Within the target node, the 16-bit table ID in the globally unique identifier can be further parsed to verify the node type's validity and locate its corresponding data table structure; simultaneously, the 36-bit array ID is parsed to access the adjacent array storage unit corresponding to the node. Since the adjacent array uses an index-free contiguous storage structure, the system can directly locate the starting position of the physical storage block through the array ID, without the need for additional index lookups, greatly improving the efficiency of reading adjacent edges. The entire path expansion process forms a closed-loop flow of "globally unique identifier → hash code → logical data segment → node location → table ID projection (on demand) → array ID to locate adjacent data → globally unique identifier of adjacent points," achieving efficient mapping from identifier to data.
[0071] This mechanism fully utilizes the distribution and structural information embedded in the globally unique identifier, enabling path queries to have the characteristics of self-location, low dependency, and high concurrency. It significantly reduces the overhead of cross-node communication and metadata query, and is particularly suitable for deep traversal and real-time path analysis scenarios of large-scale graph data.
[0072] Based on the globally unique identifier of this application, further query optimization can be performed under path lookup, such as predicate pushdown, projection query to avoid read amplification, distributed path pushdown, etc.
[0073] Based on the above embodiments, when a data topology change occurs, the hash code of the logical data segment can be kept unchanged, and the routing mapping table from the logical data segment to the physical node can be updated.
[0074] When a logical data segment is migrated, its 12-bit hash code remains unchanged, and the globally unique identifier does not need to be modified. The system only needs to update the routing mapping table from the logical data segment to the physical node to achieve seamless data location and access.
[0075] In the splitting scenario, the globally unique identifier of the original data remains unchanged; some data is divided into new logical data segments, and the new logical data segments inherit part of the hash sharding range of the original logical data segments. After the splitting is completed, the routing table is updated synchronously, and the query system can access both the original logical data segments and the new logical data segments simultaneously, achieving smooth expansion.
[0076] In scaling-down scenarios, this mechanism also applies when migrating all data from a server: the system only needs to focus on the data migration process itself, without dealing with data compatibility issues caused by changes in the globally unique identifier after migration. Thanks to the hash code embedded in the globally unique identifier and the locally valid identifier design, data relationships remain consistent regardless of migration, splitting, or merging, significantly reducing system operation and maintenance complexity and improving the elasticity and reliability of the distributed graph database.
[0077] The following description further illustrates the above embodiments using the specific application process of this application. In the following text and the corresponding figures, segment is a logical data segment, and RowID is a globally unique identifier.
[0078] Distributed graph database clusters such as Figure 3 As shown, Figure 3The distributed graph deployment cluster diagram provided in this embodiment of the application is deployed in the form of 1 GCM + 3 gstore + 1 cypher server. GCM is the control node or management node; gstore is the data node or storage node, which joins the cluster through GCM; and cypher server is the computing service node. The cluster contains a graph named "sample graph," which consists of three segments: segment1, segment2, and segment3, located on GSTORE1, GSTORE2, and GSTORE3 respectively. Figure 4 As shown, Figure 4 This is a schematic diagram of the logical data segment distribution provided in an embodiment of this application. The diagram contains a point label Person and a relation Knows.
[0079] Step 1: The user initiates a data insertion statement:
[0080] create (n:Person{_PRIMARY_KEY:
[0081] 'Marko'}-[:Knows{date:{'1998'}}]->(n:Person{_PRIMARY_KEY:'Josh'));
[0082] This statement means to insert two points PK, namely Marko and Josh, and insert an edge from Marko to Josh, with a date attribute of "1998".
[0083] Step 2: The CYPHER SERVER calculates the hash value of the key using the same 12-bit hash algorithm, which is 2623. It then searches the memory table to find that the key is within the hash range of segment2.
[0084] Step 3: The CYPHER SERVER sends the data to the node where segment1 is located, along with the identifier segment id = 1.
[0085] Step 4: When GSTORE1 receives this syntax, it first verifies its hash value and performs a correctness check against the existing hash range of segment1.
[0086] Step 5: After the check is passed, apply for the RowID of the node, obtain the index of the next free slot based on the remaining slots in the Person array, lock the slot, and obtain the ID of the node Table of the data; generate a RowID by shifting and assembling these three values.
[0087] Step 6: Assemble the generated RowID with the existing data to generate a tuple, along with adjacency information and index information.
[0088] Step 7: Put the Tuple, adjacency information, and index information into the node Table, node Array, and PKIndex, respectively.
[0089] Step 8: Following the same process as steps 2-7, insert the Josh node. Josh's hashcode is 3594, and it is located on segment3.
[0090] Step 9: When inserting edges, insert the edges into the segments corresponding to the start and end vertices respectively. The RowID allocation process is the same as in steps 2-7. It should be noted that when inserting edges, the industrial-grade graph library will generate two edges with different RowIDs but the same start and end vertices and data. The Remote RowIDs of these two edges are set to each other's RowId. These two edges are complementary. This is done in industry to speed up queries.
[0091] When performing a data path query, see [link / reference]. Figure 5 , Figure 5 This is a schematic diagram of data distribution provided in an embodiment of this application. Figure 5 As shown, the data distribution is as follows: segment 1 has one node: Alice; segment 2 has one node: Josh; and segment 3 has two nodes: Marko and Ann. The edge relationships in the data are: Alice->Josh->Marko->Ann, all of which are Knows. For distinction, the Knows are followed by an index, and each edge has several attributes (edge attributes omitted). This example demonstrates the advantages of ROWID using a conventional pathfinding DFS algorithm without any optimization.
[0092] Step 1: The user queries the last vertex within three hops starting from Alice, and inputs the statement MATCH(n:Person{_PRIMARY_KEY:'Alice'})-[]->()-[]->()-[]->(m) return m; After calculation by the CYPHERSERVER query engine, the final physical plan is generated internally.
[0093] Step 2: The CYPHER SERVER first generates a 12-bit hash value based on the primary key "Alice", and then queries the segment table to find that Alice is located in Segment1.
[0094] Step 3: The CYPHER SERVER sends the primary key to segment1 and retrieves all adjacent edges of point Alice. In this example, there is only one edge, Knows1 (or the endpoint RowID of Knows1 can be returned directly). At this point, the endpoint of Knows1 is retrieved, and the one-hop point RowID is obtained.
[0095] Step 4: CYPHER SERVER obtains the RowID of the endpoint Josh on Knows1, parses the corresponding Hashcode, and determines Josh's Segment.
[0096] Step 5: After determining Josh's segment, query Josh's next adjacent edge through the adjacency interface, and determine the segment to which Marko, the endpoint of Josh's adjacent edge Knows2, belongs, as in Step 4. At this point, the vertex data RowID of the second hop is obtained.
[0097] Step 6: Then, as in step 5, query the adjacent edges of Marko and obtain Knows3, and get the endpoint of Knows. At this point, the RowID of the third hop vertex Ann has been obtained.
[0098] Step 7: Parse the corresponding Segment of vertex Ann using RowID and initiate an attribute query. GSTORE returns all attributes of Ann, and the query ends here.
[0099] The following section provides further explanation of data splitting; see [link to relevant documentation]. Figure 6 , Figure 6 This is an example diagram showing the logical data segment before it is split, as provided in an embodiment of this application. Figure 6 The segments of the sample graph shown are distributed on a single GSTORE1, where the same segment in-memory table exists on GCM and CYPHER SERVER. In this example, segment1 is split into segment1 and segment2, and then segment2 is migrated to GSTORE2. The RowID in the split data does not need to be changed.
[0100] Step 1: The user sends a data splitting command to GCM via CYPHER SERVER. After GCM performs a correctness check, it sends a data splitting command to segment1 on GSTORE1.
[0101] Step 2: After GSTORE1 passes the validity check, a new segment2 is generated locally with a hash range of [2048, 4095].
[0102] Step 3: GSTORE1 performs data splitting, migrating all data in segment1 with hash values in the range of [2048, 4095] to segment2.
[0103] Step 4: After the migration is complete, notify GCM that the migration is complete. At this time, GCM locks the global table and generates the metadata of segment2.
[0104] Step 5: When the Cypher Server initiates a data query command, if the version number does not match the system version number, it will fetch the latest metadata from GCM (lazy loading). It will then update the local segment table. The final segment metadata and distribution are as follows: Figure 7 As shown, Figure 7 This is an example diagram showing the logical data segmentation provided in an embodiment of this application. Correct data routing can then be performed based on the segment table. Inserting data follows the same principle.
[0105] Step 6: Segment2 migration operation, adding the new GSTORE2 to the cluster.
[0106] Step 7: The user initiates a migration command for segment 2 to GCM via CYPHER SERVER, migrating from GSTORE1 to GSTORE2.
[0107] Step 8: After the Segment2 migration is complete, it will notify GCM that the migration is complete. At this time, GCM will lock the global table and update the metadata of segment2.
[0108] Step 9: When the Cypher Server initiates a data query command, if the version number does not match the system version number, it will fetch the latest metadata from GCM (lazy loading). It will then update the local segment table. The final segment metadata and distribution are as follows: Figure 8 As shown, Figure 8 This is an example diagram showing the logical data segment after migration, provided in an embodiment of this application. Correct data routing can then be performed based on the segment table. Inserting data follows the same principle.
[0109] This application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method described in the above method embodiments.
[0110] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they 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 executes all or part of the steps of the methods described in the 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.
[0111] See Figure 9 , Figure 9 This is a schematic diagram of a node routing system structure provided in an embodiment of this application. The system includes:
[0112] The request acquisition module is used to acquire routing requests and determine the starting node of the routing requests;
[0113] The node information reading module is used to read the unique key of the starting node;
[0114] The globally unique identifier lookup module is used to perform a primary key index lookup based on the unique key to determine the globally unique identifier of the starting node;
[0115] The logical data segment determination module is used to determine the logical data segment to which the next-hop node belongs based on the logical data segment hash code contained in the globally unique identifier;
[0116] The node routing module is used to route to the storage node corresponding to the routing request based on the logical data segment and the consistent hash mapping table.
[0117] Based on the above embodiments, as a preferred embodiment, it further includes:
[0118] The identifier generation module is used to generate a globally unique identifier for each node based on the array ID, table ID, and hash code.
[0119] Based on the above embodiments, as a preferred embodiment, it further includes:
[0120] The starting node verification module is used to read the table ID, verify the validity of the node type of the starting node based on the table ID, and locate the data table structure of the starting node.
[0121] The array ID parsing module is used to parse the array ID and access the adjacent array storage unit corresponding to the starting node based on the array ID.
[0122] Based on the above embodiments, as a preferred embodiment, the identifier generation module is a module for performing the following steps:
[0123] When creating a new node, calculate the logical data segment hash code based on the unique key of the new node;
[0124] According to the preset hash mapping strategy, the hash code of the logical data segment is mapped to the corresponding logical data segment, and the node is sent to the service node where the logical data segment is located;
[0125] On the service node, an array ID and a table ID are assigned to the newly added node according to the identifier allocator; each array belongs to a corresponding logical data segment;
[0126] The globally unique identifier is obtained by concatenating the hash code of the logical data segment, the array ID, and the table ID.
[0127] Based on the above embodiments, as a preferred embodiment, it further includes:
[0128] The logical data segment migration module is used to maintain the hash code of the logical data segment unchanged and update the routing mapping table from the logical data segment to the physical node when the logical data segment corresponding to the node is migrated.
[0129] Based on the above embodiments, as a preferred embodiment, it further includes:
[0130] The node batch creation module is used to obtain several globally unique identifiers when creating nodes in batches, map and group the nodes according to the hash code and logical data segment corresponding to each globally unique identifier, and assign the corresponding globally unique identifier.
[0131] The computer-readable storage medium provided in this embodiment includes the node routing method mentioned above, and has the same effect.
[0132] The computer program product provided in this embodiment includes the node routing method mentioned above, and has the same effect.
[0133] This application also provides an electronic device, see [link to document]. Figure 10 The present application provides a structural diagram of an electronic device, such as... Figure 10 As shown, it may include a processor 1410 and a memory 1420.
[0134] The processor 1410 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 1410 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1410 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 1410 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 1410 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0135] The memory 1420 may include one or more computer-readable storage media, which may be non-transitory. The memory 1420 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 1420 is used to store at least the following computer program 1421, which, after being loaded and executed by the processor 1410, is capable of implementing the relevant steps in the methods executed by the electronic device side as disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 1420 may also include an operating system 1422 and data 1423, etc., and the storage method may be temporary storage or permanent storage. The operating system 1422 may include Windows, Linux, Android, etc.
[0136] In some embodiments, the electronic device may further include a display screen 1430, an input / output interface 1440, a communication interface 1450, a sensor 1460, a power supply 1470, and a communication bus 1480.
[0137] certainly, Figure 10 The structure of the electronic device shown does not constitute a limitation on the electronic device in the embodiments of this application. In practical applications, the electronic device may include more than [other components]. Figure 10 More or fewer components as shown, or combinations of certain components.
[0138] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. As the system provided in the embodiments corresponds to the method provided in the embodiments, the description is relatively simple; relevant parts can be found in the method section.
[0139] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of this application.
[0140] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A node routing method, characterized in that, include: Generate a globally unique identifier for each node based on the array ID, table ID, and hash code; Obtain the routing request and determine the starting node of the routing request; Read the unique key of the starting node; A primary key index lookup is performed based on the unique key to determine the globally unique identifier of the starting node; The logical data segment to which the next-hop node belongs is determined based on the hash code of the logical data segment contained in the globally unique identifier; The route is routed to the storage node corresponding to the route request based on the logical data segment and the consistent hash mapping table. The generation of globally unique identifiers for each node based on array ID, table ID, and hash code includes: When creating a new node, the hash code of the logical data segment is calculated based on the unique key of the new node; According to the preset hash mapping strategy, the hash code of the logical data segment is mapped to the corresponding logical data segment, and the node is sent to the service node where the logical data segment is located; On the service node, an array ID and a table ID are assigned to the newly added node according to the identifier allocator; each array belongs to a corresponding logical data segment; The globally unique identifier is obtained by concatenating the hash code of the logical data segment, the array ID, and the table ID.
2. The node routing method according to claim 1, characterized in that, After performing a primary key index lookup based on the unique key to determine the globally unique identifier of the starting node, the method further includes: Read the table ID, verify the validity of the node type of the starting node based on the table ID, and locate the data table structure of the starting node; Parse the array ID and access the adjacent array storage unit corresponding to the starting node based on the array ID.
3. The node routing method according to claim 1, characterized in that, When the logical data segment corresponding to the node is migrated, the following is also included: Keeping the hash code of the logical data segment unchanged, update the routing mapping table from the logical data segment to the physical node.
4. The node routing method according to claim 1, characterized in that, When creating nodes in batches, the following is also included: Obtain several globally unique identifiers, map and group nodes according to the hash code and logical data segment corresponding to each globally unique identifier, and assign the corresponding globally unique identifier.
5. A node routing system, characterized in that, include: The identifier generation module is used to generate a globally unique identifier for each node based on the array ID, table ID, and hash code. The request acquisition module is used to acquire routing requests and determine the starting node of the routing requests; The node information reading module is used to read the unique key of the starting node; The globally unique identifier lookup module is used to perform a primary key index lookup based on the unique key to determine the globally unique identifier of the starting node; The logical data segment determination module is used to determine the logical data segment to which the next-hop node belongs based on the logical data segment hash code contained in the globally unique identifier; The node routing module is used to route to the storage node corresponding to the routing request based on the logical data segment and the consistent hash mapping table; The identifier generation module is used to perform the following steps: When creating a new node, the hash code of the logical data segment is calculated based on the unique key of the new node; According to the preset hash mapping strategy, the hash code of the logical data segment is mapped to the corresponding logical data segment, and the node is sent to the service node where the logical data segment is located; On the service node, an array ID and a table ID are assigned to the newly added node according to the identifier allocator; each array belongs to a corresponding logical data segment; The globally unique identifier is obtained by concatenating the hash code of the logical data segment, the array ID, and the table ID.
6. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the method as claimed in any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed, implements the steps of the method as described in any one of claims 1 to 4.
8. A computer program product, characterized in that, It includes a computer program that, when executed, implements the steps of the method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Method, System, and Computer-Readable Medium for Diameter Routing Based on Hybrid Sessions
CN103477661B
Request routing method for division of ownership of multiple computing nodes and separated memory system
CN118660054A