A method and apparatus for relational data

By designing the database service nodes to periodically update metadata and restore service in case of failure, the problems caused by database expansion and metadata failure are solved, achieving stable service and dynamic relation type support in the metadata database, and reducing operating costs.

CN117251511BActive Publication Date: 2026-03-31XINGIN INFORMATION TECH (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-10
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

In existing technologies, as the number of users and requests increases, the cost pressure of database expansion increases, and stable graph database services cannot be provided when the metadata storage database fails.

Method used

Design dedicated graph database service nodes to regularly update metadata and store it in memory. Support the dynamic addition of relation types and restore services through local caching or files in case of metadata database failure, reducing the pressure of direct access to the relational database cluster.

Benefits of technology

It achieves stable service in the event of metadata storage failure, reduces the burden on relational database clusters, supports rapid response for dynamic relation types, avoids service interruptions, and reduces operating costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117251511B_ABST
    Figure CN117251511B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method and device for relational data. A method for relational data is provided, the method comprising: periodically accessing a meta database to obtain new metadata and adding the new metadata to the memory of a graph database service node; receiving a request of a business party and parsing a relational type associated with the request according to the request; checking the parsed relational type according to the metadata in the local cache of the graph database service node; in the case of successful checking, accessing the cache of the graph database service node or accessing a relational database cluster to obtain relational data for use by the business party.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates generally to the field of computer technology, and more specifically to a method and apparatus for relational data. Background Technology

[0002] With the development of big data, relational networks and their processing are receiving increasing attention. These relational networks are usually based on graph theory, and the core elements constituting a graph include vertices and edges that reflect the relationships between vertices.

[0003] Taking social networks as an example, the nodes in the corresponding social graph can indicate objects within the social network. These objects can be users, content (such as comments), and other objects associated with users and content (such as locations). Edges in the social graph can indicate relationships between objects. For example, an edge between the node representing user 1 and the node representing user 2 indicates the social relationship between them. Furthermore, edges in the social graph can have directionality and attributes to further describe the relationships between objects. For instance, an edge pointing unidirectionally from the node representing user 1 to the node representing user 2 with the attribute "follow" indicates that user 1 follows user 2. Summary of the Invention

[0004] A brief overview of this disclosure is given below to provide a basic understanding of some aspects of it. However, it should be understood that this overview is not an exhaustive summary of this disclosure. It is not intended to identify key or essential parts of this disclosure, nor is it intended to limit the scope of this disclosure. Its purpose is merely to present certain concepts of this disclosure in a simplified form as a prelude to the more detailed description that follows.

[0005] According to a first aspect of this disclosure, a method for relational data is provided, the method comprising: periodically accessing a metadata database to obtain new metadata and adding the new metadata to the memory of a graph database service node; receiving a request from a business party and parsing a relation type associated with the request based on the request; validating the parsed relation type based on metadata in the local cache of the graph database service node; and, if the verification is successful, accessing the cache of the graph database service node or accessing a relational database cluster to obtain relational data for use by the business party.

[0006] According to a second aspect of this disclosure, a system for relational data is provided, the system comprising a graph database service node configured to: periodically access a metadata database to obtain new metadata and add the new metadata to the memory of the graph database service node; receive a request from a business party and parse the relation type associated with the request; verify the parsed relation type based on the metadata in the local cache of the graph database service node; and, if the verification is successful, access the cache of the graph database service node or access a relational database cluster to obtain relational data for the business party to use.

[0007] According to a third aspect of this disclosure, an apparatus for relational data is provided, comprising: a memory having instructions stored thereon; and a processor configured to execute the instructions stored in the memory to perform the method according to a first aspect of this disclosure.

[0008] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided, including computer-executable instructions that, when executed by one or more processors, cause the one or more processors to perform the method according to a first aspect of this disclosure.

[0009] Other features and advantages of this disclosure will become clearer from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description

[0010] The accompanying drawings, which form part of this specification, illustrate embodiments of this disclosure and, together with the specification, serve to explain the principles of this disclosure.

[0011] This disclosure will be more clearly understood with reference to the accompanying drawings and the following detailed description, wherein:

[0012] Figure 1 A schematic diagram of at least a portion of a system for relational data according to embodiments of the present disclosure is shown;

[0013] Figure 2 A flowchart of at least a portion of a method for relational data according to embodiments of the present disclosure is shown;

[0014] Figure 3 A schematic diagram of at least a portion of a computer system for relational data according to an embodiment of the present disclosure is shown. Detailed Implementation

[0015] The following detailed description is based on the accompanying drawings and provides various exemplary embodiments of the present disclosure to aid in a comprehensive understanding. Various details are included in the following description to aid understanding; however, these details are considered exemplary only and not intended to limit the present disclosure, which is defined by the appended claims and their equivalents. The words and phrases used in the following description are intended only to provide a clear and consistent understanding of the present disclosure. Additionally, descriptions of well-known structures, functions, and configurations may have been omitted for clarity and brevity. Those skilled in the art will recognize that various changes and modifications can be made to the examples described herein without departing from the spirit and scope of the present disclosure.

[0016] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the scope of this disclosure or its application or use. That is, the structures and methods herein are shown in an exemplary manner to illustrate different embodiments of the structures and methods in this disclosure. However, those skilled in the art will understand that they merely illustrate exemplary ways that can be used to implement this disclosure, and not exhaustive ways. Furthermore, the drawings are not necessarily drawn to scale, and some features may be enlarged to show details of specific components.

[0017] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.

[0018] In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values.

[0019] In existing technologies, different business units typically implement their own solutions for handling relational data, and access the database (such as a MySQL database) storing this data using fixed statements (such as SQL statements) in their business code. However, as the number of users and requests continues to grow, the ever-expanding databases bring increasing cost pressures.

[0020] This disclosure designs a dedicated graph database service to handle graph data business. Therefore, the graph data service in this disclosure not only needs to provide a central point for relational metadata for various business parties, but also needs to allow the dynamic addition of new relation types without restarting the graph database service. Furthermore, in the event of a failure in the database storing metadata, it is necessary to provide graph database services without relying on the metadata database; that is, a solution for managing metadata and restoring services during failures is required.

[0021] Figure 1A schematic diagram of at least a portion of a system 100 for relational data according to an embodiment of the present disclosure is shown. Figure 1 As shown, system 100 may include graph database service node 101, metadata file 102, metadata database 103, and relational database cluster 104.

[0022] Graph database service node 101 can be configured to provide graph database services, for example, receiving service requests from one or more business parties, obtaining metadata from metadata database 103 and / or metadata from metadata file 102, and obtaining relational data from relational database cluster 104. It should be understood that... Figure 1 The system 100 shown includes two graph database service nodes 101; however, this disclosure is not limited thereto, but may include one or more graph database service nodes (e.g., a graph database service node cluster).

[0023] Metadata file 102 can be configured to back up metadata for use in case of failure or emergency. Metadata file 102 can be stored, for example, on a hard disk. In the event of a failure of metadata database 103, metadata file 102 can be read from the hard disk and distributed to each graph database service node 101, thereby ensuring the consistency of metadata received by each graph database service node 101.

[0024] Metadatabase 103 can be configured to store metadata, which can be, for example, a MySQL database.

[0025] The relational database cluster 104 can be configured to store relational data, and it can be, for example, a MySQL database cluster. In embodiments according to this disclosure, business data from different business parties and / or different relation types can be stored in different databases within the relational database cluster 104 and can be accessed through the same or different graph database service nodes 101.

[0026] Metadata can be data used to define the edge relationship types of a graph. Specifically, metadata can include one or more of the following: one or more relationship types and other data associated with those relationship types, such as data used to access business data corresponding to those relationship types. For example, in a social graph scenario, metadata could include: social relationship types; the database, table names, usernames and passwords required to access the business data for each social relationship type; and whether the social relationship type supports anti-fraud measures. Non-limiting examples of social relationship types could include friend relationships between users on a social network, posting relationships, like relationships, and collection relationships between users and social content (such as notes). Metadata can be stored in a separate metadata database 103 and can be dynamically updated, such as by adding or removing relationship types. Furthermore, metadata can also be backed up locally in a metadata file 102 on the graph database service.

[0027] Relational data can be business data associated with various relation types stored in relational database cluster 104. In the context of social graphs, relational data can be, for example, specific objects of edge relationships (e.g., user 1 and note A published by user 1 in the publishing relationship between users and notes), specific times of edge relationships (e.g., the actual time when user 1 published note A in the publishing relationship between users and notes), and so on.

[0028] It should be understood that, Figure 1 The system 100 shown includes a graph database service node 101, a metadata file 102, a metadata database 103, and a relational database cluster 104. However, this disclosure is not limited to this; the system may include only one or more of these modules, and may also include other modules not shown in the diagram. Figure 1 The module shown in the image.

[0029] Figure 2 A flowchart of at least a portion of a method 200 for relational data according to embodiments of the present disclosure is shown. Figure 2 The method 200 shown can be executed, for example, at the graph database service node.

[0030] At step S21, the graph database service node can periodically (e.g., every 5 minutes) access the metadata database to retrieve new metadata and add it to the graph database service node's memory. Specifically, for example, newly added relation types can be retrieved periodically. This step advantageously updates the relation types stored locally on the graph database service node without restarting it, thus supporting the need to dynamically add new relation types. Furthermore, the graph database service node can still respond quickly and reliably to requests from business users even with changes in supported relation types. On the other hand, since the relation types stored locally on the graph database service node are updated periodically, there is no need to rewrite the online cluster in response to newly added relation types, thereby avoiding impact on normal requests from other business users.

[0031] In embodiments according to this disclosure, a graph database service node can access a metadata database to obtain metadata upon startup and store the obtained metadata in the memory of the graph database service node.

[0032] Furthermore, for example, if the graph database service node restarts due to a failure, there will be no metadata in the local cache of the graph database service node. In this case, if access to the metadata database fails (for example, if the metadata database also fails), the metadata file stored on the hard drive of the graph database service node can be accessed to load the metadata and store the loaded metadata in the memory of the graph database service node.

[0033] At point S22, the graph database service node can receive requests from business stakeholders and parse them to obtain the relationship types associated with the requests. For example, in a social graph scenario, the graph database service node can receive requests from business stakeholders and parse them to obtain information such as follow relationships between users on a social network, posting relationships between users and content, and like relationships between users and content.

[0034] At point S23, since the graph database service node previously had metadata retrieved from the metadata database or metadata file in its cache, the graph database service node can verify the parsed relation type based on the metadata in its local cache. The graph database service node can then determine whether the system supports the relation type requested by the business based on whether the parsed relation type is included in the metadata in its local cache.

[0035] At point S24, if the verification is successful, the graph database service node can access its cache or the relational database cluster to obtain relational data for business use. For example, in a social graph scenario, if the graph database service node parses and determines that the business requires the publishing relationship between users and content, and the metadata in the local cache supports the publishing relationship type, then the graph database service node can access the database in the relational database cluster that stores the relational data of the publishing relationship type, based on the database, table name, and username and password required to access the publishing relationship type business data included in the metadata.

[0036] In embodiments according to this disclosure, in the event of a verification failure, the graph database service node can return an incorrect relation type to the business party. For example, if the relation type requested by the business party is not included in the metadata cached locally by the graph database service node, it indicates that the graph database service currently does not support that business type, and feedback can be provided to the business party. Furthermore, in embodiments according to this disclosure, relation types can be added according to the business party's request, and new metadata can be added to the graph database (e.g., manually), thereby enabling support for the corresponding new relation types and the provision of related business data services.

[0037] Figure 3 A schematic diagram of at least a portion of a computer system 300 for relational data according to an embodiment of the present disclosure is shown. System 300 includes one or more processors 310, one or more memories 320, and other components (not shown) typically found in devices such as computers. Each of the one or more memories 320 may store content accessible by the one or more processors 310, including instructions 321 executable by the one or more processors 310, and data 322 that may be retrieved, manipulated, or stored by the one or more processors 310.

[0038] Instruction 321 can be any set of instructions that will be executed directly by one or more processors 310, such as machine code, or any set of instructions that will be executed indirectly, such as a script. The terms “instruction,” “application,” “procedure,” “step,” and “program” used herein are interchangeable. Instruction 321 can be stored in object code format for direct processing by one or more processors 310, or stored as a script or set of independent source code modules in any other computer language, including those interpreted on demand or compiled ahead of time. Instruction 321 may include instructions that cause one or more processors 310 to act as the various models described herein. The function, methods, and routines of instruction 321 are explained in more detail in other parts of this document.

[0039] One or more memories 320 may be any temporary or non-temporary computer-readable storage medium capable of storing content accessible by one or more processors 310, such as hard disk drives, memory cards, ROM, RAM, DVDs, CDs, USB storage, writable memory, and read-only memory. One or more of the memories 320 may include a distributed storage system, wherein instructions 321 and / or data 322 may be stored on multiple different storage devices that may be physically located in the same or different geographical locations. One or more of the memories 320 may be connected to one or more processors 310 via a network, and / or may be directly connected to or incorporated into any of the one or more processors 310.

[0040] One or more processors 310 may retrieve, store, or modify data 322 according to instructions 321. Data 322 stored in one or more memories 320 may include at least a portion of one or more of the items stored in the one or more storage devices 310 described above. For example, while the subject matter described herein is not limited to any particular data structure, data 322 may also be stored in computer registers (not shown), or as a table or XML document with many different fields and records in a relational database. Data 322 may be formatted in any computing device-readable format, such as, but not limited to, binary values, ASCII, or Unicode. Furthermore, data 322 may include any information sufficient to identify relevant information, such as numbers, descriptive text or symbols, proprietary codes, pointers, references to data stored in other memories such as other network locations, or information used by functions to calculate relevant data.

[0041] One or more processors 310 can be any conventional processor, such as a commercially available central processing unit (CPU), graphics processing unit (GPU), etc. Alternatively, one or more processors 310 can also be special-purpose components, such as application-specific integrated circuits (ASICs) or other hardware-based processors. While not required, one or more processors 310 may include specialized hardware components to perform specific computational processes, such as image processing of images, faster or more efficiently.

[0042] Although Figure 3One or more processors 310 and one or more memories 320 are schematically shown within the same box, but system 300 may actually include multiple processors or memories that may reside within the same physical housing or multiple different physical housings. For example, one of the one or more memories 320 may be a hard disk drive or other storage medium located in a housing different from each of the one or more computing devices (not shown) described above. Therefore, references to processors, computers, computing devices, or memories should be understood to include references to a collection of processors, computers, computing devices, or memories that may operate in parallel or not in parallel.

[0043] This disclosure proposes a management and disaster recovery solution for relational data based on its method and apparatus. Even when the underlying persistent database service (such as MySQL) fails, catastrophic impacts can be avoided through cache hits, ensuring normal service of the graph database in fault scenarios. This solution has proven highly effective in graph database practice. A dedicated database stores the edge relation metadata of the graph data. The graph database service periodically accesses the database containing the metadata to obtain the latest social relation types and stores them in memory. New social relations can be dynamically added at any time, and new relation types can be loaded without interrupting online read / write services. When the database containing the metadata becomes unavailable, the graph database service can choose to load the metadata from a local metadata file or restore the metadata from the cache, ensuring continued service. Furthermore, by validating relation types on the graph database service nodes, the pressure caused by businesses directly accessing the relational database cluster in large quantities is reduced.

[0044] The term "A or B" in the specification and claims includes both "A and B" and "A or B", but does not exclusively include only "A" or only "B", unless otherwise specified.

[0045] In this disclosure, references to "one embodiment" or "some embodiments" mean that a feature, structure, or characteristic described in connection with that embodiment is included in at least one embodiment or at least some embodiments of this disclosure. Therefore, the appearance of the phrases "in one embodiment" or "in some embodiments" throughout this disclosure does not necessarily refer to the same or the same embodiments. Furthermore, in one or more embodiments, features, structures, or characteristics can be combined in any suitable combination and / or sub-combination.

[0046] As used herein, the term "exemplary" means "serving as an example, instance, or illustration," and not as a "model" to be precisely copied. Any implementation described herein by example is not necessarily to be construed as preferred or advantageous over other implementations. Furthermore, this disclosure is not limited to any theory expressed or implied as given in the foregoing technical field, background, summary of invention, or detailed description.

[0047] Additionally, certain terms may be used in the following description for reference only and are therefore not intended to be limiting. For example, unless the context clearly indicates otherwise, the words “first,” “second,” and other such numerical terms relating to structures or elements do not imply order or sequence. It should also be understood that the term “including / comprising,” as used herein, indicates the presence of the indicated feature, whole, step, operation, unit, and / or component, but does not preclude the presence or addition of one or more other features, wholes, steps, operations, units, and / or components, and / or combinations thereof.

[0048] In this disclosure, the terms "component" and "system" are intended to refer to a computer-related entity, or hardware, a combination of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process, object, executable, thread of execution, and / or program running on a processor. By way of example, both an application running on a server and the server itself can be a component. One or more components can exist within an executing process and / or thread, and a component can be located on a single computer and / or distributed across two or more computers.

[0049] Those skilled in the art will recognize that the boundaries between the above operations are merely illustrative. Multiple operations may be combined into a single operation, a single operation may be distributed among additional operations, and operations may be performed with at least partial overlap in time. Moreover, alternative embodiments may include multiple instances of a particular operation, and the order of operations may be changed in various other embodiments. However, other modifications, variations, and substitutions are equally possible. Therefore, this specification and the accompanying drawings should be considered illustrative rather than restrictive.

[0050] While specific embodiments of this disclosure have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of this disclosure. The various embodiments disclosed herein can be combined in any way without departing from the spirit and scope of this disclosure. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of this disclosure. The scope of this disclosure is defined by the appended claims.

Claims

1. A method for relational data, the method comprising: periodically accessing a meta database to obtain new metadata and adding the new metadata to the memory of a graph database service node, wherein the metadata in the meta database is in a dynamic update state, and the metadata comprises one or more relationship types; receiving a request from a business party and resolving a relationship type associated with the request according to the request; checking the resolved relationship type according to the metadata in the local cache of the graph database service node; the checking is used to determine whether the resolved relationship type is included in the metadata in the local cache to determine whether the relationship type of the business request is supported; in the case of successful checking, accessing the cache of the graph database service node or accessing a relational database cluster to obtain relational data for the business party; wherein the relational data of different business parties or different relationship types is stored in different databases in the relational database cluster, and the different databases are called through the same or different graph database service nodes.

2. The method of claim 1, wherein, The method further comprises: when the graph database service node is started, accessing the meta database to obtain metadata and saving the obtained metadata in the memory of the graph database service node.

3. The method of claim 1 or 2, wherein, The method further comprises: in the case of unsuccessful access to the meta database, accessing a metadata file local to the graph database service node to load metadata and saving the loaded metadata in the memory of the graph database service node.

4. The method of claim 1, wherein, The metadata comprises one or more of the following: a database corresponding to the business data of the one or more relationship types, a table name, a username and a password required to access the business data, and whether the one or more relationship types support anti-cheating.

5. The method of claim 1, wherein, The method further comprises: in the case of failed checking, returning an error relationship type to the business party. 6.A system for relational data, the system comprising a graph database service node, the graph database service node being configured to: periodically accessing the metadata database to obtain new metadata and adding the new metadata to the memory of the graph database service nodes, wherein, the metadata in the meta database is in a dynamic update state, and the metadata comprises one or more relationship types; receive a request from a business party and resolve a relationship type associated with the request according to the request; check the resolved relationship type according to the metadata in the local cache of the graph database service node; the checking is used to determine whether the resolved relationship type is included in the metadata in the local cache to determine whether the relationship type of the business request is supported; in the case of successful checking, access the cache of the graph database service node or access a relational database cluster to obtain relational data for the business party; wherein the relational data of different business parties or different relationship types is stored in different databases in the relational database cluster, and the different databases are called through the same or different graph database service nodes.

7. The system of claim 6, wherein, The graph database service node is further configured to: when the graph database service node is started, access the meta database to obtain metadata and save the obtained metadata in the memory of the graph database service node.

8. The system of claim 6 or 7, wherein, The graph database service node is further configured to: In case of unsuccessful access to the meta database, access is made to a metadata file local to the graph database service node to load the metadata and save the loaded metadata in the memory of the graph database service node.

9. The system of claim 6, wherein, The metadata comprises one or more of: a database corresponding to the business data of the one or more relationship types, a table name, a username and a password required to access the business data, and whether the one or more relationship types support anti-cheating.

10. The system of claim 6, wherein, The graph database service node is further configured to: in case of a failed verification, return an error relationship type to the business party.

11. An apparatus for relationship data, comprising: a memory having instructions stored thereon; and a processor configured to execute the instructions stored on the memory to perform the method according to any one of claims 1 to 5.

12. A computer-readable storage medium comprising computer-executable instructions that, when executed by one or more processors, cause the one or more processors to perform the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Relation processing method and system based on massive data

    CN108829783A

  • Metadata access method, system and device of distributed system and medium

    CN111708734A