Data synchronization method and device, storage medium and computer equipment

By configuring preset processing rules and exception handling rules in the data synchronization interface, and processing according to the matching of the data to be synchronized with the preset identification, the problems of low data synchronization efficiency and poor versatility in the existing technology are solved, and efficient and accurate are achieved. Data synchronization.

CN118626564APending Publication Date: 2024-09-10TONGFANG KNOWLEDGE NETWORK DIGITAL PUBLISHING TECHNOLOGY CO LTD +1
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410806618.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

Existing data synchronization methods are inefficient and have high error rates, and the code needs to be rewritten when the data structure or logic changes, resulting in high development costs and poor versatility.

Method used

Provides a data synchronization method. By configuring multiple preset processing rules in the data synchronization interface, according to the matching of the data to be synchronized with the preset identification, the corresponding processing rules are called for data processing and updating. It supports data type conversion and default value processing. and formula calculations, and handle exceptions in abnormal situations to improve the flexibility and accuracy of data synchronization.

Benefits of technology

It improves the efficiency and accuracy of data synchronization, reduces development costs, enhances the versatility of the method, and is suitable for data synchronization between different data sources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626564A
    Figure CN118626564A
Patent Text Reader

Abstract

The invention discloses a data synchronization method and device, a storage medium and computer equipment. The data synchronization method comprises the steps of creating a data synchronization interface of target data; wherein a plurality of preset processing rules are configured in the data synchronization interface; matching the to-be-synchronized data with a preset identifier; if the to-be-synchronized data does not contain the preset identifier, updating the target data according to the to-be-synchronized data; and if the to-be-synchronized data contains the preset identifier, calling a target preset processing rule matched with the preset identifier to process the to-be-synchronized data, and updating the target data according to the processed to-be-synchronized data. According to the method, the preset processing rule only needs to be flexibly adjusted according to the processing logic of different data, so that the preset processing rule is continuously updated and perfected, the method is suitable for data synchronization between different data sources, and the universality of the method is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In the related technology, it is often necessary to synchronize data from one data source to another data source. However, there is still a synchronization method that manually exports the data to be synchronized and then manually imports the data to be synchronized into the target data source. This synchronization method is not only inefficient, but also has a high error rate. In addition to the manual import and export method, data synchronization is also achieved by developing code between data sources. However, every time the data structure or logic of the data source changes, the code needs to be rewritten, which has high development costs and poor versatility. Summary of the invention

[0003] In view of this, the present application provides a data synchronization method, apparatus, storage medium and computer device, which flexibly adjust preset processing rules according to the processing logic of different data, thereby achieving flexible processing of the data to be synchronized and improving the versatility of the data synchronization method.

[0004] According to one aspect of the present application, a data synchronization method is provided, comprising: creating a data synchronization interface for target data; wherein a plurality of preset processing rules are configured in the data synchronization interface; matching the data to be synchronized with a preset identifier; if the data to be synchronized does not contain the preset identifier, updating the target data according to the data to be synchronized; if the data to be synchronized contains the preset identifier, calling a target preset processing rule that matches the preset identifier to process the data to be synchronized, and updating the target data according to the processed data to be synchronized.

[0005] Optionally, calling the target preset processing rule that matches the preset identifier to process the data to be synchronized, and updating the target data based on the processed data to be synchronized, includes: if the preset identifier is a first identifier, converting the data type of the data to be synchronized into the data type of the target data, and updating the target data based on the converted data to be synchronized; if the preset identifier is a second identifier, updating the target data based on the preset data corresponding to the data to be synchronized; if the preset identifier is a third identifier, determining the result data based on the preset formula corresponding to the data to be synchronized and the preset formula identifier, and updating the target data based on the result data.

[0006] Optionally, the data synchronization method also includes: obtaining attribute information of the synchronization data source; wherein the attribute information includes at least the data volume of the synchronization data source, the data name of the synchronization data source and the data creation time of the synchronization data source; if the attribute information meets the first preset synchronization condition, the data belonging to the synchronization data source is determined as the data to be synchronized; if the attribute information meets the second preset synchronization condition, the data belonging to the synchronization data source and the creation time is between the current time and the time when the target data was last updated is determined as the data to be synchronized.

[0007] Optionally, before the step of matching the data to be synchronized with a preset identifier, the method further includes: obtaining an update cycle for updating the target data; and if the current moment matches the moment corresponding to the update cycle, obtaining the data to be synchronized.

[0008] Optionally, the data synchronization interface is also configured with multiple preset exception handling rules, and the data synchronization method also includes: capturing exception information of the data to be synchronized; if the exception information meets the preset exception type, calling the target preset exception handling rule matching the preset exception type to process the data to be synchronized with the exception.

[0009] Optionally, the preset exception type includes a first preset exception type and a second preset exception type, and the calling of the target preset exception handling rule matching the preset exception type to process the data to be synchronized with the exception includes: if the exception information matches the first preset exception type, refusing to match the data to be synchronized with the preset identifier; in response to a first retry instruction, re-matching the data to be synchronized with the preset identifier; if the exception information matches the second preset exception type, refusing to match the abnormal data in the data to be synchronized with the preset identifier, and matching the data in the data to be synchronized except the abnormal data with the preset identifier; in response to the second retry instruction, matching the abnormal data with the preset identifier.

[0010] Optionally, the data synchronization method also includes: configuring an authorized connection relationship for the target data source and the synchronization data source; encrypting and verifying the target data source and the synchronization data source based on the authorized connection relationship; if both the target data source and the synchronization data source pass the verification, obtaining the data to be synchronized from the synchronization data source, and updating the target data based on the data to be synchronized or the processed data to be synchronized.

[0011] According to another aspect of the present application, a data synchronization device is provided, comprising: an interface module for creating a data synchronization interface for target data; wherein the data synchronization interface is configured with a plurality of preset processing rules; a matching module for matching the data to be synchronized with a preset identifier; an updating module for updating the target data according to the data to be synchronized if the data to be synchronized does not contain the preset identifier; and, if the data to be synchronized contains the preset identifier, calling the target preset processing rule that matches the preset identifier to process the data to be synchronized, and updating the target data according to the processed data to be synchronized.

[0012] Optionally, the update module is specifically used to convert the data type of the data to be synchronized into the data type of the target data if the preset identifier is a first identifier, and update the target data according to the converted data to be synchronized; if the preset identifier is a second identifier, update the target data according to the preset data corresponding to the data to be synchronized; if the preset identifier is a third identifier, determine the result data according to the preset formula corresponding to the data to be synchronized and the preset formula identifier, and update the target data according to the result data.

[0013] Optionally, the data synchronization device further includes:

[0014] A determination module is used to obtain attribute information of a synchronization data source; wherein the attribute information includes at least the data volume of the synchronization data source, the data name of the synchronization data source and the data creation time of the synchronization data source; if the attribute information meets the first preset synchronization condition, the data belonging to the synchronization data source is determined as the data to be synchronized; if the attribute information meets the second preset synchronization condition, the data belonging to the synchronization data source and the creation time is between the current time and the time when the target data was last updated is determined as the data to be synchronized.

[0015] Optionally, the data synchronization device further includes:

[0016] The acquisition module is used to acquire the update cycle of the target data before the step of matching the data to be synchronized with the preset identifier; if the current time matches the time corresponding to the update cycle, the data to be synchronized is acquired.

[0017] Optionally, the data synchronization device further includes:

[0018] A processing module is also configured with multiple preset exception handling rules in the data synchronization interface to capture the exception information of the data to be synchronized; if the exception information meets the preset exception type, the target preset exception handling rule matching the preset exception type is called to process the data to be synchronized with the exception.

[0019] Optionally, the processing module is specifically used for the preset exception types including a first preset exception type and a second preset exception type, and the calling of the target preset exception processing rule matching the preset exception type to process the data to be synchronized with the exception includes: if the exception information matches the first preset exception type, refusing to match the data to be synchronized with the preset identifier; in response to a first retry instruction, re-matching the data to be synchronized with the preset identifier; if the exception information matches the second preset exception type, refusing to match the abnormal data in the data to be synchronized with the preset identifier, and matching the data in the data to be synchronized except the abnormal data with the preset identifier; in response to a second retry instruction, matching the abnormal data with the preset identifier.

[0020] Optionally, the data synchronization device further includes:

[0021] An authentication module is used to configure an authorized connection relationship between the target data source and the synchronization data source; encrypt and authenticate the target data source and the synchronization data source based on the authorized connection relationship; if both the target data source and the synchronization data source pass the authentication, obtain the data to be synchronized from the synchronization data source, and update the target data based on the data to be synchronized or the processed data to be synchronized.

[0022] According to another aspect of the present application, a readable storage medium is provided, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the above-mentioned data synchronization method are implemented.

[0023] According to another aspect of the present application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, and the processor implements the steps of the above-mentioned data synchronization method when executing the program.

[0024] Through the above technical solution, the present application provides a data synchronization method, device, storage medium and computer equipment, creates a data synchronization interface configured with multiple preset processing rules, and sets a preset identifier for the data in the data to be synchronized that cannot be directly used to update the target data, and calls the target preset processing rule through the preset identifier to achieve the adaptation and conversion of the data to be synchronized. The present application accurately locates the data to be processed in the data to be synchronized through the preset identifier, avoids unnecessary data processing operations, and improves synchronization efficiency. And when the data to be synchronized or the target data changes, it is only necessary to flexibly adjust the preset processing rules according to the processing logic of different data, so as to continuously update and improve the preset processing rules, so that the present application is applicable to data synchronization between different data sources, thereby improving the versatility of the present application.

[0025] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0027] Figure 1 A schematic diagram of a process flow of a data synchronization method provided in an embodiment of the present application is shown;

[0028] Figure 2 A structural block diagram of a data synchronization device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0029] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0030] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present application.

[0031] Those skilled in the art will appreciate that, unless expressly stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "connected" to another element, it may be directly connected or connected to the other element, or there may be intermediate elements. In addition, the "connection" or "connection" used herein may include wireless connection or wireless fusion. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.

[0032] Now, exemplary embodiments according to the present application will be described in more detail with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in a variety of different forms and should not be interpreted as being limited to the embodiments set forth herein. It should be understood that these embodiments are provided to make the disclosure of the present application thorough and complete, and to fully convey the concepts of these exemplary embodiments to those of ordinary skill in the art.

[0033] In this embodiment, a data synchronization method is provided, in response to data in a synchronization data source needing to be synchronized to a target data source, such as Figure 1 As shown, the method includes:

[0034] S101, creating a data synchronization interface for target data.

[0035] Among them, a plurality of preset processing rules are configured in the data synchronization interface.

[0036] The data that needs to be synchronized in the synchronization data source is the data to be synchronized, and the target data is the data that needs to be synchronized and updated in the target data source.

[0037] In this embodiment, the processing logic of different data is implemented by configuring different preset processing rules in the data synchronization interface. Unlike the related technology of rewriting the code when the data to be synchronized or the target data changes, it is only necessary to dynamically adjust and modify the preset processing rules to adapt to different synchronization scenarios and synchronization requirements, thereby improving the versatility of the present application.

[0038] Furthermore, the data processing rules frequently used in actual synchronization scenarios can be pre-configured in the data synchronization interface, and the preset processing rules can be adjusted according to the actual situation of data synchronization. For example, if the data processing rules involved in this data synchronization scenario are not configured in the data synchronization interface, new preset processing rules can be added to the data synchronization interface according to the processing logic of the synchronized data in this data synchronization scenario to meet the actual needs of data synchronization. Similarly, when different data sources use this application for data synchronization, it is only necessary to add the preset processing rules that need to be used according to the preset processing rules that already exist in the data synchronization interface. By continuously improving and updating the preset processing rules, the present application is applicable to data synchronization between different data sources, thereby improving the versatility of the present application.

[0039] Exemplarily, this embodiment creates a strategy interface FormulaStrategy in the form of a configuration file. The internal method of the strategy interface FormulaStrategy is calculate. By overriding the calculate method in the strategy interface FormulaStrategy, multiple preset processing rules are configured in the strategy interface FormulaStrategy. For example, by overriding the calculate method, three preset processing rules are configured in the strategy interface FormulaStrategy, namely the first preset processing rule, the second preset processing rule and the third preset processing rule. Among them, the first preset processing rule obtains the data type of the data to be synchronized and the data type of the target data, and converts the data type of the data to be synchronized into the data type of the target data. The second preset processing rule is used to handle some special cases such as default values ​​or null values. The second preset processing rule updates the target data according to the preset data corresponding to the data to be synchronized. For example, if the data to be synchronized is a null value null, the preset data is a string "NULL", and the target data is updated to the string "NULL". The third preset rule includes a preset formula, wherein the preset formula is a relationship expression between the data to be synchronized and the target data. The third preset rule obtains data related to the preset formula in the data to be synchronized, determines the result data using the preset formula, and updates the target data to the result data. If the data related to the preset formula in the data to be synchronized has a null value, the target data is updated to the value "0".

[0040] It is worth mentioning that the strategy interface encapsulates each preset processing rule so that the preset processing rules can be replaced with each other in the interface, thereby achieving the purpose of calling different preset processing rules. The strategy mode allows the preset processing rules to change independently of the client that uses it. Therefore, when synchronizing data between different data sources, only the preset processing rules need to be adjusted, thereby improving the universality of this application.

[0041] It should be noted that before calling the preset processing rules, the configuration file corresponding to this embodiment needs to be parsed into an object that can be recognized by the program. For example, if the configuration file corresponding to this embodiment is a JSON file named config.json, then use the loadConfig method of the ConfigLoader class to load the SyncConfig object from the JSON file named config.json.

[0042] S102: Match the data to be synchronized with a preset identifier.

[0043] In this embodiment, it is determined whether the target data can be directly updated with the data to be synchronized. If not, a preset identifier is set in the data to be synchronized. The data to be processed in the subsequent synchronization process is accurately located by the preset identifier, thereby reducing unnecessary data processing and improving the efficiency of data synchronization. In the subsequent synchronization step, the preset processing rules are accurately called by the preset identifier, and the data to be processed in the data to be synchronized is accurately processed, thereby improving the accuracy of data synchronization.

[0044] Exemplarily, after obtaining the data to be synchronized, the data to be synchronized is compared with the target data to determine whether the data to be synchronized and the target data can be synchronized directly. If so, there is no need to set a preset identifier for the data to be synchronized, and in the subsequent synchronization step, the target data can be directly updated to the data to be synchronized. If not, according to the processing logic of the data that cannot be directly synchronized in the data to be synchronized, the corresponding preset processing rule is determined in the data synchronization interface, and the preset identifier matched by the preset processing rule is set in the above-mentioned data that cannot be directly synchronized.

[0045] For example, the data to be synchronized includes: the first order date "2023-04-01" (date type is "yyyy-MM-dd"), product quantity "10", product price "9.9" and pending order null, and the target data in the target data source includes the second order date (date type is "yyyy-MM-dd HH:mm:ss"), total product value and target order. After comparing the data to be synchronized with the target data, it can be seen that the four data in the data to be synchronized are inconsistent with the corresponding data formats and types in the target data, so the data to be synchronized cannot be used directly to update the target data. Therefore, preset identifiers are set in the four data in the data to be synchronized. Since the data types of the first order date in the data to be synchronized and the corresponding second order date in the target data are inconsistent, it is necessary to call the first preset processing rule to convert the data type of the first order date, and then set the first identifier matching the first preset processing rule in the first order date. Similarly, since the total value of the products in the target data needs to be determined based on the corresponding product quantity and product price in the data to be synchronized, and there is a relational expression "total value of products = product quantity * product price" between the total value of products, product quantity and product price, it is necessary to call the third preset processing rule to process the product quantity and product price, then set the third identifier matching the third preset processing rule in both the product quantity and product price, and determine "total value of products = product quantity * product price" as the preset formula in the third preset processing rule. Similarly, since the pending orders in the data to be synchronized are null values, which is a special case, the second identifier matching the second preset processing rule is set in the pending orders.

[0046] It should be noted that when judging whether the data in the synchronization data source can be synchronized with the corresponding data in the target data source, it is necessary to perform a comprehensive comparison of each piece of data in the data to be synchronized. For example, it is necessary to compare the data type, data name, accuracy of the data value, etc. of the data. This can be done through automated judgments using data comparison tools in related technologies. In critical or complex data synchronization scenarios, manual review and verification can also be performed on the basis of automated judgments. This application does not impose specific restrictions here. If no deviations or anomalies occur when the target data is directly updated to the data to be synchronized, it is determined that the data to be synchronized and the target data can be directly synchronized. Otherwise, it is necessary to process the data to be synchronized before synchronizing the target data.

[0047] In one embodiment, the data synchronization method provided in this embodiment also includes: obtaining attribute information of the synchronization data source; if the attribute information meets the first preset synchronization condition, the data belonging to the synchronization data source is determined as the data to be synchronized; if the attribute information meets the second preset synchronization condition, the data belonging to the synchronization data source and whose creation time is between the current time and the time when the target data was last updated is determined as the data to be synchronized.

[0048] The attribute information includes at least the data volume of the synchronization data source, the data name of the synchronization data source, and the data creation time of the synchronization data source.

[0049] In this embodiment, before each data synchronization, the data to be synchronized is determined in the synchronization data source to accurately apply different data synchronization scenarios, improve the reliability of data synchronization, save data synchronization resources, reduce the pressure of data synchronization, and improve the efficiency of data synchronization.

[0050] Exemplarily, the first preset synchronization condition is applicable to a data synchronization scenario in which all data in the synchronization data source is synchronized to the target data source, and the second preset synchronization condition is applicable to a data synchronization scenario in which part of the data in the synchronization data source is synchronized to the target data source. If the attribute information meets the first preset synchronization condition, all data in the synchronization source is determined as data to be synchronized to ensure the integrity and consistency of the data. If the attribute information meets the second preset synchronization condition, data in the synchronization data source whose creation time is between the time when the last target data update was completed and the current time is determined as data to be synchronized, so as to reduce unnecessary data transmission, reduce the pressure of data synchronization, and thus improve the efficiency of data synchronization.

[0051] It should be noted that the first preset synchronization condition and the second preset synchronization condition can be specifically set according to the actual data synchronization scenario, and this embodiment does not impose specific restrictions. For example, when the data in the synchronization data source is synchronized to the target data source for the first time, all the data in the synchronization data source needs to be determined as data to be synchronized, so the first preset synchronization condition can be determined according to the amount of data. Furthermore, when the target data is updated again after the target data is updated for the first time, only part of the data that has changed after the target data is updated for the first time in the synchronization data source needs to be synchronized to the target data source within the preset time. Therefore, the second preset synchronization condition can be determined according to the creation time of the data. For example, the time when the target data is updated for the first time is 2024-01-01. If only the newly added data in the synchronization data source of the day is synchronized every day, the data in the synchronization data source with a creation time between 2024-01-01 00:00:00 and 2024-01-01 23:59:59 is determined as data to be synchronized. Alternatively, a second preset synchronization condition can be set according to the data name. For example, the data in the synchronization data source is the data of all teachers in the school, including the data of in-service and retired teachers. If only the in-service teacher data in the target data needs to be updated, then only the in-service teacher data in the synchronization data source needs to be identified as the data to be synchronized.

[0052] In one embodiment, before the step of matching the data to be synchronized with the preset identifier, the data synchronization method provided by this embodiment further includes: obtaining an update cycle for updating the target data; if the current time matches the time corresponding to the update cycle, obtaining the data to be synchronized.

[0053] The update cycle is used to describe when to update the target data.

[0054] In this embodiment, the time for acquiring the data to be synchronized is determined according to the update cycle, thereby determining the time for updating the target data, avoiding excessive resource consumption caused by frequent updates of the target data, and effectively managing and optimizing the execution of data synchronization through the update cycle, thereby improving the stability and reliability of data synchronization.

[0055] For example, the update cycle may be set to update once a day or once an hour, etc., and may even be accurate to the minute, so as to update the target data at the most appropriate time.

[0056] S103, if the data to be synchronized does not contain a preset identifier, updating the target data according to the data to be synchronized;

[0057] S104: If the data to be synchronized contains a preset identifier, a target preset processing rule matching the preset identifier is called to process the data to be synchronized, and the target data is updated according to the processed data to be synchronized.

[0058] In this embodiment, whether to call the preset processing rule to process the data to be synchronized is determined by whether the data to be synchronized contains a preset identifier. Since the preset identifier is associated with different preset processing rules, the processing methods required for different data to be synchronized can be accurately determined by adding the preset identifier, thereby avoiding unnecessary data processing operations and improving data synchronization efficiency. The preset processing rule matching the preset identifier is called to accurately process the data to be synchronized, so that the processed data to be synchronized is accurately adapted to the target data, thereby improving synchronization accuracy.

[0059] Further, as a refinement and extension of the specific implementation methods of the above-mentioned embodiments, in order to fully illustrate the specific implementation process of this embodiment, the steps of calling the target preset processing rule that matches the preset identifier to process the data to be synchronized, and updating the target data according to the processed data to be synchronized, specifically include: if the preset identifier is a first identifier, the data type of the data to be synchronized is converted into the data type of the target data, and the target data is updated according to the converted data to be synchronized; if the preset identifier is a second identifier, the target data is updated according to the preset data corresponding to the data to be synchronized; if the preset identifier is a third identifier, the result data is determined according to the preset formula corresponding to the data to be synchronized and the preset formula identifier, and the target data is updated according to the result data.

[0060] In this embodiment, by matching the preset identifier with the preset processing rule, the data synchronization process can be flexibly processed according to different data in the data to be synchronized, thereby meeting the synchronization requirements of different data sources.

[0061] Exemplarily, taking the example in S102 as an example, after the data to be synchronized matches the preset identifier, since the first order date contains the preset identifier, and the preset identifier is the first identifier, the first preset processing rule matching the first identifier is called to process the first order date, and the second order date is updated according to the processed first order date. Specifically, first determine that the data type to be converted is a date type, and obtain the date type of the first order date and the second order date, convert the data type of the first order date to the data type of the second order date, and the converted first order date is "2023-04-0100:00:00", and the second order date is updated to "2023-04-01 00:00:00". Similarly, since both the product quantity and product price contain the preset identifier, and the preset identifier is the third preset identifier, the third preset processing rule matching the third preset identifier is called to process the product quantity and product price, and the total product value is updated according to the processed product quantity and product price. Specifically, obtain the product quantity and product price involved in the preset formula "Total product value = product quantity * product price" in the third preset processing rule, convert the value of the product quantity into an integer type, convert the value of the product price into a double-precision floating-point type, and then substitute the converted product quantity and product price into the preset formula. And determine the calculated value as the result data, so as to update the total product value as the result data. Similarly, since the pending order contains a preset identifier, and the preset identifier is the second identifier, the second preset processing rule matching the second identifier is called to process the pending order, and the target order is updated according to the processed pending order, that is, the target order is updated to the string "NULL".

[0062] In one embodiment, in order to ensure that data synchronization is carried out normally and accurately, the data synchronization method provided in this embodiment also includes: capturing abnormal information of the data to be synchronized; if the abnormal information meets the preset abnormal type, calling the target preset abnormality handling rule matching the preset abnormality type to handle the abnormal data to be synchronized.

[0063] In this embodiment, the data synchronization process is judged whether an abnormality occurs by capturing abnormal information, ensuring immediate response and processing when an abnormality occurs. After the abnormal information is captured, it is processed in a timely manner according to the preset abnormal type that the abnormal information meets, ensuring the accuracy of data synchronization, avoiding data damage or loss, and improving the reliability and stability of data synchronization.

[0064] It should be noted that the exception information is information generated when an exception exists in the data to be synchronized, and the exception information is used to describe the specific type of the exception and locate the data with the exception in the data to be synchronized.

[0065] Further, as a refinement and extension of the specific implementation methods of the above-mentioned embodiments, in order to fully illustrate the specific implementation process of this embodiment, the target preset exception handling rules matching the preset exception type are called to process the data to be synchronized with exceptions, specifically including: the preset exception type includes a first preset exception type and a second preset exception type; if the exception information matches the first preset exception type, then the data to be synchronized is refused to be matched with the preset identifier; in response to the first retry instruction, the data to be synchronized is re-matched with the preset identifier; if the exception information matches the second preset exception type, then the abnormal data in the data to be synchronized is refused to be matched with the preset identifier, and the data other than the abnormal data in the data to be synchronized is matched with the preset identifier; in response to the second retry instruction, the abnormal data is matched with the preset identifier.

[0066] In this embodiment, different exception processing is performed according to different preset exception types that the exception information conforms to, so that the preset exception processing rules are closer to the characteristics of the preset exception types, ensuring the accuracy and reliability of the exception processing.

[0067] Exemplarily, the first preset exception type includes serious system-level errors or data consistency problems such as database connection failure and insufficient disk space. If the exception information meets the first preset exception type, the data to be synchronized is refused to be matched with the preset identifier to stop the entire data synchronization process to prevent further data damage or waste of resources. If the first preset type that the exception information meets is a known exception that can be automatically resolved, an automatic retry is performed after the data synchronization stops, and the number of automatic retries and the result of the automatic retry are obtained, such as database reconnection. If the automatic retry result does not meet the preset result, the automatic retry is performed again until the number of automatic retries reaches the preset number of automatic retries. If the first preset type that the exception information meets is an unknown or complex exception, the first retry instruction is obtained, and after obtaining the first retry instruction, the data to be synchronized is re-matched with the preset identifier. Among them, the first retry instruction is used to indicate how to retry data synchronization after an exception of the first preset exception type occurs.

[0068] For example, the triggering conditions of the first retry instruction may include the number of retries, the retry interval time, the maximum number of retries, and whether to perform a data correction operation. If the execution of a data correction operation is detected, the data to be synchronized is updated according to the indicated correction data to correct the abnormal data in the synchronized data, and a first retry instruction is generated. Alternatively, when the current moment meets the moment corresponding to the retry interval time, the data to be synchronized is matched with a preset identifier to avoid a large number of continuous retry requests when the abnormal information is captured, increase the probability of successful data synchronization retry, and obtain the first number of matches and the first matching result at the same time. If the first matching result does not meet the preset result corresponding to the first preset abnormal type, the data to be synchronized is re-matched with the preset identifier until the first matching number reaches the maximum number of retries. If the automatic retry result or the first matching result still does not meet the preset result corresponding to the first preset abnormal type, the first failure information is determined and manual intervention is performed.

[0069] Furthermore, the second preset exception type includes non-fatal errors such as single data format errors. If the exception information meets the second preset exception type, the abnormal data in the data to be synchronized is rejected to be matched with the preset identifier, and the data other than the abnormal data in the data to be synchronized is matched with the preset identifier, so as to skip the abnormal data during the data synchronization process and avoid interrupting the entire synchronization process due to individual data problems.

[0070] Similarly, the second retry instruction is used to indicate how to retry data synchronization after an exception of a second preset exception type occurs. Among them, the triggering condition of the second retry instruction may include whether the data synchronization is completed in addition to the number of retries, the retry interval time, the maximum number of retries, and whether the correction data operation is performed. If the data synchronization is completed, that is, the target data update is completed, then the second retry instruction is generated. Alternatively, if the correction data operation is detected, the abnormal data in the data to be synchronized is updated according to the indicated correction data to correct the abnormal data, and a second retry instruction is generated. Alternatively, when the current moment meets the moment corresponding to the retry interval time, the abnormal data is matched with the preset identifier, and the second matching number and the second matching result are obtained at the same time. If the second matching result does not meet the preset result corresponding to the second preset exception type, the abnormal data is re-matched with the preset identifier until the second matching number reaches the maximum number of retries. If the second matching result still does not meet the preset result corresponding to the second preset exception type, the second failure information is determined, and manual intervention is performed.

[0071] It should be noted that the preset result is set according to the specific exception type, and this application does not limit it here. For example, if the preset exception type that the exception information meets is a database connection failure, the preset result includes a successful database connection. If the preset exception type that the exception information meets is caused by the presence of malformed data in the data to be synchronized, the preset result includes that the malformed data in the data to be synchronized successfully matches the preset identifier.

[0072] In an actual synchronization scenario, if an exception occurs in which a single piece of data in the data to be synchronized has an erroneous format, an error log can be set to record each erroneous data that is skipped in the abnormal data for subsequent processing.

[0073] In one embodiment, in order to ensure the security of data synchronization, the data synchronization method provided in this embodiment also includes: configuring an authorized connection relationship for the target data source and the synchronization data source; encrypting and verifying the target data source and the synchronization data source based on the authorized connection relationship; if both the target data source and the synchronization data source pass the verification, obtaining the data to be synchronized from the synchronization data source, and updating the target data based on the data to be synchronized or the processed data to be synchronized.

[0074] In this embodiment, through permission verification before data synchronization, it is determined that the data sources involved in the data synchronization are legal and have the right to access and operate the data, effectively preventing unauthorized access and protecting sensitive data and key data in the data source from being illegally viewed, modified or deleted, which is conducive to maintaining data integrity and security and preventing data leakage.

[0075] For example, the data source involved in the data synchronization scenario opens the connection information of the data source and the read and write permissions of the data based on the confidentiality agreement, or enables the data source to provide data through interface requests, and only opens read-only permissions to avoid affecting the own data, and at the same time ensures the normal network communication between the data sources. Furthermore, the synchronization data source and the target data source are determined according to the actual data synchronization scenario, and the authorized connection relationship is configured for the synchronization data source and the target data source, so as to perform encryption verification on the target data source and the synchronization data source according to the authorized connection relationship.

[0076] It is worth mentioning that there are many ways to encrypt and verify the target data source and the synchronization data source based on the authorized connection relationship. For example, after configuring the authorized connection relationship between the synchronization data source and the target data source, the target data source determines the authentication data according to the authorized connection relationship, and encrypts the authentication data, and then sends the encrypted authentication data to the data synchronization method described in this embodiment. After the synchronization data source configures the authorization data, it also encrypts the authorization data, and sends the encrypted authorization data to the data synchronization method described in this embodiment. After receiving the encrypted authentication data and the encrypted authorization data, the encrypted authorization data and the authentication data are decrypted respectively. If the authentication data is consistent with the authorization data, it is determined that both the target data source and the synchronization data source have passed the verification, and the verification results are sent to the synchronization data source and the target data source respectively, so as to obtain the data to be synchronized from the synchronization data source, and update the target data according to the data to be synchronized or the processed data to be synchronized.

[0077] Alternatively, the target data source sends the encrypted authentication data to the synchronization data source, and the synchronization data source decrypts the encrypted authentication data. The synchronization data source judges the authentication data based on the authorization data. If the authentication data conforms to the authorization data, it is determined that the target data source has passed the verification, and the verification result is sent to the data synchronization method and the target data source described in this embodiment, respectively, so that the data synchronization method described in this embodiment can obtain the data to be synchronized from the synchronization data source, and can update the target data according to the data to be synchronized or the processed data to be synchronized.

[0078] The data synchronization method provided in the embodiment of the present application can be applied to the terminal, can also be applied to the server, and can also be software running in the terminal or the server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the data synchronization method, etc., but is not limited to the above forms.

[0079] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0080] The order of execution of each step in the above embodiment does not mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.

[0081] Furthermore, if Figure 2 As shown, as a specific implementation of the above data synchronization method, an embodiment of the present application provides a data synchronization device 200, which includes: an interface module 201, a matching module 202, and an update module 203.

[0082] The interface module 201 is used to create a data synchronization interface for target data; wherein the data synchronization interface is configured with a plurality of preset processing rules;

[0083] The matching module 202 is used to match the data to be synchronized with the preset identifier;

[0084] The update module 203 is used to update the target data according to the data to be synchronized if the data to be synchronized does not contain a preset identifier; and if the data to be synchronized contains a preset identifier, call the target preset processing rule matching the preset identifier to process the data to be synchronized, and update the target data according to the processed data to be synchronized.

[0085] In one embodiment, the update module is specifically used to convert the data type of the data to be synchronized into the data type of the target data if the preset identifier is the first identifier, and update the target data according to the converted data to be synchronized; if the preset identifier is the second identifier, update the target data according to the preset data corresponding to the data to be synchronized; if the preset identifier is the third identifier, determine the result data according to the preset formula corresponding to the data to be synchronized and the preset formula identifier, and update the target data according to the result data.

[0086] In one embodiment, the data synchronization device further includes:

[0087] A determination module is used to obtain attribute information of a synchronization data source; wherein the attribute information includes at least the data volume of the synchronization data source, the data name of the synchronization data source and the data creation time of the synchronization data source; if the attribute information meets the first preset synchronization condition, the data belonging to the synchronization data source is determined as data to be synchronized; if the attribute information meets the second preset synchronization condition, the data belonging to the synchronization data source and whose creation time is between the current time and the time when the target data was last updated is determined as data to be synchronized.

[0088] In one embodiment, the data synchronization device further includes:

[0089] The acquisition module is used to acquire the update cycle of the target data before the step of matching the data to be synchronized with the preset identifier; if the current time matches the time corresponding to the update cycle, the data to be synchronized is acquired.

[0090] In one embodiment, the data synchronization device further includes:

[0091] The processing module is also configured with multiple preset exception handling rules in the data synchronization interface to capture the exception information of the data to be synchronized; if the exception information meets the preset exception type, the target preset exception handling rule matching the preset exception type is called to process the data to be synchronized with the exception.

[0092] In one embodiment, a processing module is specifically used to preset exception types including a first preset exception type and a second preset exception type, and calls a target preset exception processing rule that matches the preset exception type to process the data to be synchronized that has an exception, including: if the exception information matches the first preset exception type, refusing to match the data to be synchronized with the preset identifier; in response to a first retry instruction, re-matching the data to be synchronized with the preset identifier; if the exception information matches the second preset exception type, refusing to match the abnormal data in the data to be synchronized with the preset identifier, and matching the data other than the abnormal data in the data to be synchronized with the preset identifier; in response to the second retry instruction, matching the abnormal data with the preset identifier.

[0093] In one embodiment, the data synchronization device further includes:

[0094] The authentication module is used to configure the authorized connection relationship between the target data source and the synchronization data source; encrypt and verify the target data source and the synchronization data source based on the authorized connection relationship; if both the target data source and the synchronization data source pass the verification, obtain the data to be synchronized from the synchronization data source, and update the target data based on the data to be synchronized or the processed data to be synchronized.

[0095] For the specific definition of the data synchronization device, please refer to the definition of the data synchronization method above, which will not be repeated here. Each module in the above-mentioned data synchronization device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0096] Based on the above Figure 1 The method shown in the embodiment of the present application accordingly provides a readable storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned Figure 1 The data synchronization method shown.

[0097] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.

[0098] Based on the above Figure 1 The method shown, and Figure 2 In order to achieve the above-mentioned purpose, the embodiment of the present application further provides a computer device, which can be a personal computer, a server, a network device, etc. The computer device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figure 2 The data synchronization method shown.

[0099] Optionally, the computer device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a Bluetooth interface, a WI-FI interface), etc.

[0100] Those skilled in the art will appreciate that the computer device structure provided in this embodiment does not limit the computer device, and may include more or fewer components, or a combination of certain components, or different component arrangements.

[0101] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages and saves the hardware and software resources of the computer device, and supports the operation of information processing programs and other software and / or programs. The network communication module is used to realize communication between the components inside the storage medium, and communication with other hardware and software in the physical device.

[0102] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, or by hardware.

[0103] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.

[0104] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.

Claims

1. A data synchronization method, characterized in that: The method comprises: Creating a data synchronization interface for target data; wherein the data synchronization interface is configured with a plurality of preset processing rules; Matching the data to be synchronized with the preset identifier; If the data to be synchronized does not contain the preset identifier, updating the target data according to the data to be synchronized; If the data to be synchronized contains the preset identifier, a target preset processing rule matching the preset identifier is called to process the data to be synchronized, and the target data is updated according to the processed data to be synchronized.

2. The data synchronization method according to claim 1, characterized in that: The calling of a target preset processing rule matching the preset identifier to process the data to be synchronized, and updating the target data according to the processed data to be synchronized, comprises: If the preset identifier is the first identifier, converting the data type of the data to be synchronized into the data type of the target data, and updating the target data according to the converted data to be synchronized; If the preset identifier is the second identifier, updating the target data according to the preset data corresponding to the data to be synchronized; If the preset identifier is the third identifier, result data is determined according to the data to be synchronized and the preset formula corresponding to the preset formula identifier, and the target data is updated according to the result data.

3. The data synchronization method according to claim 1, characterized in that: The method further comprises: Acquire attribute information of the synchronization data source; wherein the attribute information at least includes the data volume of the synchronization data source, the data name of the synchronization data source and the data creation time of the synchronization data source; If the attribute information meets the first preset synchronization condition, the data belonging to the synchronization data source is determined as the data to be synchronized; If the attribute information meets the second preset synchronization condition, the data belonging to the synchronization data source and having a creation time between the current time and the time when the target data was last updated is determined as the data to be synchronized.

4. The data synchronization method according to claim 1, characterized in that: Before the step of matching the data to be synchronized with the preset identifier, the method further includes: Acquire an update cycle for updating the target data; If the current time matches the time corresponding to the update period, the data to be synchronized is obtained.

5. The data synchronization method according to claim 1, characterized in that: The data synchronization interface is also configured with a plurality of preset exception handling rules, and the method further includes: Capturing abnormal information of the data to be synchronized; If the exception information matches the preset exception type, a target preset exception processing rule matching the preset exception type is called to process the to-be-synchronized data with the exception.

6. The data synchronization method according to claim 5, characterized in that: The preset exception type includes a first preset exception type and a second preset exception type, and the calling of a target preset exception processing rule matching the preset exception type to process the to-be-synchronized data with an exception includes: If the exception information matches the first preset exception type, refusing to match the data to be synchronized with the preset identifier; and in response to the first retry instruction, re-matching the data to be synchronized with the preset identifier; If the exception information matches the second preset exception type, refuse to match the exception data in the data to be synchronized with the preset identifier, and match the data other than the exception data in the data to be synchronized with the preset identifier; in response to a second retry instruction, match the exception data with the preset identifier.

7. The data synchronization method according to claim 1, characterized in that: The method further comprises: Configuring an authorized connection relationship between the target data source and the synchronization data source; Performing encryption verification on the target data source and the synchronization data source according to the authorized connection relationship; If both the target data source and the synchronization data source pass the verification, the data to be synchronized is obtained from the synchronization data source, and the target data is updated according to the data to be synchronized or the processed data to be synchronized.

8. A data synchronization device, characterized in that: The device comprises: An interface module, used to create a data synchronization interface for target data; wherein the data synchronization interface is configured with a plurality of preset processing rules; A matching module, used to match the data to be synchronized with a preset identifier; an updating module, configured to update the target data according to the data to be synchronized if the data to be synchronized does not contain the preset identifier; and If the data to be synchronized contains the preset identifier, a target preset processing rule matching the preset identifier is called to process the data to be synchronized, and the target data is updated according to the processed data to be synchronized.

9. A readable storage medium having a program or instruction stored thereon, characterized in that: When the program or instruction is executed by a processor, the steps of the data synchronization method according to any one of claims 1 to 7 are implemented.

10. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the program, the data synchronization method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

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

    CN115203217A

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

    CN115309829A

  • Data processing method and device, electronic equipment and computer readable storage medium

    CN115878727A

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

    CN116401319A

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

    CN116737829A