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

By adding a data synchronization call program to the business code and recording the service call path, a tracking information package is generated, which solves the problem that the data synchronization process cannot be traced in the existing technology, and realizes path tracing and non-intrusive synchronization.

CN117312456BActive Publication Date: 2026-05-08SUZHOU WANDIANZHANG NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SUZHOU WANDIANZHANG NETWORK TECH CO LTD
Filing Date
2023-10-27
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

In existing technologies, data synchronization using the Dubbo interface cannot trace the data synchronization process after the call.

Method used

By intercepting the abstract syntax tree of the business code with probes, adding a data synchronization call program using bytecode rewriting technology, generating a sending packet and recording the service call path, and combining the tracking information of the target terminal to generate a tracking information packet, the path tracking of the data synchronization process is realized.

Benefits of technology

It enables path tracing of the data synchronization process, allowing users to view the service paths that failed to synchronize after a synchronization failure, and achieves non-intrusive plug-and-play functionality through probe and bytecode rewriting technologies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117312456B_ABST
    Figure CN117312456B_ABST
Patent Text Reader

Abstract

The application discloses a data synchronization method and device, equipment and a storage medium, and relates to the technical field of data synchronization. The method comprises the following steps: obtaining a data synchronization request of a target service, generating a sending package based on the data synchronization request; generating first tracking information according to a service calling path of the sending package in the local, adding the first tracking information into the sending package to obtain a target sending package, and sending the target sending package to a data synchronization system of a target terminal; obtaining a response package fed back by the target terminal based on the target sending package, and extracting second tracking information from the response package; the second tracking information is tracking information generated by the target terminal according to a service calling path of the target sending package in the target terminal. Path tracking in the data synchronization process can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data synchronization technology, and in particular to a data synchronization method, apparatus, device, and storage medium. Background Technology

[0002] Currently, data synchronization typically involves direct synchronization between databases. However, in many cases, there is a need for data synchronization between services in different scenarios or regions. Existing technologies utilize the Dubbo interface to call interfaces in other regions for synchronization, but this cannot trace the data synchronization process after the call. Therefore, how to achieve path tracing in data synchronization is a pressing technical problem that needs to be solved. Summary of the Invention

[0003] In view of this, the purpose of this invention is to provide a data synchronization method, apparatus, device, and medium capable of path tracing during the data synchronization process. The specific solution is as follows:

[0004] Firstly, this application discloses a data synchronization method, including:

[0005] Obtain the data synchronization request of the target service, and generate a sending packet based on the data synchronization request;

[0006] First tracking information is generated based on the local service call path of the sent packet, the first tracking information is added to the sent packet to obtain the target sent packet, and the target sent packet is sent to the data synchronization system of the target terminal;

[0007] Obtain the response packet fed back by the target terminal based on the target sent packet, and extract the second tracking information from the response packet; the second tracking information is the tracking information generated by the target terminal according to the service call path of the target sent packet in the target terminal;

[0008] Based on the first tracking information and the second tracking information, a tracking information package corresponding to the data synchronization request is generated.

[0009] Optionally, before obtaining the data synchronization request for the target service, the following steps are included:

[0010] By intercepting the abstract syntax tree generated during the compilation process of all original services using probes, configuration information is extracted from the abstract syntax tree to obtain the configuration information corresponding to each original service.

[0011] The original services are filtered based on the configuration information to identify target original services with synchronization requirements;

[0012] The bytecode rewriting technique is used to add a data synchronization call program to the business code of the original target business to obtain the target business; the target business can call the interface of the data synchronization system.

[0013] Optionally, the data synchronization system that sends the target packet to the target terminal includes:

[0014] Backup the target packet;

[0015] According to the encryption and decryption rules agreed upon between the local machine and the target terminal, the encryption and decryption service is used to encrypt the target's sent packet to obtain the encrypted sent packet.

[0016] The encrypted packet is sent to the target terminal's data synchronization system using the network connection to the target terminal.

[0017] Optionally, after sending the target packet to the data synchronization system of the target terminal, the method further includes:

[0018] The target terminal's data synchronization system uses a parser to parse the target transmission packet and obtain the command to be executed stored in the target transmission packet;

[0019] The command to be executed is executed by calling the command execution service to perform data synchronization, and the response package is generated based on the data synchronization result.

[0020] Optionally, generating the first tracing information based on the local service call path of the sent packet includes:

[0021] Record the first interface information of the local service call in the sent packet;

[0022] Record the first relay information and the first persistent information related to the sent packet after it invokes the local service;

[0023] Record the second interface information of the external interface call in the sent packet;

[0024] The first tracking information is generated based on the first interface information, the first relay information, the first persistent information, and the second interface information.

[0025] Optionally, the second tracking information includes: third interface information of the target packet calling the target terminal service, second relay information and second persistence information related to the target packet calling the target terminal service, and fourth interface information of the target packet calling external interfaces.

[0026] Optionally, generating the tracking information packet corresponding to the data synchronization request based on the first tracking information and the second tracking information includes:

[0027] The tracking information package corresponding to the data synchronization request is generated by merging the first tracking information and the second tracking information.

[0028] Based on the call result information in the second tracking information, determine whether the data of the target service has been successfully synchronized on the target terminal;

[0029] If synchronization is successful, the status of the sent packet is changed to "complete"; otherwise, the sent packet is resent.

[0030] Secondly, this application discloses a data synchronization device, applied to a data synchronization system, comprising:

[0031] The packet generation module is used to obtain the data synchronization request of the target service and generate a packet based on the data synchronization request;

[0032] The tracking information generation module is used to generate first tracking information based on the local service call path of the sending packet, add the first tracking information to the sending packet to obtain the target sending packet, and send the target sending packet to the data synchronization system of the target terminal;

[0033] The tracking information extraction module is used to obtain the response packet fed back by the target terminal based on the target sent packet, and extract the second tracking information from the response packet; the second tracking information is the tracking information generated by the target terminal according to the service call path of the target sent packet in the target terminal;

[0034] The tracking information packet generation module is used to generate a tracking information packet corresponding to the data synchronization request based on the first tracking information and the second tracking information.

[0035] Thirdly, this application discloses an electronic device, including:

[0036] Memory, used to store computer programs;

[0037] A processor is used to execute the computer program to implement the aforementioned data synchronization method.

[0038] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein the computer program implements the aforementioned data synchronization method when executed by a processor.

[0039] In this application, a data synchronization request for a target service is obtained, and a sending packet is generated based on the data synchronization request; first tracking information is generated according to the service call path of the sending packet on the local machine, the first tracking information is added to the sending packet to obtain a target sending packet, and the target sending packet is sent to the data synchronization system of the target terminal; a response packet fed back by the target terminal based on the target sending packet is obtained, and second tracking information is extracted from the response packet; the second tracking information is the tracking information generated by the target terminal according to the service call path of the target sending packet on the target terminal; a tracking information packet corresponding to the data synchronization request is generated based on the first tracking information and the second tracking information.

[0040] As can be seen, by recording the service call path of the sent packet locally before sending, and based on the obtained service call path of the sent packet on the target terminal, the complete synchronization path of the sent packet, i.e., the tracking information packet, is obtained. Thus, path tracing during the data synchronization process is achieved based on the tracking information packet, effectively realizing path tracking of the data synchronization process. This allows for viewing the path of services that failed to synchronize after data synchronization failure. Furthermore, by using probe and bytecode rewriting techniques to proxy and rewrite the business code, plug-and-play functionality is implemented for the business logic, without intrusion. Attached Figure Description

[0041] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0042] Figure 1 A flowchart of a data synchronization method provided in this application;

[0043] Figure 2 A flowchart illustrating a specific data synchronization method provided in this application;

[0044] Figure 3 A schematic diagram of a data synchronization device provided in this application;

[0045] Figure 4 This application provides a structural diagram of an electronic device. Detailed Implementation

[0046] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0047] In existing technologies, Dubbo interfaces are used to call interfaces in other regions for synchronization, but this cannot achieve traceability of the data synchronization process after the call. To overcome the above technical problems, this application proposes a data synchronization method that can achieve path tracing during the data synchronization process.

[0048] This application discloses a data synchronization method applied to a data synchronization system. See also... Figure 1 As shown, the method may include the following steps:

[0049] Step S11: Obtain the data synchronization request of the target service, and generate a sending packet based on the data synchronization request;

[0050] In this embodiment, the data synchronization system obtains data synchronization requests from external target services through a local interface, and generates a sending packet based on the data synchronization request. Specifically, it generates the sending packet based on the synchronization service call of the target service and the data to be synchronized in the data synchronization request. The data to be synchronized is the data that needs to be synchronized on the target terminal. In this embodiment, the sending packet can be stored on a data transmission carrier within the data synchronization system.

[0051] The target business refers to the business process obtained before and after receiving the data synchronization request. It's understandable that various business processes are written by different business departments, and the original business code does not contain the program for calling the synchronization service. If each business department were to add the data synchronization call program manually, it would increase complexity, and the synchronization function could not be implemented immediately. Therefore, in this embodiment, probe and bytecode rewriting techniques are used to automatically add the program for calling the synchronization service to the business code during the compilation process, enabling the target business to successfully call the data synchronization system's interface to achieve business data synchronization.

[0052] In this embodiment, before obtaining the data synchronization request of the target service, the process may include: intercepting the abstract syntax tree generated during the compilation process of all original services using a probe, extracting configuration information from the abstract syntax tree to obtain the configuration information corresponding to each original service; filtering the original services according to the configuration information to select the target original services with synchronization requirements; adding a data synchronization call program to the business code of the target original service using the bytecode rewriting technology to obtain the target service; and the target service being able to call the interface of the data synchronization system.

[0053] The probe intercepts the abstract syntax tree (AST) corresponding to all business logic loading and reads and encapsulates the relevant configuration information. Based on this configuration information, it filters some custom paths. Specifically, it can generate relevant interception chains based on the business classes to be intercepted. If not specified, it intercepts all classes, filtering out unnecessary business logic and intercepting only the business logic that needs to be synchronized, i.e., the original target business logic. After filtering all classes, it uses bytecode rewriting technology to proxy and rewrite the relevant classes, i.e., rewriting the business code that needs to be synchronized. Specifically, it adds a data synchronization caller to call the synchronization methods of the data synchronization system. After the rewriting is complete, the business status is changed to "rewritten".

[0054] Step S12: Generate first tracking information based on the local service call path of the sent packet, add the first tracking information to the sent packet to obtain the target sent packet, and send the target sent packet to the data synchronization system of the target terminal.

[0055] In this embodiment, first tracking information is generated based on the obtained service call path of the sent packet on the local machine. That is, the sent packet will call corresponding services on the local data synchronization system as needed, such as encryption services. Therefore, the relevant services called by the sent packet locally are recorded to obtain the service call path of the sent packet on the local machine, which serves as the first tracking information. This first tracking information allows understanding of the relevant operations of the sent packet on the local data synchronization system, such as the generation process, encryption process, and then the sending process. Then, the first tracking information is added to the sent packet to obtain the target sent packet, which is then sent to the data synchronization system of the target terminal. The sent packet also stores relevant commands and the first tracking information. After receiving the sent packet, the target terminal executes the commands within it. In other words, the sent packet stores the data content to be transferred / sent, as well as the path information of the sent packet during the transfer process.

[0056] Specifically, the target packet can be sent to the target terminal's data synchronization system through the sending service in the data synchronization system. That is, the sending service is responsible for sending the data transmission carrier to the data synchronization systems in each region. Internally, it is a consumer queue mode that continuously retrieves relevant sending packets from the data transmission carrier. These sending packets store relevant commands and tracking information.

[0057] In this embodiment, generating the first tracing information based on the local service call path of the sending packet may include: recording the first interface information of the sending packet's call to the local service; recording the first relay information and first persistence information related to the sending packet's call to the local service; recording the second interface information of the sending packet's call to the external interface; and generating the first tracing information based on the first interface information, the first relay information, the first persistence information, and the second interface information. That is, the first tracing information is divided into three parts: the initial interface information, the relay information, the persistence information, and the external interface information called, which can be collected by different collection units.

[0058] In this embodiment, the data synchronization system that sends the target packet to the target terminal may include: backing up the target packet; encrypting the target packet using an encryption / decryption service according to encryption / decryption rules agreed upon by the local system and the target terminal to obtain an encrypted packet; and sending the encrypted packet to the target terminal's data synchronization system using a network connection with the target terminal. That is, backing up the target packet allows for retransmission after a transmission failure by retrieving the packet from the backup. In this embodiment, the target packet can also be encrypted according to encryption / decryption rules agreed upon by the local system and the target terminal before being sent, thereby ensuring data security.

[0059] Step S13: Obtain the response packet fed back by the target terminal based on the target sending packet, and extract the second tracking information from the response packet; the second tracking information is the tracking information generated by the target terminal according to the service call path of the target sending packet in the target terminal.

[0060] In this embodiment, after receiving the target packet, the target terminal's data synchronization system performs synchronization and sends back a response packet. The local data synchronization system extracts second tracking information from the response packet. This second tracking information is generated by the target terminal regarding the service call path of the target packet within the target terminal. The second tracking information includes: third interface information of the target packet's service call to the target terminal; second relay information and second persistence information related to the target packet's service call; and fourth interface information of the target packet's external interface call. In other words, this second tracking information allows the target terminal's data synchronization system to understand the relevant service call operations performed by the target packet.

[0061] In this embodiment, after sending the target packet to the data synchronization system of the target terminal, the process may further include: the data synchronization system of the target terminal using a parser to parse the target packet to obtain the command to be executed stored in the target packet; executing the command to be executed by calling a command execution service to perform data synchronization; and generating the response packet based on the data synchronization result. That is, the data synchronization system of the target terminal uses a parser to parse the target packet to obtain the command to be executed stored in the target packet, then executes the command to be executed by calling a command execution service to perform data synchronization, and generates a response packet based on the data synchronization result. The command execution service is used to execute commands and has an internal command queue in which all commands are stored. The executor continuously retrieves relevant commands from this queue for execution. Similarly, if the local data synchronization system receives a target packet sent by the data synchronization system of another terminal, it will also execute the above process.

[0062] Step S14: Generate a tracking information packet corresponding to the data synchronization request based on the first tracking information and the second tracking information.

[0063] In this embodiment, the complete path information of the sent packet can be obtained by combining the first tracking information and the second tracking information, so that if a synchronization problem occurs, the location of the problem can be located by checking the tracking information.

[0064] In this embodiment, generating the tracking information packet corresponding to the data synchronization request based on the first tracking information and the second tracking information includes: generating the tracking information packet corresponding to the data synchronization request by merging the first tracking information and the second tracking information; determining whether the data of the target service has been successfully synchronized on the target terminal based on the call result information in the second tracking information; if the synchronization is successful, changing the status of the sending packet to the completed status; otherwise, resending the sending packet. That is, the second tracking information contains the call results of the corresponding service calls executed by the target terminal according to the target sending packet, i.e., the success or failure result of calling each service on the target terminal. If there are no call failures, it proves that the synchronization is successful, and the status of the sending packet is changed to the completed status; otherwise, the sending packet needs to be resent for a second synchronization.

[0065] In this embodiment, it may further include: if an alarm event is triggered during the operation of the data synchronization system, a corresponding alarm notification is generated through the message center according to a preset message pattern; the alarm event includes disconnection from the target terminal, total number of sent packets exceeding a preset threshold, and failure of the data synchronization system call on the target terminal. That is, the data synchronization system also includes a message center service for generating alarm notifications when an alarm event is triggered.

[0066] In this embodiment, it may further include: establishing a connection with the target terminal through a connection service; and monitoring the operational status of the connection service through a heartbeat monitoring service. That is, the data synchronization system includes a dedicated connection service for establishing network connections, responsible for network connections in each region, and also responsible for notifying all service-related network conditions; and a heartbeat monitoring service for monitoring the operational status of the connection service, i.e., monitoring whether the connection service is still usable.

[0067] As can be seen from the above, this embodiment obtains the data synchronization request of the target service, generates a sending packet based on the data synchronization request, generates first tracking information according to the service call path of the sending packet locally, adds the first tracking information to the sending packet to obtain the target sending packet, and sends the target sending packet to the data synchronization system of the target terminal; obtains the response packet fed back by the target terminal based on the target sending packet, and extracts second tracking information from the response packet; the second tracking information is the tracking information generated by the target terminal according to the service call path of the target sending packet on the target terminal; and generates a tracking information packet corresponding to the data synchronization request based on the first tracking information and the second tracking information. It can be seen that by recording the service call path of the sending packet locally before sending, and obtaining the service call path of the sending packet on the target terminal, the complete synchronization path of the sending packet, i.e., the tracking information packet, is obtained. Thus, path tracing during the data synchronization process is realized based on the tracking information packet, effectively achieving path traceability during the data synchronization process, and enabling the viewing of the path of services that failed to synchronize after data synchronization failure. Furthermore, by using probe and bytecode rewriting technology to proxy rewrite the business code, plug-and-play functionality is achieved for the business, without intrusion.

[0068] Accordingly, this application discloses a specific data synchronization system, the system structure of which is as follows: Figure 2 As shown, the system includes: data backup service, log tracking service, message center service, and synchronization engine service.

[0069] The data backup system backs up the data transmission carriers, which internally store service call records and tracking path IDs. The log tracing system handles later log checks, primarily using packet information from the data transmission carriers for tracking. The data transmission carrier structure is mainly composed of three parts: an entry unit for recording initial interface information; a temporary unit for recording relay and persistent information; and an output unit for recording external interface information. Each synchronization call constitutes a complete tracking path. The message center system is primarily used for alerts. It notifies relevant personnel to check for errors when the service connection is lost, the data volume on the data transmission carrier exceeds a threshold, commands exceed a threshold, or other regional interface calls fail. The synchronization engine system is the core component, actually used for data synchronization. It consists of four main parts: local interfaces, internal services, transmission carriers, and a parser. Local interfaces are the interfaces that need to be synchronized in the project. Internal services are the services within the engine, providing various processing and forming the core of the entire engine. The transmission carrier is the data carrier used for remote calls. The parser is mainly used to parse related commands, primarily for various commands transmitted between the server and client.

[0070] The internal services specifically include: a command execution service, used to execute relevant commands. It maintains an internal queue where all commands are stored, and the executor continuously retrieves commands from this queue for execution. The connection service, the most crucial of all services, is primarily responsible for network connectivity between zones and also notifies all services of network status. The heartbeat service monitors the availability of the connection service. The sending service is responsible for sending data transmission carriers to each zone. Internally, it uses a consumer queue model, continuously retrieving relevant transmission packets from the data transmission carrier. These packets store relevant commands and log information. The encryption / decryption service is responsible for data transmission security. It stores the encryption / decryption algorithms used by each zone, and each zone retrieves the relevant encryption / decryption information based on its own regional information.

[0071] As can be seen, the data synchronization system in this embodiment enables structured data to be synchronized between different regions, solving the security and traceability issues existing in traditional methods. Furthermore, the system architecture is non-intrusive, employing probe and bytecode technology to proxy and rewrite all code, making it plug-and-play.

[0072] This application also discloses a specific method for starting a data synchronization system, which may include the following steps:

[0073] Step S21. After the business application starts, use probes to intercept all loaded abstract syntax trees, read the relevant configuration information, and encapsulate all the configuration information.

[0074] Step S22. Based on the configuration information, filter some custom paths and generate relevant interception chains based on the classes to be intercepted. If not specified, all classes will be intercepted.

[0075] Step S23. Filter all classes and perform proxy rewriting on the relevant classes using bytecode rewriting technology.

[0076] Step S24. Rewriting complete, change the business code status to "rewritten".

[0077] Step S25. Start all services of the data synchronization system through the serial peripheral interface. All services will execute their own pre-processing methods, which include the following:

[0078] S251. Connection service starts. This service uses Remote Procedure Call (RPC) technology, and periodically determines whether a new connection to the remote end needs to be obtained, and notifies all services of the current network status.

[0079] S252. Sending service starts. A consumer group is created, which in turn creates a consumer daemon thread. The consumer daemon thread continuously consumes the sent packets. If there are no packets, it sleeps for a period of time; if there are packets, it calls the consumption process. At this time, the connection service is called to obtain a connection. If the connection is not working properly, the connection service is notified to check its own connection status.

[0080] S253. Heartbeat Service. Maintain network status with the remote end by sending a heartbeat packet at regular intervals (e.g., every 30 seconds). If the heartbeat fails, report it to the connection service.

[0081] S254. Encryption / decryption service: Based on the configuration of the data synchronization system in different regions, obtain its own encryption / decryption algorithm.

[0082] S255. The command execution service has its own command queue. It retrieves relevant commands from the command queue. The adapter retrieves the relevant command executor based on the command information and then executes the command. There are two types of commands: commands obtained by parsing parameters by the parser, which are all commands that execute the corresponding methods; and commands returned after the call is completed, which are generally commands that inform the service that the call was successful.

[0083] Step S26. Startup complete.

[0084] Accordingly, this application discloses a specific data synchronization method, which may include the following steps:

[0085] Step S31. The external call agent's local data synchronization system interface is executed. After these interfaces are completed, relevant sending packets will be generated. All sending packets are stored in the data transmission carrier.

[0086] Step S32. The data backup system will store these sent packets to prevent all information from being lost due to a power outage.

[0087] Step S33. At this time, the packet will also generate the first tracking information for subsequent information tracking.

[0088] Step S34. The consumer in the sending service obtains the sending packet from the data transmission carrier, first calls the encryption / decryption service to encrypt the sending packet, then obtains a connection from the connection service and sends it. If the sending fails at this time, it reports to the connection service, causing the connection service to reconnect and informing all listening services that the connection is currently unavailable; and sends it to the message center. The message center can select any method such as telephone, WeChat, DingTalk, or SMS to send the alarm through configuration. If successful, it asynchronously waits for the return value of the call completion.

[0089] Step S35. After receiving this message, the target terminal uses its own decryption service to decrypt the sent packet.

[0090] Step S36. At this time, the target terminal also performs its own tracking information recording operation according to the same recording method based on the first tracking information of the packet sent by the client, and the recorded information is the second tracking information.

[0091] Step S37. Using the parser, parse the relevant commands in the sent packet, call the command execution service, and put them into the command execution queue to wait for command execution. This will call the relevant interface methods, and the relevant calls will also be recorded in the second trace information. After the call is completed, regardless of success or failure, it will be encapsulated into a response packet and returned to the local data synchronization system.

[0092] Step S38. After receiving the response packet, the encryption / decryption service is used to decrypt it. Similarly, the command parser is called to parse it. After completion, the status of the log tracing service is changed to complete.

[0093] Step S39. The information of the relevant sent packets in the data backup is transformed into complete information and can be added to the database of historical sent packets. At this point, the entire process is complete.

[0094] Accordingly, this application also discloses a data synchronization device, see [link to relevant documentation]. Figure 3 As shown, the device includes:

[0095] Sending packet generation module 11 is used to obtain the data synchronization request of the target service and generate a sending packet based on the data synchronization request;

[0096] The tracking information generation module 12 is used to generate first tracking information based on the local service call path of the sending packet, add the first tracking information to the sending packet to obtain the target sending packet, and send the target sending packet to the data synchronization system of the target terminal;

[0097] The tracking information extraction module 13 is used to obtain the response packet fed back by the target terminal based on the target sending packet, and extract the second tracking information from the response packet; the second tracking information is the tracking information generated by the target terminal according to the service call path of the target sending packet in the target terminal;

[0098] The tracking information packet generation module 14 is used to generate a tracking information packet corresponding to the data synchronization request based on the first tracking information and the second tracking information.

[0099] As can be seen from the above, this embodiment obtains the data synchronization request of the target service, generates a sending packet based on the data synchronization request, generates first tracking information according to the service call path of the sending packet locally, adds the first tracking information to the sending packet to obtain the target sending packet, and sends the target sending packet to the data synchronization system of the target terminal; obtains the response packet fed back by the target terminal based on the target sending packet, and extracts second tracking information from the response packet; the second tracking information is the tracking information generated by the target terminal according to the service call path of the target sending packet on the target terminal; and generates a tracking information packet corresponding to the data synchronization request based on the first tracking information and the second tracking information. It can be seen that by recording the service call path of the sending packet locally before sending, and obtaining the service call path of the sending packet on the target terminal, the complete synchronization path of the sending packet, i.e., the tracking information packet, is obtained. Thus, path tracing during the data synchronization process is realized based on the tracking information packet, effectively achieving path traceability during the data synchronization process, and enabling the viewing of the path of services that failed to synchronize after data synchronization failure. Furthermore, by using probe and bytecode rewriting technology to proxy rewrite the business code, plug-and-play functionality is achieved for the business, without intrusion.

[0100] In some specific embodiments, the data synchronization device may specifically include:

[0101] The interception unit is used to intercept the abstract syntax tree generated during the compilation process of all original services through probes, and extract configuration information from the abstract syntax tree to obtain the configuration information corresponding to each original service.

[0102] The filtering unit is used to filter the original services according to the configuration information and select the target original services that have synchronization requirements.

[0103] An adding unit is used to add a data synchronization calling program to the business code of the target original business using the bytecode rewriting technology, so as to obtain the target business; the target business can call the interface of the data synchronization system.

[0104] In some specific embodiments, the tracking information generation module 12 may specifically include:

[0105] Backup unit, used to back up the target transmission packet;

[0106] The encryption unit is used to encrypt the target transmission packet according to the encryption and decryption rules agreed upon by the local unit and the target terminal, and obtain the encrypted transmission packet.

[0107] The sending unit is used to send the encrypted packet to the data synchronization system of the target terminal using a network connection with the target terminal.

[0108] In some specific embodiments, the data synchronization device may specifically include:

[0109] The parsing unit is used by the target terminal's data synchronization system to parse the target sending packet using a parser, and to obtain the command to be executed stored in the target sending packet;

[0110] The command execution unit is used to execute the command to be executed by calling the command execution service to perform data synchronization, and to generate the response package based on the data synchronization result.

[0111] In some specific embodiments, the data synchronization device may specifically include:

[0112] An alarm unit is used to generate a corresponding alarm notification through a message center according to a preset message pattern when an alarm event occurs during the operation of the data synchronization system. The alarm events include disconnection from the target terminal, total number of packets sent exceeding a preset threshold, and failure of the data synchronization system call of the target terminal.

[0113] In some specific embodiments, the data synchronization device may specifically include:

[0114] A connection unit is used to establish a connection with the target terminal through a connection service;

[0115] The monitoring unit is used to monitor the operating status of the connection service through the heartbeat monitoring service.

[0116] In some specific embodiments, the tracking information generation module 12 may specifically include:

[0117] The first interface information recording unit is used to record the first interface information of the local service call by the sending packet;

[0118] The relay information recording unit is used to record the first relay information and the first persistent information related to the sending packet calling the local service;

[0119] The second interface information recording unit is used to record the second interface information of the external interface call of the sending packet;

[0120] The first tracking information generation unit is used to generate the first tracking information based on the first interface information, the first relay information, the first persistent information, and the second interface information.

[0121] In some specific embodiments, the second tracking information includes: third interface information of the target packet calling the target terminal service, second relay information and second persistent information related to the target packet calling the target terminal service, and fourth interface information of the target packet calling external interfaces.

[0122] In some specific embodiments, the tracking information packet generation module 14 may specifically include:

[0123] The merging unit is used to generate a tracking information packet corresponding to the data synchronization request by merging the first tracking information and the second tracking information;

[0124] The synchronization judgment unit is used to determine whether the data of the target service has been successfully synchronized on the target terminal based on the call result information in the second tracking information;

[0125] The status modification unit is used to modify the status of the transmitted packet to the completed status if the synchronization is successful; otherwise, the transmitted packet is retransmitted.

[0126] Furthermore, this application also discloses an electronic device, see [link to relevant documentation]. Figure 4 As shown, the content in the figure should not be considered as any limitation on the scope of use of this application.

[0127] Figure 4 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the data synchronization method disclosed in any of the foregoing embodiments.

[0128] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0129] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon include operating system 221, computer program 222 and data 223 including tracking information packets, etc., and the storage method can be temporary storage or permanent storage.

[0130] The operating system 221 manages and controls the various hardware devices on the electronic device 20 and the computer program 222 to enable the processor 21 to perform calculations and processing on the massive amounts of data 223 in the memory 22. The operating system 221 can be Windows Server, Netware, Unix, Linux, etc. In addition to including computer programs capable of performing the data synchronization method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.

[0131] Furthermore, this application also discloses a computer storage medium storing computer-executable instructions. When the computer-executable instructions are loaded and executed by a processor, they implement the data synchronization method steps disclosed in any of the foregoing embodiments.

[0132] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0133] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0134] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0135] The above provides a detailed description of the data synchronization method, apparatus, device, and medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A data synchronization method, characterized in that, Applications in data synchronization systems include: Obtain the data synchronization request of the target service, and generate a sending packet based on the data synchronization request; the sending packet is stored on the data transmission carrier within the data synchronization system. First tracking information is generated based on the local service call path of the sent packet, the first tracking information is added to the sent packet to obtain the target sent packet, and the target sent packet is sent to the data synchronization system of the target terminal; Obtain the response packet fed back by the target terminal based on the target sent packet, and extract the second tracking information from the response packet; the second tracking information is the tracking information generated by the target terminal according to the service call path of the target sent packet in the data synchronization system of the target terminal; Generate a tracking information packet corresponding to the data synchronization request based on the first tracking information and the second tracking information; The step of generating the first tracing information based on the local service call path of the sent packet includes: Record the first interface information of the local service call made by the sent packet; the local service includes command execution service, connection service, heartbeat service, sending service, and encryption / decryption service; Record the first relay information and the first persistent information related to the sent packet after it invokes the local service; Record the second interface information of the external interface call in the sent packet; The first tracking information is generated based on the first interface information, the first relay information, the first persistent information, and the second interface information; Prior to obtaining the data synchronization request for the target service, the process also includes: By intercepting the abstract syntax tree generated during the compilation process of all original services using probes, configuration information is extracted from the abstract syntax tree to obtain the configuration information corresponding to each original service. The original services are filtered based on the configuration information to identify target original services with synchronization requirements; By using bytecode rewriting technology, a data synchronization call program is added to the business code of the original target business to obtain the target business; the target business is able to call the interface of the data synchronization system. The step of generating the tracking information packet corresponding to the data synchronization request based on the first tracking information and the second tracking information includes: The tracking information package corresponding to the data synchronization request is generated by merging the first tracking information and the second tracking information. Based on the call result information in the second tracking information, determine whether the data of the target service has been successfully synchronized on the target terminal; If synchronization is successful, the status of the sent packet is changed to "complete"; otherwise, the sent packet is resent.

2. The data synchronization method according to claim 1, characterized in that, The data synchronization system that sends the target packet to the target terminal includes: Backup the target packet; According to the encryption and decryption rules agreed upon between the local machine and the target terminal, the encryption and decryption service is used to encrypt the target's sent packet to obtain the encrypted sent packet. The encrypted packet is sent to the target terminal's data synchronization system using the network connection to the target terminal.

3. The data synchronization method according to claim 1, characterized in that, After the data synchronization system sends the target packet to the target terminal, it further includes: The target terminal's data synchronization system uses a parser to parse the target transmission packet and obtain the command to be executed stored in the target transmission packet; The command to be executed is executed by calling the command execution service to perform data synchronization, and the response package is generated based on the data synchronization result.

4. The data synchronization method according to claim 1, characterized in that, The second tracking information includes: third interface information of the target packet calling the target terminal service, second relay information and second persistence information related to the target packet calling the target terminal service, and fourth interface information of the target packet calling the external interface.

5. A data synchronization device, characterized in that, Applications in data synchronization systems include: The packet generation module is used to obtain the data synchronization request of the target service and generate a packet based on the data synchronization request; the packet is stored on the data transmission carrier in the data synchronization system. The tracking information generation module is used to generate first tracking information based on the local service call path of the sending packet, add the first tracking information to the sending packet to obtain the target sending packet, and send the target sending packet to the data synchronization system of the target terminal; The tracking information extraction module is used to obtain the response packet fed back by the target terminal based on the target sent packet, and extract the second tracking information from the response packet; the second tracking information is the tracking information generated by the target terminal according to the service call path of the target sent packet in the data synchronization system of the target terminal; A tracking information packet generation module is used to generate a tracking information packet corresponding to the data synchronization request based on the first tracking information and the second tracking information. The tracking information generation module is used to record the first interface information of the sending packet's call to the local service; the local service includes command execution service, connection service, heartbeat service, sending service, and encryption / decryption service; record the first relay information and the first persistent information related to the sending packet's call to the local service; record the second interface information of the sending packet's call to the external interface; and generate the first tracking information based on the first interface information, the first relay information, the first persistent information, and the second interface information. The data synchronization device is further configured to, before acquiring the data synchronization request of the target service, By intercepting the abstract syntax tree generated during the compilation process of all original business processes using probes, configuration information is extracted from the abstract syntax tree to obtain the configuration information corresponding to each original business process. The original business processes are then filtered based on the configuration information to identify target original business processes with synchronization requirements. A data synchronization call program is added to the business code of the target original business processes using bytecode rewriting technology to obtain the target business processes. The target business processes are able to call the interface of the data synchronization system. The tracking information packet generation module is used to generate a tracking information packet corresponding to the data synchronization request by merging the first tracking information and the second tracking information; determine whether the data of the target service has been successfully synchronized on the target terminal based on the call result information in the second tracking information; if the synchronization is successful, change the status of the sending packet to the completed status; otherwise, resend the sending packet.

6. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the data synchronization method as described in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, Used for storing computer programs; wherein the computer programs, when executed by a processor, implement the data synchronization method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Data synchronization method, apparatus, computer apparatus, and storage medium

    CN109086295A

  • Link tracking method, device and system and storage medium

    CN116360931A