Data synchronization method, system and computer readable storage medium

By making differential judgments and alarms on the metadata record table before data synchronization, the problem of data synchronization failure or incompleteness in the rapidly changing business version environment is solved, and the accuracy and efficiency of data synchronization are achieved.

CN114490863BActive Publication Date: 2024-12-27SHENZHEN PUDU TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202111555264.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-17
Publication Date
2024-12-27
Estimated Expiration
2041-12-17

AI Technical Summary

Technical Problem

In the environment of rapidly changing business versions, due to business data changes or communication in time during data synchronization, synchronization may fail or data incomplete, resulting in downstream data being unable to obtain the latest business data in a timely manner.

Method used

By making differential judgments on the metadata record tables at the source and target data ends before data synchronization, decide whether to synchronize data based on the difference type, and issue an alarm message when inconsistent to prompt the user to be different, avoid useless resource waste .

Benefits of technology

Ensure the accuracy and efficiency of data synchronization, avoid synchronization failure or data incompleteness caused by business data changes, promptly feedback on different metadata, and improve data consistency and system resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114490863B_ABST
    Figure CN114490863B_ABST
Patent Text Reader

Abstract

The present application discloses a data synchronization method, device and computer-readable storage medium, which belong to the field of data synchronization verification. The method includes: obtaining a first metadata record table from a first device, and obtaining a second metadata record table from a second device. According to the first metadata record table and the second metadata record table, determine the difference type between the table structure of the first metadata record table and the table structure of the second metadata record table. When the difference type is the first difference type, perform a data synchronization operation; when the difference type is the second difference type, do not perform a data synchronization operation, wherein the data synchronization operation is to synchronize the first data in the first metadata record table to the second metadata record table. The present application determines the difference type of metadata in the first device and the second device through verification before data synchronization, and can timely identify the difference in metadata according to the difference type, so that early warning and feedback processing can be carried out in a timely manner.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data synchronization, and in particular to a data synchronization method, device and computer-readable storage medium. Background Art

[0002] Data has become an important asset that enterprises rely on very much. The quality of data is directly related to the accuracy of information, and data verification is an important part of achieving data quality. At present, most companies have solutions suitable for their own business in terms of data synchronization verification. When the business version is replaced quickly, when synchronizing data, there may be synchronization failures or incomplete synchronized data due to business data changes or untimely communication, resulting in the inability of downstream data to obtain the latest business data in time when using it. Summary of the invention

[0003] The present application provides a data synchronization method, device and computer-readable storage medium, which can promptly identify the difference in metadata between the source data end and the target end when the metadata of the source data end changes, and determine whether to perform data synchronization based on the difference type.

[0004] The technical solution is as follows:

[0005] In a first aspect, a data synchronization method is provided, the method comprising: obtaining a first metadata record table from a first device, and obtaining a second metadata record table from a second device. According to the first metadata record table and the second metadata record table, determining a difference type between the table structures of the first metadata record table and the second metadata record table. When the difference type is a first difference type, performing a data synchronization operation. When the difference type is a second difference type, not performing a data synchronization operation. The data synchronization operation is to synchronize the first data in the first metadata record table to the second metadata record table.

[0006] In the present application, before the metadata of the first device is synchronized to the second device, a data verification judgment is performed, that is, first determine whether the first metadata record table and the second metadata record table are consistent. In the case that the first metadata record table and the second metadata record table are inconsistent, an alarm message is issued according to the difference type of the two data record tables to prompt that the first metadata record table and the second metadata record table are inconsistent, so that the user can promptly understand the difference between the metadata in the first device and the second device through the alarm message. In addition, the present application determines whether to synchronize data based on the difference type. In this way, different difference types result in different actions performed by the first device. When a field is missing in the first metadata record table, data synchronization may not be performed, so that the system no longer wastes resources for useless operations.

[0007] In a possible implementation of the present application, the types of differences between the table structure of the first metadata record table and the table structure of the second metadata record table include:

[0008] If the first metadata record table includes the second metadata record table, it indicates that the table structure of the first metadata record table is consistent with the table structure of the second metadata record table, or there are additional fields in the table structure of the first metadata record table relative to the table structure of the second metadata record table, and the difference type is the first difference type; if the first metadata record table does not include the second metadata record table, it indicates that there are modified and / or deleted fields in the first metadata record table relative to the second metadata record table, and the difference type is the second difference type.

[0009] In the present application, by determining the difference type between the table structure of the first metadata record table and the table structure of the second metadata record table, the difference between the two types of table structures can be obtained, and the next step of targeted processing can be facilitated according to different difference types.

[0010] Optionally, when the difference type is the first difference type and there are additional fields in the table structure of the first metadata record table relative to the table structure of the second metadata record table, a first monitoring alarm is issued, and the first monitoring alarm is used to prompt that there are additional fields in the first metadata record table relative to the second metadata record table; when the difference type is the second difference type, a second monitoring alarm is issued, and the second monitoring alarm is used to prompt that there are modified and / or deleted fields in the first metadata record table relative to the second metadata record table.

[0011] In this application, corresponding monitoring alarms are issued according to different difference types, which is convenient for developers to handle according to different difference types.

[0012] In a possible implementation of the present application, obtaining a first metadata record table from a first device and obtaining a second metadata record table from a second device include: obtaining a request for data to be synchronized, wherein the request for data to be synchronized includes the type of data to be synchronized; obtaining name information of the first metadata record table from a configuration table according to the type of data to be synchronized, and obtaining the first metadata record table from the first device and obtaining the second metadata record table from the second device according to the name information of the first metadata record table.

[0013] Optionally, determining the type of difference between the table structure of the first metadata record table and the table structure of the second metadata record table based on the first metadata record table and the first metadata record table, including: determining whether data verification is required based on the type of data to be synchronized; if data verification is required, determining the type of difference between the table structure of the first metadata record table and the table structure of the second metadata record table based on the first metadata record table and the first metadata record table; if data verification is not required, directly synchronizing the first data in the first metadata record table to the second metadata record table.

[0014] In a possible implementation of the present application, the first data includes multiple first sub-data, and is characterized in that synchronizing the first data in the first metadata record table to the second metadata record table includes: synchronizing the multiple first sub-data in the first metadata record table to the second metadata record table; and recording in the second metadata record table the time when each first sub-data is synchronized to the second metadata record table.

[0015] In a possible implementation of the present application, when the difference type is the first difference type, a data synchronization operation is performed, and then further includes: obtaining a first data amount increased in the first metadata record table within a first time period, and a second data amount increased in the second metadata record table within a second time period; determining whether to resynchronize the first data to the second metadata record table based on the first data amount and the second data amount; when the first data amount and the second data amount are the same, the first data is not resynchronized to the second metadata record table; if the first data amount and the second data amount are different, the first data is resynchronized to the second metadata record table.

[0016] Optionally, when the difference type is the first difference type, a data synchronization operation is performed, and then further includes: obtaining the total amount of first data corresponding to the first metadata record table and the total amount of second data corresponding to the second metadata record table; determining whether to resynchronize the first data to the second metadata record table based on the first total amount of data and the second total amount of data; when the first total amount of data and the second total amount of data are the same, the first data is not resynchronized to the second metadata record table; if the first total amount of data and the second total amount of data are not the same, the first data is resynchronized to the second metadata record table.

[0017] Optionally, the configuration table further includes: information for determining the first metadata record table and information for determining the second metadata record table. The information of the synchronization check table includes information for determining the first metadata record table and information for determining the second metadata record table in the configuration table.

[0018] In a second aspect, a data synchronization device is provided, the device comprising:

[0019] An acquisition module, used to acquire a first metadata record table from a first device, and to acquire a second metadata record table from a second device;

[0020] a determination module, configured to determine, according to the first metadata record table and the second metadata record table, a difference type between a table structure of the first metadata record table and a table structure of the second metadata record table;

[0021] An execution module is used to perform a data synchronization operation when the difference type is a first difference type, and not perform a data synchronization operation when the difference type is a second difference type, wherein the data synchronization operation is to synchronize the first data in the first metadata record table to the second metadata record table.

[0022] According to a third aspect, a data synchronization system is provided, including: a first device, and a second device communicating with the first device, wherein the first device is used to execute the above-mentioned data synchronization method.

[0023] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and the computer program implements the above-mentioned data synchronization method when executed by a processor.

[0024] In a fifth aspect, a chip is provided, comprising a processor, the processor and a communication interface coupled to the processor, the processor being used to run a computer program or instructions to implement the above-mentioned data synchronization method, and the communication interface being used to communicate with other modules outside the chip.

[0025] In a sixth aspect, a communication device is provided, comprising: a communication interface, a memory, and at least one processor, wherein the at least one processor is connected to the communication interface, the at least one processor is coupled to the memory, the at least one processor is used to run instructions stored in the memory to execute the above-mentioned data synchronization method, and the communication interface is used to communicate with other modules outside the communication device.

[0026] It can be understood that the beneficial effects of the second, third, fourth, fifth and sixth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] 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 of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0028] Figure 1 It is a structural diagram of a data synchronization system provided in an embodiment of the present application;

[0029] Figure 2 It is a structural diagram of a data synchronization system provided in an embodiment of the present application;

[0030] Figure 3 It is a flowchart of a data synchronization method provided in an embodiment of the present application;

[0031] Figure 4 It is a schematic diagram of a monitoring alarm displayed on a display interface of a third device provided in an embodiment of the present application;

[0032] Figure 5 It is a schematic diagram of a monitoring alarm displayed on a display interface of a third device provided in an embodiment of the present application;

[0033] Figure 6 is a schematic diagram of an interface for prompting whether to synchronize first data in a first metadata record table to a second device, provided in an embodiment of the present application;

[0034] Figure 7 is a schematic diagram of a data synchronization device provided in an embodiment of the present application;

[0035] Figure 8 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0036] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0037] It should be understood that the "multiple" mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate the clear description of the technical solution of this application, the words "first" and "second" are used to distinguish between the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not limit them to be different.

[0038] The so-called metadata refers to information such as table fields, field types, field names, field order, etc.

[0039] Before explaining the embodiments of the present application in detail, the application scenarios of the embodiments of the present application are first described.

[0040] Data has become an important resource that all walks of life in modern society rely on. The quality of data is directly related to the accuracy of information, and data synchronization verification is the key to achieving data quality. At present, most companies have their own data synchronization verification solutions. When the business version is replaced quickly, there may be synchronization failures or incomplete synchronized data due to business data changes or untimely communication during data synchronization, resulting in the inability of downstream data to obtain the latest data in time when it is used. Based on this scenario, a data synchronization solution is proposed to deal with changes in the metadata of the source data end, which can promptly identify the difference between the metadata of the source data end and the target end, so that early warning and feedback processing can be carried out in a timely manner.

[0041] like Figure 1 As shown, an embodiment of the present application provides a data synchronization system including: a first device 10 and a second device 20, wherein the first device 10 and the second device 20 can communicate with each other.

[0042] Among them, Figure 1 In the system shown, one of the first device 10 and the second device 20 can be regarded as an upstream device (also referred to as a source data end), and the other of the first device 10 and the second device 20 can be regarded as a downstream device (also referred to as a target end). The downstream device can synchronize the data in the upstream device to the downstream device, thereby realizing data sharing.

[0043] Optionally, in the embodiments of the present application, the upstream device usually communicates with the business segment data. Therefore, due to the update of the data version of the business segment, the data stored in the upstream device will cause changes. Therefore, in order to ensure the data consistency of the upstream and downstream devices, or to ensure that the target end can obtain the updated data of the business segment through the source data end in time, it is necessary to synchronize the data in real time so that the downstream device can obtain the data in time.

[0044] In the case where there is a communication connection between the first device 10 and the second device 20, the first device 10 and the second device 20 may establish the communication connection through wireless communication technology or wired communication technology.

[0045] For example, the wireless communication technology may be Bluetooth (BT), traditional Bluetooth or Bluetooth Low Energy (BLE), wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Zigbee connections, frequency modulation (FM), near field communication (NFC), infrared (IR), or general 2.4G / 5G frequency band wireless communication technology, etc. The wireless connection is a connection established using the wireless communication technology. The embodiment of the present application does not specifically limit the type of wireless communication technology. The wired communication connection may be a communication connection established based on a universal serial bus (USB) protocol, a high definition multimedia interface (HDMI) protocol, a general-purpose interface bus (GPIB) protocol, or an Ethernet protocol. The embodiment of the present application does not specifically limit the specific communication connection method between the first device 10 and the second device 20.

[0046] For example, if both the first device 10 and the second device 20 have NFC, then the first device 10 and the second device 20 can be automatically paired by touching the NFC sensing areas of the first device 10 and the second device 20. After pairing, the first device 10 and the second device 20 can establish a communication connection.

[0047] like Figure 2 As shown, another data synchronization system provided by an embodiment of the present application, Figure 2 The communication system shown is Figure 1Compared with the communication system shown in the figure, it further includes: a data synchronization device 30. The data synchronization device 30 communicates with the first device 10 and the second device 20 respectively.

[0048] Among them, the data synchronization device 30 is used to synchronize data in the first device 10 (for example, data added in the first metadata record table) to the second device 20, or to synchronize data in the second device 20 (for example, data in the second metadata record table) to the first device 10.

[0049] It is worth noting that, in the case where the data synchronization system has a data synchronization device 30, the first device 10 and the second device 20 in the system may or may not have a communication connection. The manner in which the data synchronization device 30 establishes a communication connection with the first device 10 and the second device 20, respectively, can refer to the above Figure 1 The method shown will not be repeated here.

[0050] To this end, an embodiment of the present application provides a data synchronization method, which compares the first metadata record table in the first device 10 and the second metadata record table in the second device 20 before data synchronization to determine whether the first metadata record table and the second metadata record table are consistent. If there is inconsistency, timely feedback is given on the changes in the first metadata record table relative to the second metadata record table, so that developers can take timely action.

[0051] The data synchronization method provided in the embodiment of the present application is explained in detail below.

[0052] Figure 3 is a flow chart of a data synchronization method provided by an embodiment of the present application. Figure 3 , the method comprises the following steps:

[0053] Step 101 : the third device obtains a first metadata record table from the first device 10 , and obtains a second metadata record table from the second device 20 .

[0054] The first metadata record table and the second metadata record table include at least one of the following information: one or more fields, field parameters of each field, and the field carries data. For example, the field parameter can be one or more of the following corresponding to the field: field name, field type or field order or data volume. The data volume corresponding to the field can be regarded as the data volume of the corresponding data in the field.

[0055] The target field in the first metadata record table records the first data to be synchronized to the second device 20. The configuration table determines information of the first metadata record table and the second metadata record table that need to be synchronized.

[0056] It is understandable that each field in the metadata record table indicates / carries one or more data. For example, field A indicates data A, and field B indicates data B.

[0057] The field order is used to determine the arrangement order or position order of multiple fields in the metadata record table. For example, the field order can indicate the arrangement order of multiple fields in the metadata record table, such as field A is located before field B. Or the field order is used to indicate the position of each field, and the third device can determine the arrangement order or position order of different fields according to the field order of different fields.

[0058] In one embodiment of the present application, the configuration table includes multiple metadata record tables that need to be verified, and table names or library names of the metadata record tables.

[0059] Optionally, the first data is data added to the target field in the first metadata record table relative to the target field in the second metadata record table.

[0060] Optionally, the first data is data corresponding to a target field in the first metadata record table, and the target field is also a field in the second metadata record table. In other words, the target field is a common field in the first metadata record table and the second metadata record table.

[0061] In a possible implementation of the present application, Figure 1 As shown, the third device may be the first device 10, the first device 10 is the source data end, the second device 20 is the target end, and the source data end and the target end communicate directly.

[0062] In a possible implementation of the present application, Figure 2 As shown, the third device is a data synchronization device 30, the first device 10 is a source data end, the second device 20 is a target end, and the data synchronization device 30 communicates with the source data end and the target end respectively.

[0063] In a possible implementation of the present application, in order to synchronize data in time, the method provided in the embodiment of the present application may further include before step 101: the third device determines that the first data in the first device 10 needs to be synchronized to the second device 20. Exemplarily, the third device determines that the first data in the first device 10 needs to be synchronized to the second device 20, including: when the preset conditions are met, the third device determines that the first data in the first device 10 needs to be synchronized to the second device 20. Among them, the preset conditions include: reaching the data synchronization cycle, and / or detecting the data synchronization instruction. For example, if the third device detects the data synchronization instruction triggered by the user in the third device, the third device can determine that the first data of the first metadata record table in the first device 10 needs to be synchronized to the second device 20. It is worth noting that the data synchronization cycle can be configured by the user or the system default, or it can be determined by the third device. For example, the data synchronization cycle can be 1 day, 1 hour or 3 hours, which is not limited in the embodiment of the present application. When the data synchronization cycle is the system default, the user can update the data synchronization cycle by operating the third device.

[0064] The third device can obtain the second metadata record table from the second device 20 in the following manner: the third device sends a data acquisition request to the second device 20, and the data acquisition request includes a configuration table. Accordingly, after receiving the data acquisition request, the second device 20 can provide the third device with content related to the configuration table, such as the second metadata record table, according to the configuration table. Specifically, the third device can send a data acquisition request to the second device 20 when a preset condition is met. In addition, in addition to the third device requesting the second device 20 to obtain data, when the second device 20 detects that the preset condition is met, the second device 20 can also actively send content related to the configuration table to the third device. The specific implementation of the third device obtaining the first metadata record table from the first device 10 can refer to the specific implementation of the third device obtaining the second metadata record table from the second device 20, which will not be repeated here.

[0065] Step 102: According to the first metadata record table and the second metadata record table, determine the difference type between the table structure of the first metadata record table and the table structure of the second metadata record table.

[0066] It is worth noting that when the table structure of the first metadata record table is inconsistent with the table structure of the second metadata record table, it means that there are differences between the metadata record tables, and the types of differences are different, indicating that the table structure of the first metadata record table in the first device 10 (for example, the source data end) has changed, for example, a field has been added to the first metadata record table, a field has been deleted, and the field parameters of a field have been updated.

[0067] In one embodiment of the present application, if the comparison check finds that the fields in the first metadata record table are increased compared to the fields in the second metadata record table, that is, the first metadata record table contains all the fields in the second metadata record table and has additional fields, then the difference type is determined to be added fields. If the comparison check finds that the fields in the first metadata record table have one or more of the following situations compared to the fields in the second metadata record table: modified field name, deleted field, field type, field order, then the difference type is determined to be modified field parameters and / or deleted fields.

[0068] As an example, if the first metadata record table and the second metadata record table have the same multiple fields, but the field order of the multiple fields is different, it can also be considered that the table structure of the first metadata record table is inconsistent with the table structure of the second metadata record table. For example, the first metadata record table has field 1 and field 2, and field 1 is before field 2, and the second metadata record table has field 1 and field 2, and field 2 is before field 1, then the first metadata record table and the second source data record table are inconsistent.

[0069] As another example, if the first metadata record table has field A, field B, and field C, and the second metadata record table has field A and field B but does not have field C, it can also be considered that the table structure of the first metadata record table and the table structure of the second metadata record table are inconsistent.

[0070] As another example, if the first metadata record table has field A, field B, and field C, and the second metadata record table has field A, field B, and field C, but the type / name of field C in the first metadata record table and the type / name of field C in the second metadata record table are different, it can also be considered that the table structure of the first metadata record table and the table structure of the second metadata record table are inconsistent.

[0071] As another example, if the first metadata record table has fields A, B, and C, and the second metadata record table has fields A and B, but the type / name of field B in the first metadata record table is different from the type / name of field B in the second metadata record table, and the first metadata record table has one more field C than the second metadata record table, it can also be considered that the table structure of the first metadata record table is inconsistent with the table structure of the second metadata record table.

[0072] As another example, if the first metadata record table has field A and field B, and the second metadata record table has field A, field B, and field C, the first metadata record table lacks field C compared to the second metadata record table, so the two can also be considered inconsistent.

[0073] As another example, if the first metadata record table and the second metadata record table do not have any common fields, it can also be considered that the two are inconsistent. In this case, the third device can also use alarm information to prompt, so that the developer can determine that the table structure of the first metadata record table and the table structure of the second metadata record table do not have any common fields, which makes it easier for the developer to understand the reason in time.

[0074] It can be understood that as long as the field parameters of the common fields in the table structure of the first metadata record table and the table structure of the second metadata record table are inconsistent, and / or the first metadata record table has more fields or lacks fields than the second metadata record table, or does not have common fields, the table structure of the first metadata record table and the table structure of the second metadata record table can be considered inconsistent.

[0075] To facilitate subsequent description, this application refers to the situation where the first metadata record table, in addition to all the fields in the second metadata record table, also includes or does not include the first field as: the difference type between the first metadata record table and the second metadata record table is the first difference type.

[0076] In this application, the situation where a field in the second metadata record table is missing in the first metadata record table, or the field parameters of the common fields in the first metadata record table and the second metadata record table are different, is referred to as: the difference type between the table structure of the first metadata record table and the table structure of the second metadata record table is a second difference type.

[0077] Step 103: When the difference type is the first difference type, the third device performs a data synchronization operation; when the difference type is the second difference type, the third device does not perform a data synchronization operation, wherein the data synchronization operation is to synchronize the first data in the first metadata record table to the second metadata record table.

[0078] As a specific implementation, when the difference type between the table structure of the first metadata record table and the table structure of the second metadata record table is the first difference type, and the table structures of the two record tables are consistent, it can mean that one or more of the following parameters corresponding to the fields in the first metadata record table and the second metadata record table are the same: name, type, order, etc. It is worth noting that the consistency of the table structures of the first metadata record table and the second metadata record table does not mean that the amount of data in the two metadata record tables is consistent. In other words, when the table structures of the first metadata record table and the second metadata record table are consistent, the first data is synchronized to the second metadata record table. For example, the first metadata record table in the first device 10 and the second metadata record table in the second device 20 both have field 1, and the type of field 1 is the same, but the data information corresponding to field 1 in the first metadata record table and the data information corresponding to field 1 in the second metadata record table may be inconsistent, so the third device can synchronize the data corresponding to field 1 in the first metadata record table to field 20 under field 1 in the second metadata record table.

[0079] As an example, the first metadata record table and the second metadata record table both have field 1 and field 2, and the names, types, and orders of the fields are consistent, then it is determined that the first metadata record table and the second metadata record table are consistent, and data synchronization is performed, that is, the first data in the first metadata record table, that is, the newly added data relative to the data corresponding to the second metadata record table, is synchronized to the second device 20.

[0080] In a possible embodiment of the present application, when the first metadata record table and the second metadata record table are consistent, if the third device determines that the data amount corresponding to the first metadata record table and the data amount corresponding to the second metadata record table are inconsistent, the first data is synchronized to the second metadata record table. If the metadata record tables are consistent but the data amounts are inconsistent, it indicates that the data amount corresponding to the first metadata record table has changed relative to the data amount corresponding to the second metadata record table, so data synchronization can ensure data consistency.

[0081] It is worth noting that when the difference type is the first difference type and the first metadata record table includes the first field in addition to the second metadata record table, when the third device synchronizes the first data to the second metadata record table, the data carried by the first field is synchronized to the second metadata record table.

[0082] In a possible implementation of the present application, determining the difference type between the table structure of a first metadata record table and the table structure of a second metadata record table includes: if the first metadata record table includes the second metadata record table, the table structure of the first metadata record table is consistent with the table structure of the second metadata record table, or there is an additional field in the table structure of the first metadata record table relative to the table structure of the second metadata record table, then the difference type is the first difference type.

[0083] As in the above embodiment, if the first metadata record table has field A, field B and field C, and the second metadata record table has field A and field B, but does not have field C, it can be determined that the difference type between the table structure of the first metadata record table and the table structure of the second metadata record table is the first difference type. If the first metadata record table has field A and field B, and the second metadata record table has field A and field B, it is also determined that the difference type between the table structure of the first metadata record table and the table structure of the second metadata record table is the first difference type. At this time, there is no difference, but the consistency and the addition of fields will both perform data synchronization actions, so the consistency is also classified as the first difference type.

[0084] If the first metadata record table does not include the second metadata record table, it indicates that there are modified and / or deleted fields in the first metadata record table relative to the second metadata record table, and the difference type is the second difference type.

[0085] As in the above embodiment, when the comparison check finds that the fields of the first metadata record table have one or more of the following conditions compared with the fields of the second metadata record table: modification of field name, deletion of field, field type, and field order, the difference type is determined to be the second difference type. The specific implementation is the embodiment in the above step 102, which will not be repeated here.

[0086] The present application provides a data synchronization method, which performs data verification and judgment before synchronizing the first data in the first metadata record table to the second metadata record table, that is, first determining the difference type between the table structure of the first metadata record table and the table structure of the second metadata record table, and determining whether to synchronize the data according to the difference type between the table structure of the first metadata record table of the first device 10 and the table structure of the second metadata record table of the second device 20. Different difference types make the actions performed by the third device different. For example, when a field is missing in the first metadata record table, data synchronization may not be performed, and the system no longer wastes resources for useless operations.

[0087] In a possible implementation of the present application, when the difference type is the first difference type and there are additional fields in the table structure of the first metadata record table relative to the table structure of the second metadata record table, a first monitoring alarm is issued, and the first monitoring alarm is used to prompt that there are additional fields in the first metadata record table relative to the second metadata record table. When the difference type is the second difference type, a second monitoring alarm is issued, and the second monitoring alarm is used to prompt that there are modified and / or deleted fields in the first metadata record table relative to the second metadata record table.

[0088] In a possible implementation of the present application, when the third device has a display interface, issuing the warning information may refer to the third device displaying the warning information in the form of text on the display interface, such as Figure 4 or Figure 5 As shown, issuing an alarm message may refer to the third device issuing an alarm message in the form of voice playback, or issuing an alarm message in the form of a text message to a terminal (such as a mobile phone) bound to the third device.

[0089] Since the third device processes differently for different difference types, the following will be described in different situations:

[0090] Case 1), the difference type is the first difference type

[0091] In a possible implementation of the present application, according to the difference type, a warning message is issued, including: the difference type indicates that the first metadata record table includes the first field in addition to the second metadata record table, and the warning message is used to indicate that the first metadata record table has an additional field relative to the second metadata record table. It is worth noting that the first metadata record table includes the first field in addition to the second metadata record table, which means that the first metadata record table has an additional field relative to the second metadata record table.

[0092] For example, after comparing the table structure of the first metadata record table with the table structure of the second metadata record table, the third device confirms that the table structure of the first metadata record table is inconsistent with the table structure of the second metadata record table, and determines that the difference type is the first difference type, then issues an alarm message, such as Figure 4As shown, the alarm information is used to indicate that the difference type between the first metadata record table and the second metadata record table is the first difference type, so as to notify the user through the alarm information that the metadata record table information of the first device 10 (source data end) and the second device 20 (target end) are inconsistent, so as to facilitate the developer to determine that the first metadata record table has not only all the fields in the second metadata record table, but also other fields (such as the first field) are added. Optionally, the third device can also prompt to continue synchronizing data and execute the action of synchronizing the first data in the first metadata record table to the second metadata record table. In this case, it is convenient for the developer to find the developer of the upstream device to confirm the fact of the alarm information in time after obtaining the alarm information of the difference type being the first difference type.

[0093] It is worth noting that in case 1, in addition to prompting that the table structure of the first metadata record table is inconsistent with the table structure of the second metadata record table, the warning information can also prompt a specific difference type, such as the first difference type. In addition, optionally, the warning information can also prompt what the added field is.

[0094] As an example, for example, the first metadata record table includes field 1, field 2, and field 3, and the second metadata record table includes field 2 and field 3. Therefore, it can be determined that the first metadata record table has additional fields relative to the second metadata record table.

[0095] Case 2), the difference type is the second difference type

[0096] In a possible implementation of the present application, after the third device compares the table structure of the first metadata record table with the table structure of the second metadata record table, confirms that the table structure of the first metadata record table is inconsistent with the table structure of the second metadata record table, and determines that the difference type is the second difference type, the third device issues an alarm message to notify the user through the alarm message that a field in the second metadata record table is missing in the first metadata record table, or that the field parameters of the common fields in the first metadata record table and the second metadata record table are different, and that the synchronization of the first data in the first metadata record table to the second metadata record table is not performed. Optionally, when the difference type is the second difference type, the third device can also prompt not to continue synchronizing the data. If it is found in the verification that the field of the first metadata record table of the first device 10 has modified field parameters or deleted fields compared to the second metadata record table of the second device 20 (target end), the alarm message is used to prompt, or the task fails (data synchronization is not performed). At this time, for the developer, it can decide to process immediately according to the specific alarm information.

[0097] Optionally, when it is determined that the difference type is the second difference type, the third device may further issue a prompt message indicating that the data synchronization has failed.

[0098] It is worth noting that in case 2, in addition to prompting that the first metadata record table and the second metadata record table are inconsistent, the alarm information can also prompt a specific difference type, such as the second difference type. In addition, optionally, the alarm information can also prompt which field is deleted, and / or which field parameter is modified. For example, if the third device finds that the name of field 1 in the first metadata record table and field 1 in the second metadata record table are different after comparison, the alarm information can be used to prompt that the field name of field 1 is different.

[0099] In a possible implementation of the present application, according to the difference type, a warning message is issued, including: the difference type indicates that the first metadata record table lacks the second field in the second metadata record table, and / or the field parameters of the third field in the first metadata record table are different from those of the third field in the second metadata record table. The warning message is used to prompt that the first metadata record table has modified field parameters and / or deleted fields relative to the second metadata record table, such as Figure 5 shown.

[0100] As an example, both the first metadata record table and the second metadata record table have Field 1, but the name of Field 1 in the first metadata record table is Name 1, while the name of Field 1 in the second metadata record table is Name 2. Therefore, it can be considered that the first metadata record table has modified the field name relative to the second metadata record table.

[0101] As an example, both the first metadata record table and the second metadata record table have field 1, but the type of field 1 in the first metadata record table is type 1, while the type of field 1 in the second metadata record table is type 2. Therefore, it can be considered that the first metadata record table has modified the field type relative to the second metadata record table.

[0102] As an example, both the first metadata record table and the second metadata record table have field 1, but the name of field 1 in table 1 is name 1 and the type is type 1, while the name of field 1 in the second metadata record table is name 2 and the type is type 2. Therefore, it can be considered that the first metadata record table has modified the field name and field type relative to the second metadata record table.

[0103] As an example, for example, the first metadata record table has field 1 and field 2, and the second metadata record table has field 1, field 2, and field 3, so it can be considered that the first metadata record table deletes field 3 relative to the second metadata record table.

[0104] In the present application, according to the difference type between the table structure of the first metadata record table of the first device 10 and the table structure of the second metadata record table of the second device 20, an alarm message is issued to prompt that the table structure of the first metadata record table and the table structure of the second metadata record table are inconsistent, so that developers can promptly understand the differences in metadata between the upstream device (i.e., the first device 10) and the downstream device (i.e., the second device 20) through the alarm message, and perform targeted processing for different difference types.

[0105] In a possible implementation of the present application, the third device obtains the first metadata record table from the first device 10, and obtains the second metadata record table from the second device 20, including: obtaining a request for data to be synchronized, wherein the request for data to be synchronized includes the data type to be synchronized. According to the data type to be synchronized, the name information of the first metadata record table is obtained from the configuration table. According to the name information of the first metadata record table, the first metadata record table is obtained from the first device 10 and the second metadata record table is obtained from the second device 20.

[0106] The third device obtains a configuration table according to the information of the synchronously verified table, wherein the information of the synchronously verified table includes information for determining the first metadata record table and information for determining the second metadata record table. The information for determining the first metadata record table includes name information of the first metadata record table or information associated with the name information of the first metadata record table. The information for determining the second metadata record table includes name information of the second metadata record table or information associated with the name information of the second metadata record table.

[0107] In a possible implementation of the present application, before synchronizing data, the third device writes the synchronization verification information into a configuration table, and configures the timing schedule to perform the pre-synchronization verification. The timing schedule is the timing of triggering data synchronization. As an example, the third device writes the information of the first metadata record table in the first device 10 and the information of the second metadata record table in the configuration table. As an example, the information of the metadata record table can be an identifier of the metadata record table, such as a name or a storage location or a library name. The library name is used to indicate the name of the database where the metadata record table is located.

[0108] Optionally, the third device determines the type of difference between the table structure of the first metadata record table and the table structure of the second metadata record table based on the first metadata record table and the second metadata record table, including: determining whether data verification is required based on the type of data to be synchronized; if data verification is required, determining the type of difference between the table structure of the first metadata record table and the table structure of the second metadata record table based on the first metadata record table and the second metadata record table; if data verification is not required, directly synchronizing the first data in the first metadata record table to the second metadata record table.

[0109] In a possible embodiment of the present application, when the first metadata record table and the second metadata record table are consistent, if the third device determines that the amount of data corresponding to the first metadata record table has changed after the second time, although the first metadata record table and the second metadata record table are consistent, data synchronization is also required. The second time is the time of data synchronization completed by the first device 10 and the second device 20 before synchronizing the first data to the second device 20. As an example, the third device determines that the amount of data corresponding to the first metadata record table has changed after the second time, which can be achieved in the following way: the third device sends a data query request to the first device 10 to obtain from the first device 10 whether the amount of data corresponding to the first metadata record table has changed. Or, the third device determines whether the amount of data corresponding to the first metadata record table has changed according to the time when the data in the first device 10 is updated. For example, the third device determines that the data in the first device 10 is updated at time 1, and synchronizes the updated data to the second device 20 after time 1, but after a period of time, such as at time 2, the data in the first device 10 is updated again, so the third device determines that the amount of data corresponding to the first metadata record table has changed after the second time.

[0110] Of course, the third device may also determine whether the amount of data corresponding to the first metadata record table has changed by other means, such as user input, or interaction with other devices, which will not be elaborated in the embodiments of the present application.

[0111] In a possible embodiment of the present application, the first data includes multiple first sub-data, and synchronizing the first data in the first metadata record table to the second metadata record table includes: synchronizing the multiple first sub-data in the first metadata record table to the second metadata record table; and recording in the second metadata record table the time when each first sub-data is synchronized to the second metadata record table.

[0112] It is understandable that when the table structure of the first metadata record table is consistent with the table structure of the second metadata record table, or when the table structure of the first metadata record table is inconsistent with the table structure of the second metadata record table, and the difference type is determined to be the first difference type, the action of synchronizing the first data to the second metadata record table is performed, and the time when the first data is synchronized to the second metadata record table is recorded. This facilitates the subsequent determination of whether the data volume of the data corresponding to the first metadata record table has changed.

[0113] As an example, when determining to execute synchronization of data in the first metadata recording table to the second metadata recording table, the third device simultaneously records the synchronization time as time point A.

[0114] In a possible embodiment of the present application, when the difference type is the first difference type, a data synchronization operation is performed, and then the method further includes: obtaining a first amount of data added to the first metadata record table in a first time period, and a second amount of data added to the second metadata record table in a second time period. According to the first amount of data and the second amount of data, it is determined whether to resynchronize the first data to the second metadata record table. When the first amount of data and the second amount of data are the same, the first data is not resynchronized to the second metadata record table; when the first amount of data and the second amount of data are different, the first data is resynchronized to the second metadata record table.

[0115] In a possible embodiment of the present application, when the difference type is the first difference type, a data synchronization operation is performed, and then the following steps are further included: obtaining the first data total amount corresponding to the first metadata record table and the second data total amount corresponding to the second metadata record table. According to the first data total amount and the second data total amount, determining whether to resynchronize the first data to the second metadata record table. When the first data total amount and the second data total amount are the same, the first data is not resynchronized to the second metadata record table; when the first data total amount and the second data total amount are not the same, the first data is resynchronized to the second metadata record table.

[0116] After the first data is synchronized to the second metadata record table, as time goes by, the data corresponding to the first metadata record table and the data corresponding to the second metadata record table may differ again. For example, the business data corresponding to the first device 10 has changed. In order to keep the data of the two consistent, after the first data is synchronized to the second device 20, the method provided in the embodiment of the present application may also include: a verification process. That is, verify whether the data corresponding to the first metadata record table and the data corresponding to the second metadata record table are consistent after the first data is synchronized to the second metadata record table. The following will describe the specific implementation of the verification process in mode 1 and mode 2:

[0117] Method 1: Verify by comparing increments

[0118] In a possible embodiment of the present application, after synchronizing the first data to the second metadata record table, the method provided in the embodiment of the present application further includes:

[0119] Step A: The third device obtains a first amount of data added to the first metadata record table within a first time period, and a second amount of data added to the second metadata record table within a second time period.

[0120] The start time of the first time period and the second time period is equal to or later than the first time, the second time period includes the first time period and the data synchronization time interval, and the first time is the time when the first data is synchronized to the second device.

[0121] As an example, the starting point of the first time period may be the time when the first data is synchronized to the second device 20 (ie, the first time).

[0122] As an example, the data synchronization time interval may be preset by the system or determined by the third device itself, which is not limited in the embodiments of the present application.

[0123] Step B: The third device determines whether to resynchronize the first data to the second metadata record table according to the first data volume and the second data volume, where the first data is the data added to the first metadata record table during the first time period. The data volume of the first data is the first data volume.

[0124] It is worth noting that the specific implementation method of the third device obtaining the first data amount increased in the first metadata record table within the first time period and the second data amount increased in the second metadata record table within the second time period can refer to the above-mentioned process of the third device obtaining the second metadata record table from the second device 20.

[0125] In a possible implementation of the present application, the above step B can be specifically implemented in the following manner: when the first data volume is inconsistent with the second data volume, continue to perform data synchronization, that is, resynchronize the first data to the second metadata record table. This is because if the first data volume is inconsistent with the second data volume, it indicates that during the synchronization operation, not all data in the first data are synchronized to the second metadata record table, so it is necessary to re-execute data synchronization to ensure that the data in the two are consistent.

[0126] It is worth noting that after synchronizing the first data to the second metadata record table, the second device 20 can also update the data of the corresponding system in the second device according to the first data, thereby ensuring that the data in the corresponding system in the second device is the latest data.

[0127] As an example, the first time period is the time period between time point A and time point B, such as T1, and the first data is the amount of data added to the first metadata record table of the first device 10 from time point A to time point B, which is the first data amount. The second time period is the first time period plus the data synchronization time interval T2. Then the amount of data added to the second metadata record table within T1+T2 is the second data amount, or the second time period is a period of time starting from time point A, and the length of the second time period is equal to the length of the first time period + the data synchronization time interval. The third device compares the first data amount and the second data amount to determine whether to re-execute the data synchronization.

[0128] In a possible implementation of the present application, the third device determines whether to synchronize the first data to the second device 20 based on the first data volume and the second data volume, including: if the first data volume and the second data volume are the same, then the first data is not resynchronized to the second device 20. If the first data volume and the second data volume are the same, it means that all data in the first data have been synchronized to the second metadata record table. If the first data volume and the second data volume are not the same, all data in the first data have not been synchronized to the second metadata record table, and data synchronization needs to be performed again.

[0129] Method 2: Verify by comparing the total amount

[0130] In a possible implementation of the present application, after synchronizing the first data to the second metadata record table, the method provided in this embodiment further includes: a third device obtains a total amount of first data corresponding to the first metadata record table and a total amount of second data corresponding to the second metadata record table. The third device determines whether all data in the first data has been synchronized to the second metadata record table based on the total amount of the first data and the total amount of the second data, and the first data is data added to the first metadata record table within the first time period.

[0131] In a possible implementation of the present application, the third device determines whether to synchronize the second data to the second device 20 based on the total amount of the first data and the total amount of the second data, including: if the total amount of the first data and the total amount of the second data are the same, then the step of synchronizing all data corresponding to the first data or the first metadata record table to the second metadata record table is not performed. If the total amount of the first data and the total amount of the second data are the same, it indicates that all data in the first data have been synchronized to the second metadata record table. If the total amount of the first data and the total amount of the second data are different, it indicates that all data in the first data have not been synchronized to the second metadata record table, and data synchronization needs to be performed again.

[0132] In an optional embodiment of the present application, the method provided in the embodiment of the present application also includes: when the third device determines that the synchronization of the first data has failed, the step of synchronizing the first data to the second metadata record table can be re-executed. For example, the third device can execute the step of synchronizing the first data to the second metadata record table according to a preset data synchronization number threshold. For example, if the data synchronization number threshold is 3 times, then after the first synchronization fails, the step of synchronizing the first data to the second metadata record table can be re-executed. Or when the data synchronization number threshold is reached, if the first data still fails to synchronize, the user can be reminded of the data synchronization failure or the user can be prompted to modify the data synchronization number threshold.

[0133] Alternatively, when the third device determines that the synchronization of the first data fails, it may prompt a message indicating the failure of data synchronization, and then decide whether to re-execute the step of synchronizing the first data to the second metadata record table based on the operation instruction triggered by the user. Alternatively, the data synchronization times threshold may be determined based on the user's trigger.

[0134] In a possible implementation of the present application, the configuration table further includes: information for determining the first metadata record table and information for determining the second metadata record table. The information of the synchronization check table includes information for determining the first metadata record table and information for determining the second metadata record table in the configuration table.

[0135] In a possible implementation of the present application, before synchronizing data, the third device writes the synchronization verification information into a configuration table, and configures the timing schedule to perform the pre-synchronization verification. The timing schedule is the timing of triggering data synchronization. As an example, the third device writes the information of the first metadata record table in the first device 10 and the information of the second metadata record table in the configuration table. As an example, the information of the metadata record table can be an identifier of the metadata record table, such as a name or a storage location or a library name. The library name is used to indicate the name of the database where the metadata record table is located.

[0136] Figure 7 201 is a structural diagram of a data synchronization device 201 provided in an embodiment of the present application. The data synchronization device can be implemented by software, hardware or a combination of both to form part or all of a computer device, and the computer device can be as follows Figure 8 Computer equipment shown. Figure 7 The device includes: an acquisition module 2011, a determination module 2012, a prompt module 2013, and an execution module 2014.

[0137] The acquisition module 2011 is used to acquire the first metadata record table from the first device 10 and acquire the second metadata record table from the second device 20 .

[0138] The determination module is used to determine the difference type between the table structure of the first metadata record table and the table structure of the second metadata record table according to the first metadata record table and the second metadata record table.

[0139] The execution module is used to perform a data synchronization operation when the difference type is a first difference type, and not perform a data synchronization operation when the difference type is a second difference type, wherein the data synchronization operation is to synchronize the first data in the first metadata record table to the second metadata record table.

[0140] Specifically, the data synchronization device 201 can execute all the steps executed by the third device in the above embodiment. In addition, the specific implementation of each unit on the data synchronization device 201 side can refer to the description in the above embodiment, which will not be repeated here.

[0141] In the embodiment of the present application, the information of the table to be synchronized and verified is written into the configuration table, and the scheduled scheduling is configured to execute the verification task. When the configured scheduled time arrives, the task is executed, and the metadata record table corresponding to the configuration table is obtained at the source data end and the target end through the information in the configuration table, including the library name, table name, field, field type, field order and other information where the metadata record table is located, and the metadata record table of the source data end and the target end are compared. If the metadata record table of the source data end is consistent with the metadata record table information of the target end, it is considered that the verification is passed and the data is synchronized. If it is found during the verification that the fields of the source data have increased compared to the fields of the target data, an alarm message is issued to prompt that the metadata record tables of the source data end and the target end are inconsistent, and the synchronization of data continues. After the developer obtains the alarm message of the added field, he will go to the upstream personnel to confirm the fact of the alarm message, so as not to affect the normal progress of the task; if it is found during the verification that the fields of the metadata record table of the source data end have modified the field name, deleted the field, or the field type is inconsistent with the metadata record table of the target end, an alarm message is issued to prompt the developer that the metadata record table has deleted or modified the field, and the synchronization of data is not performed. At this time, the developer needs to deal with it immediately. The method and device provided in the present application enable developers to obtain the change information of the metadata record table of the source data end in a timely manner and make timely processing, and in the case of modifying and deleting fields, no synchronization of data is performed to occupy resources for the next step.

[0142] It should be noted that: when the data synchronization device provided in the above embodiment performs data synchronization verification, it only uses the division of the above-mentioned functional modules as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0143] The functional units and modules in the above embodiments 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, and the above integrated units may be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present application.

[0144] The data synchronization device and data synchronization method embodiments provided in the above embodiments belong to the same concept. The specific working process of the units and modules in the above embodiments and the technical effects brought about can be found in the method embodiment part and will not be repeated here.

[0145] Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 8 As shown, the computer device 301 includes: a processor 3011, a memory 3012, and a computer program 3013 stored in the memory 3012 and executable on the processor 3011. When the processor 3011 executes the computer program 3013, the steps in the method for synchronizing data in the above embodiment are implemented.

[0146] The computer device 301 may be a general-purpose computer device or a dedicated computer device. In a specific implementation, the computer device 301 may be a desktop computer, a portable computer, a network server, a PDA, a mobile phone, a tablet computer, a wireless terminal device, a communication device or an embedded device. The embodiment of the present application does not limit the type of the computer device 301. Those skilled in the art will understand that Figure 8 This is only an example of the computer device 301 and does not constitute a limitation on the computer device 301 . The computer device 301 may include more or fewer components than shown in the figure, or a combination of certain components, or different components, such as input and output devices, network access devices, etc.

[0147] The processor 3011 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0148] In some embodiments, the memory 3012 may be an internal storage unit of the computer device 301, such as a hard disk or memory of the computer device 301. In other embodiments, the memory 3012 may also be an external storage device of the computer device 301, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 301. Further, the memory 3012 may also include both an internal storage unit of the computer device 301 and an external storage device. The memory 3012 is used to store an operating system, an application program, a boot loader, data, and other programs. The memory 3012 may also be used to temporarily store data that has been output or is to be output.

[0149] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0150] 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 present application implements all or part of the processes in the above method embodiments, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of each of the above method embodiments can be implemented. Among them, the computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, ROM (Read-Only Memory), RAM (Random Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk and optical data storage device. The computer-readable storage medium mentioned in the present application can be a non-volatile storage medium, in other words, a non-transient storage medium.

[0151] An embodiment of the present application also provides a chip, which includes a processor, which is coupled to a communication interface. The processor is used to run a computer program or instruction to implement the data synchronization method as described in the above embodiment, and the communication interface is used to communicate with other modules outside the chip.

[0152] An embodiment of the present application also provides a communication device, comprising: a communication interface and at least one processor, wherein the at least one processor is connected to the communication interface, the at least one processor is coupled to a memory, the at least one processor is used to run instructions stored in the memory to execute the data synchronization method of the above embodiment, and the communication interface is used to communicate with other modules outside the communication device.

[0153] It should be understood that all or part of the steps to implement the above embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The computer instructions can be stored in the above-mentioned computer readable storage medium.

[0154] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0155] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0156] In the embodiments provided in the present application, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, 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.

[0157] 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.

[0158] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A data synchronization method, characterized in that: The method comprises: Acquire a first metadata record table from the first device, and acquire a second metadata record table from the second device; Determine, according to the first metadata record table and the second metadata record table, a difference type between a table structure of the first metadata record table and a table structure of the second metadata record table; When the difference type is a first difference type, a data synchronization operation is performed, wherein the first difference type is that the first metadata record table includes or does not include a first field in addition to all the fields in the second metadata record table; When the difference type is a second difference type, the data synchronization operation is not performed, and the second difference type is that a field in the second metadata record table is missing in the first metadata record table, or field parameters of a common field in the first metadata record table and the second metadata record table are different; The data synchronization operation is to synchronize the first data in the first metadata record table to the second metadata record table.

2. The method according to claim 1, characterized in that The method further comprises: When the difference type is the first difference type and there is an additional field in the table structure of the first metadata record table relative to the table structure of the second metadata record table, a first monitoring alarm is issued, and the first monitoring alarm is used to prompt that there is an additional field in the first metadata record table relative to the second metadata record table; When the difference type is the second difference type, a second monitoring alarm is issued, and the second monitoring alarm is used to prompt that there is a modification and / or deletion of fields in the first metadata record table relative to the second metadata record table.

3. The method according to claim 1, characterized in that Acquiring a first metadata record table from a first device and acquiring a second metadata record table from a second device includes: Obtaining a request for data to be synchronized, wherein the request for data to be synchronized includes the type of data to be synchronized; According to the data type to be synchronized, the name information of the first metadata record table is obtained from the configuration table. According to the name information of the first metadata record table, a first metadata record table is obtained from the first device and a second metadata record table is obtained from the second device.

4. The method according to claim 3, characterized in that Determining, according to the first metadata record table and the second metadata record table, a difference type between a table structure of the first metadata record table and a table structure of the second metadata record table, comprising: Determining whether data verification is required according to the type of data to be synchronized; If data verification is required, determining the type of difference between the table structure of the first metadata record table and the table structure of the second metadata record table according to the first metadata record table and the second metadata record table; If data verification is not required, the first data in the first metadata record table is directly synchronized to the second metadata record table.

5. The method according to claim 1 or 2, wherein the first data comprises a plurality of first sub-data, characterized in that: Synchronizing the first data in the first metadata record table to the second metadata record table includes: Synchronize the plurality of first sub-data in the first metadata record table to the second metadata record table; and record in the second metadata record table the time when each first sub-data is synchronized to the second metadata record table.

6. The method according to claim 1 or 2, characterized in that: When the difference type is the first difference type, a data synchronization operation is performed, and then the method further includes: Acquire a first amount of data added to the first metadata record table within a first time period, and a second amount of data added to the second metadata record table within a second time period; determining, according to the first data amount and the second data amount, whether to resynchronize the first data to the second metadata record table; When the first data amount and the second data amount are the same, the first data is not resynchronized to the second metadata record table; If the first data amount is different from the second data amount, the first data is resynchronized to the second metadata record table.

7. The method according to claim 1 or 2, characterized in that: When the difference type is the first difference type, a data synchronization operation is performed, and then the method further includes: Acquire a total amount of first data corresponding to the first metadata record table and a total amount of second data corresponding to the second metadata record table; determining whether to resynchronize the first data to the second metadata record table according to the first total data amount and the second total data amount; When the total amount of the first data is the same as the total amount of the second data, the first data is not resynchronized to the second metadata record table; If the total amount of the first data is different from the total amount of the second data, the first data is resynchronized to the second metadata record table.

8. The method according to claim 3, characterized in that The configuration table further includes: information for determining the first metadata record table and information for determining the second metadata record table; The information of the table to be synchronously verified includes information used by the configuration table to determine the first metadata record table and information used to determine the second metadata record table.

9. A data synchronization system, characterized in that: include: A first device, and a second device communicating with the first device, wherein the first device is used to execute the method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that: The readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Data synchronization method and device for data warehouse

    CN110019539A

  • Structure synchronization method and device from relational database to Hadoop database

    CN110245145A

  • Data synchronization method and device, computer equipment and storage medium

    CN111427951A

  • Data synchronization method, system and equipment between heterogeneous databases and storage medium

    CN113051347A

  • Data synchronization method and device, electronic equipment and computer storage medium

    CN113392153A