Data access method, device and equipment

By creating notification messages from the listening channel to the database node on the client, accurately judge node failure and quickly failover, the problem of low accuracy in judging node failure in the existing technology is solved, reducing the timeout waiting situation.

CN119782052APending Publication Date: 2025-04-08CETC JINCANG (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411936889.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

In the prior art, the accuracy of judging database node failure is low, resulting in a timeout waiting situation when the client is waiting for the node to respond.

Method used

Listen to notification messages by creating a listening path between the client and the nodes other than the first node in the server cluster. When a notification message that a failure occurs in the first node is heard, the client sends a data access request to the faultless node in the server cluster.

Benefits of technology

This method can accurately determine node failures, reduce the waiting timeout of data access requests, and enable the client to quickly failover.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119782052A_ABST
    Figure CN119782052A_ABST
Patent Text Reader

Abstract

The present application provides a method, device and equipment for data access. The database system includes a client and a server cluster. The method is applied to the client, including: sending a data access request to a first node in the server cluster, and creating a monitoring path with a second node in the server cluster; the second node is a node in the server cluster other than the first node; monitoring the notification message of the second node through the monitoring path; if a notification message of a fault in the first node is monitored, sending a data access request to a third node in the server cluster; the third node is a node without faults in the server cluster. By creating a monitoring path and monitoring the fault notification message of the node connected to the client, when a node connected to the client fails, the client can quickly send a data access request to the node without faults.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to database technology, and in particular to a method, apparatus and device for accessing data. Background Art

[0002] The database cluster includes multiple nodes, which can be used to store and manage large amounts of data and provide data access interfaces for clients. When a node accessed by a client fails, a failover is required to access data from a healthy node. When a client needs to obtain data from a node, the client can send a request to the node, and the node responds to the request. When the client is waiting for a response from a node, it may time out due to a node failure.

[0003] Currently, by obtaining the waiting time that the client waits for the node to respond, when the waiting time exceeds a certain value, it can be determined that the node has failed and access data from a new node.

[0004] However, the accuracy of the above method for determining whether a node fails is low. Summary of the invention

[0005] The present application provides a method, apparatus and device for data access, which are used to solve the problem of low accuracy in determining whether a node has a fault.

[0006] In a first aspect, the present application provides a data access method, wherein a database system includes a client and a server cluster, and the method is applied to the client, and the method includes:

[0007] Sending a data access request to a first node in the server cluster, and establishing a monitoring path with a second node in the server cluster; the second node is a node in the server cluster other than the first node;

[0008] monitoring a notification message of the second node through a monitoring path;

[0009] If a notification message that a fault occurs in the first node is monitored, a data access request is sent to a third node in the server cluster; the third node is a node without faults in the server cluster.

[0010] In a possible implementation manner, if a notification message that a fault exists in the first node is monitored, sending a data access request to a third node in the server cluster includes:

[0011] If a notification message indicating that the first node has a fault is monitored, a target signal is generated through the monitoring path;

[0012] Determining that the first node has a fault based on the target signal, and setting a target mark, where the target mark is used to indicate that a connection between the client and the first node is unavailable;

[0013] Based on the target tag, a data access request is sent to the third node in the server cluster.

[0014] In a possible implementation manner, generating a target signal through the monitoring path includes:

[0015] Acquire the node identifier carried in the notification message through the monitoring path;

[0016] When the node identifier is the identifier of the first node, determining through the monitoring path that the first node fails;

[0017] The target identifier of the target execution unit is obtained through the monitoring path, and a target signal is generated based on the target identifier. The target execution unit is an execution unit corresponding to a data access request in a waiting response state, and the target identifier is used to indicate that the target execution unit is in a waiting response state.

[0018] In a possible implementation, the method further includes:

[0019] The state of the target flag bit corresponding to the target execution unit is set to a first state through the monitoring path.

[0020] In a possible implementation manner, determining that the first node has a fault based on the target signal includes:

[0021] Based on the target signal, obtaining a state of a target flag bit corresponding to the target execution unit;

[0022] When the state of the target flag bit is the first state, the data access request in the waiting for response state is controlled to exit the waiting for response state, and it is determined that the first node has a fault.

[0023] In a possible implementation manner, sending a data access request to a third node in the server cluster includes:

[0024] Determine the third node without fault in a pre-stored node status table, and establish a connection with the third node; the node status table includes fault status information of each node in the server cluster;

[0025] A data access request is sent to the third node.

[0026] In a possible implementation, the method further includes:

[0027] Based on the notification message that the first node has a fault, the state of the first node in the node state table is updated to a fault state.

[0028] In a second aspect, the present application provides a data access device, comprising:

[0029] A sending module, used to send a data access request to a first node in a server cluster; the server cluster is a cluster in a database system;

[0030] A processing module, configured to establish a monitoring path with a second node in the server cluster; the second node is a node in the server cluster other than the first node;

[0031] The monitoring module is further used to monitor the notification message of the second node through the monitoring path;

[0032] The sending module is further configured to send a data access request to a third node in the server cluster if a notification message indicating a fault in the first node is monitored; the third node is a node without fault in the server cluster.

[0033] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;

[0034] The memory stores computer-executable instructions;

[0035] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.

[0036] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.

[0037] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.

[0038] The data access method, device and equipment provided by the present application, the database system includes a client, and a server cluster, the method is applied to the client, and the method includes: sending a data access request to a first node in the server cluster, and creating a monitoring path between the second node in the server cluster; the second node is a node in the server cluster other than the first node; monitoring the notification message of the second node through the monitoring path; if the notification message of the failure of the first node is monitored, then sending a data access request to the third node in the server cluster; the third node is a node without failure in the server cluster. By creating a monitoring path and monitoring the failure notification message of the node connected to the client, when the node connected to the client fails, the client can quickly send a data access request to the node without failure. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0040] Figure 1 A flowchart of a data access method provided for this application;

[0041] Figure 2 A schematic flow chart of a method for a client to determine that a first node has failed provided in an embodiment of the present application;

[0042] Figure 3 A flowchart of another data access method provided in an embodiment of the present application;

[0043] Figure 4 A schematic diagram of the structure of the data access device provided by this application;

[0044] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0045] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0046] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0047] The specific application scenario of this application is the scenario where the client accesses data from the database.

[0048] A database cluster is a system consisting of multiple interconnected database server nodes that work together to process database operations and store data. By distributing data across multiple nodes and coordinating the work between them, a database cluster can provide higher processing power and resource utilization than a single database server. A node is each database server in a database cluster.

[0049] When a client accesses data from a node connected to it, it can send a request to the node, and the node responds to the request and feeds the response data back to the client. After the client sends a request to the node, it will enter a state of waiting for the node's response. During the waiting process, if the node fails and the client is unaware of the node's failure, the client will remain in a waiting state and a waiting timeout will occur. Since the thread or process corresponding to the request will occupy the client's resources while the client is waiting for the node to respond, a timeout will waste resources on the client.

[0050] In some implementations, a maximum time to wait for a response is set. When the time the client waits for a node to respond reaches the maximum time, the client may consider the request to have timed out and confirm that the node has failed.

[0051] However, for complex requests, the node will take a long time to respond to them, that is, the client will wait for a long time, and there may be a situation where the waiting time exceeds the set maximum time. At this time, the request will be interrupted and the node will be confirmed to be faulty. Therefore, the above implementation may make incorrect judgments and the accuracy of confirming that the node is faulty is low.

[0052] In other implementations, since the data interaction between the client and the node is based on the Transmission Control Protocol (TCP), when the client does not receive a response from the node, it will automatically resend the request to the node, and the number of resend requests can be set. Therefore, a smaller number of resends is set, and when the number of resends reaches the number of times the node still does not respond, it is determined that the node is faulty.

[0053] However, when the network load is high or there are short-term abnormal fluctuations, the time it takes for the client to receive a response from the node may be extended. During this period, the number of times the client resends the request to the node may have exceeded the set number, and the client may think that the node is faulty and make a misjudgment. In addition, if the client resends and waits for a response for a long time, it may occupy the client's resources, making it unable to perform other tasks. Therefore, the above implementation still has the problem of low accuracy in confirming that the node is faulty.

[0054] Based on this, the present application provides a data access method, in which during the process of a client sending a data access request to a node, the client monitors the notification messages sent by other nodes in the server cluster except the first node through the monitoring path created by the client, and when it is monitored that the node to which the client performs data access fails, the client controls the data access request to be made to the node without failure in the server cluster. In this way, the failure of the node can be accurately determined, and the situation of timeout waiting for the data access request can be reduced, so that when the node to which the client is connected fails, the client can quickly perform a failover.

[0055] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0056] The data access method provided in the embodiment of the present application is applied to a client, which is a client in a database system. In addition to the client, the database system also includes a server cluster. The server cluster includes multiple nodes.

[0057] Figure 1 A flow chart of a data access method provided for this application is as follows: Figure 1 As shown, the method includes:

[0058] S101: Send a data access request to a first node in a server cluster, and create a monitoring path with a second node in the server cluster.

[0059] The second node is a node in the server cluster except the first node.

[0060] The first node is a node in the server cluster that has established a connection with the client.

[0061] Exemplarily, the client can create a monitoring path with the second node in the server cluster at the driver layer. For example, the server cluster includes 10 nodes, the client currently establishes a connection with the second node, and the monitoring path created by the client is a monitoring path with any node except the second node.

[0062] The monitoring channel can monitor the notification message of any node except the first node.

[0063] It should be noted that any node in the server cluster can detect the status of other nodes through network perception. Network perception includes methods such as heartbeat mechanism or TCP connection detection, which are not specifically limited in the embodiments of the present application.

[0064] In a possible implementation, when each node detects each other's status through the heartbeat mechanism, in the cluster, each node will periodically send heartbeat messages to tell other nodes their current operating status. For example, every 1 second, node A will send a heartbeat message to node B, and node B will know that node A is running normally after receiving it.

[0065] For example, if node B does not receive the heartbeat message from node A for a period of time (e.g., 5 consecutive seconds), it will be considered that node A may have a fault. In this way, the surviving nodes without faults can perceive the faults of other nodes in a timely manner.

[0066] In another possible implementation, each node detects each other's status through a TCP connection. In a cluster, nodes communicate through TCP connections. After a TCP connection is established, both parties send some control messages to each other to maintain the status of the connection. If a node fails, the TCP connection will be abnormal. For example, if the sender does not receive an acknowledgment message (ACK) for a long time after sending data, or receives an incorrect TCP flag (such as RST), it can be judged that there is a problem with the connection, and then it can be inferred that the other node may have a fault.

[0067] S102: Monitor a notification message of the second node through a monitoring path.

[0068] In this application, when a surviving node senses that a node has failed, it needs to promptly notify the client of this information. Therefore, the second node, as a surviving node without failure, can send a notification message to notify the first node of the failure when it senses that the first node has failed.

[0069] In a possible implementation, the client's monitoring channel can monitor the notification messages of each node in the server cluster through the subscription service. For example, the surviving node sends the fault notification message to a message queue, and the client subscribes to this message queue and can receive the notification in time.

[0070] In another possible implementation, a persistent connection is established between the client and the node, and the surviving node sends a notification message to the client through the persistent connection, and monitors the notification message through the monitoring path.

[0071] S103: If a notification message indicating that a fault occurs on the first node is monitored, a data access request is sent to a third node in the server cluster.

[0072] The third node is a node without any faults in the server cluster.

[0073] In the present application, a node status table is pre-stored in the client, and the node status table includes fault status information of each node in the server cluster.

[0074] In a possible implementation, the client may determine a third node without faults in a pre-stored node status table, establish a connection with the third node, and then send a data access request to the third node.

[0075] Exemplarily, the client may install the order of the nodes in the node status table and try to connect to the new node in sequence. Of course, in the process of trying to connect in sequence, the client will skip the faulty node.

[0076] In this way, by finding a third node without faults in the node status list and establishing a connection with the third node, the client can quickly establish a connection with the node without faults.

[0077] In another possible implementation, a load balancer is used to distribute client requests. When the first node to which the client is connected fails, the load balancer senses the unavailability of the first node and forwards subsequent requests to a third node.

[0078] In the present application, when a notification message indicating that a first node has a fault is monitored, the client may update the status of the first node in the node status table based on the notification message indicating that the first node has a fault, and update the status of the first node to a faulty status.

[0079] Exemplarily, in the node status list, the fault state and the non-fault state may be represented by different identifiers, for example, the fault state is represented by 1, and the non-fault state is represented by 0. The embodiment of the present application does not limit the specific representation method.

[0080] In this way, the data access method provided by the present application creates a listening path between the client and the nodes in the server cluster except the first node, so that when the first node connected to the client fails, the client can quickly know that the first node has failed through the listening path, and thus establish a connection with other normal nodes and send data access requests to the normal nodes, which can reduce the situation of data access request timeout waiting.

[0081] The client may determine that the first node fails through the notification information monitored by the monitoring channel. The following describes a process of the client determining that the first node fails through the notification information.

[0082] Figure 2 A flowchart of a method for a client to determine that a first node has failed is provided in an embodiment of the present application.

[0083] like Figure 2 As shown, the client determining that the first node fails may include:

[0084] S201: If a notification message indicating a fault of the first node is detected, a target signal is generated through a monitoring path.

[0085] In the present application, if a notification message indicating that a first node has a fault is monitored, the node identifier carried in the notification message can be obtained through the monitoring path; when the node identifier is the identifier of the first node, it is determined through the monitoring path that the first node has a fault; the target identifier of the target execution unit is obtained through the monitoring path, and a target signal is generated based on the target identifier.

[0086] The target execution unit is an execution unit corresponding to the data access request in a waiting-for-response state.

[0087] Exemplarily, when generating a notification message, the second node can carry the identifier of the first node into the notification message. In addition to carrying the identifier of the first node, it can also carry information indicating that a fault has occurred in the first node. In this way, the monitoring path can determine that a fault has occurred in the first node based on the information carried in the notification message.

[0088] The target execution unit is a thread or process corresponding to the data access request, which is not specifically limited in the embodiments of the present application.

[0089] It is understandable that after the client sends a data access request to the first node, it is in a state of waiting for the response of the first node, that is, a blocked state. Specifically, after the client sends a data access request to the first node of the server, it usually calls the select or poll system to wait for the response of the first node. During the process of waiting for the response of the first node, the client thread or process that calls select or poll will always be in a blocked state.

[0090] Therefore, after the client sends a data access request to the first node, the client generates a target identifier of the target execution unit corresponding to the data access request, for example, generates a blocking flag. The target identifier indicates that the target execution unit is in a waiting state for a response, that is, the target execution unit is in a blocking state.

[0091] Furthermore, the client may also register the serial number of the target execution unit, that is, the process number or thread number corresponding to the data access request.

[0092] In the present application, a target identifier of a target execution unit is obtained through a monitoring path, and a target signal is generated based on the target identifier, including: obtaining a blocking flag of a process or thread in a blocked state through a monitoring path, and generating a target signal corresponding to the thread number or process number based on the blocking flag.

[0093] Exemplarily, the target signal is represented by any one of the user-defined signals (SIGUSR1 or SIGUSR2). This embodiment of the present application does not specifically limit this.

[0094] In this way, a target signal corresponding to the target execution unit in the waiting response state is generated through the monitoring path, so that the subsequent target execution unit can determine that the first node is in a fault state based on the signal.

[0095] S202: Set the state of the target flag bit corresponding to the target execution unit to a first state through a monitoring path.

[0096] Exemplarily, the target flag bit may be cliInterruptPending. Setting the target flag bit to the first state may be setting the flag bit cliInterruptPending to true, that is, setting the flag bit cliInterruptPending to be greater than 0.

[0097] For example, the flag bit cliInterruptPending of the thread or process corresponding to the data access request is set to true.

[0098] In this way, by setting the state of the target flag bit of the target execution unit, the subsequent target execution unit can exit the waiting response state based on the state of the flag bit, thereby reducing the situation of timeout waiting.

[0099] S203: Determine that a fault occurs in the first node based on the target signal, and set a target mark, where the target mark is used to indicate that a connection between the client and the first node is unavailable.

[0100] In an embodiment of the present application, kill or pthread_kill is used through the monitoring path to send a target signal to the target execution unit in the waiting response state based on the identification of the target execution unit, that is, kill or pthread_kill is used through the monitoring path to send a signal to the process or thread in the blocked state according to the thread number or process number corresponding to the blocking flag.

[0101] Exemplarily, determining that there is a fault in the first node based on the target signal may include: based on the target signal, obtaining the state of a target flag bit corresponding to the target execution unit; when the state of the target flag bit is a first state, controlling a data access request in a waiting response state to exit the waiting response state, and determining that there is a fault in the first node.

[0102] Exemplarily, a data access request in a waiting response state is controlled to exit the waiting response state, that is, a thread or process in a blocked state is controlled to exit the blocked state, specifically, a process or thread of a select or poll system call is interrupted.

[0103] In this way, by controlling the target execution unit in the waiting state to exit the waiting response state based on the signal of the monitoring path, it can be achieved that when the first node fails, the client can control the target execution unit in the waiting response state to exit the waiting response state in a shorter time, which can reduce the situation of waiting for the response due to not knowing that the first node has failed, improve the user experience, and reduce the situation of occupying client resources due to being in the waiting state.

[0104] Exemplarily, setting the target mark may be setting the connection state value of the first node to BAD, that is, the first node is in an unavailable state.

[0105] S204: Send a data access request to a third node in the server cluster based on the target tag.

[0106] Exemplarily, when the target mark is detected, it can be determined that the first node is in an unavailable state, and then a connection with a third node in the server cluster can be established, and a data access request can be sent to the third node.

[0107] The method of establishing a connection with the third node in the server cluster can be referred to the above embodiment, which will not be described in detail here.

[0108] In the present application, after the monitoring path monitors the notification information, the monitoring path can generate a target signal based on the notification information, so that the target execution in the waiting response state can exit the waiting response state based on the target signal, and a target mark for indicating that the first node has failed can be set, so that the client sends a data access request to a third node in the server cluster that has no failure. In this way, the time for the client to determine that the node connected to it has failed is shortened, so that the client can quickly perform a failover when the first node fails.

[0109] In combination with the above embodiments, the data access method of the present application is described in detail through specific examples. Figure 3 A flowchart of another data access method provided in an embodiment of the present application.

[0110] like Figure 3 As shown, data access methods may include:

[0111] S301. Create a new connection.

[0112] In this step, the client establishes a new connection with the first node.

[0113] S302: Create a monitoring thread.

[0114] The client can establish a monitoring thread at the driver layer to create a monitoring path. After executing step S302, step S306 is executed.

[0115] S303: Connection is successful, and the node status table is saved.

[0116] When the connection between the client and the first node is successful, the status of each node in the cluster can be obtained and a node status table can be created. The content in the node status table can refer to the above embodiment and will not be repeated here.

[0117] S304: Send a data access request to the first node, enter a blocking state, and register a process number or a thread number.

[0118] After the client sends a data access request to the first node, it can call the select or poll system to wait for the response of the first node, so that the process or thread corresponding to the data access request is blocked, and the process number of the process corresponding to the data access request or the thread number of the corresponding thread is registered.

[0119] Exemplarily, the client sets a blocking flag of a thread or process to indicate that the thread or process is in a blocking state.

[0120] S305: Wait for a response from the first node.

[0121] Wait for the first node to respond by calling select or poll.

[0122] S306: Create connections with each node in the server cluster.

[0123] The client can establish a TCP connection with each node in the server cluster.

[0124] S307: Monitor each connection.

[0125] Exemplarily, each connection is monitored by a monitoring thread to obtain notification messages sent by each node.

[0126] S308: Determine whether there is a notification message.

[0127] When there is a notification message, the following step S309 may be executed, and when there is no notification message, the following step S3010 may be executed.

[0128] S309: Match the nodes based on the notification message and query the process or thread blocked on the faulty node.

[0129] In the present application, the monitoring thread may match nodes based on the notification information, that is, determine that a first node fails, and query the process or thread blocked on the first node.

[0130] The monitoring thread may determine the process or thread blocked at the first node through a blocking flag corresponding to the process or thread. For details, please refer to the above embodiment, which will not be described again.

[0131] S3010, generate and send a target signal to interrupt the waiting response state.

[0132] The method for monitoring the thread to generate the target signal can be found in the above embodiment, which will not be described in detail here.

[0133] In this step, a target signal may be sent to the thread or process waiting for a response from the first node (ie, in a blocked state) to interrupt the waiting response state of the thread or process, ie, to make the thread or process exit the waiting response state.

[0134] Furthermore, the monitoring thread may also set the target flag to the first state. Specifically, cliInterruptPending may be set to be greater than 0.

[0135] S3011. Network problem handling.

[0136] If there is no notification message, you can check whether there is a network problem and continue to return to step S307.

[0137] S3012: Determine whether the target flag is in the first state.

[0138] In this step, judging whether the target flag is in the first state may be judging whether cliInterruptPending is greater than 0. When cliInterruptPending is greater than 0, the following steps S3013-S3014 may be executed. If cliInterruptPending is not greater than 0, the following steps S3015-S3016 may be executed.

[0139] S3013. Set the connection status value and exit the loop.

[0140] In this step, the connection state value of the first node may be set to BAD to indicate that the first node is in an unavailable state, and the loop in which the data request is located is exited.

[0141] S3014. Perform failover.

[0142] Performing a failover, that is, determining a node without a fault as described in the above step, sends a data access request to the node without a fault. For details, please refer to the above embodiment, which will not be repeated here.

[0143] S3015: Determine whether it is a normal interruption.

[0144] In the present application, whether it is a normal interruption can be determined by whether it is EINTR, if so, then continue to execute step S305 to wait for the response of the first node. If not, then execute step S3016.

[0145] S3016. Return the reason for the exception.

[0146] When it is not a normal interrupt, the reason for the abnormal interrupt can be returned.

[0147] In summary, the data access method provided by the present application can reduce the waiting time when a node fails after the client makes a data access request, thereby improving the response efficiency of the application.

[0148] Figure 4 A schematic diagram of the structure of the data access device provided in this application, such as Figure 4 As shown, the data access device 40 provided in this embodiment includes:

[0149] The sending module 401 is used to send a data access request to a first node in a server cluster; the server cluster is a cluster in a database system.

[0150] The processing module 402 is used to create a monitoring path with a second node in the server cluster; the second node is a node in the server cluster other than the first node.

[0151] The monitoring module 403 is further configured to monitor the notification message of the second node through the monitoring path.

[0152] The sending module 401 is further configured to send a data access request to a third node in the server cluster if a notification message indicating a fault occurs in the first node is monitored; the third node is a node without faults in the server cluster.

[0153] In a possible implementation, the processing module 402 is further used to generate a target signal through a monitoring path if a notification message indicating a fault in the first node is monitored; determine that a fault exists in the first node based on the target signal, and set a target mark, which is used to indicate that the connection between the client and the first node is unavailable.

[0154] The sending module 401 is specifically configured to send a data access request to a third node in the server cluster based on the target tag.

[0155] In one possible implementation, the processing module 402 is specifically used to obtain a node identifier carried in a notification message through a monitoring path; when the node identifier is an identifier of a first node, determine that a fault occurs in the first node through the monitoring path; obtain a target identifier of a target execution unit through the monitoring path, and generate a target signal based on the target identifier, the target execution unit being an execution unit corresponding to a data access request that is in a state of waiting for a response, and the target identifier is used to indicate that the target execution unit is in a state of waiting for a response.

[0156] In a possible implementation, the processing module 402 is further configured to set the state of the target flag bit corresponding to the target execution unit to the first state through the monitoring path.

[0157] In one possible implementation, the processing module 402 is specifically used to obtain the state of a target flag bit corresponding to a target execution unit based on a target signal; when the state of the target flag bit is a first state, control a data access request in a waiting response state to exit the waiting response state, and determine that a fault exists in the first node.

[0158] In a possible implementation, the sending module 401 is specifically used to determine a third node without faults in a pre-stored node status table and establish a connection with the third node; the node status table includes fault status information of each node in the server cluster; and send a data access request to the third node.

[0159] In a possible implementation, the device further includes an updating module 404, and the updating module 404 is configured to update the state of the first node in the node state table to a fault state based on a notification message indicating that the first node has a fault.

[0160] The data access device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be described in detail here.

[0161] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the electronic device 50 provided in this embodiment includes: at least one processor 501 and a memory 502. Optionally, the device 50 also includes a communication component 503. The processor 501, the memory 502 and the communication component 503 are connected via a bus 504.

[0162] In a specific implementation process, at least one processor 501 executes the computer-executable instructions stored in the memory 502, so that at least one processor 501 executes the above method.

[0163] The specific implementation process of the processor 501 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0164] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0165] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.

[0166] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0167] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0168] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.

[0169] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0170] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0171] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0172] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0173] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0174] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0175] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0176] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A data access method, characterized in that: The database system includes a client and a server cluster. The method is applied to the client and includes: Sending a data access request to a first node in the server cluster, and establishing a monitoring path with a second node in the server cluster; the second node is a node in the server cluster other than the first node; monitoring a notification message of the second node through a monitoring path; If a notification message that a fault occurs in the first node is monitored, a data access request is sent to a third node in the server cluster; the third node is a node without faults in the server cluster.

2. The method according to claim 1, characterized in that If a notification message that a fault exists in the first node is monitored, sending a data access request to a third node in the server cluster includes: If a notification message indicating that the first node has a fault is monitored, a target signal is generated through the monitoring path; Determining that the first node has a fault based on the target signal, and setting a target mark, where the target mark is used to indicate that a connection between the client and the first node is unavailable; Based on the target tag, a data access request is sent to the third node in the server cluster.

3. The method according to claim 2, characterized in that Generating a target signal through the monitoring path includes: Acquire the node identifier carried in the notification message through the monitoring path; When the node identifier is the identifier of the first node, determining through the monitoring path that the first node fails; The target identifier of the target execution unit is obtained through the monitoring path, and a target signal is generated based on the target identifier. The target execution unit is an execution unit corresponding to a data access request in a waiting state for a response, and the target identifier is used to indicate that the target execution unit is in a waiting state for a response.

4. The method according to claim 3, characterized in that: The method further comprises: The state of the target flag bit corresponding to the target execution unit is set to a first state through the monitoring path.

5. The method according to claim 4, characterized in that The determining, based on the target signal, that the first node has a fault includes: Based on the target signal, obtaining a state of a target flag bit corresponding to the target execution unit; When the state of the target flag bit is the first state, the data access request in the waiting for response state is controlled to exit the waiting for response state, and it is determined that the first node has a fault.

6. The method according to any one of claims 1 to 5, characterized in that: The sending a data access request to a third node in the server cluster includes: Determine the third node without fault in a pre-stored node status table, and establish a connection with the third node; the node status table includes fault status information of each node in the server cluster; A data access request is sent to the third node.

7. The method according to claim 6, characterized in that The method further comprises: Based on the notification message that the first node has a fault, the state of the first node in the node state table is updated to a fault state.

8. A data access device, characterized in that: include: A sending module, used for sending a data access request to a first node in the server cluster; The server cluster is a cluster in the database system; A processing module, configured to establish a monitoring path with a second node in the server cluster; The second node is a node in the server cluster except the first node; The monitoring module is further used to monitor the notification message of the second node through the monitoring path; The sending module is further configured to send a data access request to a third node in the server cluster if a notification message indicating a fault in the first node is monitored; the third node is a node without fault in the server cluster.

9. An electronic device, comprising: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.