Data synchronization method, electronic equipment, computer storage medium and program product
By dividing the data synchronization method into independent metadata and sending updates when changes occur, the problems of effective bandwidth waste in the data synchronization link and BMC software stability are solved, achieving more efficient data synchronization and resource utilization.
Patent Information
- Application Number
- CN202511244188.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-02
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2045-09-02
AI Technical Summary
In the prior art, the effective bandwidth of the data synchronization link is wasted, and there are problems such as BMC software crashing and increased complexity in unpacking and assembling packages when versions are inconsistent.
The module data to be synchronized is divided into multiple independent metadata, and a metadata linked list is constructed. The metadata is updated only when it changes, and the updated metadata is sent when the conditions are met, thereby improving the effective bandwidth utilization of the data synchronization link.
This improves the effective bandwidth utilization of the data synchronization link, avoids BMC software crashes caused by memory out-of-bounds, and reduces the complexity of packet unpacking and assembly.
Smart Images

Figure CN120763255A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data synchronization technology, and in particular to a data synchronization method, electronic device, computer storage medium, and program product. Background Art
[0002] To improve reliability, a single chassis in a centralized storage system typically uses dual controllers. The management software on each controller expects to obtain full chassis monitoring data from its own BMC (Baseboard Management Controller), rather than accessing data across multiple controllers. This improves management software efficiency.
[0003] In related technologies, the controller's BMC stores data collected by each module in its own data structure, periodically encapsulates it into a single data packet, and sends it to the counterpart BMC for mirrored storage. While this method is simple to implement, it wastes the effective bandwidth of the data synchronization link. Summary of the Invention
[0004] The present application provides a data synchronization method, an electronic device, a computer-readable storage medium, and a computer program product to at least solve the problem of waste of effective bandwidth of a data synchronization link in the related art.
[0005] The present application provides a data synchronization method, which is applied to a local control module. The method includes: determining a local control metadata linked list corresponding to module data to be synchronized, wherein the module data to be synchronized is divided into multiple metadata based on data attributes, and the local control metadata linked list is constructed with the metadata as the linked list node; when there is updated metadata in the local control metadata linked list, constructing a metadata linked list to be sent based on the data identifier and data length of the updated metadata; when the metadata linked list to be sent meets the data synchronization condition, obtaining the data to be synchronized from the local control metadata linked list based on the metadata linked list to be sent, and sending the data to be synchronized to the opposite control module to complete the data synchronization of the opposite control module.
[0006] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned data synchronization methods when executing the computer program.
[0007] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned data synchronization methods are implemented.
[0008] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned data synchronization methods when executed by a processor.
[0009] Through the present application, the module data to be synchronized is first divided into multiple independent metadata according to the data attributes, and a metadata linked list of this control is constructed based on the metadata. In the process of monitoring the metadata according to the preset period, when it is determined that there is a data change in the metadata, the corresponding metadata in the metadata linked list of this control is updated, and the data identifier and data length of the updated metadata are notified to construct the metadata linked list to be sent. When the metadata linked list to be sent meets the data synchronization conditions, the corresponding metadata is copied from the metadata linked list of this control based on the metadata linked list to be sent to obtain the data to be synchronized, so that the data to be synchronized sent to the opposite control module only contains the metadata with data changes, thereby improving the effective bandwidth utilization of the data synchronization link. Therefore, it can solve the technical problem of waste of effective bandwidth of the data synchronization link in the related technology and achieve the technical effect of improving resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0011] Figure 1 This is a schematic diagram of the architecture of a storage system with two controllers in the related art; Figure 2 A schematic diagram of a data synchronization method in related art; Figure 3 A flowchart of a data synchronization method provided in an embodiment of the present application; Figure 4 A schematic diagram of a metadata list to be sent provided in an embodiment of the present application; Figure 5 A schematic diagram of data to be synchronized provided in an embodiment of the present application; Figure 6 A schematic diagram of the architecture of the local control module provided in an embodiment of the present application. DETAILED DESCRIPTION
[0012] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0013] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0014] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0015] In conjunction with the specific application environment architecture or specific hardware architecture on which the execution of the data synchronization method depends, the specific application environment architecture or specific hardware architecture is described here.
[0016] Within the storage software stack, management software and BMC software have clear divisions of responsibility in server / storage device management. Through layered collaboration, they achieve comprehensive management of hardware resources and application services. The BMC, an embedded controller independent of the main system, focuses on hardware monitoring and low-level control, such as real-time sensor data collection from CPU (Central Processing Unit), memory, hard drive temperature, fan speed, and power supply voltage. The management software not only handles storage-related faults, alarms, and events, but also obtains hardware status information from the BMC to comprehensively assess the operating status of the storage device and provide timely warnings and fault alerts to customers.
[0017] Storage devices are mainly divided into two categories: distributed storage and centralized storage. Centralized storage has extremely high requirements for data response. In a single chassis of centralized storage, dual controllers are usually used to improve reliability. The management software on each controller hopes to obtain the full amount of BMC monitoring data for the entire chassis from the local controller BMC, rather than obtaining it across controllers, thereby improving the operating efficiency of the management software. In this context, dual-controller BMC data mirroring has become a basic requirement for storage BMCs, such as Figure 1 The storage system shown is a single-frame dual-controller system.
[0018] In related technologies, such as Figure 2 As shown, BMC (assuming Figure 1 The data collected by each module in the A control baseboard management controller is stored in the data structure of each module, regularly encapsulated into a data packet and delivered to the synchronous sending queue, and then the synchronous thread sends the data packet to the control BMC (i.e. Figure 1The B-controller baseboard management controller (BMC) receives data packets and delivers them to a distribution queue. The BMC then distributes them to the corresponding modules by module name. Within the modules, the data packets are copied locally according to the corresponding data structure. If the data to be synchronized by a module exceeds the maximum length of the synchronization link, the corresponding module must add a file transfer protocol layer to complete packet unpacking and assembly to ensure data consistency.
[0019] The data synchronization method used in related technologies has the following disadvantages: 1. Although periodic synchronization of all module data is simple to implement, it wastes the effective bandwidth of the data synchronization link. This is because during the synchronization period, not all data in the same module is updated, only a small amount of data is updated, or no data is updated.
[0020] 2. When the versions of two BMC controllers (for example, baseboard management controller A and baseboard management controller B) are inconsistent, or the internal data structures of the modules of the two BMC controllers are inconsistent, direct data copying can easily cause memory out-of-bounds errors, leading to BMC software crashes and affecting BMC software stability.
[0021] 3. When the module synchronization data exceeds the data transmission length of the synchronization link at one time, additional unpacking and assembly software processing is required, which increases the complexity.
[0022] In order to solve at least one of the above technical problems, the present application proposes a data synchronization method. First, the data of the module to be synchronized is divided into multiple independent metadata according to the data attributes, and a local control metadata linked list is constructed based on the metadata. In the process of monitoring the metadata according to a preset period, when it is determined that there is a data change in the metadata, the corresponding metadata in the local control metadata linked list is updated, and the data identifier and data length notification of the updated metadata are used to construct the metadata linked list to be sent. When the metadata linked list to be sent meets the data synchronization conditions, the corresponding metadata is copied from the local control metadata linked list based on the metadata linked list to be sent to obtain the data to be synchronized, so that the data to be synchronized sent to the opposite control module only contains the metadata with data changes, thereby improving the effective bandwidth utilization of the data synchronization link. Therefore, it can solve the technical problem of waste of effective bandwidth of the data synchronization link in the related technology and achieve the technical effect of improving resource utilization.
[0023] The data synchronization method of the present application is illustrated below with reference to the accompanying drawings.
[0024] Figure 1 A data synchronization method proposed in an embodiment of the present application.
[0025] Reference Figure 1 As shown, the data synchronization method of the embodiment of the present application is applied to the local control module, and the data synchronization method includes: S1, determining the local control metadata linked list corresponding to the module data to be synchronized, wherein the module data to be synchronized is divided into multiple metadata based on data attributes, and the local control metadata linked list is constructed with the metadata as the linked list nodes; Specifically, assuming that the local control module is Figure 1 Taking the A-control board management controller in the controller-A shown in the figure as an example, the opposite control module is Figure 1 The controller in -B is the B control baseboard management controller.
[0026] by Figure 1 For example, by sorting out the modules in the A-controller baseboard management controller and the data that needs to be synchronized within each module, the module data to be synchronized is obtained. Based on the data attributes, this module data to be synchronized is divided into multiple independent metadata. For example, a key value (identification code) is assigned to each module, and a key value is also assigned to each independent data within the module. The two key values have different dimensions and are independent enumeration sets, as shown in Table 1, to form multiple independent metadata.
[0027] Table 1
[0028] For example, the data that needs to be synchronized in baseboard management controller A includes the following: BMC version number (16 bytes) and controller type (1 byte). Therefore, the BMC version number and controller type are two independent metadata. Furthermore, the length of each independent metadata must exceed the effective bandwidth of the synchronization link.
[0029] Then, a chain node is constructed based on the metadata to obtain the local control metadata linked list List1 corresponding to the module data to be synchronized of the A control substrate management module.
[0030] S2: If there is updated metadata in the control metadata list, construct a metadata list to be sent based on the data identifier and data length of the updated metadata; Specifically, the metadata in the current control metadata list List1 can be detected according to a preset period. When the actual sampling data of the metadata is inconsistent with the previous sampling data, it is determined that the metadata has been updated. Based on the actual sampling data, the data content of the metadata in the current control metadata list List1 is changed to determine that there is updated metadata in the current control metadata list.
[0031] At this time, the data identifier and data length of the updated metadata in the control metadata linked list List1 are obtained, and the data identifier and data length of the updated metadata are used as the linked list nodes to construct the synchronized metadata linked list List3. The data identifier may include the metadata key value of the metadata and the module key value of the module to which it belongs. The data length can be determined based on the updated content.
[0032] S3, when the metadata list to be sent meets the data synchronization conditions, obtain the data to be synchronized from the metadata list of the control module based on the metadata list to be sent, and send the data to be synchronized to the opposite control module to complete the data synchronization of the opposite control module.
[0033] Specifically, when the effective construction time of the data to be synchronized linked list List3 reaches the preset time threshold, or the total length of the data to be synchronized calculated according to the data to be synchronized linked list List3 reaches the preset threshold, or the number of newly added nodes in the data to be synchronized linked list List3 reaches the preset node threshold, it is considered that the metadata linked list List3 to be sent meets the data synchronization conditions and the data to be synchronized needs to be sent.
[0034] At this time, based on the metadata list List3 to be sent, the corresponding metadata content is copied from the metadata list List1 of this control to obtain the data to be synchronized, and the data to be synchronized is encapsulated into a data packet and delivered to the synchronization sending queue. Then the synchronization thread sends the data packet to the B control substrate management controller (that is, the opposite control module) so that the B control substrate management controller obtains the corresponding data to be synchronized based on the analysis of the received data packet, obtains at least one metadata, and then distributes it to the corresponding module for storage according to the module Key value and metadata Key value of each metadata to complete data synchronization.
[0035] This embodiment completes data synchronization based on independent metadata. At this time, when the local control module and the opposite control module have inconsistent versions, or when the local control module and the opposite control module have inconsistent module internal data structures, the copy and transmission of metadata will not cause memory out-of-bounds, BMC software crash, or affect the stability of the BMC software. In addition, the data to be synchronized is determined based on the updated metadata, and only the metadata with data changes is sent, thereby improving the effective bandwidth utilization of the synchronization link.
[0036] In some embodiments of the present application, determining the local control metadata linked list corresponding to the module data to be synchronized includes: determining the module data to be synchronized based on the sub-modules in the local control module and the target synchronization data in the sub-modules; dividing the module data to be synchronized into multiple metadata according to data attributes to determine the metadata configuration file of the local control module, wherein the metadata configuration file corresponds to the sub-modules in the local control module; parsing the metadata configuration file to obtain multiple metadata in a preset data structure, wherein the preset data structure includes data identification, data length and data content; using multiple metadata in the preset data structure as linked list nodes to construct the local control metadata linked list.
[0037] Specifically, continue to use the local control module as Figure 1 Taking the A-control baseboard management controller shown as an example, the modules in the A-control baseboard management controller and the data that need to be synchronized in each module are sorted out to obtain the module data to be synchronized, and the module data to be synchronized is divided into multiple independent metadata based on data attributes, as shown in Table 1. A key value is assigned to each module, and a key value is also assigned to each independent data in the module to form multiple independent metadata. The metadata is identified based on key values of different dimensions to improve the identification accuracy of the metadata.
[0038] After sorting out the metadata that needs to be synchronized for each module in the A-control substrate management controller based on the above steps, the metadata configuration file of each module is output in the manner of referring to Table 1. Taking module 1 among the many modules of the A-control substrate management controller as an example, after the module 1 program is started, the metadata configuration file of module 1 is first parsed, and each metadata in the metadata configuration file is generated as a node of a linked list according to the preset data structure of Table 2. All metadata in the entire metadata configuration file are generated as linked list nodes in the same way, thereby obtaining the metadata linked list List1 of this control.
[0039] Table 2
[0040] In other words, the independent metadata is abstracted into a unified, pre-set data structure, as shown in Table 2. This pre-set data structure contains the data content, data length, and data identifier. The data identifier is the module name (module key) to which the metadata belongs and the metadata number within the module (metadata key), and the data content is a pointer to the metadata. Referring to the data structure shown in Table 2, a local metadata linked list, List1, is generated for module 1. The corresponding memory is allocated for the metadata data pointer (mod_data_ptr) for each node in List1. Similarly, the local metadata linked list, List1, for each module in the A-control baseboard management controller is constructed.
[0041] In the A-control board management controller, each module collects hardware data and compares it with the previous data. If there is a change, the data in Table 2 is updated (the data length of the metadata remains unchanged, but the content may change. For example, the alarm light status may be on at the previous moment and off at the next moment). Then, based on the data identifier and data length of the updated metadata, a linked list of metadata to be sent is constructed to determine whether to perform data synchronization transmission.
[0042] This embodiment abstracts metadata into the same data structure to construct the control metadata linked list List1, thereby improving data synchronization accuracy and ensuring data synchronization efficiency.
[0043] In some embodiments of the present application, when updated metadata exists in the current control metadata linked list, a metadata linked list to be sent is constructed based on the data identifier and data length of the updated metadata, including: performing metadata traversal detection based on the current control metadata linked list; after completing this traversal detection and when updated metadata exists in the current control metadata linked list, obtaining the data identifier and data length of the updated metadata; and using the data identifier and data length of the updated metadata as linked list nodes to construct the metadata linked list to be sent.
[0044] That is to say, after constructing the obtained local control metadata linked list List1, metadata traversal detection is performed based on the local control metadata linked list List1. After a round of detection of all metadata instances in the local control metadata linked list List1 is completed, the data identifier (mod_id, mod_data_id) and data length (mod_data_len) of the metadata updated in this round are extracted and used as linked list nodes and added to the metadata linked list to be sent List3, as shown in FIG. Figure 4 shown.
[0045] After completing the test of all metadata, this embodiment counts the updated metadata in the control metadata linked list List1, and sends the data identifier and data length of the updated metadata to the metadata linked list List3 to be sent in turn for adding nodes, thereby improving the construction quality of the metadata linked list to be sent. At the same time, it can form a periodic update of the metadata linked list to be sent, which facilitates time planning between different processes and improves data synchronization quality.
[0046] In some embodiments of the present application, metadata traversal detection is performed based on the local control metadata linked list, including: constructing a metadata instance test data structure in the hardware information instance test thread based on the local control metadata linked list, wherein the instance test data structure includes a data identifier and data content; based on the hardware information instance test thread, traversing the hardware objects of the local control module according to the data identifier of the metadata to obtain the current data value of the metadata, and when there is a deviation between the current data value of the metadata and the initial data value in the data content of the metadata, updating the current data value of the metadata to the local control metadata linked list.
[0047] Specifically, after constructing the local control metadata linked list List1, the hardware information test thread maintains a data structure for each metadata item, recording the metadata's key value and the previous data value (i.e., the initial data value). The hardware acquisition thread traverses the hardware objects according to the metadata's key value. Each metadata item collected is compared with the previous data value. If they are inconsistent, the metadata is updated in the local control data linked list List1, and the metadata is considered updated. If they are consistent, the metadata is not updated.
[0048] This embodiment maintains a data structure for metadata in the hardware information test thread and performs traversal detection based on the data structure, thereby reducing the reading of the control data linked list List1 and improving the traversal detection efficiency.
[0049] In some embodiments of the present application, after constructing a linked list of metadata to be sent based on the data identifier and data length of the updated metadata, the data synchronization method also includes: determining the data length of the updated metadata based on the data identifier and data length of the updated metadata; obtaining the sum of the data lengths of the updated metadata in the linked list of metadata to be sent to obtain the total length of the data to be synchronized; and when the total length of the data to be synchronized reaches a preset threshold, determining that the data synchronization conditions are met.
[0050] Specifically, Figure 4For example, each node in the linked list of metadata to be sent, List3, is traversed, and the data length of the updated metadata corresponding to each node is calculated. Referring to Table 2, the formula for calculating the sum of the updated metadata data lengths is mod_data_len + 3 (mod_id, mod_data_id, and mod_data_len occupy 3 bytes). The data lengths of the updated metadata corresponding to all nodes in the linked list of metadata to be sent, List3, are then summed to obtain the total length of the data to be synchronized, Sumlenlist3. The total length of the data to be synchronized, Sumlenlist3, is compared with a preset threshold. If the total length of the data to be synchronized, Sumlenlist3, reaches the preset threshold, data synchronization is performed. If the total length of the data to be synchronized, Sumlenlist3, does not reach the preset threshold, and the waiting process for metadata update continues. The preset threshold can be set based on actual conditions and is used to determine the degree of compatibility between the total length of the data to be synchronized and the data transmission performance between the two modules. This embodiment performs data synchronization only when the total length of the data to be synchronized reaches the preset threshold, thereby improving data transmission resource matching and reducing resource waste while ensuring data synchronization quality.
[0051] In some embodiments of the present application, the data synchronization method also includes: determining the effective bandwidth of the synchronization link between the local control module and the opposite control module; determining the unit payload length based on the effective bandwidth of the synchronization link; obtaining the product between the unit payload length and a preset coefficient to obtain a preset threshold.
[0052] In other words, the effective data length (unit payload length) of a synchronous link transmission is determined by the effective bandwidth of the synchronous link between the local control module and the opposite control module. For example, the maximum data field of a TCP / IP (Transmission Control Protocol / Internet Protocol) packet is 1500 bytes, while the maximum data field of an IPMI packet is 249 bytes.
[0053] If the synchronization link between the local control module and the opposite control module is a network, the unit payload length is determined to be 1500 bytes. At this time, if the total length of the data to be synchronized Sumlenlist3 = 1500, it is considered a match and the following data synchronization operation is performed. A threshold, that is, a preset coefficient, can also be set here. For example, if it reaches 90% of the effective bandwidth of the synchronization link, it is also considered a match, that is, when the total length of the data to be synchronized Sumlenlist3 = 1350 (i.e. 1500*90%), it is considered a match and the following data synchronization operation is performed; otherwise, it is considered a mismatch. In order to avoid wasting link bandwidth, data synchronization enters a waiting state, waiting for new synchronization metadata to be added.
[0054] This embodiment calculates the matching between the amount of data to be synchronized and the effective bandwidth of the synchronization link based on a preset threshold. On the one hand, it can improve the effective bandwidth utilization rate. On the other hand, it can also prevent the synchronization data from exceeding the data transmission length of the synchronization link at one time, which requires additional unpacking and packaging software processing, resulting in increased complexity.
[0055] In some embodiments of the present application, the data to be synchronized is obtained from the local control metadata list based on the metadata list to be sent, including: matching the metadata in the local control metadata list according to the data identifier of the updated metadata in the metadata list to be sent; copying the metadata in the local control metadata list that has been successfully matched to obtain at least one metadata to be synchronized; and determining the data to be synchronized based on the at least one metadata to be synchronized.
[0056] That is to say, when the data synchronization conditions are met, the corresponding metadata is copied from the metadata list List1 based on the data identifier of the updated metadata to obtain the metadata to be synchronized, and then the metadata to be synchronized is synchronized according to Figure 5 The data to be synchronized is constructed in the format of , and sent to the opposite control module. If the data synchronization conditions are not met, it continues to wait for the addition of new synchronization metadata.
[0057] This embodiment copies metadata from the control metadata linked list based on the data identifier to construct the data to be synchronized, thereby ensuring the quality of data synchronization.
[0058] In some embodiments of the present application, the data synchronization method further includes: after obtaining the data to be synchronized from the control metadata linked list based on the metadata linked list to be sent, clearing the data in the metadata linked list to be sent.
[0059] That is, after the metadata list to be sent meets the data synchronization conditions and the metadata list to be synchronized is retrieved from the local control metadata list List1 based on the metadata list to be sent List3, the metadata list to be synchronized can be sent to the opposite control module via the send queue. Furthermore, the metadata list to be synchronized List3 is cleared to allow for the reception of new updated metadata and prevent duplicate data synchronization. This embodiment monitors data based on the metadata list to be sent List3, distinguishing it from the data synchronization process. Without affecting data synchronization efficiency, the metadata list to be sent List3 is cleared to improve the monitoring quality of updated data.
[0060] In some embodiments of the present application, the data synchronization method also includes: obtaining the actual synchronization interval duration of the local control module; when the actual synchronization interval duration reaches the preset interval time, determining that the data synchronization conditions are met, and after obtaining the data to be synchronized from the local control metadata list based on the metadata list to be sent, re-timing the actual synchronization interval duration.
[0061] That is, in addition to determining whether to execute the data synchronization operation based on the total length of the data to be synchronized Sumlenlist3, the synchronization interval is also used to determine whether to start the data synchronization operation to meet the timeliness requirements of data updates. The preset interval time can be set according to actual conditions.
[0062] For example, data synchronization conditions include the total length of the pending data (Sumlenlist3) reaching a preset threshold (i.e., matching the effective synchronization link bandwidth) or the actual synchronization interval (timer) reaching a preset interval (i.e., timer expiration). Both the "matching the effective synchronization link bandwidth" and "timer expiration" conditions can trigger data synchronization, with the former taking precedence over the latter. Once triggered, all metadata corresponding to the metadata list (List3) must be sent. The actual synchronization interval condition is set to ensure that even if the length of the pending metadata is less than the effective synchronization link bandwidth, it can be sent to the opposite control system in a timely manner.
[0063] In the process of determining whether the data synchronization conditions are met, if the total length of the data to be synchronized does not match the effective bandwidth of the synchronization link, in order to avoid wasting link bandwidth, the data synchronization enters a waiting state, waiting for new synchronization metadata to be added. After the timer times out, according to the metadata to be synchronized in the metadata to be sent list3, the data is copied from the local control metadata list List1 in sequence, sent to the opposite control module, and the timer is restarted; If the total length of the data to be synchronized matches the effective bandwidth of the synchronization link, the data in the data link list Listl of the local control module is obtained immediately and sent to the opposite control module, and the timer is restarted even if the timer has not timed out.
[0064] In some embodiments of the present application, the data synchronization method further comprises: if the actual synchronization interval length reaches the preset interval time and the metadata link list to be sent is empty, determining that the data synchronization condition is not met, and restarting the actual synchronization interval length.
[0065] That is, if the metadata link list to be sent List3 is empty, i.e., there is no metadata to be synchronized, after the timer times out, i.e., the actual synchronization interval length reaches the preset interval time, the timer is reset and the actual synchronization interval length is restarted to avoid invalid data synchronization operation and optimize the data synchronization process.
[0066] In some embodiments of the present application, the data synchronization method further comprises: in the case of receiving the data to be synchronized sent by the opposite control module, performing metadata analysis on the data to be synchronized sent by the opposite control module to determine at least one metadata to be synchronized sent by the opposite control module; matching the control mirror metadata link list corresponding to the opposite control module according to the data identifier of the at least one metadata to be synchronized sent by the opposite control module; and updating the control mirror metadata link list according to the matching result to complete the data synchronization of the opposite control module.
[0067] Specifically, as shown in Figure 1 Taking the local control module as the A-control baseboard management controller and the opposite control module as the B-control baseboard management controller as an example, the B-control baseboard management controller sends the data to be synchronized in its internal to the A-control baseboard management controller based on the above data synchronization method, and the A-control baseboard management controller completes the data synchronization of the B-control baseboard management controller. The specific operation is as follows: After receiving the data to be synchronized sent by the B-control baseboard management controller, the A-control baseboard management controller analyzes each metadata in turn according to the format of Figure 5 , obtains at least one metadata to be synchronized sent by the B-control baseboard management controller, and then finds the corresponding metadata in the control mirror data link list List2 in the A-control baseboard management controller according to the data identifier mod_id and mod_data_id of the at least one metadata to be synchronized sent by the B-control baseboard management controller, and then updates the metadata in the control mirror data link list List2 according to the data identifier (mod_id, mod_data_id).
[0068] This embodiment matches the control mirror metadata linked list based on the data identifier of the metadata to be synchronized, and updates the control mirror metadata linked list according to the matching result, thereby improving data synchronization effect and data mirroring stability.
[0069] In some embodiments of the present application, data of the control mirror metadata linked list is updated according to the matching result, including: when the data identifier of the metadata to be synchronized sent by the opposite control module matches the control mirror metadata linked list successfully, the corresponding metadata in the control mirror metadata linked list is updated based on the metadata to be synchronized sent by the opposite control module; when the data identifier of the metadata to be synchronized sent by the opposite control module fails to match the control mirror metadata linked list, the metadata to be synchronized sent by the opposite control module is discarded.
[0070] That is to say, when the data identifiers mod_id and mod_data_id of the metadata to be synchronized sent by the B-control baseboard management controller are found in the control mirror data linked list List2 in the A-control baseboard management controller, the corresponding metadata in the control mirror data linked list List2 is updated.
[0071] If the data identifiers mod_id and mod_data_id of the metadata to be synchronized sent by the B-control baseboard management controller are not found in the control mirror data linked list List2 in the A-control baseboard management controller, the metadata is directly discarded without being updated, which can prevent the BMC software from crashing due to memory out of bounds and affecting the stability of the BMC software.
[0072] In addition, when the data identifier of the metadata to be synchronized sent by the opposite control module fails to match the metadata linked list of the opposite control mirror, the metadata to be synchronized that failed to match can also be pre-stored in a preset storage module and stored for a preset period of time through the preset storage module. If the match is still not successful within the preset period of time, the data will be deleted.
[0073] As a specific implementation of this application, Figure 6 As shown, the above data synchronization method can be completed based on this system architecture, as follows: STEP 1: After sorting out the metadata that needs to be synchronized for each module of the baseboard management controller (BMC), refer to Table 1 to output the metadata configuration file for each module. Taking module 1 among the many BMC modules as an example, after the module 1 program starts, first parse the module 1 metadata configuration file. Refer to Table 2 to generate a local control metadata linked list List1 for module 1, and allocate the corresponding memory for the data pointer part (mod_data_ptr) of the metadata of each node in the linked list.
[0074] STEP 2: Module 1 has obtained a list of all metadata through STEP 1. Within Module 1's hardware information test thread, a data structure is maintained for each metadata item, recording the metadata key and the previous data value. After Module 1's hardware information collection thread begins, each metadata value collected is compared with the previous value. If there is a discrepancy, the value is updated to Module 1's local control data list, List1.
[0075] STEP 3: After all metadata instances of module 1 are tested, the updated metadata parameters (mod_id, mod_data_id, mod_data_len) are sent to the data synchronization module one by one.
[0076] STEP 4: After the data synchronization module is started, a software timer is immediately started. The timer is used to send the metadata to the controlling BMC in a timely manner even if the length of the metadata to be synchronized is less than the effective bandwidth of the synchronization link.
[0077] After receiving the metadata parameters from module 1, the data synchronization module adds them to its local list of metadata to be sent, List3, and calculates whether the amount of data to be synchronized matches the effective bandwidth of the synchronization link. This calculation is performed by traversing each node (metadata) in List3 and calculating the data length corresponding to each node using the formula (see Table 2): mod_data_len + 3 (mod_id, mod_data_id, and mod_data_len occupy 3 bytes). The sum is calculated to obtain the total length of the data to be synchronized, Sumlenlist3. Assuming the synchronization link between BMCs is a network, the unit payload length corresponding to the effective bandwidth of the BMC synchronization link is 1500 bytes. If Sumlenlist3 = 1500, a match is considered. A threshold, or a preset coefficient, can also be set. For example, a match is considered when the total length of the data to be synchronized reaches 90% of the effective bandwidth of the synchronization link. This is converted to Sumlenlist3 = 1350, which is considered a match.
[0078] If the total length of the data to be synchronized matches the effective bandwidth of the synchronization link, even if the timer has not timed out, the metadata must be immediately obtained from the local control metadata list List1 of module 1 and sent to the control (press Figure 5 After the sending is completed, the metadata is deleted from the metadata list to be sent List3.
[0079] It should be noted that each time a node is added to the metadata list to be sent List3, the data synchronization module must calculate the total length of the data to be synchronized Sumlenlist3. Both the "matching the effective bandwidth of the synchronization link" and the "timer timeout" conditions can trigger data synchronization. The former has a higher priority than the latter. Once triggered, all the corresponding metadata in the metadata list to be sent List3 must be sent.
[0080] If they do not match, in order to avoid wasting link bandwidth, data synchronization enters a waiting state, waiting for new synchronization metadata to be added. After the timer times out, the data is copied from the module 1's local control metadata list List1 in sequence according to the metadata information to be synchronized in the metadata list to be sent List3, and sent to the control (by pressing Figure 5 After sending a metadata, delete the metadata from List3. After all the data in List3 are sent, reset the timer.
[0081] If the Timer has timed out and List3 is an empty linked list (ie, there is no metadata to be synchronized), the timer is reset directly.
[0082] STEP5: This step is to process the synchronous data sent by the control. After receiving the data packet, follow the Figure 5 After the parsing is completed, the corresponding metadata is found in the module 1 control mirror data linked list List2 according to mod_id and mod_data_id, and then the metadata is updated.
[0083] STEP 6: After completing STEPs 1 to 5, the local control BMC has obtained the metadata of local control module 1 and the mirror metadata of peer control module 1. If the host computer queries the corresponding data, in the interface function of module 1, it can directly search from the module 1 local control metadata linked list List1 and the module 1 peer control mirror metadata linked list List2 based on mod_data_id.
[0084] Based on the above, the data synchronization method of this application can bring the following beneficial effects: 1. Improve the effective bandwidth utilization of the BMC data synchronization link; 2. New synchronization metadata added to each BMC module will prevent memory out-of-bounds issues from triggering BMC software crashes, improving BMC software reliability. 3. Based on conditional settings, the data to be synchronized is matched with the synchronization link bandwidth, eliminating the need for additional unpacking and assembly, reducing software complexity.
[0085] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0086] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned data synchronization method embodiments.
[0087] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned data synchronization method embodiments when running.
[0088] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0089] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any of the above data synchronization method embodiments are implemented.
[0090] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above-mentioned data synchronization method embodiments are implemented.
[0091] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0092] The above is a detailed introduction to a data synchronization method, electronic device, computer storage medium and program product provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only applicable to help understand the method of the present application and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A data synchronization method, characterized in that: Applied to a local control module, the method includes: Determine a local control metadata linked list corresponding to the module data to be synchronized, wherein the module data to be synchronized is divided into multiple metadata based on data attributes, and the local control metadata linked list is constructed using the metadata as linked list nodes; If updated metadata exists in the local metadata linked list, constructing a metadata linked list to be sent based on the data identifier and data length of the updated metadata; When the metadata list to be sent meets the data synchronization conditions, the data to be synchronized is obtained from the local control metadata list based on the metadata list to be sent, and the data to be synchronized is sent to the opposite control module to complete the data synchronization of the opposite control module.
2. The data synchronization method according to claim 1, characterized in that: Determine the local control metadata linked list corresponding to the module data to be synchronized, including: Determine the module data to be synchronized according to the submodules in the local control module and the target synchronization data in the submodules; Dividing the module data to be synchronized into a plurality of metadata according to data attributes to determine a metadata configuration file of the local control module, wherein the metadata configuration file corresponds to a submodule in the local control module; Parsing the metadata configuration file to obtain a plurality of metadata in a preset data structure, wherein the preset data structure includes a data identifier, a data length, and a data content; The metadata linked list of the control is constructed by using a plurality of metadata in the preset data structure as linked list nodes.
3. The data synchronization method according to claim 1, wherein: When updated metadata exists in the local metadata linked list, constructing a metadata linked list to be sent based on the data identifier and data length of the updated metadata includes: Perform metadata traversal detection based on the metadata linked list; When the traversal detection is completed and the updated metadata exists in the control metadata linked list, the data identifier and data length of the updated metadata are obtained; The data identifier and data length of the updated metadata are used as linked list nodes to construct the metadata linked list to be sent.
4. The data synchronization method according to claim 3, characterized in that: Performing metadata traversal detection based on the metadata linked list includes: Constructing a metadata instance test data structure in the hardware information instance test thread based on the control metadata linked list, wherein the instance test data structure includes a data identifier and data content; Based on the hardware information test thread, the hardware objects of the local control module are traversed according to the data identifier of the metadata to obtain the current data value of the metadata. When there is a deviation between the current data value of the metadata and the initial data value in the data content of the metadata, the current data value of the metadata is updated to the local control metadata linked list.
5. The data synchronization method according to claim 1, wherein: After constructing a metadata linked list to be sent based on the data identifier and data length of the updated metadata, the method further includes: Determining the data length of the updated metadata according to the data identifier and the data length of the updated metadata; Obtaining the sum of the data lengths of the updated metadata in the metadata linked list to be sent to obtain the total length of the data to be synchronized; When the total length of the data to be synchronized reaches a preset threshold, it is determined that the data synchronization condition is met.
6. The data synchronization method according to claim 5, characterized in that: The method further comprises: Determining an effective bandwidth of a synchronization link between the local control module and the opposite control module; Determining a unit payload length based on the synchronization link effective bandwidth; The product of the unit payload length and a preset coefficient is obtained to obtain the preset threshold.
7. The data synchronization method according to claim 5, characterized in that: Acquiring the data to be synchronized from the local control metadata linked list based on the metadata linked list to be sent, including: Matching metadata in the current control metadata chain list according to the data identifier of the updated metadata in the to-be-sent metadata chain list; Copying the metadata in the local control metadata linked list that has been successfully matched to obtain at least one metadata to be synchronized; The data to be synchronized is determined based on the at least one metadata to be synchronized.
8. The data synchronization method according to claim 7, characterized in that: The method further comprises: After acquiring the data to be synchronized from the local control metadata linked list based on the metadata linked list to be sent, the metadata linked list to be sent is cleared.
9. The data synchronization method according to claim 1, wherein: The method further comprises: Obtaining the actual synchronization interval duration of the local control module; When the actual synchronization interval reaches the preset interval time, it is determined that the data synchronization condition is met, and after obtaining the data to be synchronized from the local control metadata list based on the metadata list to be sent, the actual synchronization interval is retimed.
10. The data synchronization method according to claim 9, characterized in that: Also includes: When the actual synchronization interval reaches the preset interval time and the linked list of metadata to be sent is an empty linked list, it is determined that the data synchronization condition is not met, and the actual synchronization interval is retimed.
11. The data synchronization method according to claim 1, wherein: The method further comprises: When receiving the data to be synchronized sent by the opposite control module, performing metadata parsing on the data to be synchronized sent by the opposite control module to determine at least one metadata to be synchronized sent by the opposite control module; Matching the control mirror metadata linked list corresponding to the opposite control module according to the data identifier of at least one metadata to be synchronized sent by the opposite control module; The control mirror metadata linked list is updated according to the matching result to complete the data synchronization of the opposite control module.
12. The data synchronization method according to claim 11, characterized in that: The control mirror metadata linked list is updated according to the matching result, including: When the data identifier of the metadata to be synchronized sent by the opposing control module successfully matches the metadata linked list of the opposing mirror, updating the corresponding metadata in the metadata linked list of the opposing mirror based on the metadata to be synchronized sent by the opposing control module; In a case where the data identifier of the metadata to be synchronized sent by the opposite control module fails to match the metadata linked list of the opposite control mirror, the metadata to be synchronized sent by the opposite control module is discarded.
13. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the data synchronization method according to any one of claims 1 to 12 when executing the computer program.
14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the data synchronization method according to any one of claims 1 to 12.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the data synchronization method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Data table updating method and device, equipment and storage medium
CN115481132A
Data synchronization method and device, electronic equipment and storage medium
CN116431398A
Metadata synchronization method, device and equipment based on lake and warehouse integration and medium
CN116595096A
Data synchronization method, substrate management controller, electronic equipment and storage medium
CN116795290A
Data synchronization method and device, readable storage medium and electronic equipment
CN117725129A