State check method, device, storage medium, and program product
By generating summary information at the data set object level in a distributed system and using the control node to perform state consistency verification, the problem of high resource overhead in existing technologies is solved, and efficient state consistency verification is achieved.
Patent Information
- Application Number
- PCT/CN2025/101746
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-07-09
- Filing Date
- 2025-06-18
- Publication Date
- 2026-01-15
AI Technical Summary
In distributed systems, existing state consistency verification schemes suffer from high resource overhead, leading to inconsistencies in the states of multiple nodes and causing data errors.
By using dataset objects as the verification granularity, summary information reflecting the structural size of dataset objects is generated, and state consistency verification is performed through control nodes, reducing computational load and resource overhead.
This achieves state consistency verification across multiple member nodes while saving computation, reducing resource consumption, and avoiding data inconsistency issues.
Smart Images

Figure CN2025101746_15012026_PF_FP_ABST
Abstract
Description
Status verification methods, devices, storage media and program products
[0001] This disclosure claims priority to Chinese Patent Application No. 202410920833.3, filed with the China Patent Office on July 9, 2024, entitled “Status Verification Method, Apparatus, Storage Medium and Program Product”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This disclosure relates to the field of distributed technology, and in particular to a status verification method, device, storage medium, and program product. Background Technology
[0003] In distributed systems, to achieve high availability, a replicated state machine mechanism is generally used to implement multiple nodes. These nodes have the same state, run the same deterministic state machine, and work together. If one node fails, the system can switch to another node without affecting the overall availability of the system.
[0004] The RAFT distributed consensus algorithm can be used to maintain the consistency of the state machine among multiple nodes. That is, the elected leader node is responsible for handling client requests and replicating the logs corresponding to client requests to other nodes, and ensuring that each log is persisted. Each node executes the same logs in sequence, eventually reaching the same state.
[0005] In practical applications, inconsistencies in the states of multiple nodes often occur due to factors such as code defects (bugs) and different program versions, leading to serious problems such as data errors. To address this, a scheme is proposed to perform state consistency verification on multiple nodes during their operation, enabling timely detection of inconsistencies and prompt recovery of erroneous data.
[0006] The commonly used state consistency verification scheme is to calculate the CRC (Cyclic Redundancy Check) value of each memory data generated by each node after executing the same log, and then compare the CRC values of each memory data to see if they are consistent, thus achieving the purpose of verifying the state consistency of multiple nodes. However, this scheme has the drawback of high resource overhead. Summary of the Invention
[0007] This disclosure provides a state verification method, device, storage medium, and program product to reduce the resource overhead of performing state consistency verification on multiple member nodes in a distributed system.
[0008] This disclosure provides a state verification method applied to a leader node among multiple member nodes in a distributed system. The method includes: responding to a state verification trigger event; determining at least one first target dataset object from the memory state after executing a first target transaction log, wherein the memory state includes multiple dataset objects, and each dataset object is a data structure that organizes memory data; generating summary information of the at least one first target dataset object as the first state verification information of the leader node, using the dataset object as the verification granularity, wherein the summary information reflects the structural size of the corresponding first target dataset object; and providing the first state verification information of the leader node to a control node, so that the control node can perform state consistency verification on the multiple member nodes based on the first state verification information of the leader node and the non-leader nodes among the multiple member nodes.
[0009] This disclosure also provides a state verification method applied to a leader node among multiple member nodes in a distributed system. The method includes: responding to a state verification trigger event; determining at least one first target dataset object from the memory state after executing a first target transaction log, wherein the memory state includes multiple dataset objects, and the dataset object is a data structure that organizes memory data; generating summary information of the at least one first target dataset object as the first state verification information of the leader node, using the dataset object as the verification granularity; receiving first state verification information sent by non-leader nodes among the multiple member nodes; and performing state consistency verification on the multiple member nodes based on the first state verification information of the leader node and the non-leader nodes.
[0010] This disclosure also provides a state verification method applied to a non-leader node among multiple member nodes in a distributed system. The method includes: responding to a state verification trigger event; determining at least one first target dataset object from the memory state after executing a first target transaction log, wherein the memory state includes multiple dataset objects, and the dataset object is a data structure that organizes memory data; generating summary information of the at least one first target dataset object as the first state verification information of the non-leader node, using the dataset object as the verification granularity, the summary information reflecting the structural size of the corresponding first target dataset object; and providing the first state verification information of the non-leader node to a control node or a leader node among the multiple member nodes, so that the control node or the leader node can perform state consistency verification on the multiple member nodes based on the first state verification information of the non-leader node and the leader node.
[0011] This disclosure also provides a state verification method applied to a control node. The method includes: obtaining first state verification information of a leader node and a non-leader node among multiple member nodes in a distributed system; and performing state consistency verification on the multiple member nodes based on the first state verification information of the leader node and the non-leader node. The first state verification information is summary information of at least one first target dataset object generated by the leader node or the non-leader node. The at least one first target dataset object is determined from the memory state after the execution of a first target transaction. The memory state includes multiple dataset objects, and each dataset object is a data structure that organizes memory data.
[0012] This disclosure also provides an electronic device, including: a memory and a processor; the memory is used to store a computer program, and the processor is coupled to the memory and used to execute the computer program to implement the steps in the above-described method.
[0013] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, enables the processor to perform the steps in the methods described above.
[0014] This disclosure also provides a computer program product, which includes a computer program / instructions that, when executed by a processor, enable the processor to perform the steps described in the method embodiments above.
[0015] In this embodiment of the disclosure, during the state consistency verification of member nodes in a distributed system, a first target dataset object for state verification is determined from the memory state after executing the first target transaction log; a summary information reflecting the structural size of the first target dataset object is generated using the dataset object as the verification granularity; and state consistency verification is performed on each member node based on the summary information. Since the state consistency verification process uses summary information reflecting the structural size of the dataset object, and the verification granularity is the dataset object itself, rather than the memory data contained in the dataset, it saves computation and reduces overhead while simultaneously performing state consistency verification on multiple member nodes. Attached Figure Description
[0016] The accompanying drawings, which are included to provide a further understanding of this disclosure and form part of this disclosure, illustrate exemplary embodiments of the present disclosure and are used to explain the disclosure, but do not constitute an undue limitation of the disclosure. In the drawings:
[0017] Figure 1 is a schematic diagram of the structure of a distributed system provided in an exemplary embodiment of the present disclosure;
[0018] Figure 2 is a schematic diagram of the structure of another distributed system provided by an exemplary embodiment of the present disclosure;
[0019] Figure 3 is a flowchart illustrating a state verification method provided in an exemplary embodiment of this disclosure;
[0020] Figure 4 is a flowchart illustrating another state verification method provided by an exemplary embodiment of this disclosure;
[0021] Figure 5 is a flowchart illustrating yet another exemplary embodiment of the present disclosure of a state verification method;
[0022] Figure 6 is a schematic diagram of the structure of another distributed system provided by an exemplary embodiment of the present disclosure;
[0023] Figure 7 is a flowchart illustrating another state verification method provided in yet another exemplary embodiment of this disclosure;
[0024] Figure 8 is a flowchart illustrating yet another exemplary embodiment of the present disclosure of a state verification method;
[0025] Figure 9 is a schematic diagram of the structure of an electronic device provided in another exemplary embodiment of this disclosure. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this disclosure clearer, the technical solutions of this disclosure will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.
[0027] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, and displayed data) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use, and processing of such data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding access points are provided for users to choose to authorize or refuse. In addition, the various models involved in this disclosure (including but not limited to language models or large models) comply with relevant laws and standards.
[0028] There is a significant resource overhead when performing state consistency verification on multiple member nodes in a distributed system. To address this issue, in this embodiment, during the state consistency verification process, the dataset objects in the memory of each member node are used as the verification granularity to generate summary information reflecting the structural size of the dataset objects; state consistency verification is then performed on each member node based on this summary information. Since the state consistency verification process uses summary information reflecting the structural size of the dataset objects, and the verification granularity is the dataset objects themselves, rather than the in-memory data contained in the dataset, this approach saves computational resources and reduces overhead while simultaneously performing state consistency verification on multiple member nodes.
[0029] The technical solutions provided by the embodiments of this disclosure are described in detail below with reference to the accompanying drawings.
[0030] Figure 1 is a schematic diagram of the structure of a distributed system provided in an exemplary embodiment of this disclosure. As shown in Figure 1, the distributed system 100 includes multiple member nodes. Each member node can be any electronic device with computing and communication capabilities, such as computers, mobile phones, tablets, and other terminal devices; it can also be traditional servers, cloud servers, server clusters, or workstations; or it can be virtual machines, containers, or various cloud computing instances, etc., without limitation. Furthermore, depending on the service types and functions provided by the distributed system, the implementation form and functions of the member nodes will vary, without limitation.
[0031] In this embodiment, the distributed system 100 can be, but is not limited to, a distributed storage system, a distributed message queue system, a distributed configuration management system, or a distributed metadata management system, etc. For example, in some storage systems, to address the reliability issue of metadata, multiple metadata servers are used for redundant management of metadata. These multiple metadata servers can form a distributed metadata management system. The distributed system in this embodiment can be implemented as a distributed metadata management system. In this case, the member nodes can be metadata servers within the distributed metadata management system, and the metadata servers are used to manage metadata. Alternatively, if the distributed system in this embodiment is implemented as a distributed storage system, the member nodes can be storage servers or storage nodes within the distributed storage system, and the storage servers or storage nodes are used for data storage.
[0032] In this embodiment, multiple member nodes employ a replicated state machine mechanism. Each member node runs its own state machine, maintaining state consistency across all member nodes. This achieves the goal of storing the same data on different member nodes in a redundant manner with multiple replicas. In this embodiment, the multiple member nodes are divided into a leader node 101 and non-leader nodes 102, as shown in Figure 1. Leader node 101 is used as an example, and the other member nodes are non-leader nodes 102. Leader node 101 and non-leader nodes 102 work collaboratively. In the event of a failure of leader node 101, the system can switch to non-leader node 102, at which point the non-leader node will be re-designated as the leader node.
[0033] In this embodiment, the RAFT distributed consensus algorithm is used to maintain the consistency of the state machine. The leader node 101 handles client requests, which contain a command that needs to be executed by the replicated state machine. The leader node writes this command as a new log entry to its log file and replicates the corresponding log entry to the non-leader nodes 102. Upon receiving the log entry, the non-leader nodes 102 write it to their local log file and send a success message back to the leader node 101. When the leader node 101 receives success messages from a majority of the non-leader nodes 102, it determines that the log entry has been successfully replicated to a majority of the non-leader nodes 102. In other words, the log entry has been successfully replicated and can be executed and applied to the state machine. This situation can also be referred to as consensus between the leader node 101 and the non-leader nodes 102 regarding the log entry. It should be noted that this embodiment does not limit the number of "a majority of the non-leader nodes 102," for example, it could be more than half of the non-leader nodes or more than a certain predetermined proportion of non-leader nodes. Upon reaching a consensus, leader node 101 applies the log entry to its own state machine to update the state and returns the execution result to the client; it also notifies non-leader node 102 to apply the log entry. The order in which leader node 101 applies the log entry and notifies non-leader node 102 to apply it is not limited; they can be executed in any order or in parallel. For non-leader node 102, upon receiving the notification, it determines that the log entry can be executed, and then executes it at an appropriate time based on its order in the local log file. This mechanism ensures that the log entry is executed only if it has been successfully replicated by a majority of member nodes, which helps guarantee state consistency among a majority of member nodes.
[0034] In this system, the leader node 101 is responsible for handling client requests and log replication, maintaining state consistency among member nodes. If the leader node 101 becomes unavailable, maintaining state consistency among member nodes becomes difficult. Therefore, when the leader node 101 is unavailable, a new leader node 101 can be elected from among multiple non-leader nodes 102. In this embodiment, a heartbeat mechanism is used to trigger the election of the leader node 101. The leader node 101 periodically sends heartbeat messages to all non-leader nodes 102 to maintain its leader node status. If any non-leader node 102 does not receive a heartbeat message within a predetermined number of periods (e.g., one period), it considers there to be no available leader node 101. In this case, the non-leader node 102 becomes a candidate node and sends an election notification to other non-leader nodes 102 to initiate the election of a new leader node. For any non-leader node 102, it may receive election notifications from one or more other non-leader nodes 102. Based on a certain election strategy, a new leader node is selected from the other non-leader nodes 102 that sent the election notifications. The selected new leader node is then sent to the other non-leader nodes 102 according to the voting results. The non-leader node 102 that sent the election notifications can receive the voting results from the other non-leader nodes 102 and summarize the candidate node with the most votes. This candidate node then becomes the new leader node 101.
[0035] It should be noted that, in this embodiment, member nodes are logically divided into three states: leader node, non-leader node, and candidate node. The state of a member node can change dynamically at different times, and there is no restriction on this.
[0036] The above embodiments describe how a replicated state machine maintains state consistency among member nodes by having each node execute the same log entries. However, in practical applications, due to factors such as code defects or different program versions, inconsistencies may arise between multiple member nodes, leading to serious problems such as data errors.
[0037] To address the issue of inconsistent states among multiple member nodes in the aforementioned distributed system, this disclosure provides several state verification methods. These methods not only enable state consistency verification across multiple member nodes but also offer the advantage of low overhead. The various state verification methods will be described in detail below, in conjunction with the corresponding distributed system architecture.
[0038] In a state verification method A1, it can be implemented based on the architecture of the distributed system 300 shown in Figure 2. The distributed system 300 adds a control node 103 on top of the distributed system 100 shown in Figure 1. The control node 103 is responsible for assisting the leader node 101 and non-leader nodes 102 in performing state consistency verification.
[0039] The state verification method A1 is described from the perspective of the leader node among the multiple member nodes in the distributed system, as shown in Figure 3. The method includes:
[0040] S301: Response status verification trigger event, determine at least one first target dataset object from the memory state after executing the first target transaction log. The memory state includes multiple dataset objects. A dataset object is a data structure that organizes memory data in memory.
[0041] S302: Using the dataset object as the verification granularity, generate summary information of at least one first target dataset object as the first state verification information of the leader node. The summary information reflects the structural size of the corresponding first target dataset object.
[0042] S303: Provide the first state verification information of the leader node to the control node so that the control node can perform state consistency verification on multiple member nodes based on the first state verification information of the leader node and the non-leader nodes among the multiple member nodes.
[0043] The state verification method A1 is described from the perspective of the non-leader node among the multiple member nodes in the distributed system, as shown in Figure 4. The method includes:
[0044] S401: Response status verification trigger event, determine at least one first target dataset object from the memory state after executing the first target transaction log. The memory state includes multiple dataset objects. A dataset object is a data structure that organizes memory data in memory.
[0045] S402: Using the dataset object as the verification granularity, generate summary information of at least one first target dataset object as the first state verification information of the non-leader node. The summary information reflects the structural size of the corresponding first target dataset object.
[0046] S403: Provide the first state verification information of the non-leader node to the control node so that the control node can perform state consistency verification on multiple member nodes based on the first state verification information of the non-leader node and the leader node.
[0047] The state verification method A1 is described from the perspective of the control nodes included in the distributed system, as shown in Figure 5. The method includes:
[0048] S501: Obtain the first state verification information of the leader node and non-leader node among multiple member nodes in a distributed system;
[0049] S502: Based on the first state verification information of the leader node and the non-leader node, perform state consistency verification on multiple member nodes; wherein, the first state verification information is the summary information of at least one first target dataset object generated by the leader node or the non-leader node, and the at least one first target dataset object is determined from the memory state after the execution of the first target transaction day, the memory state includes multiple dataset objects, and the dataset object is a data structure that organizes memory data in memory.
[0050] In state verification method A1, the state verification trigger events can be the same or different for the leader node and non-leader nodes. The function of the state verification trigger event is to trigger the leader node and non-leader nodes to perform state consistency verification. Additionally, the state verification trigger event also allows the leader node and non-leader nodes to determine the first target transaction log and at least one first target dataset object. The first target transaction log is the transaction log that the leader node and non-leader nodes need to execute. It is the transaction log used to identify the starting point for the leader node and non-leader nodes to perform state consistency verification. For ease of distinction and description, it is called the first target transaction log. There are no restrictions on how the first target transaction log is determined.
[0051] For both leader and non-leader nodes, if a state consistency check is determined to be performed, it will be conducted on the memory state generated after the execution of the first target transaction log. If the transaction logs executed by the leader and non-leader nodes, the order of execution, and the results are all identical, theoretically their memory states should be the same. However, due to various factors, their memory states may differ. The memory state refers to the data state generated in memory after each member node executes its transaction log. This memory state dynamically changes as the transaction logs are continuously executed. The memory state includes one or more dataset objects. A dataset object is a dataset generated by organizing and managing memory data according to a certain data structure. It can also be another name for the data structure used for data organization and management in memory. A dataset object can be, but is not limited to, linked lists, tables, or arrays in memory. In this embodiment, state consistency checks can be performed based on all dataset objects in the memory state of each member node, or based on a portion of the dataset objects. Regardless of whether it is partial or complete, the dataset object required for the state consistency check is called the first target dataset object. The first target dataset object can be one or more (i.e., at least one). The method for determining the first target dataset object is not limited.
[0052] In this embodiment, the initiator of the status verification trigger event is not limited. For example, it can be initiated by the control node 103, or by the leader node under certain conditions. Figure 2 illustrates an example of the control node 103 initiating the status verification trigger event. The specific implementation of the status verification trigger event and the determination methods of the first target transaction log and the first target dataset object are illustrated below:
[0053] In an optional embodiment A1, the leader node can periodically initiate state consistency checks according to a set time period. The arrival of the time period can then serve as the state check trigger event for the leader node. In this implementation, the last executed transaction log before the period arrival event can also be used as the first target transaction log. Furthermore, in this implementation, when the period arrives, the leader node can also notify non-leader nodes to perform state consistency checks; the notification method is not limited, and this notification event can serve as the state check trigger event for the non-leader nodes. In this optional embodiment, the method for determining the first target dataset object is not limited.
[0054] In an optional embodiment A2, the leader node can monitor the number of executed transaction logs and whether the number of executed transaction logs has reached a set number. After detecting that the number of executed transaction logs has reached the set number, the leader node recounts the executed transaction logs. Whenever the number of executed transaction logs reaches the set number, a state consistency check is triggered, and the event indicating that the number of executed transaction logs has reached the set number serves as the leader node's state check trigger event. In this implementation, when the number of executed transaction logs reaches the set number, the leader node uses the last executed transaction log among the monitored set number of executed transaction logs as the first target transaction log. Furthermore, in this implementation, when the leader node detects that the number of executed transaction logs has reached the set number, it can also notify non-leader nodes to perform a state consistency check. The notification method is not limited, and this notification event can serve as the non-leader node's state check trigger event. In this optional embodiment, the method for determining the first target dataset object is not limited.
[0055] In an optional embodiment A3, the control node 103 sends a first verification request to both the leader node and non-leader nodes after certain conditions are met, triggering state consistency verification by both nodes. For example, the control node may periodically send the first verification request to both the leader node and non-leader nodes; or, it may send the first verification request to both the leader node and non-leader nodes when a change in the number of member nodes in the distributed storage system is detected. In this implementation, the state verification trigger event is the same for both the leader node and non-leader nodes: receiving the first verification request. The first verification request includes an identifier for a first target transaction log, which can be implemented as a log ID, allowing the leader node to determine which transaction log to execute before performing state consistency verification. In this optional embodiment, the method for determining the first target dataset object is not limited.
[0056] In an optional embodiment A4, the control node sends a first verification request to the leader node (as shown in ① of Figure 2) after certain conditions are met, triggering the leader node to perform a state consistency check. For example, the control node can periodically send the first verification request to the leader node; or, it can send the first verification request to the leader node when it detects a change in the number of member nodes in the distributed storage system. The first verification request includes an identifier of a first target transaction log, which the leader node uses to determine which transaction log to execute before performing the state consistency check. In this embodiment, the event of receiving the first verification request can serve as the leader node's state check trigger event. In this implementation, upon receiving the first verification request, the leader node can also notify non-leader nodes to perform state consistency checks; the notification method is not limited, and this notification event can serve as the non-leader node's state check trigger event. In this optional embodiment, the method for determining the first target dataset object is not limited.
[0057] In the optional embodiments A1, A2, and A4 above, one implementation method B1 for the leader node to notify non-leader nodes to perform state consistency verification includes: the leader node, in response to a state verification trigger event (the state verification trigger event varies in different optional embodiments, see the description above), generates a first verification log, writes the first verification log to the leader node's log file, and synchronizes the first verification log to the non-leader node's log file (as shown in ③ of Figure 2). The event of receiving the first verification log can then serve as the state verification trigger event for the non-leader node. Wherein, whether it is the leader node or a non-leader node, the first verification log is located after the first target transaction log in the log file, and is the next log to be executed after the first target transaction log. In this embodiment, the function of the first verification log is to instruct each member node to generate summary information of at least one first target dataset object with the dataset object as the verification granularity, so as to facilitate state consistency verification of each member node. When synchronizing the first verification log to the log files of non-leadership nodes, a non-leadership node that successfully receives and writes the first verification log to its log file can return a success message to the leader node. The leader node can receive the success messages from the non-leadership nodes, and when the number of received success messages exceeds a set threshold, it determines that the first verification log has reached consensus between the leader and non-leadership nodes; that is, both the leader and non-leadership nodes can execute the first verification log. This set threshold can be half or more of the number of member nodes, and is not limited thereto. Furthermore, when the first verification log reaches consensus between the leader and non-leadership nodes, both the leader and non-leadership nodes can each determine at least one first target dataset object from the memory state after executing the first target transaction log. In this optional embodiment, the method for determining the first target dataset object is not limited.
[0058] The following methods can be used to confirm the first target dataset object:
[0059] Method 1: By default, all dataset objects in the memory state can be used as the first target dataset object. This method applies to embodiments A1-A4 above. Method 2: Based on embodiments A3 and A4 above, the first verification request may further include identification information of the first target dataset object or dataset object description information used to determine the first target dataset object. That is, the first target dataset object used for state consistency verification is specified by the control node 103, which can be all dataset objects in the memory state or a portion of the dataset objects. Method 3: Based on embodiments A1, A2, and A3 above, the leader node can determine the first target dataset object used for state consistency verification. This can be all dataset objects in the memory state or a portion of the dataset objects; and carry the identification information of the first target dataset object or condition information used to determine the first target dataset object in the first verification log, so that non-leader nodes can determine the first target dataset object accordingly. Each dataset object in the memory state has unique identification information, and the dataset object can be uniquely identified based on the identification information. If the first verification request or the first verification log contains dataset object description information used to determine the first target dataset object, multiple dataset objects in the memory state are filtered according to the dataset object description information to obtain the first target dataset object. The specific content of the dataset object description information is not limited; for example, it could be a recently updated dataset object; it could also be a dataset object containing a specific field; or it could be the creation time of the dataset object, etc.
[0060] Further optionally, if the first verification request or the first verification log contains dataset object description information, the dataset object description information can be explicitly included. In this case, the dataset object description information can be implemented as the identifier of the dataset object or the selection condition of the dataset object; or, the dataset object description information can be implicitly included. In this case, it means that no identifier of any dataset object or selection condition of the dataset object is included, which means that all dataset objects are used as the first target dataset object by default.
[0061] Regardless of which method is used to determine the first target transaction log and the first target dataset object, based on this, the leader node and non-leadership nodes each generate at least one summary information corresponding to the first target dataset object, using the dataset object as the verification granularity. The summary information of the at least one first target dataset object generated by the leader node serves as the leader node's first state verification information; the summary information of the at least one first target dataset object generated by the non-leadership node serves as the non-leadership node's first state verification information. Each summary information reflects the structural size of its corresponding first target dataset object, simply put, it reflects the amount of data contained in the first target dataset object. When calculating the summary information, the calculation is mainly based on the structural size of the dataset object. Here, structural size describes the scale and complexity of the dataset object, not its actual storage size in memory. The meaning of structural size will differ for different types of dataset objects. Furthermore, the first target dataset object in this embodiment can include dataset objects of the same type or different types; this is not limited. Further optionally, the following describes the meaning of structural size and how to calculate summary information, using the example of the first target dataset object in this embodiment including a data table and / or array.
[0062] In one optional embodiment, taking a dataset object as an example, a data table is a data structure used to manipulate and store two-dimensional data. It organizes data in rows and columns, and its structural size can be represented by the number of rows and / or columns. The number of rows represents the number of records in the table and can be used to measure the amount of data in the table; the number of columns represents the number of fields in the table and can be used to measure the complexity of the table structure. The number of rows and columns reflects the size and complexity of the data table. Based on this, if at least one first target dataset object includes a first target dataset object implemented as a data table, the structural size of the data table can be calculated when generating summary information. The structural size of the data table can be characterized by the number of rows and / or columns. Therefore, summary information can be calculated based on the number of rows and / or columns of the data table. Here, the structural size of the data table is not its actual storage size, but rather the result of mathematical operations on the number of rows, columns, or the number of rows and columns (e.g., the number of elements multiplied by rows and columns) to characterize the structural size of the data table. The result of mathematical operations on the number of rows, columns, or the number of rows and columns is used as the summary information of the data table.
[0063] In another optional embodiment, taking a dataset object as an array as an example, an array is an ordered sequence of elements, a data structure composed of a collection of elements of the same type, such as a one-dimensional array and a multi-dimensional array. The structural size of an array can be represented using dimensions and shape; dimension refers to the number of nested levels of the array; shape refers to the size of the array in each dimension, i.e., the number of elements included in each dimension. Based on this, if at least one first target dataset object includes a first target dataset object implemented as an array, the structural size of the array can be calculated when generating summary information. The structural size of the array can be characterized by its dimensions and / or shape. Therefore, summary information can be calculated based on the dimensions and / or shape of the array. Further optionally, the structural size of the array can be characterized by statistically analyzing the array's dimensions, shape, or the result of mathematical operations between dimensions and shape (e.g., the number of elements multiplied by the dimension and shape), and the array's dimensions, shape, or the result of mathematical operations between dimensions and shape can be used as the summary information of the array.
[0064] It should be noted that in this embodiment, when calculating the summary information reflecting the structural size of the dataset object at the verification granularity (as shown in ② of Figure 2), the calculation is performed on the structural size of the dataset object, without involving the calculation of the memory data itself or the actual storage size of the dataset object. Therefore, computational load can be saved and overhead reduced.
[0065] Furthermore, both the non-leadership node and the leader node use the summary information of at least one first target dataset object as their respective first state verification information. The non-leadership node sends its first state verification information to the leader node (as shown in ④ of Figure 2). The leader node provides both its own first state verification information and that of the non-leadership node to the control node (as shown in ⑤ of Figure 2), so that the control node can perform state consistency verification on multiple member nodes based on the first state verification information of the leader node and the non-leadership node among the multiple member nodes (as shown in ⑥ of Figure 2).
[0066] For the control node, it can obtain the first state verification information of the leader node and the first state verification information of the non-leader node; and perform state consistency verification on the leader node and the non-leader node based on the first state verification information of the leader node and the non-leader node. Figure 2 only shows one implementation of the control node obtaining the first state verification information of the leader node and the non-leader node, and is not limited to this. For example, in an optional embodiment, the control node directly collects the first state verification information from each member node, that is, the leader node and the non-leader node respectively send their respective first state verification information to the leader node. Where the leader node is responsible for receiving the first state verification information sent by the non-leader node, it can use either a Pull or Push method. In the Pull method, the leader node actively pulls the first state verification information from the non-leader node through the API (application programming interface) provided by the non-leader node; in the Push method, the non-leader node periodically pushes the first state verification information to the leader node. Optionally, when the control node directly collects the first state verification information from each member node, either Pull or Push can be used. In the Pull method, the control node actively pulls the first state verification information from each member node through the API provided by each member node. In the Push method, each member node periodically pushes the first state verification information to the control node so that the control node can perform state consistency verification on each member node based on the first state verification information.
[0067] Having obtained the first state verification information of the leader node and the non-leader node, the control node can compare the summary information of the same first target dataset objects from each member node. Based on the comparison results of the summary information of each first target dataset object, it determines whether multiple member nodes have passed the state consistency check. The specific implementation of determining whether multiple member nodes have passed the state consistency check based on the comparison results of the summary information of each first target dataset object can be flexibly set according to the application scenario. For example, multiple member nodes can be considered to have passed the state consistency check if the summary information of all first target dataset objects is the same for each member node; otherwise, they are considered to have failed the state consistency check. Alternatively, multiple member nodes can be considered to have passed the state consistency check if the summary information of most first target dataset objects is the same for each member node; otherwise, they are considered to have failed the state consistency check. Here, "most" can refer to more than half of the first target dataset objects.
[0068] Furthermore, to facilitate the comparison of state verification information, when generating summary information for at least one first target dataset object, this summary information is associated with the log number of the first target transaction log. The corresponding summary information can be uniquely identified based on this log number. Since different summary information is generated after the execution of transaction logs with the same log number, different member nodes should have the same memory state when executing transaction logs with the same log number, and the summary information generated based on the same memory state should also be the same. Therefore, during state consistency verification, summary information with the same log number among different member nodes can be compared. If they are the same, it indicates state consistency; if they are different, it indicates inconsistency. Additionally, if the log numbers corresponding to the summary information are different, no comparison is required.
[0069] When member nodes execute transaction logs according to the log order in the log file, the execution time of each member node is not strictly consistent; that is, the execution time of transaction logs with the same log number may differ on different member nodes. To enable comparison of transaction logs with the same log number, optionally, summary information can be collected from each member node at preset intervals. These preset intervals are used to compensate for the time differences in execution among different member nodes, thereby enabling comparison of each transaction log with the same log number.
[0070] In this embodiment of the disclosure, during the state consistency verification of member nodes in a distributed system, a first target dataset object for state verification is determined from the memory state after executing the first target transaction log; summary information reflecting the structural size of the first target dataset object is generated using the dataset object as the verification granularity; and the control node performs state consistency verification on each member node based on the summary information. Since the state consistency verification process uses summary information reflecting the structural size of the dataset object, and the verification granularity is the dataset object itself, rather than the memory data contained in the dataset, it saves computation and reduces overhead while performing state consistency verification on multiple member nodes. Furthermore, by introducing the control node for state consistency verification, it does not burden the member nodes.
[0071] In the above embodiments, a state verification method A1 is introduced. This method introduces the concepts of verification logs and transaction logs. The verification log is different from the transaction log. The verification log instructs each member node to generate summary information for at least one first target dataset object, using the dataset object as the verification granularity, for state consistency verification. The verification log can be used to determine the location of the transaction log executed by the member node. Executing the verification log does not modify the memory data, while executing the transaction log typically modifies the memory data.
[0072] In this embodiment, besides being written to a log file, each member node can also periodically or on-demand persist the transaction log, transferring it from the log file to a local or remote persistent storage medium. During the persistent storage process, the transaction log can be serialized into a persistent format (such as a string) and then persistently stored. If a member node restarts due to a power outage, the serialized transaction log stored in the persistent storage medium can be deserialized, and the deserialized log can be added to the log file, thus obtaining the transaction log state of the member node before the power outage. Furthermore, to reduce recovery time, checkpoints are created to record the positions where transaction logs are persisted. This allows recovery to begin from the corresponding checkpoint position as needed, without needing to recover all transaction logs. The checkpoint mechanism significantly reduces the number of logs that need to be recovered during fault recovery, improving recovery efficiency.
[0073] In the above embodiments, the method of performing state consistency verification based on generated digest information is emphasized. Since the generation of digest information does not involve calculations on the memory data itself, nor on the actual storage size of the dataset object, computational load can be saved and overhead reduced. Simultaneously, by comparing whether the digest information generated by each member node is consistent, the purpose of performing state consistency verification on multiple member nodes can be achieved.
[0074] Furthermore, this embodiment also provides a state verification method A2. State verification method A2 is described from the perspective of a leader node or non-leader node among multiple member nodes in a distributed system. The method includes: in the case of executing a second target transaction log, determining a second target dataset object updated by the second target transaction log and the updated target memory data within the second target dataset object; wherein, the second target transaction log is a transaction log that requires memory data verification by the leader node and non-leader node; generating a target verification value corresponding to the second target dataset object based on the target memory data, as the second state verification information of the leader node or non-leader node; and reporting the second state verification information of the leader node or non-leader node to the control node, so that the control node can perform state consistency verification on multiple member nodes based on the second state verification information of the leader node and non-leader node.
[0075] The second target transaction log can be one or more, and can be all transaction logs in memory or a portion of them; there is no limitation on this. The second target transaction log can be flexibly determined based on application requirements and the accuracy requirements of state consistency verification. For example, in an optional embodiment, the second target transaction log defaults to the transaction logs that have reached consensus between the leader node and non-leader nodes, which means that state verification based on memory data is required for each transaction log. Alternatively, the second target transaction log defaults to the transaction logs that have reached consensus between the leader node and non-leader nodes and have a specific log index; where the specific log index refers to a specific log number, such as an odd-numbered log number, an even-numbered log number, or a log number with a fixed interval, such as log numbers starting from log number 1 with intervals of 3, for example, 4, 7, 10, etc. Alternatively, the second target transaction log can be the transaction log specified by the control node through a second verification request.
[0076] Optionally, the control node can send a second verification request to both the leader node and the non-leader node, and include in the second verification request various descriptive information that can identify the second target transaction log, such as the index or filtering conditions of the transaction log to be incrementally verified in memory, to trigger the leader node and the non-leader node to perform incremental verification of the second target transaction log in memory. For both the leader node and the non-leader node, they can respond to the second verification request and determine the second target transaction log based on the descriptive information in the second verification request.
[0077] Optionally, the control node can also send a second verification request to the leader node, carrying descriptive information such as the index or filtering conditions of the transaction logs requiring incremental memory data verification, which can identify the second target transaction log. Upon receiving the second verification request, the leader node can notify non-leader nodes to perform incremental memory data verification on the second target transaction log, and this notification can include the descriptive information used to identify the second target transaction log. One implementation of the leader node notifying non-leader nodes to perform incremental memory data verification on the second target transaction log includes: responding to the second verification request, generating a second verification log, writing the second verification log to the leader node's log file, and synchronizing the second verification log to the non-leader nodes' log files. Whether it's the leader node or a non-leader node, the second verification log is located after the second target transaction log in the log file and is the next log to be executed after the second target transaction log. In this embodiment, the function of the second verification log is to instruct each member node to perform incremental memory data verification on the second target transaction log. When synchronizing the second verification log to the log files of non-leadership nodes, a non-leadership node that successfully receives and writes the second verification log to its log file can return a success message to the leader node. The leader node can receive success messages from non-leadership nodes, and when the number of received success messages exceeds a set threshold, it determines that the second verification log has reached consensus between the leader and non-leadership nodes; that is, both the leader and non-leadership nodes can execute the second verification log. This set threshold can be half or more of the number of member nodes, and is not limited thereto.
[0078] Regardless of the method used to determine the second target transaction log, based on this, the leader node and non-leader nodes can execute the second target transaction log. Executing the second target transaction log typically updates the memory state, thus identifying the second target dataset object updated by the second target transaction log in the memory state, and the updated target memory data within the second target dataset object. Subsequently, the leader node and non-leader nodes generate target verification values corresponding to the second target dataset object from the target memory data, using these as their respective second state verification information, and report them to the control node. For the control node, it can obtain the second state verification information from the leader node and non-leader nodes, and use this information to perform state consistency checks on multiple member nodes.
[0079] Furthermore, to reduce resource overhead during the generation of the target verification value, in an optional embodiment, an incremental verification value calculation method is used to generate the target verification value. Specifically, when generating the target verification value corresponding to the second target dataset object based on the target memory data, the initial verification value of the second target dataset object is obtained. The initial verification value is the target verification value obtained by updating the second target dataset object based on the previous second target transaction log; the incremental verification value is calculated based on the target memory data; and the target verification value corresponding to the second target dataset object is generated based on the initial verification value and the incremental verification value. Optionally, the target verification value can also be persisted so that it can be deserialized when the member node restarts.
[0080] In this embodiment, when generating the target verification value corresponding to the second target dataset object, the granularity of generating the target verification value is not limited, considering the distribution of the target memory data. For example, taking the second target dataset object as a data table, the target memory data may be distributed in one or more rows of the data table. Therefore, the data table can be used as the verification granularity to calculate the incremental verification value for the target memory data in the entire data table. The incremental verification value is then combined with the initial verification value to obtain the target verification value, both of which are at the data table granularity. Alternatively, the row-level verification granularity can be used to calculate the incremental verification value for the target memory data distributed in each row. The incremental verification value of each row is then combined with the initial verification value to obtain the target verification value, both of which are at the row-level granularity. The target verification value corresponding to the second target dataset object includes the target verification values of each row in which the target memory data is distributed. Calculating the target verification value at the row-level granularity allows for finer-grained location of data errors, facilitating rapid problem identification and repair.
[0081] In this embodiment, when generating the target verification value corresponding to the second target dataset object, the target verification value is simultaneously associated with the log number of the second target transaction log. The corresponding target verification value can be uniquely determined based on this log number. After different member nodes execute the second transaction log with the same log number, the target memory data updated by the second target transaction log should be the same. Therefore, the target verification values generated based on the target memory data are also the same. Accordingly, during state consistency verification, target verification values with the same log number among different member nodes can be compared. If they are the same, it indicates state consistency; if they are different, it indicates inconsistency. Furthermore, if the log numbers corresponding to the target verification values are different, no comparison is required.
[0082] In this embodiment, when generating the target verification value corresponding to the second target dataset object based on the initial verification value and the incremental verification value, each incremental verification value can be merged with the previous target verification value (i.e., the initial verification value mentioned above) to obtain a new target verification value. The merging algorithm includes, but is not limited to, direct summation, XOR-based algorithms, and polynomial-based algorithms, etc., and is not restricted in this regard.
[0083] In this embodiment, the verification method based on the second state verification information can refer to the verification method for the first state verification information described above, that is, state consistency verification is performed with the help of the control node. The method by which the control node obtains the second state verification information can refer to the method for obtaining the first state verification information, and will not be repeated here.
[0084] It should be noted that the method for state consistency verification based on generated summary information described in the foregoing embodiments (i.e., state verification method A1) and the method for state consistency verification by calculating incremental verification values (i.e., state verification method A2) are not mutually exclusive. That is, state verification method A1 and state verification method A2 can be used in combination. For example, state verification method A1 can be used first for coarser-grained verification, and if the state consistency verification fails, state verification method A2 can then be used for finer-grained verification to accurately locate the error in the data. Of course, state verification method A1 and state verification method A2 are also independent of each other; that is, state verification method A1 and state verification method A2 can be executed independently to achieve the purpose of state consistency verification.
[0085] In the above embodiments, the control node is used to perform state consistency verification on each member node, but this is not the only method. This disclosure does not limit the entity performing the state consistency verification. In the following embodiments, referring to the distributed system shown in Figure 6, a scheme for performing state consistency verification by the leader node (i.e., state verification method A3) is described. The difference between this scheme and the previous embodiments lies in the different entity performing the state consistency verification; the remaining details can be found in the above embodiments and will not be repeated in subsequent embodiments.
[0086] In a state verification method A3, it can be implemented based on the architecture of the distributed system 500 shown in Figure 6. In the distributed system 500, the leader node 101 cooperates with the non-leader node 102 to perform state consistency verification.
[0087] The state verification method A3 is described from the perspective of the leader node 101 among the multiple member nodes in the distributed system 500, as shown in Figure 7. The method includes:
[0088] S701: Response status verification trigger event, determine at least one first target dataset object from the memory state after executing the first target transaction log. The memory state includes multiple dataset objects. A dataset object is a data structure that organizes memory data in memory.
[0089] S702: Using the dataset object as the verification granularity, generate summary information of at least one first target dataset object as the first state verification information of the leader node. The summary information reflects the structural size of the corresponding first target dataset object.
[0090] S703: Receive first status verification information sent by the non-leader node among multiple member nodes;
[0091] S704: Perform state consistency verification on multiple member nodes based on the first state verification information of the leader node and non-leader nodes.
[0092] The state verification method A1 is described from the perspective of the non-leader node 102 among the multiple member nodes included in the distributed system 500, as shown in Figure 8. The method includes:
[0093] S801: Response status verification trigger event, determine at least one first target dataset object from the memory state after executing the first target transaction log. The memory state includes multiple dataset objects. A dataset object is a data structure that organizes memory data in memory.
[0094] S802: Using the dataset object as the verification granularity, generate summary information of at least one first target dataset object as the first state verification information of the non-leader node. The summary information reflects the structural size of the corresponding first target dataset object.
[0095] S803: Provide the first state verification information of the non-leader node to the leader node among multiple member nodes, so that the leader node can perform state consistency verification on multiple member nodes based on the first state verification information of the non-leader node and the leader node.
[0096] In this embodiment, the leader node 101 in the distributed system 500 initiates a state verification trigger event (see ① in Figure 6). Detailed implementation of the leader node initiating the state verification trigger event can be found in the aforementioned embodiments and will not be repeated here. Furthermore, the leader node and non-leader nodes execute steps ② and ③ in Figure 6. Steps ② and ③ can be found in the aforementioned embodiments and will not be repeated here. In this embodiment, the leader node 101 is responsible for receiving the first state verification information sent by the non-leader node 102 (as shown in ④ in Figure 6); and, based on the first state verification information of the leader node 101 and the first state verification information of the non-leader node 102, performing state consistency verification on multiple member nodes (as shown in ⑤ in Figure 6). Specific implementation details of state verification method A3 can be found in the aforementioned state verification method A1 and will not be repeated here.
[0097] Furthermore, in this embodiment, a state consistency verification method A4 is also provided. State verification method A2 is described from the perspective of the leader node among multiple member nodes in the distributed system. This method includes: in the case of executing a second target transaction log, determining a second target dataset object updated by the second target transaction log and the updated target memory data within the second target dataset object; based on the target memory data, generating a target verification value corresponding to the second target dataset object; the second target transaction log is a transaction log that requires memory data verification by the leader node and the non-leader node; receiving second state verification information sent by the non-leader node; and performing state consistency verification on multiple member nodes based on the second state verification information of the leader node and the non-leader node. Specific implementation details of state consistency verification method A4 can be found in the aforementioned state consistency verification method A2, and will not be repeated here.
[0098] When describing state verification method A4 from the perspective of a non-leader node among multiple member nodes in a distributed system, the description of state verification method A4 from the perspective of the leader node can be referred to above. The difference is that the non-leader node provides its second state verification information to the leader node, so that the leader node can perform state consistency verification on multiple member nodes based on the second state verification information of the non-leader node and the leader node.
[0099] In this embodiment of the disclosure, if multiple member nodes fail the state consistency check, an alert can be issued to ensure that the problem can be noticed and handled in a timely manner. Optionally, an appropriate alert method can be selected based on the severity level of the check result. In an optional embodiment, when multiple member nodes fail the state consistency check, the severity level of the check result is determined based on the check method used to obtain the check result and / or the number of inconsistencies in the check information appearing in the check method. The check method includes a check method based on first state check information and / or a check method based on second state check information. Based on the severity level of the check result, a target alert method is determined from multiple alert methods, and the check result is output using the target alert method. In one example, a severity threshold can be set based on the number of inconsistencies in the check information. For example, if the number of inconsistencies in the check information is 1-2, the severity is considered minor; if the number of inconsistencies in the check information is 3-4, the severity is considered moderate; and if the number of inconsistencies in the check information is 5 or more, the severity is considered severe. In another example, a severity threshold can be set based on the type of memory data in the check information inconsistencies. For example, memory data can be categorized into three types: core, primary, and secondary. If inconsistencies occur in the checksums of core memory data, the severity is considered severe; if inconsistencies occur in primary memory data, the severity is considered moderate; and if inconsistencies occur in secondary memory data, the severity is considered minor. Furthermore, appropriate alert methods can be selected based on the severity level. For instance, minor alerts can be sent via SMS, while moderate / severe alerts can be sent via telephone.
[0100] It should be noted that the entity issuing the warning differs depending on the entity performing the state consistency check. For example, in state consistency check methods A1 and A2, the control node performs state consistency checks on multiple member nodes, so the warning is issued by the control node when multiple member nodes fail the state consistency check. In state consistency check methods A3 and A4, the leader node performs state consistency checks on multiple member nodes, so the warning is issued by the leader node when multiple member nodes fail the state consistency check.
[0101] The detailed implementation methods and beneficial effects of each step in this embodiment have been described in detail in the foregoing embodiments, and will not be elaborated here.
[0102] It should be noted that the execution subject of each step of the method provided in the above embodiments can be the same device, or the method can be executed by different devices. For example, the execution subject of steps S801 to S803 can be device A; or the execution subject of steps S801 and S802 can be device A, and the execution subject of step S803 can be device B; and so on.
[0103] Furthermore, some processes described in the above embodiments and accompanying drawings include multiple operations that appear in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear herein, or they may be executed in parallel. The operation numbers, such as S801, S802, etc., are merely used to distinguish different operations and do not represent any execution order. Additionally, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should be noted that the descriptions such as "first" and "second" in this document are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to different types.
[0104] Figure 9 is a schematic diagram of the structure of an electronic device provided in another exemplary embodiment of this disclosure. As shown in Figure 9, the electronic device includes a memory 94 and a processor 95.
[0105] Memory 94 is used to store computer programs and can be configured to store various other data to support operation on the electronic device. Examples of this data include instructions for any application or method used to operate on the electronic device, contact data, phone book data, messages, pictures, videos, etc.
[0106] The memory 94 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 storage, flash memory, magnetic disk or optical disk.
[0107] Processor 95, coupled to memory 94, is configured to execute a computer program in memory 94 for: responding to a state verification trigger event; determining at least one first target dataset object from the memory state following the execution of the first target transaction log, the memory state including multiple dataset objects, each dataset object being a data structure in memory that organizes memory data; generating summary information of the at least one first target dataset object at the dataset object level, as the first state verification information of the leader node, the summary information reflecting the structural size of the corresponding first target dataset object; and providing the first state verification information of the leader node to a control node, so that the control node can perform state consistency verification on the multiple member nodes based on the first state verification information of the leader node and the non-leader nodes among the multiple member nodes.
[0108] In an optional embodiment, when the processor 95 determines at least one first target dataset object from the memory state after executing the first target transaction log in response to a state verification trigger event, it is specifically configured to: generate a first verification log in response to the state verification trigger event, wherein the first verification log is used to instruct each member node to generate summary information of the at least one first target dataset object with the dataset object as the verification granularity; write the first verification log into the log file of the leader node and synchronize the first verification log to the log file of the non-leader node, wherein the first target transaction log is the previous log of the first verification log; and, if the first verification log reaches a consensus between the leader node and the non-leader node, determine the at least one first target dataset object according to the dataset object description information included in the first verification log.
[0109] In an optional embodiment, when the processor 95 generates the first verification log in response to a status verification trigger event, it is specifically configured to: generate the first verification log in response to a first verification request sent by the control node, wherein the first verification request includes identification information of the first target transaction log to determine the position of the first verification log in the log file; or, generate the first verification log when a set number of transaction logs are detected to have been executed, wherein the last executed transaction log among the set number of transaction logs is the first target transaction log; or, generate the first verification log when a set time period arrives, wherein the last transaction log written to the log file before the set time period arrives is the first target transaction log.
[0110] In an optional embodiment, when the processor 95 determines the at least one first target dataset object based on the dataset object description information included in the first verification log, it is specifically configured to: if the dataset object description information is explicitly included in the first verification log, select a dataset object that conforms to the dataset object description information from the plurality of dataset objects included in the memory state as the first target dataset object; if the dataset object description information is implicitly included in the first verification log, use all of the plurality of dataset objects included in the memory state as the first target dataset object.
[0111] In an optional embodiment, when the processor 95 generates summary information of the at least one first target dataset object with the dataset object as the verification granularity, it is specifically configured to: if the at least one first target dataset object includes a first target dataset object implemented as a data table, calculate the summary information based on the number of rows and / or columns of the data table; if the at least one first target dataset object includes a first target dataset object implemented as an array, calculate the summary information based on the dimensions and / or shape of the array.
[0112] In an optional embodiment, the processor 95 is further configured to: determine, in the case of executing a second target transaction log, a second target dataset object updated by the second target transaction log and the updated target memory data in the second target dataset object; wherein, the second target transaction log is a transaction log that requires memory data verification by the leader node and the non-leader node; generate a target verification value corresponding to the second target dataset object based on the target memory data, as the second status verification information of the leader node; and report the second status verification information of the leader node to the control node so that the control node can perform status consistency verification on the plurality of member nodes based on the second status verification information of the leader node and the non-leader node.
[0113] In one optional embodiment, the second target transaction log is by default the various transaction logs that have reached consensus between the leader node and the non-leader node, or by default the transaction logs that have reached consensus between the leader node and the non-leader node and have a specific log index, or the transaction logs specified by the control node through the second verification request.
[0114] In an optional embodiment, when the processor 95 generates the target verification value corresponding to the second target dataset object based on the target memory data, it is specifically configured to: obtain the initial verification value of the second target dataset object, wherein the initial verification value is the target verification value obtained by updating the second target dataset object in the previous second target transaction log; calculate the incremental verification value based on the target memory data; and generate the target verification value corresponding to the second target dataset object based on the initial verification value and the incremental verification value.
[0115] In an optional embodiment, when the processor 95 provides the first state verification information of the leader node to the control node so that the control node can perform state consistency verification on the plurality of member nodes based on the first state verification information of the leader node and the non-leader nodes among the plurality of member nodes, the processor 95 is specifically configured to: receive the first state verification information returned by the non-leader node; and provide the first state verification information of the leader node and the non-leader node together to the control node so that the control node can perform state consistency verification on the plurality of member nodes based on the first state verification information of the leader node and the non-leader node.
[0116] Furthermore, as shown in Figure 9, the electronic device also includes other components such as a communication component 96, a display 97, a power supply component 98, and an audio component 99. Figure 9 only schematically shows some components and does not imply that the electronic device only includes the components shown in Figure 9. Additionally, the components within the dashed boxes in Figure 9 are optional, not mandatory, and their specific inclusion depends on the product form of the electronic device. The electronic device of this embodiment can be implemented as a desktop computer, laptop computer, smartphone, or IoT (Internet of Things) device, or as a server-side device such as a conventional server, cloud server, or server array. If the electronic device of this embodiment is implemented as a desktop computer, laptop computer, smartphone, or other terminal device, it may include the components within the dashed boxes in Figure 9; if the electronic device of this embodiment is implemented as a conventional server, cloud server, or server array, it may not include the components within the dashed boxes in Figure 9.
[0117] This disclosure also provides an electronic device whose implementation structure is the same as or similar to that of the electronic device shown in FIG9, and can be implemented with reference to the structure of the electronic device shown in FIG9. The main difference between the electronic device provided in this embodiment and the electronic device in the embodiment shown in FIG9 is that the functions implemented by the processor executing the computer program stored in the memory are different. For the electronic device provided in this embodiment, the processor executing the computer program stored in the memory can be used to: respond to a state verification trigger event; determine at least one first target dataset object from the memory state after executing the first target transaction log, wherein the memory state includes multiple dataset objects, and the dataset object is a data structure that organizes memory data in memory; generate summary information of the at least one first target dataset object as the first state verification information of the leader node, wherein the summary information reflects the structural size of the corresponding first target dataset object; receive the first state verification information sent by the non-leader node among the multiple member nodes; and perform state consistency verification on the multiple member nodes according to the first state verification information of the leader node and the non-leader node.
[0118] In an optional embodiment, the processor is further configured to: determine, in the case of executing a second target transaction log, a second target dataset object updated by the second target transaction log and target memory data updated in the second target dataset object; generate a target verification value corresponding to the second target dataset object based on the target memory data; the second target transaction log is a transaction log that requires memory data verification by the leader node and the non-leader node; receive second status verification information sent by the non-leader node; and perform status consistency verification on the plurality of member nodes based on the second status verification information of the leader node and the non-leader node.
[0119] In an optional embodiment, when the processor obtains the verification result that the plurality of member nodes have failed the state consistency verification, it is specifically configured to: determine the severity level of the verification result based on the verification method that yielded the verification result and / or the number of inconsistencies in the verification information that occurred in the verification method, wherein the verification method includes a verification method based on first state verification information and / or based on second state verification information; determine a target warning method from a plurality of warning methods based on the severity level of the verification result, and output the verification result using the target warning method.
[0120] This disclosure also provides an electronic device whose implementation structure is the same as or similar to that of the electronic device shown in FIG9, and can be implemented with reference to the structure of the electronic device shown in FIG9. The main difference between the electronic device provided in this embodiment and the electronic device in the embodiment shown in FIG9 is that the functions implemented by the processor executing the computer program stored in the memory are different. For the electronic device provided in this embodiment, the processor executing the computer program stored in the memory can be used to: respond to a state verification trigger event, determine at least one first target dataset object from the memory state after executing the first target transaction log, the memory state including multiple dataset objects, the dataset object being a data structure that organizes memory data in memory; generate summary information of the at least one first target dataset object as the first state verification information of the non-leadership node, the summary information reflecting the structural size of the corresponding first target dataset object, using the dataset object as the verification granularity; provide the first state verification information of the non-leadership node to the control node or the leader node among the multiple member nodes, so that the control node or the leader node can perform state consistency verification on the multiple member nodes based on the first state verification information of the non-leadership node and the leader node.
[0121] In an optional embodiment, when the processor determines at least one first target dataset object from the memory state after executing the first target transaction log in response to a state verification trigger event, it is specifically configured to: receive the first verification log synchronized by the leader node, write the first verification log into the log file of the non-leader node, wherein the first target transaction log is the previous log of the first verification log; and, if the first verification log reaches a consensus between the non-leader node and the leader node, determine the at least one first target dataset object based on the dataset object description information included in the first verification log.
[0122] In an optional embodiment, when the processor provides the first state verification information of the non-leadership node to the control node, it is specifically configured to: send the first state verification information of the non-leadership node to the leader node, so that the leader node can provide the first state verification information of the leader node and the non-leadership node together to the control node.
[0123] In an optional embodiment, the processor is further configured to: determine, in the case of executing a second target transaction log, a second target dataset object updated by the second target transaction log and target memory data updated in the second target dataset object; generate a target verification value corresponding to the second target dataset object based on the target memory data; the second target transaction log is a transaction log that requires memory data verification by the leader node and the non-leader node; and provide the second status verification information of the non-leader node to the control node or the leader node, so that the control node or the leader node can perform status consistency verification on the plurality of member nodes based on the second status verification information of the non-leader node and the leader node.
[0124] This disclosure also provides an electronic device whose implementation structure is the same as or similar to that of the electronic device shown in FIG9, and can be implemented with reference to the structure of the electronic device shown in FIG9. The main difference between the electronic device provided in this embodiment and the electronic device in the embodiment shown in FIG9 is that the functions implemented by the processor executing the computer program stored in the memory are different. For the electronic device provided in this embodiment, the processor executing the computer program stored in the memory can be used to: obtain the first state verification information of the leader node and non-leader node among multiple member nodes in a distributed system; perform state consistency verification on the multiple member nodes according to the first state verification information of the leader node and the non-leader node; wherein, the first state verification information is the summary information of at least one first target dataset object generated by the leader node or the non-leader node, the at least one first target dataset object is determined from the memory state after the execution of the first target transaction day, the memory state includes multiple dataset objects, and the dataset object is a data structure that organizes memory data in memory.
[0125] In an optional embodiment, the processor is further configured to: acquire second state verification information of the leader node and the non-leader node; and perform state consistency verification on the plurality of member nodes based on the second state verification information of the leader node and the non-leader node; wherein the second state verification information is a target verification value generated by the leader node or the non-leader node based on the updated target memory data in the second target dataset object updated by the second target transaction log, and the second target transaction log is a transaction log that requires memory data verification by the leader node and the non-leader node.
[0126] In an optional embodiment, the processor is further configured to: send a first verification request to the leader node for the leader node to verify a first verification log, the first verification log being used to instruct each member node to generate summary information of the at least one first target dataset object with the dataset object as the verification granularity; or, send a second verification request to the leader node and the non-leader node for the leader node and the non-leader node to determine the second target transaction log.
[0127] In an optional embodiment, when the processor obtains the verification result that the plurality of member nodes have failed the state consistency verification, it is specifically configured to: determine the severity level of the verification result based on the verification method that yielded the verification result and / or the number of inconsistencies in the verification information that occurred in the verification method, wherein the verification method includes a verification method based on first state verification information and / or based on second state verification information; determine a target warning method from a plurality of warning methods based on the severity level of the verification result, and output the verification result using the target warning method.
[0128] The detailed implementation methods and beneficial effects of each step in this embodiment have been described in detail in the foregoing embodiments, and will not be elaborated here.
[0129] Accordingly, embodiments of this disclosure also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the steps in the methods described above.
[0130] This disclosure also provides a computer program product, which includes a computer program / instructions that, when executed by a processor, enable the processor to perform the steps described in the method embodiments above.
[0131] The aforementioned memory 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 storage, flash memory, magnetic disk, or optical disk.
[0132] The aforementioned communication components are configured to facilitate wired or wireless communication between the device containing the communication components and other devices. The device containing the communication components can access wireless networks based on communication standards, such as WiFi, 2G, 3G, 4G / LTE, 5G, or combinations thereof. In one exemplary embodiment, the communication components receive broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication components also include a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID), Infrared Data Association (IrDA), Ultra Wide Band (UWB), Bluetooth (BT), and other technologies.
[0133] The aforementioned display includes a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a Touch Panel, the screen can be implemented as a touchscreen to receive input signals from the user. The Touch Panel includes one or more touch sensors to sense touches, swipes, and gestures on the Touch Panel. The touch sensors can sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation.
[0134] The aforementioned power supply components provide power to various components within the device in which they reside. These power supply components may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device in which they reside.
[0135] The aforementioned audio component can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC) configured to receive external audio signals when the device containing the audio component is in an operating mode, such as call mode, recording mode, or voice recognition mode. The received audio signals can be further stored in memory or transmitted via a communication component. In some embodiments, the audio component also includes a speaker for outputting audio signals.
[0136] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-readable storage media (including, but not limited to, disk storage, compact disc read-only memory (CD-ROM), optical storage, etc.) containing computer-usable program code.
[0137] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more flowchart illustrations and / or one or more block diagrams.
[0138] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.
[0139] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.
[0140] In a typical configuration, a computing device includes one or more processors (Central Processing Units, CPUs), input / output interfaces, network interfaces, and memory.
[0141] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0142] Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, Digital Video Disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0143] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0144] The above are merely embodiments of this disclosure and are not intended to limit the scope of this disclosure. Various modifications and variations can be made to this disclosure by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the scope of the claims of this disclosure.
Claims
1. A state verification method, wherein, The method, applied to the leader node among multiple member nodes in a distributed system, includes: In response to the status verification trigger event, at least one first target dataset object is determined from the memory state after the execution of the first target transaction log. The memory state includes multiple dataset objects, and the dataset object is a data structure that organizes memory data in memory. Using dataset objects as the verification granularity, a summary information of the at least one first target dataset object is generated as the first state verification information of the leader node, and the summary information reflects the structural size of the corresponding first target dataset object; The first state verification information of the leader node is provided to the control node so that the control node can perform state consistency verification on the multiple member nodes based on the first state verification information of the leader node and the non-leader nodes among the multiple member nodes.
2. The method according to claim 1, wherein, In response to the status verification trigger event, at least one first target dataset object is determined from the memory state after the execution of the first target transaction log, including: In response to the status verification trigger event, a first verification log is generated. The first verification log is used to instruct each member node to generate summary information of at least one first target dataset object with the dataset object as the verification granularity. Write the first verification log to the log file of the leader node and synchronize the first verification log to the log file of the non-leader node, wherein the first target transaction log is the log preceding the first verification log; If a consensus is reached between the leader node and the non-leader node in the first verification log, the at least one first target dataset object is determined based on the dataset object description information included in the first verification log.
3. The method according to claim 2, wherein, In response to the status verification trigger event, generate the first verification log, including: In response to a first verification request sent by the control node, a first verification log is generated. The first verification request includes identification information of the first target transaction log, which is used to determine the location of the first verification log in the log file. or If a set number of transaction logs are detected to have been executed, the first verification log is generated, and the last transaction log executed among the set number of transaction logs is the first target transaction log. or When the set time period arrives, the first verification log is generated, and the transaction log last written to the log file before the set time period arrives is the first target transaction log.
4. The method according to claim 2 or 3, wherein, Based on the dataset object description information included in the first verification log, the at least one first target dataset object is determined, including: If the dataset object description information is explicitly included in the first verification log, the dataset object that matches the dataset object description information is selected as the first target dataset object from the multiple dataset objects included in the memory state. If the dataset object description information is implicitly included in the first verification log, all dataset objects included in the memory state are used as the first target dataset object.
5. The method according to any one of claims 1-4, wherein, Using the dataset object as the verification granularity, generate summary information for the at least one first target dataset object, including: If the at least one first target dataset object includes a first target dataset object implemented as a data table, the summary information is calculated based on the number of rows and / or columns of the data table; If the at least one first target dataset object includes a first target dataset object implemented as an array, the summary information is calculated based on the dimensions and / or shape of the array.
6. The method according to any one of claims 1-5, wherein, Also includes: In the case of executing the second target transaction log, determine the second target dataset object updated by the second target transaction log and the target memory data updated in the second target dataset object; The second target transaction log is a transaction log that requires memory data verification by the leader node and the non-leader node; Based on the target memory data, a target verification value corresponding to the second target dataset object is generated, which serves as the second state verification information of the leader node. The second state verification information of the leader node is reported to the control node so that the control node can perform state consistency verification on the multiple member nodes based on the second state verification information of the leader node and the non-leader node.
7. The method according to claim 6, wherein, The second target transaction log is, by default, the transaction logs that have reached consensus between the leader node and the non-leader node, or the transaction logs that have reached consensus between the leader node and the non-leader node and have a specific log index, or the transaction logs specified by the control node through the second verification request.
8. The method according to claim 6 or 7, wherein, Based on the target memory data, generate the target verification value corresponding to the second target dataset object, including: Obtain the initial verification value of the second target dataset object, wherein the initial verification value is the target verification value obtained by updating the second target dataset object in the previous second target transaction log; Calculate the incremental check value based on the target memory data; generate the target check value corresponding to the second target dataset object based on the initial check value and the incremental check value.
9. The method according to any one of claims 1-8, wherein, The first state verification information of the leader node is provided to the control node, so that the control node can perform state consistency verification on the multiple member nodes based on the first state verification information of the leader node and the non-leader nodes among the multiple member nodes, including: Receive the first status verification information returned by the non-leader node; The first state verification information of the leader node and the non-leader node is provided to the control node so that the control node can perform state consistency verification on the multiple member nodes based on the first state verification information of the leader node and the non-leader node.
10. A state verification method, wherein, The method, applied to the leader node among multiple member nodes in a distributed system, includes: In response to the status verification trigger event, at least one first target dataset object is determined from the memory state after the execution of the first target transaction log. The memory state includes multiple dataset objects, and the dataset object is a data structure that organizes memory data in memory. Using dataset objects as the verification granularity, a summary information of the at least one first target dataset object is generated as the first state verification information of the leader node, and the summary information reflects the structural size of the corresponding first target dataset object; Receive first status verification information sent by the non-leader node among the plurality of member nodes; Based on the first state verification information of the leader node and the non-leader node, the state consistency verification is performed on the multiple member nodes.
11. The method according to claim 10, wherein, Also includes: In the case of executing the second target transaction log, determine the second target dataset object updated by the second target transaction log and the target memory data updated in the second target dataset object; Based on the target memory data, generate the target verification value corresponding to the second target dataset object; The second target transaction log is the transaction log that requires memory data verification by the leader node and the non-leader node; Receive the second status verification information sent by the non-leader node; The state consistency of the multiple member nodes is verified based on the second state verification information of the leader node and the non-leader node.
12. The method according to claim 11, wherein, In the case where the verification results of the multiple member nodes failing the state consistency check are obtained, the method further includes: The severity level of the verification result is determined based on the verification method used to obtain the verification result and / or the number of inconsistencies in the verification information that occur in the verification method. The verification method includes verification methods based on first state verification information and / or verification methods based on second state verification information. Based on the severity level of the verification result, a target alert method is determined from multiple alert methods, and the verification result is output using the target alert method.
13. A state verification method, wherein, The method, applied to a non-leader node among multiple member nodes in a distributed system, includes: In response to the status verification trigger event, at least one first target dataset object is determined from the memory state after the execution of the first target transaction log. The memory state includes multiple dataset objects, and the dataset object is a data structure that organizes memory data in memory. Using dataset objects as the verification granularity, a summary information of the at least one first target dataset object is generated as the first state verification information of the non-leader node. The summary information reflects the structural size of the corresponding first target dataset object. The first state verification information of the non-leadership node is provided to the control node or the leader node among the plurality of member nodes, so that the control node or the leader node can perform state consistency verification on the plurality of member nodes based on the first state verification information of the non-leadership node and the leader node.
14. The method according to claim 13, wherein, In response to the status verification trigger event, at least one first target dataset object is determined from the memory state after the execution of the first target transaction log, including: Receive the first verification log synchronized by the leader node, write the first verification log into the log file of the non-leader node, and the first target transaction log is the log preceding the first verification log; If consensus is reached between the non-leader node and the leader node in the first verification log, the at least one first target dataset object is determined based on the dataset object description information included in the first verification log.
15. A state verification method, wherein, Applied to a control node, the method includes: Obtain the first state verification information of the leader node and non-leader nodes among multiple member nodes in a distributed system; Based on the first state verification information of the leader node and the non-leader node, the state consistency verification is performed on the multiple member nodes. The first status verification information is a summary of at least one first target dataset object generated by the leader node or the non-leader node. The at least one first target dataset object is determined from the memory state after the execution of the first target transaction day. The memory state includes multiple dataset objects, and the dataset object is a data structure that organizes memory data in memory.
16. The method according to claim 15, wherein, Also includes: Obtain the second state verification information of the leader node and the non-leader node; Based on the second state verification information of the leader node and the non-leader node, the state consistency verification is performed on the multiple member nodes; The second status verification information is a target verification value generated by the leader node or the non-leader node based on the updated target memory data in the second target dataset object updated by the second target transaction log. The second target transaction log is a transaction log that requires the leader node and the non-leader node to perform memory data verification.
17. An electronic device, wherein, include: Memory and processor; The memory is used to store a computer program, and the processor is coupled to the memory to execute the computer program in the memory to implement the steps of the method according to any one of claims 1-9, 10-12, 13-14, and 15-16.
18. A computer-readable storage medium storing a computer program / instructions, wherein, When the computer program is executed by a processor, it causes the processor to perform the steps of the method according to any one of claims 1-9, 10-12, 13-14, and 15-16.
19. A computer program product, wherein, include: A computer program / instruction that, when executed by a processor, causes the processor to perform the steps of the method according to any one of claims 1-9, 10-12, 13-14, and 15-16.
Citation Information
Patent Citations
Heterogeneous database synchronous data consistency verification method and device
CN110347746A
Log tamper-proofing verification system, method and device and computer equipment
CN115221136A
File verification method and device, processor and electronic equipment
CN115982103A
Data verification method and device, medium and computing equipment
CN117610081A
Scalable enterprise content management
US20170132269A1