Software defect recovery method, device, computer equipment and storage medium

By allocating the master node and follow-up node in the cluster, filtering and discarding messages that cause application crash, and switching the follow-up node as the main node, the high availability problem of cluster caused by software defects is solved, and the normal progress of message processing is achieved. High availability of clusters.

CN113282334BActive Publication Date: 2025-02-07HUARUI DISTRIBUTED TECHNOLOGY (SHANGHAI) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110630686.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-07
Publication Date
2025-02-07
Estimated Expiration
2041-06-07

AI Technical Summary

Technical Problem

The prior art cannot effectively solve the application crash caused by software defects, especially in cluster environments, which leads to the inability to guarantee the high availability of the cluster.

Method used

By allocating the master node and the follower node in the cluster, when an error occurs in the master node, the target follower node receives error information, filters out the message that causes the error, discards the message, and switches to the master node, and continues to process the message to ensure that the cluster is guaranteed. high availability.

Benefits of technology

It realizes rapid recovery of software defects in the cluster, avoids message processing interruptions, and ensures high availability of the cluster and normal message processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113282334B_ABST
    Figure CN113282334B_ABST
Patent Text Reader

Abstract

The present application relates to a method, device, computer equipment and storage medium for recovering software defects. The method comprises: receiving error information sent by the master node after an error occurs in the operation of a target application; filtering out the target message that causes the target application to run incorrectly from the candidate messages received in advance according to the error information; discarding the target message; switching the target follower node to the current master node in the cluster; receiving new messages through the current master node, and performing message processing on the candidate messages and new messages whose receiving time is after the receiving time of the target message. The use of this method can ensure the high availability of the cluster and solve the problem of automatic recovery of the distributed cluster system in the software defect scenario.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer device and storage medium for recovering software defects. Background Art

[0002] With the development of computer technology, cluster technology has emerged. A cluster is a group of independent computers that are interconnected by a high-speed network. They form a group and are managed in a single system mode. When a client interacts with a cluster, the cluster is like an independent server. Cluster configuration is used to improve availability and scalability. Generally, a high-availability cluster can include multiple servers, each of which runs the same application. The consistency is ensured by state machine replication, that is, by ensuring the same initial state, message input, and deterministic processing to ensure consistent output and internal state. When one of the servers fails, the remaining servers can continue to provide services, thereby achieving high availability of the cluster. However, the state machine replication method cannot solve the application crash caused by software defects. When the application causes an error in processing a message, which in turn causes all applications in the entire cluster to crash, developers need to locate and fix the defects one by one. The message cannot be processed for a long time, and the high availability of the cluster cannot be guaranteed. Summary of the invention

[0003] Based on this, it is necessary to provide a method, apparatus, computer device and storage medium for recovering software defects that can ensure high availability of a cluster in response to the above technical problems.

[0004] A method for recovering software defects is applied to a target follower node in a cluster, wherein the cluster includes a master node and at least one follower node, a target application program is running in the master node and the follower node, and the content and order of messages received by the follower node and the master node are consistent, and the method includes:

[0005] Receiving error information sent by the master node after an error occurs in the running of the target application;

[0006] According to the error information, select the target message causing the target application to run in error from the candidate messages received in advance and not processed;

[0007] discarding the target message;

[0008] Switch the target follower node to the current master node in the cluster;

[0009] A new message is received through the current master node, and message processing is performed on candidate messages whose receiving time is after the receiving time of the target message and the new message.

[0010] In one embodiment, before receiving the error information sent by the master node after the target application program runs into an error, the method further includes:

[0011] Receiving message processing progress information corresponding to the message sent by the master node after processing the message;

[0012] Filtering out messages corresponding to the message processing progress information from pre-received and unprocessed candidate messages;

[0013] Message processing is performed on the message corresponding to the message processing progress information.

[0014] In one of the embodiments, before discarding the target message, the method further includes:

[0015] Close the business processing logic corresponding to the message type of the target message; or,

[0016] Roll back the version of the target application from the current version to the previous version of the current version.

[0017] In one of the embodiments, the cluster further includes at least one standby node. In the event of a failure of the master node, a target standby node among the standby nodes is switched to become the current master node in the cluster.

[0018] A software defect recovery device is applied to a target follower node in a cluster, wherein the cluster includes a master node and at least one follower node, a target application program is running in the master node and the follower node, and the content and order of messages received by the follower node and the master node are consistent, and the device includes:

[0019] A receiving module, used for receiving error information sent by the master node after an error occurs in the operation of the target application;

[0020] A screening module, configured to screen out target messages that cause the target application to run in error from pre-received and unprocessed candidate messages according to the error information;

[0021] A discarding module, used for discarding the target message;

[0022] A switching module, used to switch the target follower node to the current master node in the cluster;

[0023] The processing module is used to receive a new message through the current master node, and perform message processing on candidate messages whose receiving time is after the receiving time of the target message and the new message.

[0024] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:

[0025] Receiving error information sent by the master node after an error occurs in the running of the target application;

[0026] According to the error information, select the target message causing the target application to run in error from the candidate messages received in advance and not processed;

[0027] discarding the target message;

[0028] Switch the target follower node to the current master node in the cluster;

[0029] A new message is received through the current master node, and message processing is performed on candidate messages whose receiving time is after the receiving time of the target message and the new message.

[0030] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0031] Receiving error information sent by the master node after an error occurs in the running of the target application;

[0032] According to the error information, select the target message causing the target application to run in error from the candidate messages received in advance and not processed;

[0033] discarding the target message;

[0034] Switch the target follower node to the current master node in the cluster;

[0035] A new message is received through the current master node, and message processing is performed on candidate messages whose receiving time is after the receiving time of the target message and the new message.

[0036] The above-mentioned software defect recovery method, device, computer equipment and storage medium receive the error information sent by the master node after the target application program runs wrong; based on the error information, filter out the target message that causes the target application program to run wrong from the candidate messages that have been received in advance and not processed; discard the target message; switch the target follower node to the current master node in the cluster; receive new messages through the current master node, and process the candidate messages and new messages whose receiving time is after the receiving time of the target message. In this way, by dividing the nodes into master nodes and follower nodes, when the master node processes a message that triggers the target application program to run wrong, the target follower node can filter out the message that causes the target application program to run wrong, and discard the message, and then the target follower node can replace the master node that runs wrong as the new master node in the cluster, and continue to process messages, ensuring the normal processing of messages, thereby ensuring the high availability of the cluster.

[0037] A method for recovering software defects is applied to a master node in a cluster, wherein the cluster includes a master node and at least one follower node, a target application program is running in the master node and the follower node, and the content and order of messages received by the follower node and the master node are consistent, and the method includes:

[0038] After an error occurs during the operation of the target application, a corresponding error message is generated;

[0039] The error information is sent to a target following node among the following nodes to instruct the target following node to filter out the target message that causes the target application to run incorrectly from the previously received and unprocessed candidate messages according to the error information; discard the target message; switch the target following node to the current master node in the cluster; receive new messages through the current master node, and perform message processing on the candidate messages whose receiving time is after the receiving time of the target message and the new message.

[0040] In one embodiment, after the target application runs into an error and before generating a corresponding error message, the method further includes:

[0041] Obtaining a message and performing message processing on the message;

[0042] After processing the message, generating message processing progress information corresponding to the message;

[0043] The message processing progress information is sent to the target following node to instruct the target following node to filter out messages corresponding to the message processing progress information from pre-received and unprocessed candidate messages; and perform message processing on the messages corresponding to the message processing progress information.

[0044] In one of the embodiments, the cluster further includes at least one standby node. In the event of a failure of the master node, a target standby node among the standby nodes is switched to become the current master node in the cluster.

[0045] A software defect recovery device is applied to a master node in a cluster, the cluster includes a master node and at least one follower node, the master node and the follower node run a target application, the follower node and the master node receive messages with the same content and order, the device includes:

[0046] A generating module, used for generating corresponding error information after an error occurs during the operation of the target application;

[0047] A sending module is used to send the error information to a target following node among the following nodes, so as to instruct the target following node to filter out the target message that causes the target application to run incorrectly from the pre-received and unprocessed candidate messages according to the error information; discard the target message; switch the target following node to the current master node in the cluster; receive new messages through the current master node, and perform message processing on the candidate messages whose receiving time is after the receiving time of the target message and the new message.

[0048] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:

[0049] After an error occurs during the operation of the target application, a corresponding error message is generated;

[0050] The target follower node is instructed to filter out the target message that causes the target application to run incorrectly from the previously received and unprocessed candidate messages according to the error information; discard the target message; switch the target follower node to the current master node in the cluster; receive new messages through the current master node, and perform message processing on the candidate messages whose receiving time is after the receiving time of the target message and the new message.

[0051] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0052] After an error occurs during the operation of the target application, a corresponding error message is generated;

[0053] The error information is sent to a target following node among the following nodes to instruct the target following node to filter out the target message that causes the target application to run incorrectly from the previously received and unprocessed candidate messages according to the error information; discard the target message; switch the target following node to the current master node in the cluster; receive new messages through the current master node, and perform message processing on the candidate messages whose receiving time is after the receiving time of the target message and the new message.

[0054] The above-mentioned software defect recovery method, device, computer equipment and storage medium generate corresponding error information after the target application runs wrong; send the error information to the target follow-up node in the follow-up node to instruct the target follow-up node to filter out the target message that causes the target application to run wrong from the candidate messages that have been received and not processed in advance according to the error information; discard the target message; switch the target follow-up node to the current master node in the cluster; receive new messages through the current master node, and process the candidate messages and the new messages whose receiving time is after the receiving time of the target message. In this way, by dividing the nodes into master nodes and follow-up nodes, when the master node processes a message that triggers the target application to run wrong, the target follow-up node can filter out the message that causes the target application to run wrong and discard the message, and then the target follow-up node can replace the master node that runs wrong as the new master node in the cluster, and continue to process messages, ensuring the normal processing of messages, thereby ensuring the high availability of the cluster. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 This is an application scenario diagram of a method for recovering software defects in one embodiment;

[0056] Figure 2 The figure is a flowchart of a method for recovering software defects in one embodiment;

[0057] Figure 3 is a flowchart of a method for recovering software defects in another embodiment;

[0058] Figure 4 is a structural block diagram of a software defect recovery device in one embodiment;

[0059] Figure 5 is a structural block diagram of a software defect recovery device in another embodiment;

[0060] Figure 6FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0061] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0062] The software defect recovery method provided in this application can be applied to Figure 1 In the application environment shown. The application environment includes a master node 102 and at least one follower node 104. The master node 102 communicates with the follower node 104 through a network. Among them, the follower node 104 can be implemented with an independent server or a server cluster composed of multiple servers. Those skilled in the art can understand that Figure 1 The application environment shown in is only a part of the scenarios related to the present application solution and does not constitute a limitation on the application environment of the present application solution.

[0063] The target follower node 104 receives the error information sent by the master node 102 after an error occurs in the target application program; based on the error information, the target message that causes the target application program to run wrong is screened out from the candidate messages received in advance; the target message is discarded; the target follower node 104 is switched to the current master node in the cluster; new messages are received through the current master node, and message processing is performed on the candidate messages and new messages whose receiving time is after the receiving time of the target message.

[0064] In one embodiment, Figure 2 As shown, a method for recovering software defects is provided, and the method is applied to Figure 1 Taking the target following node 104 in the example as an example, the method includes the following steps:

[0065] S202, receiving error information sent by the master node after an error occurs during the operation of the target application.

[0066] Among them, the master node is the node in the cluster that is currently responsible for providing services to the outside world. The master node can receive messages and process them in real time. The follower node is the node in the cluster whose message processing progress is controlled by the master node. The target follower node is the follower node with the highest priority and in a healthy state in the cluster. It can be understood that the follower node can receive the same message as the master node, but will not automatically process the received message in real time. After processing each message, the master node notifies the follower node to process the corresponding message. Error information is information that carries the message identifier of the message that caused the target application to run incorrectly.

[0067] For example, both the master node and the follower node can receive messages with message sequence numbers 1, 2, and 3, where the message sequence numbers can be incremented in sequence according to the time sequence of receiving the messages. The master node can process the messages with message sequence numbers 1, 2, and 3 in real time. When the master node completes processing the message with message sequence number 1, the master node can notify the follower node to start processing the message with message sequence number 1; when the master node completes processing the message with message sequence number 2, the master node can notify the follower node to start processing the message with message sequence number 2; when the master node completes processing the message with message sequence number 3, the master node can notify the follower node to start processing the message with message sequence number 3, and so on. It can be understood that the master node and the follower node do not process the messages at the same time. The follower node needs to process the corresponding message only after receiving the notification from the master node.

[0068] Specifically, a target application is running in the master node. When the master node processes messages, a message may trigger an error in the target application. It is understandable that when an error occurs in the target application, the process responsible for running the target application will fail. The monitoring process in the master node will monitor the process responsible for running the target application in real time. When the process responsible for running the target application fails, the master node can generate an error message corresponding to the message that caused the failure through the monitoring process, and send the error message to the target follow-up node. The target follow-up node can receive the error message sent by the master node after an error occurs in the target application.

[0069] S204, based on the error information, select the target message that causes the target application to run in error from the candidate messages that are received in advance and not processed.

[0070] The candidate message is a message received by the target follower node before the target application of the master node runs into an error.

[0071] Specifically, the error information may carry the message identifier of the message that caused the target application to run incorrectly. The target follower node may extract the message identifier of the message that caused the target application to run incorrectly from the error information, and filter out the target message corresponding to the message identifier from the candidate messages that have been received and not processed in advance.

[0072] S206: discard the target message.

[0073] Specifically, the target follower node may discard the target message that causes the target application to run in error, that is, the target follower node may skip the target message and not process the target message.

[0074] S208, switching the target follower node to the current master node in the cluster.

[0075] Specifically, after the target application in the master node runs into an error, the master node can no longer provide business services to the target application and is already in a crashed state. At this point, to ensure normal processing of messages, the target follower node can be switched to the current master node in the cluster.

[0076] S210, receiving a new message through the current master node, and performing message processing on candidate messages and new messages whose receiving time is after the receiving time of the target message.

[0077] Specifically, the candidate messages include messages whose receiving time is before the receiving time of the target message, and messages whose receiving time is after the receiving time of the target message. Among them, the messages whose receiving time is before the receiving time of the target message are messages that have been processed by the target follower node. To avoid repeated processing of these messages, after the target follower node switches to the current master node in the cluster, it can directly process the candidate messages whose receiving time is after the receiving time of the target message, and continue to receive new messages and process the new messages.

[0078] In the above software defect recovery method, the error information sent by the master node after the target application program runs wrong is received; according to the error information, the target message that causes the target application program to run wrong is screened out from the candidate messages that have been received and not processed in advance; the target message is discarded; the target follower node is switched to the current master node in the cluster; new messages are received through the current master node, and the candidate messages and new messages whose receiving time is after the receiving time of the target message are processed. In this way, by dividing the nodes into master nodes and follower nodes, when the master node processes a message that triggers the target application program to run wrong, the target follower node can screen out the message that causes the target application program to run wrong, and discard the message, and then the target follower node can replace the master node that runs wrong as the new master node in the cluster, and continue to process messages, ensuring the normal processing of messages, thereby ensuring the high availability of the cluster.

[0079] In one embodiment, before step S202, that is, the step of receiving the error information sent by the master node after an error occurs during the operation of the target application, the above-mentioned software defect recovery method also includes: receiving message processing progress information corresponding to the message sent by the master node after processing the message; filtering out the message corresponding to the message processing progress information from the pre-received and unprocessed candidate messages; and performing message processing on the message corresponding to the message processing progress information.

[0080] The message processing progress information is information indicating the progress of the message processing by the master node.

[0081] Specifically, after processing the message, the master node may generate message processing progress information corresponding to the message, and send the message processing progress information to the target follower node. The target follower node may receive the message processing progress information corresponding to the message sent by the master node after processing the message, and filter out the message corresponding to the message processing progress information from the pre-received and unprocessed candidate messages, and then process the message corresponding to the message processing progress information.

[0082] Optionally, the messages in the master node and the follower node are marked with corresponding continuously increasing message numbers in the order of reception time. After the master node processes a message, it will record the message sequence number of the message as the current message processing progress information of the master node.

[0083] In one embodiment, after becoming the master node, the target follower node may continue to send message processing progress information to other follower nodes in the cluster.

[0084] In the above embodiment, by dividing the nodes into master nodes and follower nodes, the master node is responsible for real-time message processing and external service provision. The follower node is responsible for following the message processing progress of the master node, and processes a message after the master node has processed it, thereby avoiding the crash of all nodes in the cluster when a message triggers an error in the operation of the target application. In this way, the normal processing of messages is guaranteed, thereby ensuring the high availability of the cluster.

[0085] In one embodiment, before step S206, that is, the step of discarding the target message, the above-mentioned software defect recovery method also includes: shutting down the business processing logic corresponding to the message type of the target message; or, rolling back the version of the target application from the current version to the previous version of the current version.

[0086] Specifically, when the target application of the master node fails to run, the target follower node can synchronously block the target message that causes the target application to run incorrectly and submit it to the application layer, where the application layer is used to process the message. When the business processing logic corresponding to the message type of the target message is determined, which may cause the target application to run incorrectly, the target follower node can close the business processing logic corresponding to the message type of the target message. When the current version of the target application is determined, which may cause the target application to run incorrectly, the target follower node can roll back the version of the target application from the current version to the previous version of the current version.

[0087] In the above embodiment, by closing the business processing logic corresponding to the message type of the target message, the target follower node can be prevented from subsequently processing messages of the same message type, or subsequent messages can be processed through the previous version of the current version, thereby avoiding the target follower node from crashing again.

[0088] In one embodiment, the cluster further includes at least one standby node. In the event of a master node failure, a target standby node among the standby nodes is switched to become the current master node in the cluster.

[0089] Among them, the standby node is a node that is completely isomorphic to the primary node, and the content and order of the messages it receives, as well as the progress of processing the messages, are consistent with the content and order of the messages received by the primary node, as well as the progress of processing the messages.

[0090] Optionally, the master node failure may specifically be a software sending failure in the master node, or a hardware failure of the master node itself.

[0091] Optionally, the target standby node can be determined by a pre-stored election configuration file, wherein the election configuration file records the election priority of the standby node. It can be understood that when the master node fails, the standby node with the highest election priority in the election configuration file and in a healthy state can be determined as the target standby node, and then the target standby node is switched to the current master node in the cluster.

[0092] In the above embodiment, in the case of a master node failure, a standby node is selected to switch to the current master node in the cluster, which can ensure normal processing of messages, thereby further ensuring the high availability of the cluster.

[0093] In one embodiment, Figure 3 As shown, a method for recovering software defects is provided, and the method is applied to Figure 1 Taking the master node 102 in the example as an example, the following steps are included:

[0094] S302, after an error occurs during the operation of the target application, a corresponding error message is generated.

[0095] Specifically, the target application is running in the master node. When the master node processes messages, a message may trigger an error in the target application. It is understandable that when the target application fails, the process responsible for running the target application will fail. The monitoring process in the master node will monitor the process responsible for running the target application in real time. When the process responsible for running the target application fails, the master node can generate error information corresponding to the message that caused the failure through the monitoring process.

[0096] S304, sending the error information to the target following node in the following nodes to instruct the target following node to filter out the target message that causes the target application to run incorrectly from the pre-received and unprocessed candidate messages according to the error information; discard the target message; switch the target following node to the current master node in the cluster; receive new messages through the current master node, and process the candidate messages and new messages whose receiving time is after the receiving time of the target message.

[0097] Specifically, the master node may send an error message to the target follower node. The target follower node may receive the error message sent by the master node after the target application program runs in error. The error message may carry the message identifier of the message that causes the target application program to run in error. The target follower node may extract the message identifier of the message that causes the target application program to run in error from the error message, and filter out the target message corresponding to the message identifier from the candidate messages that have been received in advance and not processed. The target follower node may discard the target message that causes the target application program to run in error, that is, the target follower node may skip the target message and not process the target message. After the target application program in the master node runs in error, the master node can no longer provide business services to the target application and is already in a crashed state for the target application program. At this time, in order to ensure the normal processing of the message, the target follower node may switch to the current master node in the cluster. The candidate messages include messages whose receiving time is before the receiving time of the target message and messages whose receiving time is after the receiving time of the target message. Among them, the messages whose receiving time is before the receiving time of the target message are the messages that have been processed by the target follower node. To avoid repeated processing of these messages, after the target follower node switches to the current master node in the cluster, it can directly process the candidate messages whose receiving time is after the receiving time of the target message, and continue to receive new messages and process the new messages.

[0098] In the above embodiment, after the target application program runs into an error, a corresponding error message is generated; the error message is sent to the target following node in the following node to instruct the target following node to filter out the target message that causes the target application program to run into an error from the candidate messages that have been received in advance and not processed according to the error message; the target message is discarded; the target following node is switched to the current master node in the cluster; new messages are received through the current master node, and the candidate messages and new messages whose receiving time is after the receiving time of the target message are processed. In this way, by dividing the nodes into master nodes and following nodes, when the master node processes a message that triggers the target application program to run into an error, the target following node can filter out the message that causes the target application program to run into an error, and discard the message, and then the target following node can replace the master node that runs into an error as the new master node in the cluster, and continue to process messages, thereby ensuring the normal processing of messages and thus ensuring the high availability of the cluster.

[0099] In one embodiment, step S302, that is, before the step of generating a corresponding error message after an error occurs during the operation of the target application, the above-mentioned software defect recovery method also includes: obtaining a message and performing message processing on the message; after performing message processing on the message, generating message processing progress information corresponding to the message; sending the message processing progress information to the target following node to instruct the target following node to filter out the message corresponding to the message processing progress information from the pre-received and unprocessed candidate messages; and performing message processing on the message corresponding to the message processing progress information.

[0100] Specifically, the master node can obtain the message and perform message processing on the message. After the master node processes the message, it can generate message processing progress information corresponding to the message and send the message processing progress information to the target follower node. The target follower node can receive the message processing progress information corresponding to the message sent by the master node after the message processing, and filter out the message corresponding to the message processing progress information from the pre-received and unprocessed candidate messages, and then perform message processing on the message corresponding to the message processing progress information.

[0101] In the above embodiment, by dividing the nodes into master nodes and follower nodes, the master node is responsible for real-time message processing and external service provision. The follower node is responsible for following the message processing progress of the master node, and processes a message after the master node has processed it, thereby avoiding the crash of all nodes in the cluster when a message triggers an error in the operation of the target application. In this way, the normal processing of messages is guaranteed, thereby ensuring the high availability of the cluster.

[0102] In one embodiment, the cluster further includes at least one standby node. In the event of a master node failure, a target standby node among the standby nodes is switched to become the current master node in the cluster.

[0103] In the above embodiment, in the case of a master node failure, a standby node is selected to switch to the current master node in the cluster, which can ensure the normal processing of messages, thereby further ensuring the high availability of the cluster.

[0104] It should be understood that although Figure 2 and Figure 3 The steps are shown in order, but they are not necessarily executed in order. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Figure 2 and Figure 3 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0105] In one embodiment, Figure 4 As shown, a software defect recovery device 400 is provided, which is applied to a target follower node in a cluster, wherein the cluster includes a master node and at least one follower node, the master node and the follower node run a target application, and the content and order of the messages received by the follower node and the master node are consistent. The device includes: a receiving module 401, a screening module 402, a discarding module 403, a switching module 404 and a processing module 405, wherein:

[0106] The receiving module 401 is used to receive error information sent by the master node after an error occurs in the operation of the target application.

[0107] The screening module 402 is used to screen out target messages that cause errors in the operation of the target application from pre-received and unprocessed candidate messages according to the error information.

[0108] The discarding module 403 is used to discard the target message.

[0109] The switching module 404 is used to switch the target follower node to the current master node in the cluster.

[0110] The processing module 405 is used to receive a new message through the current master node, and perform message processing on the candidate messages and the new messages whose receiving time is after the receiving time of the target message.

[0111] In one embodiment, the receiving module 401 is further used to receive message processing progress information corresponding to the message sent by the master node after processing the message. The screening module 402 is further used to screen out the message corresponding to the message processing progress information from the pre-received and unprocessed candidate messages. The processing module 405 is further used to process the message corresponding to the message processing progress information.

[0112] In one embodiment, the discarding module 403 is further used to close the business processing logic corresponding to the message type of the target message; or to roll back the version of the target application from the current version to the previous version of the current version.

[0113] In one embodiment, the cluster further includes at least one standby node. In the event of a master node failure, a target standby node among the standby nodes is switched to become the current master node in the cluster.

[0114] The above-mentioned software defect recovery device receives the error information sent by the master node after the target application program runs wrong; based on the error information, the target message that causes the target application program to run wrong is screened out from the candidate messages that have been received in advance and not processed; the target message is discarded; the target follower node is switched to the current master node in the cluster; new messages are received through the current master node, and the candidate messages and new messages whose receiving time is after the receiving time of the target message are processed. In this way, by dividing the nodes into master nodes and follower nodes, when the master node processes a message that triggers the target application program to run wrong, the target follower node can screen out the message that causes the target application program to run wrong, and discard the message, and then the target follower node can replace the master node that runs wrong as the new master node in the cluster, and continue to process messages, thereby ensuring the normal processing of messages and thus ensuring the high availability of the cluster.

[0115] In one embodiment, Figure 5 As shown, a software defect recovery device 500 is provided, which is applied to a master node in a cluster, wherein the cluster includes a master node and at least one follower node, wherein a target application is running in the master node and the follower node, and the content and order of the messages received by the follower node and the master node are consistent, wherein the device includes: a generating module 501 and a sending module 502, wherein:

[0116] The generating module 501 is used to generate corresponding error information after an error occurs during the operation of the target application.

[0117] The sending module 502 is used to send the error information to the target following node in the following node to instruct the target following node to filter out the target message that causes the target application to run incorrectly from the pre-received and unprocessed candidate messages according to the error information; discard the target message; switch the target following node to the current master node in the cluster; receive new messages through the current master node, and process the candidate messages and new messages whose receiving time is after the receiving time of the target message.

[0118] In one embodiment, the generating module 501 is further used to obtain a message and perform message processing on the message; after performing message processing on the message, message processing progress information corresponding to the message is generated. The sending module 502 is further used to send the message processing progress information to the target following node to instruct the target following node to filter out the message corresponding to the message processing progress information from the candidate messages that have been received and not processed in advance; and perform message processing on the message corresponding to the message processing progress information.

[0119] In one embodiment, the cluster further includes at least one standby node. In the event of a master node failure, a target standby node among the standby nodes is switched to become the current master node in the cluster.

[0120] The above-mentioned software defect recovery device generates corresponding error information after the target application program runs wrong; sends the error information to the target follow-up node in the follow-up node to instruct the target follow-up node to filter out the target message that causes the target application program to run wrong from the candidate messages that have been received in advance and not processed according to the error information; discards the target message; switches the target follow-up node to the current master node in the cluster; receives new messages through the current master node, and processes the candidate messages and new messages whose receiving time is after the receiving time of the target message. In this way, by dividing the nodes into master nodes and follow-up nodes, when the master node processes a message that triggers the target application program to run wrong, the target follow-up node can filter out the message that causes the target application program to run wrong, and discard the message, and then the target follow-up node can replace the master node that runs wrong as the new master node in the cluster, and continue to process messages, ensuring the normal processing of messages, thereby ensuring the high availability of the cluster.

[0121] The specific definition of the software defect recovery device can be found in the definition of the software defect recovery method above, which will not be repeated here. Each module in the above-mentioned software defect recovery device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0122] In one embodiment, a computer device is provided, which may be the above-mentioned Figure 1 The internal structure diagram of the master node 102 or the target follower node 104 in FIG. Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store message processing data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for recovering from software defects is implemented.

[0123] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0124] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the software defect recovery method described above. The steps of the software defect recovery method here may be the steps of the software defect recovery method described in the above embodiments.

[0125] In one embodiment, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the processor executes the steps of the software defect recovery method described above. The steps of the software defect recovery method here can be the steps of the software defect recovery method described in each of the above embodiments.

[0126] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0127] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0128] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for recovering from software defects, characterized in that: The method is applied to a target follower node in a cluster, wherein the cluster includes a master node and at least one follower node, wherein the follower node is a node in the cluster whose message processing progress is controlled by the master node, wherein the master node notifies the follower node to process the message after processing each message, wherein the master node and the follower node run target applications, and the content and order of messages received by the follower node and the master node are consistent, and wherein the method includes: Receiving error information sent by the master node after an error occurs in the running of the target application; According to the error information, select the target message causing the target application to run in error from the candidate messages received in advance and not processed; discarding the target message; Switch the target follower node to the current master node in the cluster; A new message is received through the current master node, and message processing is performed on candidate messages whose receiving time is after the receiving time of the target message and the new message.

2. The method according to claim 1, characterized in that Before receiving the error information sent by the master node after the target application program runs in error, the method further includes: Receiving message processing progress information corresponding to the message sent by the master node after processing the message; Filtering out messages corresponding to the message processing progress information from pre-received and unprocessed candidate messages; Message processing is performed on the message corresponding to the message processing progress information.

3. The method according to claim 1, characterized in that Before discarding the target message, the method further includes: Close the business processing logic corresponding to the message type of the target message; or, Roll back the version of the target application from the current version to the previous version of the current version.

4. The method according to claim 1, characterized in that: The cluster further includes at least one standby node. In the event of a failure of the master node, a target standby node among the standby nodes is switched to be the current master node in the cluster.

5. A method for recovering from software defects, characterized in that: The method is applied to a master node in a cluster, wherein the cluster includes a master node and at least one follower node, wherein the follower node is a node in the cluster whose message processing progress is controlled by the master node, wherein the master node notifies the follower node to process the message after processing each message, wherein the master node and the follower node run target applications, and the content and order of the messages received by the follower node and the master node are consistent, and wherein the method includes: After an error occurs during the operation of the target application, a corresponding error message is generated; The error information is sent to a target following node among the following nodes to instruct the target following node to filter out the target message that causes the target application to run incorrectly from the previously received and unprocessed candidate messages according to the error information; discard the target message; switch the target following node to the current master node in the cluster; receive new messages through the current master node, and perform message processing on the candidate messages whose receiving time is after the receiving time of the target message and the new message.

6. The method according to claim 5, characterized in that After the target application runs into an error, before generating a corresponding error message, the method further includes: Obtaining a message and performing message processing on the message; After processing the message, generating message processing progress information corresponding to the message; The message processing progress information is sent to the target following node to instruct the target following node to filter out messages corresponding to the message processing progress information from pre-received and unprocessed candidate messages; and perform message processing on the messages corresponding to the message processing progress information.

7. The method according to claim 5, characterized in that The cluster further includes at least one standby node. In the event of a failure of the master node, a target standby node among the standby nodes is switched to be the current master node in the cluster.

8. A software defect recovery device, characterized in that: The device is applied to a target follower node in a cluster, wherein the cluster includes a master node and at least one follower node, wherein the follower node is a node in the cluster whose message processing progress is controlled by the master node, wherein the master node notifies the follower node to process the message after processing each message, wherein the master node and the follower node run target applications, and the content and order of the messages received by the follower node and the master node are consistent, and wherein the device includes: A receiving module, used for receiving error information sent by the master node after an error occurs in the operation of the target application; A screening module, configured to screen out target messages that cause the target application to run in error from pre-received and unprocessed candidate messages according to the error information; A discarding module, used for discarding the target message; A switching module, used to switch the target follower node to the current master node in the cluster; The processing module is used to receive a new message through the current master node, and perform message processing on candidate messages whose receiving time is after the receiving time of the target message and the new message.

9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Method for ensuring data consistency and related equipment

    CN112749178A