First start redundant data synchronization method of controller and related device
Through differential synchronization and SM3 hash algorithm, the problem of synchronization between the backup DPU and the host DPU configuration file at the first startup is solved, which improves the efficiency and accuracy of data synchronization, and ensures the continuity and stability of the industrial automation control system. .
Patent Information
- Application Number
- CN202411221943.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-12-31
AI Technical Summary
In the redundant design of the controller, how to ensure synchronization with the POU configuration file of the host DPU when it is started for the first time, especially when the host DPU configuration file may be modified at any time, the efficiency of existing data synchronization methods Low and data integrity cannot be guaranteed, resulting in the backup machine being unable to take over the host correctly, causing a production accident.
By obtaining the POU-SM3 list of the host DPU, comparing the POU-SM3 list of the backup DPU with the POU-SM3 list of the host DPU, marking inconsistent files as to be synchronized and performing differential synchronization, updating the SM3 hash value to ensure data consistency .
It improves the efficiency and accuracy of data synchronization, ensures that the backup DPU can quickly and accurately synchronize the POU configuration files of the host DPU during the first startup, avoiding data loss or corruption, and improving the reliability and stability of the system.
Smart Images

Figure CN119226051A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of industrial automation control and relates to a method for synchronizing redundant data when a controller is started for the first time and a related device. Background Art
[0002] With the continuous improvement of industrial automation level, the redundant design of controllers has become an important means to ensure production continuity and stability. In the redundant design, the host data processing unit (DPU) and the standby DPU are usually in hot standby state, that is, the standby DPU is ready to take over the tasks of the host DPU at any time. However, when the standby DPU is started for the first time or reconfigured, how to ensure that it is synchronized with the programmable object unit (POU) configuration file of the host DPU, especially when the POU configuration file of the host DPU may be modified at any time, is an urgent problem to be solved.
[0003] Traditional data synchronization methods include full and incremental synchronization. The full and incremental synchronization method is to regularly perform full data replication, supplemented by incremental synchronization of changed data, but this data synchronization method has the problem of low synchronization efficiency, and the data integrity and accuracy of this data synchronization method cannot be guaranteed, which may cause the backup DPU to fail to take over correctly when the host DPU fails, thereby causing production accidents. Therefore, it is of great significance to develop an efficient and reliable controller first-start redundant data synchronization method. Summary of the invention
[0004] In order to solve the above problems of the prior art, the present invention provides a controller first startup redundant data synchronization method and related devices to ensure that the standby DPU can accurately and quickly synchronize the POU configuration file of the host DPU when it is started for the first time, thereby ensuring the integrity and accuracy of the data.
[0005] The present invention is achieved through the following technical solutions:
[0006] The present invention provides a method for synchronizing redundant data when a controller is started for the first time, comprising:
[0007] S1, the standby DPU obtains the POU-SM3 list of the host DPU; the POU-SM3 list of the host DPU is an information list of SM 3 hash values of all current POU configuration files in the host DPU;
[0008] S2, the standby DPU compares the POU-SM3 list of the host DPU with the POU-SM3 list of the standby DPU. If there is a POU configuration file with inconsistent SM3 hash values, the POU configuration file with inconsistent SM3 hash values is marked as a POU configuration file to be synchronized and S3 is executed, otherwise S4 is executed;
[0009] S3, the standby DPU performs differential synchronization on the POU configuration file to be synchronized and updates the SM3 hash value of the corresponding POU configuration file in the POU-SM3 list of the standby DPU;
[0010] S4, end synchronization.
[0011] Preferably, in the method for synchronizing redundant data when the controller starts for the first time according to the present invention, S1 is specifically:
[0012] The standby DPU sends an SM3 request to the host DPU, wherein the SM3 request is used to trigger the host DPU to send the POU-SM3 list of the host DPU to the standby DPU; the POU-SM3 list of the host DPU is an information list of SM3 hash values of all current POU configuration files in the host DPU;
[0013] The standby DPU receives the POU-SM3 list of the host DPU.
[0014] Preferably, in the method for synchronizing redundant data when the controller starts for the first time according to the present invention, S2 is specifically:
[0015] Traverse all POU configuration files in the POU-SM3 list of the host DPU, compare the SM3 hash value of the current POU configuration file with the SM3 hash value of the corresponding POU configuration file in the POU-SM3 list of the standby DPU, if the two are inconsistent, mark the current POU configuration file as the POU configuration file to be synchronized; after the traversal is completed, if there is a POU configuration file to be synchronized, execute S3, otherwise execute S4.
[0016] Preferably, in the method for synchronizing redundant data when the controller starts up for the first time of the present invention, in S3, the standby DPU performs differential synchronization on the POU configuration file to be synchronized, specifically including:
[0017] S31, the standby DPU receives the CRC (Cyclic Redundancy Check) check code of the small block of the POU configuration file to be synchronized on the host DPU sent by the host DPU; wherein, the method for obtaining the CRC check code of the small block of the POU configuration file to be synchronized on the host DPU is: starting from position 0, the POU configuration file to be synchronized on the host DPU is divided into several small blocks according to the block length P and numbered; starting from block 0, a CRC check code is calculated for each small block, and these CRC check codes are arranged in order and sent to the standby DPU;
[0018] S32, the standby DPU starts from position 0, divides the POU configuration file to be synchronized on the standby DPU into several small blocks according to the block length P and numbers them, and calculates a CRC check code for each small block starting from block 0;
[0019] S33, the standby DPU compares the CRC check code of each small block of the POU configuration file to be synchronized on the standby DPU with the CRC check code of the corresponding small block received from the host DPU. If the CRC check code of a small block is consistent, it indicates that the small block of the POU configuration file to be synchronized on the standby DPU is matched successfully; the standby DPU sends the serial numbers of all successfully matched small blocks to the host DPU;
[0020] S34, the standby DPU receives the original content and number of the small blocks that failed to match sent by the host DPU; wherein the small blocks that failed to match refer to the small blocks that remain after the host DPU receives the numbers of all the small blocks that successfully matched sent by the standby DPU and excludes the small blocks that successfully matched;
[0021] S35, the standby DPU constructs a copy based on the original content of the successfully matched small block and the original content of the unmatched small block sent by the host DPU. After the construction is completed, the SM3 hash value of the copy is calculated and compared with the SM3 hash value of the corresponding POU configuration file in the POU-SM3 list on the host DPU. If they are consistent, it means that the synchronization is successful and the synchronization ends; otherwise, the synchronization fails and S36 is executed;
[0022] S36: Reduce the block length P, and execute S31 to S35 to synchronize again until the synchronization is successful or the value of the block length P is reduced to a preset value.
[0023] Furthermore, in the differential synchronization of S3, the method used to calculate the CRC check code is the Adler-32 algorithm or the SM3 hash algorithm.
[0024] Preferably, in the method for starting redundant data synchronization for the first time by the controller of the present invention, after S3 and before S4, the method further includes: a step of returning to S1.
[0025] The present invention also provides a controller first startup redundant data synchronization system, comprising:
[0026] An acquisition module is used for the standby DPU to acquire the POU-SM3 list of the host DPU; the POU-SM3 list of the host DPU is an information list of SM3 hash values of all current POU configuration files in the host DPU;
[0027] A judgment module is used for the standby DPU to compare the POU-SM3 list of the host DPU with the POU-SM3 list of the standby DPU. If there is a POU configuration file with inconsistent SM3 hash values, the POU configuration file with inconsistent SM3 hash values is marked as a POU configuration file to be synchronized;
[0028] The synchronization module is used for the standby DPU to synchronize the POU configuration file to be synchronized and update the SM3 hash value of the corresponding POU configuration file in the POU-SM3 list of the standby DPU.
[0029] Preferably, when the controller starts the redundant data synchronization system for the first time, the acquisition module includes a request module and a receiving module;
[0030] A request module is used for the standby DPU to send an SM3 request to the host DPU, wherein the SM3 request is used to trigger the host DPU to send the POU-SM3 list of the host DPU to the standby DPU; the POU-SM3 list of the host DPU is an information list of SM3 hash values of all current POU configuration files in the host DPU;
[0031] The receiving module is used for the standby DPU to receive the POU-SM3 list of the host DPU.
[0032] The present invention also provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the controller first starting the redundant data synchronization method as described above are implemented.
[0033] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the controller starting the redundant data synchronization method for the first time as described above are implemented.
[0034] Compared with the prior art, the present invention has the following beneficial effects:
[0035] The controller initial startup redundant data synchronization method proposed in the present invention has the following advantages: (1) Ensuring data integrity: Through the SM3 hash algorithm, the POU configuration file synchronized by the standby DPU is ensured to be completely consistent with the host DPU, avoiding the risk of data loss or damage. (2) Improving synchronization efficiency: Using differential synchronization, only the difference parts in the POU configuration files with inconsistent SM3 hash values are synchronized, and the entire POU configuration file is not synchronized, avoiding unnecessary data transmission and processing, and improving synchronization efficiency. (3) Improving system reliability: Through precise data comparison and efficient synchronization mechanism, it is ensured that the standby DPU can accurately and quickly synchronize the POU configuration file of the host DPU when it is first started, providing a strong guarantee for the continuity and stability of the industrial automation control system.
[0036] Furthermore, the controller of the present invention starts the redundant data synchronization method for the first time, and after synchronizing the POU configuration file to be synchronized, obtains the POU-SM3 list of the host DPU again and performs SM3 verification. Therefore, even if the POU configuration file of the host DPU is modified during synchronization, the standby DPU can identify the difference through SM3 verification, so that the method can adapt to the scenario of host DPU configuration modification, further ensuring the integrity and accuracy of the data. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 This is a flow chart of a method for synchronizing redundant data started for the first time by a controller of the present invention;
[0039] Figure 2 This is a flowchart of an implementation of a method for synchronizing redundant data when a controller starts the data for the first time in an embodiment of the present invention. DETAILED DESCRIPTION
[0040] The following describes the embodiments of the present invention through specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention.
[0041] It should be noted that the process equipment or devices not specifically specified in the following embodiments are all conventional equipment or devices in the art.
[0042] It should be noted that the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices. Moreover, unless otherwise specified, the numbering of each method step is only a convenient tool for identifying each method step, and is not intended to limit the order of arrangement of each method step or to define the scope of the present invention. Changes or adjustments in their relative relationships should also be regarded as the scope of the present invention without substantially changing the technical content.
[0043] Redundant design is to add additional equipment or components so that when a part of the system fails, the rest of the system can continue to work normally, thereby ensuring the continuity and safety of the entire system. In the present invention, the controller adopts a redundant design, one controller is used as the host, and the other controller is used as the backup. Under normal circumstances, the host performs the main task, and the backup is in hot backup state. When the host fails, the backup can immediately take over the control and continue to perform the task, ensuring the continuity and safety of the industrial automation control system. The first startup of the controller described in the present invention refers to the first startup of the backup machine. The purpose of the present invention is to synchronize data with the host when the backup machine is started for the first time, and to ensure the integrity and accuracy of the data.
[0044] like Figure 1 As shown, the controller starts redundant data synchronization method for the first time according to the present invention, comprising the following steps:
[0045] S1, the standby DPU obtains the POU-SM3 list of the host DPU; the POU-SM3 list of the host DPU is an information list of SM3 hash values of all current POU configuration files in the host DPU;
[0046] S2, the standby DPU compares the POU-SM3 list of the host DPU with the POU-SM3 list of the standby DPU. If there is a POU configuration file with inconsistent SM3 hash values, the POU configuration file with inconsistent SM3 hash values is marked as a POU configuration file to be synchronized and S3 is executed, otherwise S4 is executed;
[0047] S3, the standby DPU performs differential synchronization on the POU configuration file to be synchronized and updates the SM3 hash value of the corresponding POU configuration file in the POU-SM3 list of the standby DPU;
[0048] S4, end synchronization.
[0049] The POU configuration file of the present invention is a key component in the controller algorithm configuration software, which contains a series of programmable object units required to implement the control algorithm. These POU configuration files are created according to the designed control scheme and are used to write the corresponding control operation loop. SM3 (hash function algorithm standard) is a data integrity verification method. By calculating the SM3 hash value of the data, it can be determined whether an error occurs in the data transmission process. The SM3 hash value is a short fixed-bit check code calculated by the SM3 algorithm.
[0050] The above method of the present invention verifies the SM3 hash value of the POU configuration file to determine whether the POU configuration file in the standby machine is consistent with the corresponding POU configuration file in the host machine. When a POU configuration file with inconsistent SM3 hash value is found, the POU configuration file with inconsistent SM3 hash value in the host machine is differentially synchronized to the standby machine. The method of the present invention can ensure that the POU configuration file synchronized by the standby machine DPU is completely consistent with the corresponding POU configuration file in the host DPU through the verification of the SM3 hash value, avoid data loss or damage, and ensure the accuracy and integrity of the synchronized data; at the same time, because the method of the present invention only synchronizes some files in the POU configuration file with inconsistent SM3 hash value, unnecessary data transmission and processing are avoided, and the synchronization efficiency is improved.
[0051] The POU-SM3 list of the standby DPU of the present invention is an information list of SM3 hash values of all current POU configuration files in the standby DPU.
[0052] In some specific embodiments of the present invention, S1 of the controller starting the redundant data synchronization method for the first time is specifically:
[0053] The standby DPU starts and sends an SM3 request to the host DPU, wherein the SM3 request is used to trigger the host DPU to send the POU-SM3 list of the host DPU to the standby DPU; the POU-SM3 list of the host DPU is an information list of SM3 hash values of all current POU configuration files in the host DPU;
[0054] The standby DPU receives the POU-SM3 list of the host DPU.
[0055] In some specific embodiments of the present invention, the controller starts the redundant data synchronization method for the first time in S2 specifically as follows:
[0056] Traverse all POU configuration files in the POU-SM3 list of the host DPU, compare the SM3 hash value of the current POU configuration file with the SM3 hash value of the corresponding POU configuration file in the POU-SM3 list of the standby DPU, if the two are inconsistent, mark the current POU configuration file as the POU configuration file to be synchronized; after the traversal is completed, if there is a POU configuration file to be synchronized, execute S3, otherwise execute S4.
[0057] In some specific embodiments of the present invention, the controller starts the redundant data synchronization method for the first time in S3 specifically as follows:
[0058] In the method for synchronizing redundant data when the controller starts up for the first time of the present invention, in S3, the standby DPU performs differential synchronization on the POU configuration file to be synchronized, specifically including:
[0059] S31, the standby DPU receives the CRC check code of the small block of the POU configuration file to be synchronized on the host DPU sent by the host DPU; wherein the method for obtaining the CRC check code of the small block of the POU configuration file to be synchronized on the host DPU is: starting from position 0, the POU configuration file to be synchronized on the host DPU is divided into several small blocks according to the block length P and numbered; starting from block 0, a CRC check code is calculated for each small block, and these CRC check codes are arranged in order and sent to the standby DPU;
[0060] S32, the standby DPU starts from position 0, divides the POU configuration file to be synchronized on the standby DPU into several small blocks according to the block length P and numbers them, and calculates a CRC check code for each small block starting from block 0;
[0061] S33, the standby DPU compares the CRC check code of each small block of the POU configuration file to be synchronized on the standby DPU with the CRC check code of the corresponding small block received from the host DPU. If the CRC check code of a small block is consistent, it indicates that the small block of the POU configuration file to be synchronized on the standby DPU is matched successfully; the standby DPU sends the serial numbers of all successfully matched small blocks to the host DPU;
[0062] S34, the standby DPU receives the original content and number of the small blocks that failed to match sent by the host DPU; wherein the small blocks that failed to match refer to the small blocks that remain after the host DPU receives the numbers of all the small blocks that successfully matched sent by the standby DPU and excludes the small blocks that successfully matched;
[0063] S35, the standby DPU constructs a copy based on the original content of the successfully matched small block and the original content of the unmatched small block sent by the host DPU. After the construction is completed, the SM3 hash value of the copy is calculated and compared with the SM3 hash value of the corresponding POU configuration file in the POU-SM3 list on the host DPU. If they are consistent, it means that the synchronization is successful and the synchronization ends; otherwise, the synchronization fails and S36 is executed;
[0064] S36: Reduce the block length P, and execute S31 to S35 to synchronize again until the synchronization is successful or the value of the block length P is reduced to a preset value.
[0065] Example 1
[0066] like Figure 2 As shown, the controller of the present invention starts the redundant data synchronization method for the first time, and the specific implementation process includes the following steps:
[0067] (1) Standby DPU startup: When the standby DPU is started, it first establishes a "first startup data synchronization" thread to prepare to receive and process synchronization data from the host DPU.
[0068] (2) Requesting the POU-SM3 list: The "first startup data synchronization" thread of the standby DPU sends an SM3 request to the host DPU. The SM3 request is used to trigger the host DPU to send the POU-SM3 list of the host DPU to the standby DPU.
[0069] (3) Obtaining the POU-SM3 list: The host DPU responds to the SM3 request of the standby DPU and returns a POU-SM3 list containing the SM3 hash values of all the current POU configuration files of the host DPU; the "first startup data synchronization" thread of the standby DPU receives the POU-SM3 list of the host DPU sent by the host DPU.
[0070] (4) Determine and determine the POU configuration file to be synchronized: The standby DPU traverses all POU configuration files in the POU-SM3 list of the host DPU according to the POU-SM3 list received from the host DPU, and compares the SM3 hash value of the current POU configuration file with the SM3 hash value of the corresponding POU configuration file in the POU-SM3 list of the standby DPU. If the two are inconsistent, the current POU configuration file is marked as the POU configuration file to be synchronized; after the traversal is completed, if there is a POU configuration file to be synchronized, execute step (5), otherwise execute step (7).
[0071] (5) Request and synchronize the POU configuration file to be synchronized:
[0072] The standby DPU sends a synchronization request to the host DPU, and the synchronization request is used to trigger differential synchronization of POU configuration files between the host DPU and the standby DPU. The differential synchronization method is as follows:
[0073] Step 1: Starting from position 0, divide the POU configuration file to be synchronized on the host DPU into several small blocks according to the fixed block length P. The length P of each small block is initially set to 1024 bytes.
[0074] Step 2: Starting from block 0, a rolling check code CRC is calculated for each small block based on the Adler-32 algorithm, and these CRC check codes are arranged in order and sent to the standby DPU; after receiving the POU configuration file to be synchronized on the standby DPU, it is divided into several small blocks according to the same block length P starting from position 0, and the CRC check code of each small block is calculated in turn starting from block 0 to check whether the CRC check code of a small block is consistent with the CRC check code of the corresponding small block sent by the host DPU. If they are consistent, it means that the content of this small block on the standby DPU is consistent with that on the host DPU, and the small block is matched successfully;
[0075] Step 3: The standby DPU sends the numbers of the small blocks whose CRC check codes match successfully to the host DPU. After receiving the numbers, the host DPU sends the original content and numbers of the small blocks whose CRC check codes fail to match to the standby DPU.
[0076] Step 4: The standby DPU constructs a copy that may be consistent with the host DPU based on the matching information and the original content of the small block that failed to match sent by the host DPU. After the construction is completed, the SM3 hash value of the copy is calculated and compared with the SM3 hash value of the corresponding POU configuration file in the POU-SM3 list on the host DPU. If they are consistent, it means that the content differential synchronization is successful. Otherwise, the synchronization fails and step 5 is executed;
[0077] Step 5: Continuing from step 4 above, in most cases data can be synchronized successfully, but in a few cases synchronization fails because the strength of the Adler-32 algorithm is not enough. At this time, the block length P is halved (1024 / 2=512 bytes), and steps 1 to 4 are executed again for synchronization, and so on. Each time the block length P is halved until synchronization is successful or the value of P is reduced to 32 bytes.
[0078] Step 6: If the value of P is reduced to 32 bytes and synchronization still fails, it indicates that the Adler-32 algorithm can no longer meet the synchronization requirements. At this time, replace the Adler-32 algorithm with the SM3 hash algorithm with a stronger hashing degree and execute steps 1 to 4 again for synchronization.
[0079] After the synchronization is successful, the standby DPU updates the SM3 hash value of the corresponding POU configuration file in the POU-SM3 list of the standby DPU according to the SM3 hash value in the POU configuration file to be synchronized.
[0080] (6) Verify data integrity: After receiving all the POU configuration files to be synchronized, the standby DPU returns to step (2) and performs SM3 verification again to verify the integrity of the data. This step is mainly to avoid changes in the POU configuration files in the host DPU during the synchronization process, resulting in incomplete data synchronization.
[0081] (7) Complete synchronization and prepare to take over: The standby DPU completes the redundant data synchronization at the first startup and is in standby state, ready to take over the tasks of the host DPU at any time.
[0082] The controller first startup redundant data synchronization method proposed in the present invention ensures that the standby DPU can accurately and quickly synchronize the POU configuration file of the host DPU when it is first started through precise data comparison and efficient synchronization mechanism, and can ensure the integrity and accuracy of the data even if the host DPU configuration is modified during synchronization, thereby achieving the integrity and consistency of the offline page data. This method provides a strong guarantee for the stability and continuity of industrial automation control systems.
[0083] Example 2
[0084] The following are device embodiments of the present invention, which can be used to perform method embodiments of the present invention. For details not disclosed in the device embodiments, please refer to the method embodiments of the present invention.
[0085] In an embodiment of the present invention, a controller is provided to start a redundant data synchronization system for the first time, including:
[0086] An acquisition module is used for the standby DPU to acquire the POU-SM3 list of the host DPU; the POU-SM3 list of the host DPU is an information list of SM3 hash values of all current POU configuration files in the host DPU;
[0087] A judgment module is used for the standby DPU to compare the POU-SM3 list of the host DPU with the POU-SM3 list of the standby DPU. If there is a POU configuration file with inconsistent SM3 hash values, the POU configuration file with inconsistent SM3 hash values is marked as a POU configuration file to be synchronized;
[0088] The synchronization module is used for the standby DPU to perform differential synchronization on the POU configuration file to be synchronized and update the SM3 hash value of the corresponding POU configuration file in the POU-SM3 list of the standby DPU.
[0089] The acquisition module includes a request module and a receiving module;
[0090] A request module is used for the standby DPU to send an SM3 request to the host DPU, wherein the SM3 request is used to trigger the host DPU to send the POU-SM3 list of the host DPU to the standby DPU; the POU-SM3 list of the host DPU is an information list of SM3 hash values of all current POU configuration files in the host DPU;
[0091] The receiving module is used for the standby DPU to receive the POU-SM3 list of the host DPU.
[0092] In another embodiment of the present invention, a computer device is provided, the computer device including a processor and a memory, the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc., which are the computing core and control core of the terminal, which are suitable for implementing one or more instructions, and are specifically suitable for loading and executing one or more instructions in the computer storage medium to implement the corresponding method flow or corresponding function; the processor described in the embodiment of the present invention can be used for the operation of the controller to start the redundant data synchronization method for the first time.
[0093] In another embodiment of the present invention, the present invention further provides a storage medium, specifically a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The processor can load and execute one or more instructions stored in the computer-readable storage medium to implement the corresponding steps of the method for first starting redundant data synchronization by the controller in the above embodiment.
[0094] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0095] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0096] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0097] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0098] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A method for synchronizing redundant data when a controller starts up for the first time, characterized in that: include: S1, the standby DPU obtains the POU-SM3 list of the host DPU; the POU-SM3 list of the host DPU is an information list of SM3 hash values of all current POU configuration files in the host DPU; S2, the standby DPU compares the POU-SM3 list of the host DPU with the POU-SM3 list of the standby DPU. If there is a POU configuration file with inconsistent SM3 hash values, the POU configuration file with inconsistent SM3 hash values is marked as a POU configuration file to be synchronized and S3 is executed, otherwise S4 is executed; S3, the standby DPU performs differential synchronization on the POU configuration file to be synchronized and updates the SM3 hash value of the corresponding POU configuration file in the POU-SM3 list of the standby DPU; S4, end synchronization.
2. The method for synchronizing redundant data when a controller starts up for the first time according to claim 1, characterized in that: S1 is specifically: The standby DPU sends an SM3 request to the host DPU, wherein the SM3 request is used to trigger the host DPU to send the POU-SM3 list of the host DPU to the standby DPU; the POU-SM3 list of the host DPU is an information list of SM3 hash values of all current POU configuration files in the host DPU; The standby DPU receives the POU-SM3 list of the host DPU.
3. The controller first startup redundant data synchronization method according to claim 1, characterized in that: S2 is specifically: Traverse all POU configuration files in the POU-SM3 list of the host DPU, compare the SM3 hash value of the current POU configuration file with the SM3 hash value of the corresponding POU configuration file in the POU-SM3 list of the standby DPU, if the two are inconsistent, mark the current POU configuration file as the POU configuration file to be synchronized; after the traversal is completed, if there is a POU configuration file to be synchronized, execute S3, otherwise execute S4.
4. The method for synchronizing redundant data when a controller starts up for the first time according to claim 1, characterized in that: In S3, the standby DPU performs differential synchronization on the POU configuration file to be synchronized, specifically including: S31, the standby DPU receives the CRC check code of the small block of the POU configuration file to be synchronized on the host DPU sent by the host DPU; wherein the method for obtaining the CRC check code of the small block of the POU configuration file to be synchronized on the host DPU is: starting from position 0, the POU configuration file to be synchronized on the host DPU is divided into several small blocks according to the block length P and numbered; starting from block 0, the CRC check code is calculated for each small block, and these CRC check codes are arranged in order and sent to the standby DPU; S32, the standby DPU starts from position 0, divides the POU configuration file to be synchronized on the standby DPU into several small blocks according to the block length P and numbers them, and calculates the CRC check code for each small block starting from block 0; S33, the standby DPU compares the CRC check code of each small block of the POU configuration file to be synchronized on the standby DPU with the CRC check code of the corresponding small block received from the host DPU. If the CRC check code of a small block is consistent, it indicates that the small block of the POU configuration file to be synchronized on the standby DPU is matched successfully; the standby DPU sends the serial numbers of all successfully matched small blocks to the host DPU; S34, the standby DPU receives the original content and number of the small blocks that failed to match sent by the host DPU; wherein the small blocks that failed to match refer to the small blocks that remain after the host DPU receives the numbers of all the small blocks that successfully matched sent by the standby DPU and excludes the small blocks that successfully matched; S35, the standby DPU constructs a copy based on the original content of the successfully matched small block and the original content of the unmatched small block sent by the host DPU. After the construction is completed, the SM3 hash value of the copy is calculated and compared with the SM3 hash value of the corresponding POU configuration file in the POU-SM3 list on the host DPU. If they are consistent, it means that the synchronization is successful and the synchronization ends; otherwise, the synchronization fails and S36 is executed; S36: Reduce the block length P, and execute S31 to S35 to synchronize again until the synchronization is successful or the value of the block length P is reduced to a preset value.
5. The method for synchronizing redundant data when a controller starts up for the first time according to claim 4, characterized in that: In S31 and S32, the method used to calculate the CRC check code is the Adler-32 algorithm or the SM3 hash algorithm.
6. The method for synchronizing redundant data when a controller starts up for the first time according to claim 1, characterized in that: After S3 and before S4, the method further includes: a step of returning to S1.
7. A controller starts a redundant data synchronization system for the first time, characterized in that: include: An acquisition module is used for the standby DPU to acquire the POU-SM3 list of the host DPU; the POU-SM3 list of the host DPU is an information list of SM3 hash values of all current POU configuration files in the host DPU; A judgment module is used for the standby DPU to compare the POU-SM3 list of the host DPU with the POU-SM3 list of the standby DPU. If there is a POU configuration file with inconsistent SM3 hash values, the POU configuration file with inconsistent SM3 hash values is marked as a POU configuration file to be synchronized; The synchronization module is used for the standby DPU to perform differential synchronization on the POU configuration file to be synchronized and update the SM3 hash value of the corresponding POU configuration file in the POU-SM3 list of the standby DPU.
8. The controller first startup redundant data synchronization system according to claim 7, characterized in that: The acquisition module includes a request module and a receiving module; A request module is used for the standby DPU to send an SM3 request to the host DPU, wherein the SM3 request is used to trigger the host DPU to send the POU-SM3 list of the host DPU to the standby DPU; the POU-SM3 list of the host DPU is an information list of SM3 hash values of all current POU configuration files in the host DPU; The receiving module is used for the standby DPU to receive the POU-SM3 list of the host DPU.
9. A computer device, characterized in that: It comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method for first starting redundant data synchronization by the controller as claimed in any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for first starting redundant data synchronization by a controller according to any one of claims 1 to 6 are implemented.
