Data synchronization method and system and related products
By exchanging identity in the original receiving area and the original sending area of the target device and synchronizing the data set, the conflict problem of data synchronization in multiple devices in a high-speed transmission environment is solved, and accurate data transmission and update are achieved.
Patent Information
- Application Number
- CN202411793550.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-28
AI Technical Summary
In the high-speed transmission environment, data synchronization between multiple devices is prone to be disordered or lost due to data conflicts, resulting in inconsistent data stored by the device, and the accurate transmission and update of data cannot be guaranteed.
By replacing identity in the original receiving area and the original sending area of the target device, the load of data during reading, writing and transmission is reassigned and processed, so that the processing capabilities of the sending area and receiving area are matched, and the data set is synchronized to the original sending area of the target device, to ensure that each data transmission achieves the accurate effect of synchronous updates.
In a high-speed transmission environment, data processing efficiency is improved, data reentry risk is avoided, and data is accurately transmitted and updated between multiple devices is ensured.
Smart Images

Figure CN119719224A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communication technology, and in particular, to data synchronization methods, systems and related products. Background Art
[0002] With the development of technology, more and more embedded devices are connected to the Internet to realize intelligent applications. Data synchronization between these devices has become a core issue. For example, in an intelligent conference system, the latest file data needs to be synchronized to different conference terminals (including PC terminals, smart phone terminals, tablet terminals, etc.) in real time, so that the data received by each conference terminal is consistent and accurate data of the latest version status.
[0003] In the process of realizing the invention, the inventors found that there are at least the following problems in the prior art: In the prior art, data synchronization between multiple devices is often achieved through broadcasting, but in a high-speed transmission environment, due to the rapid writing and large-scale reading of broadcast data, it is easy to cause conflicts and confusion or loss of data during the transmission process, that is, data is easily overwritten or modified by other data during the writing process, resulting in inconsistency or loss of data stored in multiple devices, and unable to guarantee accurate data transmission and data update between multiple devices.
[0004] In view of this, an effective solution needs to be provided. Summary of the invention
[0005] The embodiments of the present application provide a data synchronization method, system and related products for avoiding data re-entry caused by rapid data writing in a high-speed data transmission environment, and further solving the problem of inaccurate data reading.
[0006] The first aspect of the embodiments of the present application provides a data synchronization method, system and related products, including:
[0007] For a device chain formed by connecting multiple devices, determine a target device in the device chain and a subordinate device of the target device; each of the devices is provided with an original sending area and an original receiving area that are independent of each other, and the target device refers to the device in which data is written to the original receiving area;
[0008] After recognizing that the write operation is completed, the original receiving area and the original sending area of the target device are swapped to set a new sending area and a new receiving area of the target device, and the existing data set in the original receiving area is synchronized to the original sending area of the target device, so that the target device sends the data set to the subordinate device each time through the new sending area; the data set includes the data written to the original receiving area.
[0009] Optionally, exchanging the identities of the original receiving zone and the original sending zone of the target device includes:
[0010] Re-manage the respective configuration information of the original receiving area and the original sending area, and adjust the direction of the data flow according to the correct configuration information obtained by management, so that the data originally flowing into the original receiving area is changed to flow into the original sending area, and finally sent from the original receiving area to the lower-level device to obtain a new sending area and a new receiving area in exchange.
[0011] Optionally, after swapping the identities of the original receiving zone and the original sending zone of the target device, the method further includes:
[0012] Monitor and verify the data transmission of the new sending area and the new receiving area, and when the verification fails, return to the step of re-managing the configuration information of the original receiving area and the original sending area, until a new sending area and a new receiving area that have been successfully verified are obtained.
[0013] Optionally, the method further comprises:
[0014] For each data buffer identified as a sending area, each data buffer is set to be in a read-only mode to prohibit modification of data in the sending area.
[0015] Optionally, the target device sends the data set to the subordinate device each time through the new sending area, including:
[0016] If the data transmission mode is that when the current device sends its own device data to the subordinate device on one side, it needs to carry the device data of all devices on the other side of the current device, then the device data of all devices on the other side are all passed to the current device, so that when the current device is used as the target device, the device data of all devices on the other side and the device data are uniformly sent to the subordinate device through the new sending area of the target device.
[0017] Optionally, the determining a target device in a device chain and a subordinate device of the target device includes:
[0018] Allocating a master interface and a slave interface to each device in the device chain, wherein the master interface of each device is connected to the slave interface of a lower-level device;
[0019] According to the connection order between the devices, the device identification of each device is sequentially added to the preset signal frame, and the signal frame is transparently transmitted from the master interface of each device to the slave interface of the subordinate device until each device receives the target signal frame containing all device identifications;
[0020] The device whose original receiving area is written with data in the device chain is determined as the target device, and the subordinate devices of the target device are determined based on the order in which each device identification is added to the signal frame.
[0021] When the method described in the first aspect of the present application is implemented, the content described in the second aspect of the present application can be adopted to achieve it.
[0022] A second aspect of an embodiment of the present application provides a data synchronization system, including: a determination unit and a processing unit;
[0023] The determining unit is used to determine, for a device chain formed by connecting multiple devices, a target device and subordinate devices of the target device in the device chain; each of the devices is provided with an original sending area and an original receiving area that are independent of each other, and the target device refers to the device in which data is written to the original receiving area;
[0024] The processing unit is used to, after recognizing that the write operation is completed, swap the identities of the original receiving area and the original sending area of the target device to set a new sending area and a new receiving area of the target device, and synchronize the existing data set in the original receiving area to the original sending area of the target device, so that the target device sends the data set to the subordinate device each time through the new sending area; the data set includes the data written into the original receiving area.
[0025] A third aspect of an embodiment of the present application provides an electronic device, including: a processor and a memory;
[0026] The processor is configured to communicate with the memory and execute instructions in the memory to implement the method described in the first aspect of the embodiment of the present application or any specific implementation of the first aspect.
[0027] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed by a processor, they implement the method described in the first aspect of the embodiment of the present application or any specific implementation of the first aspect.
[0028] A fifth aspect of an embodiment of the present application provides a computer program product, which includes computer instructions. When the computer instructions are executed by a processor, they implement the method described in the first aspect of the embodiment of the present application or any specific implementation of the first aspect.
[0029] It can be seen from the above technical solutions that the embodiments of the present application have at least the following advantages:
[0030] In a high-speed transmission environment, data is usually written to the receiving area at a faster speed, causing the data therein to be updated. The embodiment of the present application swaps the identities of the original receiving area and the original sending area of the target device, which can redistribute and process the load of the buffer on the data during reading, writing and transmission, so that the processing capabilities of the sending area and the receiving area are matched, thereby improving the overall data processing efficiency; in addition, synchronizing the data set to the original sending area of the target device helps to ensure that the target device can still send accurate data to the downstream device without missing any data after the next data update, that is, each data transmission is achieved. Accurate synchronous update effect, thereby effectively avoiding the risk of data re-entry in a high-speed transmission environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0032] It should be noted that, although the steps in the process diagrams (if any) involved in the embodiments are drawn in sequence as indicated by the arrows, unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the steps or stages in other steps.
[0033] Figure 1 A schematic diagram of a flow chart of a data synchronization method according to an embodiment of the present application;
[0034] Figure 2 A schematic diagram of a dual backup data area of a data synchronization method according to an embodiment of the present application;
[0035] Figure 3 A structural diagram of a data synchronization system according to an embodiment of the present application;
[0036] Figure 4 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0038] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims and drawings of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" 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 that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0039] In the following description, similar expressions such as "a specific implementation" or "a specific example" are involved, which describe a subset of all possible embodiments, but it can be understood that "a specific implementation" or "a specific example" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict. In the following description, the term multiple refers to at least two. In some specific examples, the numerical value mentioned in this application reaches the threshold value (if any), which may include the case where the former is greater than the latter of the threshold value; if similar expressions such as "any" or "at least one" are mentioned, it can specifically refer to any one of the listed examples or any combination of these examples.
[0040] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0041] The method of the present application will be further described in detail below, and some specific possible implementation examples will be provided. In actual applications, the implementation contents between these examples can be combined or implemented separately as needed according to the corresponding functional principles and application logic. If implemented in combination, the execution order between the combined examples can be determined according to their respective processing logics, which may be determined by the actual scenario.
[0042] See also Figure 1 In a first aspect, the present application provides a specific embodiment of a data synchronization method, which includes the following steps:
[0043] Step S11, for a device chain formed by connecting multiple devices, determine the target device and the subordinate devices of the target device in the device chain; each device is provided with an original sending area and an original receiving area which are independent of each other, and the target device refers to the device whose original receiving area is written with data;
[0044] In actual situations, the overall arrangement structure of each device in the device chain (which may be called node devices or device nodes) may be a cascade topology structure or a distributed synchronization structure; the subordinate device of the target device mainly refers to the device used to receive the output data of the target device, and the relationship between the subordinate device and the target device may be an adjacent relationship or a cross-device relationship, and this cross-device relationship may refer to at least one intermediate device connected between the two devices.
[0045] In an embodiment of the present application, each device is allocated an original sending area and an original receiving area equivalent to a data cache space. The original sending area and the original receiving area of each device can be collectively referred to as a dual backup data space or a dual backup data area. One data area in the dual backup data area (such as the original receiving area) is responsible for writing and receiving data, and the other data area (such as the original sending area) is responsible for allowing the sending interface to use and send data. The data sent here can be taken from the receiving area under the same device, and the above-mentioned writing can include at least one data operation of adding, deleting, and modifying.
[0046] Step S12, after recognizing that the write operation is completed, the original receiving area and the original sending area of the target device are swapped to set a new sending area and a new receiving area of the target device, and the existing data set in the original receiving area is synchronized to the original sending area of the target device, so that the target device sends data sets to the lower-level devices each time through the new sending area.
[0047] Among them, the data set includes the data written to the original receiving area. In the process of high-speed data transmission, data re-entry may occur. For example, data is usually written to the receiving area at a faster speed to update the data therein, and at a high-speed data transmission rate, it may not be synchronized to the new data before it is sent, such as sending inaccurate old data. Therefore, based on consideration of this problem, the embodiment of the present application designs the above-mentioned dual backup data area for each device: at the same time, one area in the dual backup data area is only responsible for receiving and writing data, and the other area is only responsible for sending data, so that the data transmitted between devices is accurately sent and received through the dual backup data area. In addition, it is also designed that: after the write operation is completed, the original receiving area and the original sending area of the target device are swapped (i.e., data space switching), and the existing data set in the original receiving area is synchronized to the original sending area (i.e., the new receiving area) of the target device, so that the data sent each time must be accurate.
[0048] Of course, there may be no substantial change between the data sets before and after writing. For example, if it is simply replacement of the same value or redundancy, then in some examples, it can be considered that the data sent each time is still old data, but it must be accurate because the old data at this time is obtained through the above design.
[0049] In summary, the method of the embodiment of the present application can ensure that the data sent to the subordinate device each time is accurate and valid, for example, it must contain the latest written data, even if the sent data may still be old data, which can be distinguished according to the actual situation.
[0050] Based on the above example descriptions, some specific possible implementation examples are provided below.
[0051] based on Figure 1 In some specific examples, the operation of "swapping the identities of the original receiving area and the original sending area of the target device" in the above step S12 may specifically include: re-managing the configuration information of the original receiving area and the original sending area, and adjusting the direction of the data flow according to the correct configuration information obtained by the management, so that the data originally flowing into the original receiving area is changed to flow into the original sending area, and finally sent from the original receiving area to the lower-level device to obtain a new sending area and a new receiving area by swapping.
[0052] Exemplarily, the current configuration information of the target device about its original receiving area and original sending area can be obtained, such as the path of the data flow, the configuration of the port and other parameters related to data transmission. These configuration information can be modified according to the needs of the exchange of identities. For example, the input data flow that was originally to flow into the original receiving area can be changed to flow into the new receiving area (i.e., the original sending area). In addition, the data flow that was originally to be output from the original sending area can be changed to be output from the new sending area (i.e., the original receiving area). Then, according to the modified correct configuration information, the flow direction of the data flow inside and outside the device can be actually adjusted to obtain a new sending area and a new receiving area in exchange, thereby ensuring that the data can flow correctly along the new path.
[0053] In actual operation, the original receiving area and the original sending area of the target device may be swapped after the write operation is completed, or more specifically, when the write operation is completed and there is a need to send. The specific timing may depend on the circumstances and is not limited here.
[0054] based on Figure 1 In some specific examples, after the above step S12, the method of the embodiment of the present application may further include: monitoring and verifying the data transmission status of the new sending area and the new receiving area, and when the verification fails, returning to the step of re-managing the configuration information of the original receiving area and the original sending area until the new sending area and the new receiving area are successfully verified.
[0055] After completing the identity swap as described above, it is necessary to monitor and verify the operating status of the device and the flow of data streams to prevent data loss or service interruption caused by configuration errors or data flow interruptions. Exemplarily, network monitoring tools (such as Wireshark, tcpdump, etc.) and device log files can be used to observe and record the flow of data streams inside the device. On the other hand, an external device or network can be operated to send data to the new receiving area of the target device, and verify whether the data can be correctly received and processed by the new receiving area. At the same time, the new receiving area can send test data to the new sending area, and check whether the data can be correctly sent to the lower-level device through the new sending area. The above log file can record the performance indicators of the target device, such as throughput, delay, error rate, etc., to ensure that the performance of the device is not affected after the identity swap and can meet business needs.
[0056] If the above verification result is a failure, it may indicate an identity swap error. The cause of the verification failure can be analyzed and corresponding corrections can be made based on the monitored information such as configuration information, data flow path, device log, etc. For example, return to the operation of the above step S12 to reconfigure the configuration information, which may include modifying port settings, adjusting data flow path, etc.; after that, re-verification can be performed to ensure that the problem has been resolved and to ensure that the data can correctly reach the new receiving area along the new path and flow out from the new sending area.
[0057] In some specific examples, during the identity exchange process, at least one synchronization mechanism selected from semaphores, mutexes, and notifications may be used to reduce the damage to the data synchronization result caused by each buffer.
[0058] based on Figure 1 In some specific examples, the method of the embodiment of the present application may further include: for each data buffer identified as a sending area, setting each data buffer here to a read-only mode to prohibit modification of data in the sending area.
[0059] like Figure 2 As shown, in actual operation, in addition to the performance of sending data to the outside, the sending area can also be designed to be in read-only mode to prevent the data in the sending area from being abnormally modified, resulting in inaccurate data being sent and affecting the data synchronization effect.
[0060] based on Figure 1In some specific examples, the process of "the target device sends a data set to the lower-level device each time through the new sending area" in the above step S12 may include: if the data transmission mode is that when the current device sends its own device data to the lower-level device on one side, it needs to carry the device data of all devices on the other side of the current device, then the device data of all devices on the other side are transmitted to the current device, so that when the current device is used as the target device, the device data of all devices on the other side and the device's own data are uniformly sent to the lower-level device through the new sending area of the target device.
[0061] Exemplarily, the data transmission mode of the device can be designed as a data carrying mode. For example, it can be set that when the current device transmits data to the device on one side, it needs to carry all the device data on the other side and the current device's own data (i.e., the device's own data). For example, if there is a cascade group (i.e., device chain) ABCD, when device B sends data to A, it needs to send the device data of B+C+D. Because the device data of C and D can be pre-transmitted to B through steps S11, S12 and other operations, C and D do not need to repeatedly transmit their device data to A. B can uniformly transmit the device data of C and D to A. It can be seen that through this data carrying mode, while ensuring effective data update (i.e., synchronization), it can effectively reduce the amount of data sent and received, avoid resource loss and data redundancy; for example, when the above-mentioned A device sends data to B, it only needs to send A's device data. When device B sends data to C, it needs to send A+B's device data.
[0062] based on Figure 1 According to example content, in some specific examples, the operation process of the above step S11 may include: allocating a master interface and a slave interface for each device in the device chain, and connecting the master interface of each device to the slave interface of the subordinate device; adding the device identification of each device to the preset signal frame in sequence according to the connection order between the devices, and transparently transmitting the signal frame from the master interface of each device to the slave interface of the subordinate device until each device receives the target signal frame containing all device identifications; determining the device in the device chain where the original receiving area is written as the target device, and determining the subordinate device of the target device based on the order in which each device identification is added to the signal frame.
[0063] Exemplarily, the master interface of each device is responsible for initiating communication access, and the slave interface is responsible for replying access information. Basic two-way data transmission can be achieved between the master and slave interfaces, and a cascade structure is formed between multiple devices. The master interface of the current device can periodically or irregularly inform other devices of the current device's own information through a specific signal frame (hereinafter referred to as a startup synchronization frame). This own information can include at least one of the following information: the device's own data, device identification (such as device ID), and the size of the space required for data cache (such as the size of the local cache space occupied by the sending area and the receiving area). For example, when a device receives a trigger signal, the startup synchronization frame can be transparently transmitted by each device node. During the transparent transmission process, each device needs to add its own information such as its own device ID to the startup synchronization frame, so that all devices in the device chain (or cascade group) can eventually receive this startup synchronization frame, that is, after the startup synchronization frame traverses each device, all devices can eventually receive their own information to achieve the effect of data synchronization.
[0064] In actual applications, through the above-mentioned startup synchronization frame, it is possible to clearly identify the position of the target device in the device chain and which device is the subordinate device of the target device (for example, knowing the ID number of the subordinate device), that is, to achieve the positioning of the device. Specifically, a unique corresponding device ID can be assigned to each device in advance. After receiving the startup synchronization frame, an ID table of the cascade group can be established locally. After that, this table can be used to know the order in which each device ID is added to the signal frame, the size of the data cache space required by each device, and other information, and start to allocate local data cache space for each device locally. Of course, there is no need to generate an ID table, that is, the position of the target device and its subordinate devices in the device chain can be determined directly based on the order in which all device identifiers are added to the signal frame.
[0065] It should be noted that the process of assigning a unique device ID to each device can be as follows: each device is provided with a master interface and a slave interface, and when the current device receives a trigger signal, the first startup message is sent through the master interface of the current device; whether the slave interface of the current device receives the second startup message within a preset time is detected; if not, the initial ID is confirmed as the device ID of the current device, and a first ID allocation message is generated; the first ID allocation message is sent through the master interface; if so, the second ID allocation message sent by the upper current device is received through the slave interface, and the ID to be allocated obtained from the second ID allocation message is determined as the device ID of the current device. This process can be called a decentralized device identification and communication mechanism, which allows each device in the network to automatically participate in the ID allocation process when receiving a trigger signal, which can reduce dependence on a single node and improve the flexibility and scalability of the system. Here, by sending and receiving startup messages through the master-slave interface of the device within the preset time, the current device can intelligently determine whether it is the starting node in the network, and thus independently decide whether to initiate ID allocation or receive the ID allocated by the superior node. This not only simplifies the network wiring requirements and avoids additional bus or loop design, but also reduces the possibility of communication conflicts by eliminating dependence on device delays, thereby ensuring efficient and stable communication between devices.
[0066] It can be seen that in the embodiments of the present application, (a) when the current device receives a trigger signal, it can try to inform other devices of the ID of the current device and the required data cache space by sending a startup synchronization frame from the interface. (b) After receiving the startup synchronization frame, each device can update the local ID table, update the startup synchronization frame, and send it through the main interface to inform other devices. (c) After each device updates the local ID table, a double backup data cache space can be established locally to prepare for data transmission. (d) For each device, data can be written and stored in its receiving area (such as receiving data or local data update). After the writing is completed, the identities of the sending area and the receiving area are replaced, and the existing data in the original receiving area (sometimes referred to as new data) is synchronized to the new receiving area (ie, the original sending area). After that, the process (d) can be looped to ensure that the sending area is always in read-only mode and is only responsible for sending data, and the receiving buffer is responsible for data update and storage.
[0067] In summary, in a high-speed transmission environment, data is usually written to the receiving area at a faster speed, causing the data therein to be updated. The embodiment of the present application swaps the identities of the original receiving area and the original sending area of the target device, which can redistribute and process the load of the buffer on the data during reading, writing and transmission, so that the processing capabilities of the sending area and the receiving area are matched, thereby improving the overall data processing efficiency; in addition, synchronizing the data set to the original sending area of the target device helps to ensure that the target device can still send accurate data to the downstream device without missing any data after the next data update, that is, each data transmission achieves the accurate effect of synchronous update, thereby effectively avoiding the risk of data re-entry in a high-speed transmission environment.
[0068] Compared to Figure 1 The examples shown illustrate that the above-mentioned additional or detailed example contents or possible implementation methods do not necessarily have to be executed during the specific implementation. If more than two examples or possible implementation methods are added, these examples or possible implementation methods can be implemented in combination or separately. If implemented in combination, the execution order between the combined examples can be determined according to their respective processing logic, which can be determined according to the actual scenario.
[0069] See also Figure 3 , the second aspect of the present application provides a specific embodiment of a data synchronization system, the system includes: a determination unit 301, a processing unit 302;
[0070] The determination unit 301 is used to determine, for a device chain formed by connecting multiple devices, a target device and subordinate devices of the target device in the device chain; each device is provided with an original sending area and an original receiving area which are independent of each other, and the target device refers to the device in which the data is written into the original receiving area;
[0071] The processing unit 302 is used to, after recognizing that the write operation is completed, swap the identities of the original receiving area and the original sending area of the target device to set a new sending area and a new receiving area of the target device, and synchronize the existing data set in the original receiving area to the original sending area of the target device, so that the target device sends a data set to the lower-level device each time through the new sending area; the data set includes the data written to the original receiving area.
[0072] In some examples, the processing unit 302 is specifically configured to:
[0073] Re-manage the configuration information of the original receiving area and the original sending area, and adjust the direction of the data flow according to the correct configuration information obtained by management, so that the data originally flowing into the original receiving area is changed to flow into the original sending area, and finally sent from the original receiving area to the lower-level device to exchange for a new sending area and a new receiving area.
[0074] In some examples, the processing unit 302 is further configured to:
[0075] Monitor and verify the data transmission of the new sending area and the new receiving area, and when the verification fails, return to the step of re-managing the configuration information of the original receiving area and the original sending area until the new sending area and the new receiving area are successfully verified.
[0076] In some examples, the processing unit 302 is further configured to:
[0077] For each data buffer identified as a sending area, each data buffer is set in read-only mode to prohibit modification of data in the sending area.
[0078] In some examples, the processing unit 302 is specifically configured to:
[0079] If the data transmission mode is that when the current device sends its own device data to the subordinate device on one side, it needs to carry the device data of all devices on the other side of the current device, then the device data of all devices on the other side are transmitted to the current device, so that when the current device is used as the target device, the device data of all devices on the other side and the device data itself are uniformly sent to the subordinate device through the new sending area of the target device.
[0080] In some examples, the determining unit 301 is specifically configured to:
[0081] Allocate a master interface and a slave interface for each device in the device chain, and connect the master interface of each device to the slave interface of the lower-level device;
[0082] According to the connection order between the devices, the device identification of each device is added to the preset signal frame in turn, and the signal frame is transparently transmitted from the master interface of each device to the slave interface of the lower-level device until each device receives the target signal frame containing all device identifications;
[0083] The device whose original receiving area is written with data in the device chain is determined as the target device, and the subordinate devices of the target device are determined based on the order in which each device identification is added to the signal frame.
[0084] In the embodiment of the present application, the operations performed by each unit of the data synchronization system are similar to the operations described in the first aspect or any specific method embodiment of the first aspect, and will not be described in detail here. Of course, the specific implementation process of each operation in the first aspect of the present application can also refer to the relevant description of the second aspect.
[0085] See also Figure 4 The electronic device 400 of the embodiment of the present application may include one or more processors (such as central processing units (CPU)) 401 and a memory 405, in which one or more applications or data are stored.
[0086] The memory 405 may be a volatile storage or a persistent storage. The program stored in the memory 405 may include one or more modules, each of which may include a series of instruction operations in the electronic device. Furthermore, the processor 401 may be configured to communicate with the memory 405 and execute a series of instruction operations in the memory 405 on the electronic device 400.
[0087] The electronic device 400 may also include one or more power supplies 402, one or more wired or wireless network interfaces 403, one or more input and output interfaces 404, and / or one or more operating systems, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0088] The processor 401 can execute the operations performed by the aforementioned first aspect or any specific method embodiment of the first aspect, and the details will not be repeated here.
[0089] The present application provides a computer-readable storage medium, comprising instructions, which, when executed on a computer, enable the computer to execute the method described in the first aspect or any specific implementation of the first aspect.
[0090] The present application provides a computer program product comprising instructions or a computer program. When the computer program product is run on a computer, the computer is enabled to execute the method described in the first aspect or any specific implementation of the first aspect.
[0091] It is understood that in various embodiments of the present application, the sequence number of each step does not mean the order of execution, and the execution order of each step should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The operation content added or refined in each example scheme of the above method, system or device (if any) does not necessarily have to be executed in the specific implementation. If more than two operations are added, these operations can be implemented in combination or separately, depending on the actual scenario.
[0092] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system (if any) and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0093] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system or device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0094] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0095] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0096] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product (or computer program product) is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a business server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.
Claims
1. A data synchronization method, characterized in that: include: For a device chain formed by connecting multiple devices, determine a target device in the device chain and a subordinate device of the target device; each of the devices is provided with an original sending area and an original receiving area that are independent of each other, and the target device refers to the device in which data is written to the original receiving area; After recognizing that the write operation is completed, the original receiving area and the original sending area of the target device are swapped to set a new sending area and a new receiving area of the target device, and the existing data set in the original receiving area is synchronized to the original sending area of the target device, so that the target device sends the data set to the subordinate device each time through the new sending area; the data set includes the data written to the original receiving area.
2. The data synchronization method according to claim 1, characterized in that: The exchanging the identities of the original receiving area and the original sending area of the target device includes: Re-manage the respective configuration information of the original receiving area and the original sending area, and adjust the direction of the data flow according to the correct configuration information obtained by management, so that the data originally flowing into the original receiving area is changed to flow into the original sending area, and finally sent from the original receiving area to the lower-level device to obtain a new sending area and a new receiving area in exchange.
3. The data synchronization method according to claim 1 or 2, characterized in that: After swapping the identities of the original receiving area and the original sending area of the target device, the method further includes: Monitor and verify the data transmission of the new sending area and the new receiving area, and when the verification fails, return to the step of re-managing the configuration information of the original receiving area and the original sending area, until a new sending area and a new receiving area that have been successfully verified are obtained.
4. The data synchronization method according to claim 1 or 2, characterized in that: The method further includes: for each data buffer zone identified as a sending zone, setting each data buffer zone to be in a read-only mode to prohibit modification of data in the sending zone.
5. The data synchronization method according to claim 1 or 2, characterized in that: The target device sends the data set to the subordinate device each time through the new sending area, including: If the data transmission mode is that when the current device sends its own device data to the subordinate device on one side, it needs to carry the device data of all devices on the other side of the current device, then the device data of all devices on the other side are all passed to the current device, so that when the current device is used as the target device, the device data of all devices on the other side and the device data are uniformly sent to the subordinate device through the new sending area of the target device.
6. The data synchronization method according to claim 1, characterized in that: The step of determining a target device in a device chain and a subordinate device of the target device includes: Allocating a master interface and a slave interface to each device in the device chain, wherein the master interface of each device is connected to the slave interface of a lower-level device; According to the connection order between the devices, the device identification of each device is sequentially added to the preset signal frame, and the signal frame is transparently transmitted from the master interface of each device to the slave interface of the subordinate device until each device receives the target signal frame containing all device identifications; The device whose original receiving area is written with data in the device chain is determined as the target device, and the subordinate devices of the target device are determined based on the order in which each device identification is added to the signal frame.
7. A data synchronization system, characterized in that: include: Determine the unit and process the unit; The determining unit is used to determine, for a device chain formed by connecting multiple devices, a target device and subordinate devices of the target device in the device chain; each of the devices is provided with an original sending area and an original receiving area that are independent of each other, and the target device refers to the device in which data is written to the original receiving area; The processing unit is used to, after recognizing that the write operation is completed, swap the identities of the original receiving area and the original sending area of the target device to set a new sending area and a new receiving area of the target device, and synchronize the existing data set in the original receiving area to the original sending area of the target device, so that the target device sends the data set to the subordinate device each time through the new sending area; the data set includes the data written into the original receiving area.
8. An electronic device, characterized in that: include: Processor and memory; The processor is configured to communicate with the memory and execute instructions in the memory to implement the method according to any one of claims 1 to 6.
9. A readable storage medium, characterized in that: The readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that The computer program product comprises computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.