Service data synchronization method, apparatus, device, and storage medium

By using a service data synchronization method, the target server and data are determined based on the service data modification instructions, and the synchronization database is updated when the modification is completed. This solves the problem of inconsistency between service data and server data in the database and achieves reliable real-time query and data synchronization.

CN115705345BActive Publication Date: 2026-01-16BEIJING QIHOOD TECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110945874.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-17
Publication Date
2026-01-16
Estimated Expiration
2041-08-17

AI Technical Summary

Technical Problem

Existing technologies cannot guarantee that the service data stored in the database is consistent with the service data on the server, and therefore cannot meet the needs of real-time queries.

Method used

The service data synchronization method determines the target server, the service data to be modified, and the target data based on the service data modification instructions. When the modification is completed, the synchronization database is updated synchronously to ensure that the data in the synchronization database is consistent with the data in the server.

Benefits of technology

It ensures that the data in the synchronized database is consistent with the data on the server, meets the needs of real-time querying, and improves user experience and the reliability of data synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115705345B_ABST
    Figure CN115705345B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of computers, and discloses a service data synchronization method, device, equipment and storage medium. According to the service data modification instruction, the target server, the service data to be modified and the target data are determined. The service data to be modified in the target server is modified into the target data. When the modification is completed, the synchronization database is synchronously updated according to the target data, the target server and the service data to be modified. When the service data to be modified in the target server is modified into the target data, the data in the synchronization database is synchronously updated according to the target data, the target server and the service data to be modified, so that the data in the synchronization database is modified at the same time when the service data in the server is modified, thereby ensuring that the data in the synchronization database is consistent with the service data in the server.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, and particularly relates to a service data synchronization method and device, equipment and storage medium. BACKGROUND

[0002] Nowadays, large Internet companies generally set up cloud platforms constructed by a large number of servers, and provide windows system for online office for employees through the cloud platform, and in order to ensure safety and secrecy, the service data on each server needs to be monitored, and a large amount of service data on each server needs to provide real-time query function, such as Exchange mailbox, DHCP, DNS resolution and other service data. However, the service data of the windows system can only be obtained by the Powershell tool, and the execution is slow, which cannot meet the real-time query requirement, and if the service data is stored in the database, it cannot guarantee that the service data stored in the database is consistent with the service data in the server, and it is also difficult to meet the real-time query requirement.

[0003] The above content is only used to assist in understanding the technical solutions of the present application, and does not represent the acknowledgement of the above content as prior art. SUMMARY

[0004] The main purpose of the present application is to provide a service data synchronization method, device, equipment and storage medium, which aims to solve the technical problem that the prior art cannot guarantee that the service data stored in the database is consistent with the service data in the server.

[0005] In order to achieve the above purpose, the present application provides a service data synchronization method, which comprises the following steps:

[0006] According to the service data modification instruction, the target server, the service data to be modified and the target data are determined;

[0007] The service data to be modified in the target server is modified to the target data;

[0008] When the modification is completed, the synchronization database is updated according to the target data, the target server and the service data to be modified.

[0009] Optionally, the step of updating the synchronization database according to the target data, the target server and the service data to be modified comprises:

[0010] According to the target server and the service data to be modified, the corresponding synchronization data in the synchronization database is searched;

[0011] The synchronization data in the synchronization database is modified to the target data.

[0012] Optionally, after the step of modifying the service data to be modified in the target server into the target data, the method further comprises:

[0013] When the modification fails, obtaining a historical failure number and adding one to the historical failure number to obtain a current failure number;

[0014] When the current failure number is greater than or equal to a preset failure number, obtaining failure cause information of the modification failure;

[0015] Generating failure warning information according to the failure cause information and displaying the failure warning information.

[0016] Optionally, after the step of obtaining a historical failure number and adding one to the historical failure number to obtain a current failure number when the modification fails, the method further comprises:

[0017] When the current failure number is less than a preset failure threshold, taking the current failure number as a new historical failure number and returning to the step of modifying the service data to be modified in the target server into the target data.

[0018] Optionally, after the step of synchronously updating the synchronization database according to the target data, the target server and the service data to be modified when the modification is completed, the method further comprises:

[0019] Obtaining a system time, and when the system time satisfies any task trigger condition in a preset task condition library, obtaining a target synchronization task corresponding to the satisfied task trigger condition;

[0020] Executing the target synchronization task to synchronously update the synchronization database.

[0021] Optionally, the step of executing the target synchronization task to synchronously update the synchronization database comprises:

[0022] Obtaining a synchronization task type corresponding to the target synchronization task;

[0023] If the synchronization task type is incremental synchronization, obtaining a synchronization time period corresponding to the target synchronization task;

[0024] Obtaining service data modification records in the synchronization time period;

[0025] Synchronously updating data in the synchronization database according to the service data modification records.

[0026] Optionally, after the step of obtaining a synchronization task type corresponding to the target synchronization task, the method further comprises:

[0027] if the synchronization task type is full update, obtaining service data in each server;

[0028] synchronously updating data in the synchronization database according to the service data.

[0029] Optionally, before the step of determining the target server, the service data to be modified and the target data according to the service data modification instruction, the method further comprises:

[0030] when the service data modification instruction is received, detecting whether there is an instruction in an instruction waiting queue corresponding to an instruction running thread pool;

[0031] if there is no instruction in the instruction waiting queue, detecting whether there is an idle thread in the instruction running thread pool;

[0032] if there is an idle thread, obtaining an instruction running thread from the instruction running thread pool;

[0033] correspondingly, the step of determining the target server, the service data to be modified and the target data according to the service data modification instruction comprises:

[0034] performing data analysis on the service data modification instruction through the instruction running thread to determine the target server, the service data to be modified and the target data.

[0035] Optionally, after the step of detecting whether there is an instruction in an instruction waiting queue corresponding to an instruction running thread pool when the service data modification instruction is received, the method further comprises:

[0036] if there is an instruction in the instruction waiting queue, adding the service data modification instruction to the instruction waiting queue.

[0037] Optionally, after the step of detecting whether there is an idle thread in the instruction running thread pool if there is no instruction in the instruction waiting queue, the method further comprises:

[0038] if there is no idle thread, adding the service data modification instruction to the instruction waiting queue.

[0039] Optionally, the step of synchronously updating the synchronization database according to the target data, the target server and the service data to be modified when the modification is completed comprises:

[0040] generating a service data modification record according to the target data, the target server and the service data to be modified when the modification is completed;

[0041] storing the service data modification record;

[0042] Synchronize the synchronization database according to the target data, the target server and the service data to be modified when the storage is completed.

[0043] Optionally, after the step of synchronizing the synchronization database according to the target data, the target server and the service data to be modified when the modification is completed, the method further comprises:

[0044] When the report generation instruction is detected, determine a data query condition and a report generation rule according to the report generation instruction;

[0045] Find corresponding report data in the synchronization database according to the data query condition;

[0046] Generate a data report according to the report generation rule and the report data, and display the data report.

[0047] In addition, to achieve the above object, the application further provides a service data synchronization device, which comprises the following modules:

[0048] An instruction analysis module is configured to determine a target server, service data to be modified and target data according to a service data modification instruction;

[0049] A data modification module is configured to modify the service data to be modified in the target server into the target data;

[0050] A data synchronization module is configured to synchronize the synchronization database according to the target data, the target server and the service data to be modified when the modification is completed.

[0051] Optionally, the data synchronization module is further configured to find corresponding data to be synchronized in the synchronization database according to the target server and the service data to be modified; and modify the data to be synchronized in the synchronization database into the target data.

[0052] Optionally, the data modification module is further configured to obtain a historical failure number when the modification fails, and add one to the historical failure number to obtain a current failure number; obtain failure cause information of the modification failure when the current failure number is greater than or equal to a preset failure number; generate failure warning information according to the failure cause information, and display the failure warning information.

[0053] Optionally, the data modification module is further configured to take the current failure number as a new historical failure number when the current failure number is less than a preset failure threshold, and return to the step of modifying the service data to be modified in the target server into the target data.

[0054] Optionally, the data synchronization module is further configured to acquire a system time, and when the system time meets any task triggering condition in a preset task condition library, acquire a target synchronization task corresponding to the met task triggering condition; and execute the target synchronization task to perform a synchronization update on the synchronization database.

[0055] Optionally, the data synchronization module is further configured to acquire a synchronization task type corresponding to the target synchronization task; if the synchronization task type is incremental synchronization, acquire a synchronization time period corresponding to the target synchronization task; acquire service data modification records in the synchronization time period; and perform a synchronization update on data in the synchronization database according to the service data modification records.

[0056] In addition, to achieve the above object, the application further provides a service data synchronization device, which comprises a processor, a memory, and a service data synchronization program stored in the memory and executable on the processor, and the service data synchronization program implements the steps of the service data synchronization method when executed by the processor.

[0057] In addition, to achieve the above object, the application further provides a computer readable storage medium, which stores a service data synchronization program, and the service data synchronization program implements the steps of the service data synchronization method when executed.

[0058] The application determines a target server, to-be-modified service data and target data according to a service data modification instruction, modifies the to-be-modified service data in the target server into the target data, and performs a synchronization update on a synchronization database according to the target data, the target server and the to-be-modified service data when the modification is completed. Since the data in the synchronization database is also modified when the to-be-modified service data in the target server is modified into the target data, the data in the synchronization database is also modified when the service data in the server is modified, so that the data in the synchronization database is consistent with the service data in the server. BRIEF DESCRIPTION OF DRAWINGS

[0059] Figure 1 is a structural schematic diagram of an electronic device of a hardware running environment related to an embodiment scheme of the application;

[0060] Figure 2 is a flowchart of a first embodiment of the service data synchronization method of the application;

[0061] Figure 3 is a flowchart of a second embodiment of the service data synchronization method of the application;

[0062] Figure 4 Flowchart of a third embodiment of the data synchronization method according to the present application;

[0063] Figure 5 Structure block diagram of a first embodiment of the data synchronization device according to the present application.

[0064] The implementation, functional features and advantages of the present application will be further explained with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION

[0065] It should be understood that the specific embodiments described herein merely serve to explain the present application and do not limit the present application.

[0066] Reference Figure 1 , Figure 1 Structure diagram of the service data synchronization device related to the hardware running environment of the embodiment of the present application.

[0067] As Figure 1 shown, the electronic device can include a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 can include a display, an input unit such as a keyboard, and can also include a standard wired interface, a wireless interface. The network interface 1004 can optionally include a standard wired interface, a wireless interface (such as a wireless fidelity (WI-FI) interface). The memory 1005 can be a high-speed random access memory (RAM), and can also be a stable non-volatile memory (NVM), such as a disk memory. The memory 1005 can also be a storage device independent of the aforementioned processor 1001.

[0068] Those skilled in the art can understand that Figure 1 the structure shown in the foregoing embodiments does not constitute a limitation on the electronic device, and can include more or fewer components than those shown, or combine certain components, or different component arrangements.

[0069] As Figure 1 shown, the memory 1005 as a storage medium can include an operating system, a network communication module, a user interface module, and a service data synchronization program.

[0070] In Figure 1The electronic device shown in the figure, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the electronic device of the application can be arranged in the service data synchronization device, the electronic device calls the service data synchronization program stored in the memory 1005 through the processor 1001, and executes the service data synchronization method provided by the embodiment of the application.

[0071] The embodiment of the application provides a service data synchronization method, referring to Figure 2 , Figure 2 The flowchart of the first embodiment of the service data synchronization method of the application.

[0072] In the embodiment, the service data synchronization method comprises the following steps:

[0073] Step S10: determining the target server, the service data to be modified and the target data according to the service data modification instruction.

[0074] It should be noted that the execution subject of the embodiment can be the service data synchronization device, and the service data synchronization device can be a personal computer, a server or other electronic devices, and can also be other devices that can realize the same or similar functions. The embodiment does not limit this, and in the embodiment and the following embodiments, the service data synchronization device is taken as an example to illustrate the service data synchronization method of the application.

[0075] It should be noted that the service data modification instruction can be an instruction sent by a user operating a user terminal to the service data synchronization device, or an instruction sent by other servers or terminal devices to the service data synchronization device. The service data modification instruction can contain parameters such as server identification, data to be modified identification and target data. According to the service data modification instruction, the target server, the service data to be modified and the target data can be determined by parsing the service data modification instruction to obtain the server identification, the data to be modified identification and the target data, and then searching for the target server according to the server identification, and searching for the service data to be modified corresponding to the data to be modified identification in the target server.

[0076] Step S20: modifying the service data to be modified in the target server into the target data.

[0077] It can be understood that after the target server and the service data to be modified are determined, the service data to be modified in the target server can be modified into the target data, so as to complete the modification of the service data in the server according to the service data modification instruction.

[0078] It should be noted that, in order to ensure the smoothness of the operation of the user terminal of the user, the modification of the service data in the server according to the service data modification instruction can be modified in an asynchronous manner, that is, when the service data modification instruction is received, the corresponding message is returned, and then the instruction analysis and data modification are performed in the background, preventing the user terminal from waiting for the result to be returned, thereby causing the operation of the user terminal to be blocked.

[0079] In actual use, the modified service data in the target server can be modified to target data by using a Powershell tool.

[0080] Step S30: When the modification is completed, the synchronization database is updated according to the target data, the target server, and the service data to be modified.

[0081] It should be noted that most of the service data in the server has a tree structure, which is difficult to perform data statistics, and in order to facilitate subsequent query and statistics, the synchronization database can be a relational database, such as a mysql database or an oracle database. The service data synchronization device manager can pre-read the service data in each server, convert the read service data into relational database data, and store it in the synchronization server, and the synchronization server provides real-time query function.

[0082] In actual use, for servers with a windows system, the service data synchronization device manager can read the service data in the server through a Powershell tool.

[0083] It can be understood that, in order to ensure that the data in the synchronization database is consistent with the service data in the server, when the modification of the service data in the server according to the service data modification instruction is completed, the corresponding data in the synchronization database needs to be modified, that is, updated synchronously.

[0084] Further, there are multiple servers in an enterprise, and the service data storage field names of servers with the same system can be the same. When the service data in each server is stored in the synchronization database, the server identifier of each server and the data identifier of the service data can be used as the basis for repeated determination, for example, a joint index is generated according to the server identifier and the data identifier of the service data. Since the repeated determination of the service data when stored is special, in order to ensure that the data in the synchronization database can be correctly updated, the step of updating the synchronization database according to the target data, the target server, and the service data to be modified in the embodiment can include:

[0085] According to the target server and the to-be-modified service data, corresponding to-be-synchronized data in the synchronization database is found; and the to-be-synchronized data in the synchronization database is modified as the target data.

[0086] It should be noted that the to-be-synchronized data can be data corresponding to the to-be-modified service data in the target server in the synchronization database. According to the target server and the to-be-modified service data, corresponding to-be-synchronized data in the synchronization database is found, which can be obtaining a server identifier of the target server and a data identifier of the to-be-modified service data, and according to the server identifier and the data identifier, corresponding to-be-synchronized data in the synchronization database is found.

[0087] It can be understood that modifying the to-be-synchronized data in the synchronization database as the target data can realize the synchronization update of the data in the synchronization database.

[0088] Further, when the service data in the server is modified, the service data can be occupied, and at this time, the modification of the service data can fail. If no subsequent processing is directly performed, the user experience can be poor. Therefore, after step S20, the embodiment can further include:

[0089] When the modification fails, a historical failure number is obtained, and the historical failure number is incremented by one to obtain a current failure number. When the current failure number is greater than or equal to a preset failure number, a failure reason information of the modification failure is obtained. According to the failure reason information, a failure warning information is generated, and the failure warning information is displayed.

[0090] It should be noted that the historical failure number is a failure number of the modification of the service data in the server according to the service modification instruction before this time. If the current modification is the first modification, the value of the historical failure number is 0. The preset failure number can be set by the management personnel of the service data synchronization device according to actual needs. The failure reason information can include data occupation, server non-response, etc. The failure warning information can be directly displayed on the display device of the service data modification device, or the failure warning information can be sent to the user terminal of the user for display. The embodiment does not limit this.

[0091] In actual use, when the current failure number is less than the preset failure number, the current failure number can be taken as a new historical failure number, and step S20 is returned to re-try to modify the service data in the server according to the parameters in the service data modification instruction.

[0092] It can be understood that a single modification failure of service data can be only because the service data is temporarily occupied and cannot be modified, or because the network of the device exists fluctuations and packet loss, etc. Therefore, the number of failures can be recorded, and multiple attempts can be made to modify the service data. If multiple modifications fail, it means that the service data can be long-term occupied or the network of the target server exists abnormalities and cannot be normally connected, and needs to be processed. Therefore, failure reason information when modification fails can be obtained, failure warning information is generated according to the failure reason information and is displayed, so as to facilitate user or management personnel to troubleshoot and process in time, and the use experience of the user can be improved.

[0093] Further, in order to meet the statistical report needs of the user, after step S50, the embodiment can further include:

[0094] When the report generation instruction is detected, a data query condition and a report generation rule are determined according to the report generation instruction; corresponding report data is found in the synchronization database according to the data query condition; and a data report is generated according to the report generation rule and the report data, and the data report is displayed.

[0095] It should be noted that the report generation instruction can be an instruction sent by the user to the service data synchronization device through the user terminal when the user needs to generate a report, or can be an instruction automatically generated by the service data synchronization device when it is detected that the preset report generation condition is met at the current time. The preset report generation condition can be set in advance by the management personnel of the service data synchronization device, for example, a report generation instruction is generated at 8:00 am every Monday.

[0096] Determining the data query condition and the report generation rule according to the report generation instruction can be extracting parameters in the report generation instruction to obtain the data query condition and the report generation rule. Finding corresponding report data in the synchronization database according to the data query condition can be finding data satisfying the data query condition in the synchronization database, and taking the found data as report data.

[0097] Generating a data report according to the report generation rule and the report data can be performing aggregation processing on the report data according to the report generation rule, and generating a data report according to the aggregation processing result. The aggregation processing can be at least one of statistical total, average value, sum, maximum value or minimum value, etc.

[0098] The embodiment determines the target server, the service data to be modified and the target data according to the service data modification instruction, modifies the service data to be modified in the target server into the target data, and synchronously updates the synchronization database according to the target data, the target server and the service data to be modified when the modification is completed. Since the data in the synchronization database is synchronously updated according to the target data, the target server and the service data to be modified when the modification of the service data to be modified in the target server into the target data is completed, the data in the synchronization database is modified at the same time when the service data in the server is modified, thereby ensuring that the data in the synchronization database is consistent with the service data in the server.

[0099] Reference Figure 3 , Figure 3 The flowchart of a second embodiment of the service data synchronization method is shown.

[0100] Based on the first embodiment, the step S30 can include the following steps.

[0101] Step S301: generating a service data modification record according to the target data, the target server and the service data to be modified when the modification is completed.

[0102] It should be noted that when the service data modification record is generated according to the target data, the target server and the service data to be modified, the current time can also be obtained, the current time is taken as the data modification time, and then the service data modification record is generated according to the data modification time, the target data, the target server and the service data to be modified.

[0103] Step S302: storing the service data modification record.

[0104] It should be noted that the service data modification record can be stored in the storage space of the service data modification device, or can be sent to the storage server for storage, and the embodiment does not limit this.

[0105] Step S303: synchronously updating the synchronization database according to the target data, the target server and the service data to be modified when the storage is completed.

[0106] It can be understood that when the service data modification record is stored, the synchronization database can be synchronously updated according to the target data, the target server and the service data to be modified.

[0107] In the embodiment, the service data modification record is generated and stored when the service data to be modified in the target server is modified into the target data, and then the synchronization database is updated. Even if the synchronization update fails, the synchronization database can be updated again according to the service data modification record, thereby improving the reliability of the service data synchronization method.

[0108] In the embodiment, after the step S30 of the service data synchronization method, the method further comprises:

[0109] Step S40: obtaining a system time, and obtaining a target synchronization task corresponding to a task trigger condition satisfied when the system time satisfies any task trigger condition in a preset task condition library.

[0110] It should be noted that the service data in the server can be modified in multiple ways, and some of the modification methods can not pass through the service data synchronization device. That is, the service data in the server is modified by the modification method, and the service data synchronization device cannot perceive it. In order to ensure that the service data modified by this method can still update the data in the synchronization database, the synchronization task can be set to scan such data periodically or periodically.

[0111] It should be noted that the system time can be the running time of the system in the service data synchronization device. The preset task condition library can be set by the administrator of the service data synchronization device, and a plurality of task trigger conditions can be stored therein. Each task trigger condition corresponds to a different synchronization task. When the task trigger condition is satisfied, the synchronization task corresponding to the satisfied task trigger condition can be used as the target synchronization task. For example, the preset task condition library stores three task trigger conditions A, B and C. The task trigger condition A is triggered every five minutes, the task trigger condition B is triggered every 10 hours, and the task trigger condition C is triggered at 2 a.m. every day. The synchronization tasks corresponding to the task trigger conditions are M A , M B , and M C , respectively.

[0112] Step S50: executing the target synchronization task to update the synchronization database.

[0113] It can be understood that the target synchronization task can be provided with a corresponding data synchronization process. The target synchronization task is executed to update the synchronization database, which can be to obtain the data synchronization process corresponding to the target synchronization task, and execute the data synchronization process to update the data in the synchronization database.

[0114] It should be noted that the synchronization task type of the synchronization task can be divided into incremental synchronization and full synchronization, and the corresponding data synchronization process is different when the synchronization task type is different. Therefore, the synchronization task type of the target synchronization task can be obtained first, and the corresponding data synchronization process is selected for data synchronization according to the synchronization task type.

[0115] In a specific implementation, the step of executing the target synchronization task to perform synchronization update on the synchronization database can include:

[0116] obtaining the synchronization task type of the target synchronization task; if the synchronization task type is incremental synchronization, obtaining the synchronization time period corresponding to the target synchronization task; obtaining the service data modification record in the synchronization time period; performing synchronization update on the data in the synchronization database according to the service data modification record; if the synchronization task type is full update, obtaining the service data in each server; performing synchronization update on the data in the synchronization database according to the service data.

[0117] It should be noted that obtaining the synchronization time period corresponding to the target synchronization task can be obtaining the last triggering time of the target synchronization task as the starting time, obtaining the triggering time of the target synchronization task this time as the ending time, and determining the time period as the synchronization time period according to the starting time and the ending time. Obtaining the service data modification record in the synchronization time period can be obtaining the service data modification record corresponding to the data modification time in the synchronization time period. According to the service data modification record, the data in the synchronization database is synchronized and updated, which can be determining all modified service data in the synchronization time period according to the service data modification record, comparing it with the corresponding data in the synchronization database, and determining the data to be modified in the synchronization database according to the comparison result, and then modifying the data.

[0118] It should be noted that obtaining the service data in each server and performing synchronization update on the data in the synchronization database according to the service data can be comparing the service data in each server with the data in the synchronization database, determining the data to be modified in the synchronization database, and then modifying the data.

[0119] It can be understood that the synchronization task type is full synchronization, and the synchronization task needs more data to be compared, is slow in execution, occupies more resources, and consumes more performance. Therefore, when setting the task trigger condition for the synchronization task with the synchronization task type of full synchronization, the trigger period can be set to be longer (such as triggering at an interval of 10 hours), or the trigger time can be set to a time when fewer users use (such as setting the trigger time to 2 o'clock in the morning every day). The synchronization task type is incremental synchronization, and the synchronization task needs less data to be compared, is faster in execution, occupies fewer resources, and consumes less performance. When setting the task trigger condition for the synchronization task with the synchronization task type of incremental synchronization, the trigger period can be set to be shorter (such as triggering at an interval of 5 minutes).

[0120] In the embodiment, considering that there are various modification modes of service data, some modification of service data can not be perceived by the service data synchronization device, and thus a plurality of synchronization tasks are set, and the synchronization tasks are allocated with task trigger conditions. When the task trigger condition is met, the corresponding synchronization task can be automatically executed to scan the service data, and the data in the synchronization database is synchronized and updated, so that even if the service data is modified in a mode that cannot be perceived by the service data synchronization device, the data in the database can still be synchronized and updated, and the reliability of the service data synchronization method is further improved.

[0121] Reference Figure 4 , Figure 4 The flowchart of the third embodiment of the service data synchronization method is shown.

[0122] Based on the first embodiment, the service data synchronization method further includes the following steps before the step S10.

[0123] Step S01: When a service data modification instruction is received, it is detected whether there is an instruction in the instruction waiting queue corresponding to the instruction running thread pool.

[0124] It should be noted that the service data modification instruction can be an instruction sent by a user operating a user terminal to the service data synchronization device, or an instruction sent by other servers or terminal devices to the service data synchronization device. The instruction running thread pool can be a thread pool for providing instruction running threads. The instruction running thread pool can be set by the administrator of the service data synchronization device in advance according to the device performance of the service data synchronization device. The instruction running thread can be a thread for processing the received service data modification instruction. The instruction waiting queue can be a queue for buffering the received service data modification instruction when there is no idle thread in the instruction running thread pool. When there is an idle thread in the instruction running thread pool, the instruction in the instruction waiting queue is preferentially extracted for processing.

[0125] Further, in order to avoid losing instructions when busy, the embodiment after step S01 can further include:

[0126] If there is an instruction in the instruction waiting queue, the service data modification instruction is added to the instruction waiting queue.

[0127] It should be noted that when there is an idle thread in the instruction running thread pool, the instruction in the instruction waiting queue is preferentially extracted for processing. If there is an instruction in the instruction waiting queue, it indicates that the current service data synchronization device is busy and has no resource allocation thread to process the currently received service data modification instruction. Therefore, the received service data modification instruction can be added to the instruction waiting queue to wait for the service data synchronization device to allocate resources for processing.

[0128] In actual use, in order to ensure the processing order of the instructions, the service data modification instruction can be added to the head of the instruction waiting queue.

[0129] Step S02: If there is no instruction in the instruction waiting queue, it is detected whether there is an idle thread in the instruction running thread pool.

[0130] It can be understood that if there is no instruction in the instruction waiting queue, it indicates that the current service data synchronization device is not busy to the extent that the received service data modification instruction needs to be buffered. At this time, the instruction running thread can be allocated to the currently received service data modification instruction. Therefore, it can be detected whether there is an idle thread in the instruction running thread pool.

[0131] In actual use, detecting whether there is an idle thread in the instruction running thread pool can be obtaining the number of idle threads of the instruction running thread pool. When the number of idle threads is greater than 0, it is determined that there is an idle thread.

[0132] Further, in order to avoid losing instructions when busy, the embodiment after step S02 can further include:

[0133] If there is no idle thread, the service data modification instruction is added to the instruction waiting queue.

[0134] It can be understood that if there is no idle thread in the instruction modification thread pool, it indicates that the service data synchronization device is relatively busy and can have no resources to allocate to the currently received service data modification instruction. Therefore, the service data modification instruction can be added to the instruction waiting queue to wait for the service data synchronization device to allocate resources for processing.

[0135] Step S03: If there is an idle thread, an instruction running thread is obtained from the instruction running thread pool.

[0136] It can be understood that if there is an idle thread in the instruction thread pool, the instruction running thread can be directly obtained from the instruction running thread pool.

[0137] In the embodiment, the step S10 comprises:

[0138] Step S10': data parsing of the service data modification instruction by the instruction running thread to determine the target server, the service data to be modified and the target data.

[0139] It should be noted that the data parsing of the service data modification instruction by the instruction running thread to determine the target server, the service data to be modified and the target data can be loading the service data modification instruction into the instruction running thread, and then performing data parsing on the service data modification instruction in the instruction running thread to determine the target server, the service data to be modified and the target data.

[0140] Before processing the service data modification instruction, the embodiment further detects whether there is an instruction in the instruction waiting queue corresponding to the instruction running thread pool, and further detects whether there is an idle thread in the instruction running thread when there is no instruction in the instruction waiting queue, and obtains the instruction running thread from the instruction running thread pool to process the service data modification instruction when there is an idle thread. Since the thread pool is set according to the device performance of the service data synchronization device, it can prevent the service data synchronization device from simultaneously processing a number of service data modification instructions exceeding its device performance, thereby avoiding the service data synchronization device from being stuck or down. When there is an instruction in the instruction waiting queue corresponding to the instruction running thread pool or there is no idle thread in the instruction running thread pool, the service data modification instruction is added to the instruction waiting queue corresponding to the instruction running thread pool, which can avoid the phenomenon of instruction loss when the service data synchronization device is busy.

[0141] In addition, the embodiment of the present application further provides a storage medium, wherein the storage medium stores a service data synchronization program, and the service data synchronization program is executed by a processor to implement the steps of the service data synchronization method as described above.

[0142] Reference Figure 5 , Figure 5 The structure block diagram of the first embodiment of the service data synchronization device of the present application is shown in the figure.

[0143] As Figure 5 shown, the service data synchronization device provided by the embodiment of the present application comprises:

[0144] The instruction parsing module 10 is configured to determine the target server, the service data to be modified and the target data according to the service data modification instruction.

[0145] The data modification module 20 is configured to modify the service data to be modified in the target server into the target data.

[0146] The data synchronization module 30 is configured to, when the modification is completed, update the synchronization database according to the target data, the target server and the service data to be modified.

[0147] The embodiment determines the target server, the service data to be modified and the target data according to the service data modification instruction, modifies the service data to be modified in the target server into the target data, and updates the synchronization database according to the target data, the target server and the service data to be modified when the modification is completed. Since the data in the synchronization database is updated according to the target data, the target server and the service data to be modified when the modification of the service data to be modified in the target server into the target data is completed, the data in the synchronization database is modified at the same time when the service data in the server is modified, so that the data in the synchronization database is consistent with the service data in the server.

[0148] Further, the data synchronization module 30 is further configured to find corresponding data to be synchronized in the synchronization database according to the target server and the service data to be modified, and modify the data to be synchronized in the synchronization database into the target data.

[0149] Further, the data modification module 20 is further configured to, when the modification fails, obtain a historical failure number, add one to the historical failure number to obtain a current failure number, obtain failure reason information when the current failure number is greater than or equal to a preset failure number, generate failure warning information according to the failure reason information, and display the failure warning information.

[0150] Further, the data modification module 20 is further configured to, when the current failure number is less than a preset failure threshold, take the current failure number as a new historical failure number, and return to the step of modifying the service data to be modified in the target server into the target data.

[0151] Further, the data synchronization module 30 is further configured to obtain a system time, obtain a target synchronization task corresponding to a task trigger condition that is satisfied when the system time satisfies any task trigger condition in a preset task condition library, and execute the target synchronization task to update the synchronization database.

[0152] Further, the data synchronization module 30 is further configured to acquire a synchronization task type corresponding to the target synchronization task; acquire a synchronization time period corresponding to the target synchronization task if the synchronization task type is incremental synchronization; acquire service data modification records in the synchronization time period; and perform synchronization update on data in the synchronization database according to the service data modification records.

[0153] Further, the data synchronization module 30 is further configured to acquire service data in each server if the synchronization task type is full update; and perform synchronization update on data in the synchronization database according to the service data.

[0154] Further, the instruction parsing module 10 is further configured to, when receiving a service data modification instruction, detect whether there is an instruction in an instruction waiting queue corresponding to an instruction running thread pool; if there is no instruction in the instruction waiting queue, detect whether there is an idle thread in the instruction running thread pool; if there is an idle thread, acquire an instruction running thread from the instruction running thread pool.

[0155] The instruction parsing module 10 is further configured to perform data analysis on the service data modification instruction through the instruction running thread, and determine a target server, service data to be modified, and target data.

[0156] Further, the instruction parsing module 10 is further configured to, if there is an instruction in the instruction waiting queue, add the service data modification instruction to the instruction waiting queue.

[0157] Further, the instruction parsing module 10 is further configured to, if there is no idle thread, add the service data modification instruction to the instruction waiting queue.

[0158] Further, the data synchronization module 30 is further configured to, when the modification is completed, generate a service data modification record according to the target data, the target server, and the service data to be modified; store the service data modification record; and perform synchronization update on a synchronization database according to the target data, the target server, and the service data to be modified when the storage is completed.

[0159] Further, the data synchronization module 30 is further configured to, when detecting a report generation instruction, determine a data query condition and a report generation rule according to the report generation instruction; find corresponding report data in the synchronization database according to the data query condition; generate a data report according to the report generation rule and the report data, and display the data report.

[0160] It should be understood that the above is only an example, and does not constitute any limitation on the technical solutions of the present application. In specific applications, those skilled in the art can set up according to the needs, and the present application does not limit this.

[0161] It should be noted that the above-described workflow is only illustrative and does not limit the scope of protection of the present application. In actual application, those skilled in the art can select part or all of them according to actual needs to achieve the purpose of the embodiment, which is not limited here.

[0162] In addition, technical details not described in detail in this embodiment can be referred to the service data synchronization method provided by any embodiment of the present application, which will not be repeated here.

[0163] In addition, it should be noted that in this paper, the terms "include", "contain" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or system including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or includes elements inherent to such process, method, article or system. Without more limitations, the element defined by the statement "includes a" does not exclude the presence of another identical element in the process, method, article or system including the element.

[0164] The above embodiment numbers of the present application are only for description, not representing the advantages and disadvantages of the embodiments.

[0165] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment method can be realized by means of software and necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of software product, which is stored in a storage medium (such as read only memory (Read Only Memory, ROM) / RAM, magnetic disk, optical disc), including a plurality of instructions for making a terminal device (which can be a mobile phone, computer, server, or network device, etc.) execute the method described in each embodiment of the present application.

[0166] The above is only the preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made by using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A method of synchronizing service data, characterized by, The service data synchronization method comprises the following steps: According to the service data modification instruction, the target server, the service data to be modified, and the target data are determined. The service data to be modified in the target server is modified to the target data. When the modification is completed, the synchronization database is synchronously updated according to the target data, the target server, and the service data to be modified, wherein the synchronization database stores relational database data converted from service data in each server, and the server identifier of the server and the data identifier of the service data are used as the basis for repeated determination. The synchronization database is synchronously updated according to the target data, the target server, and the service data to be modified, comprising: According to the server identifier of the target server and the data identifier of the service data to be modified, the corresponding data to be synchronized in the synchronization database is searched. The data to be synchronized in the synchronization database is modified to the target data.

2. The service data synchronization method of claim 1, wherein, After the step of modifying the service data to be modified in the target server to the target data, the following steps are further included: When the modification fails, the historical failure number is obtained, and the historical failure number is incremented by one to obtain the current failure number. When the current failure number is greater than or equal to the preset failure number, the failure reason information of the modification failure is obtained. Failure warning information is generated according to the failure reason information, and the failure warning information is displayed.

3. The service data synchronization method of claim 2, wherein, After the step of obtaining the historical failure number and incrementing the historical failure number by one to obtain the current failure number when the modification fails, the following steps are further included: When the current failure number is less than the preset failure threshold, the current failure number is used as the new historical failure number, and the step of modifying the service data to be modified in the target server to the target data is returned.

4. The service data synchronization method of claim 1, wherein, After the step of synchronously updating the synchronization database according to the target data, the target server, and the service data to be modified when the modification is completed, the following steps are further included: The system time is obtained, and when the system time meets any task trigger condition in the preset task condition library, the target synchronization task corresponding to the met task trigger condition is obtained. The target synchronization task is executed to synchronously update the synchronization database.

5. The service data synchronization method of claim 4, wherein, The step of executing the target synchronization task to synchronously update the synchronization database comprises: The synchronization task type corresponding to the target synchronization task is obtained. If the synchronization task type is incremental synchronization, the synchronization period corresponding to the target synchronization task is obtained. The service data modification record in the synchronization period is obtained. The data in the synchronization database is synchronously updated according to the service data modification record.

6. The service data synchronization method of claim 5, wherein, After the step of obtaining the synchronization task type corresponding to the target synchronization task, the following steps are further included: If the synchronization task type is full update, the service data in each server is obtained. The data in the synchronization database is synchronously updated according to the service data.

7. The service data synchronization method of claim 1, wherein, Before the step of determining the target server, the service data to be modified, and the target data according to the service data modification instruction, the following steps are further included: When the service data modification instruction is received, it is detected whether there is an instruction in an instruction waiting queue corresponding to an instruction running thread pool; If there is no instruction in the instruction waiting queue, it is detected whether there is an idle thread in the instruction running thread pool; If there is an idle thread, an instruction running thread is acquired from the instruction running thread pool; Correspondingly, the step of determining the target server, the service data to be modified, and the target data according to the service data modification instruction comprises: The service data modification instruction is subjected to data analysis by the instruction running thread, and the target server, the service data to be modified, and the target data are determined.

8. The service data synchronization method of claim 7, wherein, After the step of detecting whether there is an instruction in the instruction waiting queue corresponding to the instruction running thread pool when the service data modification instruction is received, the method further comprises: If there is an instruction in the instruction waiting queue, the service data modification instruction is added to the instruction waiting queue.

9. The service data synchronization method of claim 7, wherein, After the step of detecting whether there is an idle thread in the instruction running thread pool if there is no instruction in the instruction waiting queue, the method further comprises: If there is no idle thread, the service data modification instruction is added to the instruction waiting queue.

10. The service data synchronization method of any one of claims 1-9, wherein, The step of synchronously updating the synchronization database according to the target data, the target server, and the service data to be modified when the modification is completed comprises: When the modification is completed, a service data modification record is generated according to the target data, the target server, and the service data to be modified; The service data modification record is stored; When the storage is completed, the synchronization database is synchronously updated according to the target data, the target server, and the service data to be modified.

11. The service data synchronization method of any one of claims 1-9, wherein, After the step of synchronously updating the synchronization database according to the target data, the target server, and the service data to be modified when the modification is completed, the method further comprises: When a report generation instruction is detected, a data query condition and a report generation rule are determined according to the report generation instruction; Corresponding report data is searched in the synchronization database according to the data query condition; A data report is generated according to the report generation rule and the report data, and the data report is displayed.

12. A service data synchronization apparatus, characterized by comprising: The service data synchronization device comprises the following modules: An instruction analysis module is configured to determine the target server, the service data to be modified, and the target data according to the service data modification instruction; A data modification module is configured to modify the service data to be modified in the target server into the target data; A data synchronization module is configured to synchronously update the synchronization database according to the target data, the target server, and the service data to be modified when the modification is completed, wherein the synchronization database stores relational database data converted from service data in each server, and the relational database data takes the server identifier of the server and the data identifier of the service data as the basis for repeatability determination. The data synchronization module is further configured to find corresponding to-be-synchronized data in a synchronization database according to the server identifier of the target server and the data identifier of the to-be-modified service data, and modify the to-be-synchronized data in the synchronization database into the target data.

13. The service data synchronization device of claim 12, wherein, The data modification module is further configured to, when the modification fails, acquire a historical failure number and add one to the historical failure number to obtain a current failure number, acquire failure cause information of the modification failure when the current failure number is greater than or equal to a preset failure number, generate failure warning information according to the failure cause information, and display the failure warning information.

14. The service data synchronizing apparatus of claim 13, wherein The data modification module is further configured to, when the current failure number is less than a preset failure threshold, take the current failure number as a new historical failure number, and return to the step of modifying the to-be-modified service data in the target server into the target data.

15. The service data synchronizing apparatus of claim 12, wherein The data synchronization module is further configured to acquire a system time, acquire a target synchronization task corresponding to a task trigger condition that is satisfied when the system time satisfies any task trigger condition in a preset task condition library, and perform the target synchronization task to synchronously update the synchronization database.

16. The service data synchronization device of claim 15, wherein, The data synchronization module is further configured to acquire a synchronization task type corresponding to the target synchronization task, acquire a synchronization time period corresponding to the target synchronization task if the synchronization task type is incremental synchronization, acquire service data modification records in the synchronization time period, and synchronously update data in the synchronization database according to the service data modification records. The service data synchronization device includes a processor, a memory, and a service data synchronization program stored in the memory and executable on the processor, and the service data synchronization program, when executed by the processor, implements the steps of the service data synchronization method in any one of claims 1-11.

17. A service data synchronization device, characterized by The computer-readable storage medium stores a service data synchronization program, and the service data synchronization program, when executed, implements the steps of the service data synchronization method in any one of claims 1-11.

18. A computer-readable storage medium, characterized in that, ​

Citation Information

Patent Citations

  • Data updating method and system

    CN104462106A

  • Information processing method and device, server and computer readable medium

    CN110209642A

  • Data processing method, device and equipment and storage medium

    CN111309740A