Bidirectional data synchronization method, computer program product, device and storage medium
By detecting whether the data is written to the user and backing up the data, the problem of data back-passing in two-way data synchronization is solved, and efficient resource utilization and accurate data synchronization are achieved.
Patent Information
- Application Number
- CN202411245667.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-12-13
AI Technical Summary
During the two-way data synchronization process, when the source library and the destination library have a synchronous triggering action, data is returned and system resources are wasted.
By detecting whether the data is written to the user, if not, the data is backed up to the temporary table, and the predetermined exclusive user writes the data in the target library to avoid data back-passing.
Effectively prevent data back-passing, save system resources, simple operation, and ensure the accuracy and efficiency of data synchronization.
Smart Images

Figure CN119128010A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a bidirectional data synchronization method, a computer program product, a device and a storage medium. Background Art
[0002] Data ferrying is a relatively practical technology at present, which can safely transmit data between the internal and external networks. In one scenario, the changed data generated by the internal and external networks needs to be synchronized to the opposite side. For the changed data caused by synchronization from the opposite side, anti-backward control is required.
[0003] For database data synchronization, currently, materialized views (a special view of Oracle) and triggers (a more general type of stored procedure) are mainly used to capture data changes. Triggers can notify when table data is added, modified, deleted, etc., but if there are synchronization trigger actions on both the source and destination databases, the synchronized data will be synchronized to the source database again, and the data will be transmitted back, wasting system resources. Summary of the invention
[0004] In view of this, an embodiment of the present invention proposes a bidirectional data synchronization method, computer program product, device and storage medium to solve the following problems in the prior art: During the bidirectional data synchronization process, if there is a synchronization trigger action on both the source library and the destination library, the synchronized data will be synchronized to the source library again, and the data will be back-transmitted, wasting system resources.
[0005] On the one hand, an embodiment of the present invention proposes a bidirectional data synchronization method, including: a first server detects whether a user who writes data in a first database table is a predetermined exclusive user; if the user who writes the data is not the predetermined exclusive user, the first server backs up the data written to the first database table to a temporary table, and saves the data written to the first database table; a first client detects whether there is data in the temporary table, wherein the first client is a client corresponding to the first server; if there is data in the temporary table, the first client sends a data synchronization request to a second client, so as to synchronize the data in the first database table on the second client using the predetermined exclusive user.
[0006] In some embodiments, after the first client sends a data synchronization request to the second client, the method further includes: the second client writes the data in the temporary table into a second database table of the second server through the predetermined exclusive user.
[0007] In some embodiments, the second client writes the data in the temporary table to the second database table of the second server through the predetermined exclusive user, including: the second client receives an account login request from the predetermined exclusive user to obtain the data in the temporary table through the predetermined exclusive user; the second client uses the predetermined exclusive user to initiate a data write request to the second server to write the data in the temporary table to the second database table.
[0008] In some embodiments, the first server backs up the data written to the first database table to a temporary table, including: obtaining meta information of the data written to the first database table; storing the meta information in the temporary table to obtain the data in the first database table through the meta information.
[0009] In some embodiments, before the first server detects whether the user who writes data in the first database table is a predetermined exclusive user, it also includes: the first client receives an account login request from the predetermined exclusive user; the first client uses the predetermined exclusive user to initiate a data write request to the first server; and in response to the data write request, writes data in the first database table of the first server.
[0010] In some embodiments, the predetermined exclusive users include: multiple accounts with exclusive tags.
[0011] In some embodiments, the first client detects whether there is data in the temporary table, including: the first client detects whether there is data in the temporary table according to a predetermined period.
[0012] In some embodiments, after the first server detects whether the user who writes data in the first database table is a predetermined exclusive user, it further includes: if the user who writes the data is the predetermined exclusive user, saving the data written to the first database table.
[0013] On the other hand, an embodiment of the present invention provides a computer program product storing a computer program, wherein the computer program implements the steps of the above method when executed by a processor.
[0014] On the other hand, an embodiment of the present invention provides a computer device, which includes at least a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the above method when executing the computer program in the memory.
[0015] On the other hand, an embodiment of the present invention provides a storage medium, wherein the storage medium carries one or more computer programs, and the one or more computer programs implement the steps of the above method when executed by a processor.
[0016] The embodiment of the present invention sets up a predetermined exclusive user for data synchronization. When data is written into the database table by the predetermined exclusive user, it means that the data is data transmitted from the outside and needs to be synchronized. By identifying whether the user who writes the data is the predetermined exclusive user, the synchronized data can be prevented from being transmitted back. The whole process only needs to add simple logic, the operation is simple, and the effective use of system resources is ensured. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0018] Figure 1 A flowchart of a bidirectional data synchronization method provided by a first embodiment of the present invention;
[0019] Figure 2 A schematic diagram of the architecture of a bidirectional data synchronization system provided by a first embodiment of the present invention;
[0020] Figure 3 A schematic diagram of the structure of a computer device provided in the third embodiment of the present invention. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution of the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the described embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0022] Unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The words "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0023] In order to keep the following description of the embodiments of the present invention clear and concise, detailed descriptions of well-known functions and well-known components are omitted.
[0024] The first embodiment of the present invention provides a method for synchronizing bidirectional data. The process of the method is as follows: Figure 1 As shown, steps S101 to S104 are included:
[0025] S101, a first server detects whether a user who writes data in a first database table is a predetermined exclusive user.
[0026] The above-mentioned predetermined exclusive user can be one account or multiple accounts with exclusive tags, that is, the first client and the second client can log in to the same account or different accounts, as long as the different accounts have exclusive tags. By setting different accounts with exclusive tags to log in to different clients, it is convenient for users to operate on different clients and realize barrier-free data synchronization for multiple users.
[0027] Before the first server detects whether the user who writes data in the first database table is the predetermined exclusive user, the first client receives the account login request of the predetermined exclusive user and initiates a data write request to the first server using the predetermined exclusive user; in response to the data write request, the first server writes the data in the first database table. After logging in to the client using the account corresponding to the predetermined exclusive user, the data written to the first database table will not be synchronized to the second server again, preventing data from being transmitted back.
[0028] S102: When the user who writes the data is not a predetermined exclusive user, the first server backs up the data written into the first database table into a temporary table and saves the data written into the first database table.
[0029] When backing up the data written to the first database table to the temporary table, it is necessary to obtain the meta information of the data written to the first database table and store the meta information in the temporary table. The data in the first database table can be obtained later through the meta information.
[0030] The principle of data synchronization in the prior art is to use notifications to save the metadata of the changed data separately. The background task obtains the entire row of records through the metadata joint table query and performs a write operation to the destination database. This process is similar to the synchronization process in the prior art, but the synchronization process of the embodiment of the present invention is performed by a predetermined exclusive user, and then the occurrence of data backhaul events can be prevented by identifying whether the write operation is performed by the predetermined exclusive user, thereby saving system resources.
[0031] When the user who writes data is not the predetermined exclusive user, it means that the current data change is a normal data change in the production environment. The data change needs to be synchronized to the second server. Therefore, when saving the data written to the first database table, it is also necessary to back up the changed data through a temporary table for subsequent data synchronization.
[0032] If the user who writes the data is a predetermined exclusive user, it means that the process is a data synchronization process, that is, the data written to the first database table is synchronized from the second server, so at this time, only the data written to the first database table needs to be saved, and the data written to the first database table is no longer backed up to the temporary table, and the data will no longer be transmitted back through the temporary table.
[0033] S103: The first client detects whether there is data in the temporary table, wherein the first client is a client corresponding to the first server.
[0034] In specific implementation, the process can be implemented through triggers in the prior art, that is, the first client automatically detects changes in data in the temporary table through the set trigger, and performs data synchronization when data changes are found. For detecting changes in data in the temporary table, it is possible to detect whether there is data in the temporary table according to a predetermined period to solve the problem of resource waste caused by detection at any time and save system resources.
[0035] S104: When there is data in the temporary table, the first client sends a data synchronization request to the second client, so as to synchronize the data in the first database table on the second client using a predetermined exclusive user.
[0036] Correspondingly, after the second client receives the data synchronization request from the first client, the second client can write the data in the temporary table to the second database table of the second server through the predetermined exclusive user. In specific implementation, the second client receives the account login request of the predetermined exclusive user to obtain the data in the temporary table through the predetermined exclusive user; then, the second client uses the predetermined exclusive user to initiate a data write request to the second server to write the data in the temporary table to the second database table.
[0037] The embodiment of the present invention sets up a predetermined exclusive user for data synchronization. When data is written into the database table by the predetermined exclusive user, it means that the data is data transmitted from the outside and needs to be synchronized. By identifying whether the user who writes the data is the predetermined exclusive user, the synchronized data can be prevented from being transmitted back. The whole process only needs to add simple logic, the operation is simple, and the effective use of system resources is ensured.
[0038] The method for ensuring efficient and accurate backhaul prevention of bidirectional database records provided by the embodiment of the present invention does not require the user to deploy additional cache middleware for retrieval. The synchronization system consists of a group of synchronization clients and a network gatekeeper (to complete cross-network data ferrying). The method for bidirectional data transmission to achieve backhaul prevention mainly includes the following steps:
[0039] The clients on both sides use the reserved exclusive user data_sync to create triggers and temporary tables for the database tables to be monitored, and use this reserved exclusive user to read and write data. The above trigger function ensures that data addition, modification, and deletion can enter the custom logic to control data collection; the above temporary table is used to temporarily store the metadata of the changed data (such as record primary key, table name, action, time, etc.).
[0040] In the embodiment of the present invention, when the data in the database table table1 changes in the production environment, the trigger logic is automatically entered, and the trigger logic is as follows:
[0041] First, check whether the current user is a data_sync exclusive user. If the current user is a data_sync exclusive user, it means that the process is a data synchronization process, and only the changed data is saved in the database table1. Since the data_sync exclusive user is a synchronization exclusive user and is not used in the production environment, the data changes in the database table1 must not be generated in the production environment. Therefore, identifying whether the user currently writing data is a data_sync exclusive user is the key to the anti-passback design and the basis for controlling anti-passback.
[0042] If the current user is not a data_sync exclusive user, the data change in the database table table1 is determined to be an autonomous data change in the production environment, and then the metadata of the current data (action, table name, etc.) is stored in a temporary table (these data can be obtained in the trigger syntax). Subsequent synchronization data services rely on these metadata to perform joint table queries with table1 to know the content of the entire row of data.
[0043] According to the above method of the embodiment of the present invention, combined with Figure 2 The above embodiment is exemplarily described in detail by referring to the architecture of the bidirectional data synchronization system. Figure 2 In the anti-backward control process of the two-way data synchronization system, only one anti-backward process is used as an example, that is, Figure 2 The client that initiates the synchronization is called the src (source) client, and the client that receives the file data is called the dest (destination) client. The specific process is as follows:
[0044] The src client and the dest client use the data_sync exclusive user to create triggers and temporary tables for the monitoring table, and poll the temporary table for incremental data. At any time, after the monitoring table trigger enters the callback, the following checks are performed: if the current user is not the data_sync exclusive user, it is determined to be an autonomous data change generated by the production environment, and then the metadata of the current data is stored in the temporary table (these data can be obtained in the trigger syntax); if the current user is the data_sync exclusive user, it exits and does not insert incremental change data into the temporary table.
[0045] At any time, if the src client polls the temporary table and finds data, it will initiate a database synchronization request to the dest client and transmit the changed data.
[0046] The dest client receives a new synchronization request and uses data_sync to write incremental data to the database.
[0047] The embodiment of the present invention does not invade the user deployment environment, and only uses triggers and predetermined exclusive users to lightweightly implement bidirectional database synchronization anti-backwarding; the entire anti-backwarding control process of the embodiment of the present invention is completed in the user database, and no additional cache middleware is required to set up and search to determine whether it is synchronized data. In the trigger, by obtaining the current session user name and comparing it with the exclusive user data_sync, it can be determined whether it is production change data or synchronized data (which should be regarded as ignored), which can efficiently complete the database record anti-backwarding control, and control is achieved without searching through additional cache middleware.
[0048] A second embodiment of the present invention provides a computer program product, which is a computer-readable medium storing a computer program. When the computer program is executed by a processor, the method provided by any embodiment of the present invention is implemented, including the following steps S11 to S14:
[0049] S11, detecting, by the first server, whether the user who writes data in the first database table is a predetermined exclusive user;
[0050] S12, when the user who writes the data is not the predetermined exclusive user, backing up the data written to the first database table into a temporary table, and saving the data written to the first database table;
[0051] S13, detecting whether there is data in the temporary table through the first client, wherein the first client is a client corresponding to the first server;
[0052] S14: When there is data in the temporary table, a data synchronization request is sent to the second client through the first client, so as to synchronize the data in the first database table on the second client using a predetermined exclusive user.
[0053] After the first client sends a data synchronization request to the second client, the computer program is executed by the processor, and the processor also executes the following steps: the second client writes the data in the temporary table to the second database table of the second server through a predetermined exclusive user.
[0054] When the computer program is executed by the processor and the second client writes the data in the temporary table into the second database table of the second server through a predetermined exclusive user, the processor specifically executes the following steps: the second client receives an account login request from the predetermined exclusive user to obtain the data in the temporary table through the predetermined exclusive user; the second client uses the predetermined exclusive user to initiate a data write request to the second server to write the data in the temporary table into the second database table.
[0055] When the computer program is executed by the processor to back up the data written to the first database table to the temporary table, the processor specifically executes the following steps: obtaining meta information of the data written to the first database table; storing the meta information in the temporary table to obtain the data in the first database table through the meta information.
[0056] The computer program is executed by the processor before the first server detects whether the user who writes data in the first database table is a predetermined exclusive user, and the processor also executes the following steps: the first client receives an account login request from the predetermined exclusive user; the first client uses the predetermined exclusive user to initiate a data write request to the first server; in response to the data write request, the data is written in the first database table of the first server.
[0057] The above-mentioned reserved exclusive users include: multiple accounts with exclusive tags.
[0058] When the computer program is executed by the processor and the first client detects whether there is data in the temporary table, the processor specifically executes the following steps: the first client detects whether there is data in the temporary table according to a predetermined period.
[0059] After the computer program is executed by the processor and the first server detects whether the user who writes data in the first database table is a predetermined exclusive user, the processor also executes the following steps: if the user who writes the data is the predetermined exclusive user, save the data written to the first database table.
[0060] The embodiment of the present invention sets up a predetermined exclusive user for data synchronization. When data is written into the database table by the predetermined exclusive user, it means that the data is data transmitted from the outside and needs to be synchronized. By identifying whether the user who writes the data is the predetermined exclusive user, the synchronized data can be prevented from being transmitted back. The whole process only needs to add simple logic, the operation is simple, and the effective use of system resources is ensured.
[0061] Optionally, in this embodiment, the above-mentioned computer program product may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk. Optionally, in this embodiment, the processor executes the method steps recorded in the above-mentioned embodiment according to the program code stored in the computer program product. Optionally, the specific examples in this embodiment can refer to the examples described in the above-mentioned embodiment and the optional implementation mode, and this embodiment will not be repeated here. Obviously, those skilled in the art should understand that the above-mentioned modules or steps of the present invention can be implemented with a general computing device, which can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices. Optionally, they can be implemented with program codes executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from here, or they can be made into individual integrated circuit modules respectively, or multiple modules or steps in them can be made into a single integrated circuit module for implementation. In this way, the present invention is not limited to any specific combination of hardware and software.
[0062] A third embodiment of the present invention provides a computer device, the structural diagram of which can be as follows: Figure 3As shown, at least a memory 901 and a processor 902 are included, the memory 901 stores a computer program, and the processor 902 implements the method provided by any embodiment of the present invention when executing the computer program on the memory 901. Exemplarily, the computer program steps of the computer device are as follows S21 to S24:
[0063] S21, detecting, by the first server, whether the user who writes data in the first database table is a predetermined exclusive user;
[0064] S22, when the user who writes the data is not the predetermined exclusive user, backing up the data written to the first database table into a temporary table, and saving the data written to the first database table;
[0065] S23, detecting whether there is data in the temporary table through the first client, wherein the first client is a client corresponding to the first server;
[0066] S24, when there is data in the temporary table, sending a data synchronization request to the second client through the first client, so as to synchronize the data in the first database table on the second client using a predetermined exclusive user.
[0067] After executing the computer program stored in the memory for the first client to send a data synchronization request to the second client, the processor further executes the following computer program: the second client writes the data in the temporary table to the second database table of the second server through a predetermined exclusive user.
[0068] When the processor executes a computer program stored in the execution memory, in which the second client writes the data in the temporary table to the second database table of the second server through a predetermined exclusive user, the processor specifically executes the following computer program: the second client receives an account login request from the predetermined exclusive user to obtain the data in the temporary table through the predetermined exclusive user; the second client uses the predetermined exclusive user to initiate a data write request to the second server to write the data in the temporary table to the second database table.
[0069] When the processor executes a computer program stored in the memory for backing up the data written to the first database table to the temporary table, the processor specifically executes the following computer program: obtaining meta-information of the data written to the first database table; storing the meta-information in the temporary table to obtain the data in the first database table through the meta-information.
[0070] Before executing the computer program stored in the memory and configured to detect whether the user who writes data in the first database table on the first server is a predetermined exclusive user, the processor also executes the following computer program: the first client receives an account login request from a predetermined exclusive user; the first client initiates a data write request to the first server using the predetermined exclusive user; and in response to the data write request, writes data in the first database table on the first server.
[0071] The above-mentioned reserved exclusive users include: multiple accounts with exclusive tags.
[0072] When the processor executes the computer program stored in the memory for the first client to detect whether there is data in the temporary table, the processor specifically executes the following computer program: the first client detects whether there is data in the temporary table according to a predetermined period.
[0073] After executing the computer program stored in the memory for detecting whether the user who writes data in the first database table is a predetermined exclusive user on the first server, the processor further executes the following computer program: if the user who writes the data is the predetermined exclusive user, saving the data written to the first database table.
[0074] The embodiment of the present invention sets up a predetermined exclusive user for data synchronization. When data is written into the database table by the predetermined exclusive user, it means that the data is data transmitted from the outside and needs to be synchronized. By identifying whether the user who writes the data is the predetermined exclusive user, the synchronized data can be prevented from being transmitted back. The whole process only needs to add simple logic, the operation is simple, and the effective use of system resources is ensured.
[0075] A fourth embodiment of the present invention provides a storage medium, wherein the storage medium carries one or more computer programs, and when the one or more computer programs are executed by a processor, the method provided by any embodiment of the present invention is implemented, including the following steps S31 to S34:
[0076] S31, detecting, by the first server, whether the user who writes data in the first database table is a predetermined exclusive user;
[0077] S32, when the user who writes the data is not the predetermined exclusive user, backing up the data written to the first database table into a temporary table, and saving the data written to the first database table;
[0078] S33, detecting whether there is data in the temporary table through the first client, wherein the first client is a client corresponding to the first server;
[0079] S34: When there is data in the temporary table, a data synchronization request is sent to the second client through the first client, so as to synchronize the data in the first database table on the second client using a predetermined exclusive user.
[0080] After the first client sends a data synchronization request to the second client, the computer program is executed by the processor, and the processor also executes the following steps: the second client writes the data in the temporary table to the second database table of the second server through a predetermined exclusive user.
[0081] When the computer program is executed by the processor and the second client writes the data in the temporary table into the second database table of the second server through a predetermined exclusive user, the processor specifically executes the following steps: the second client receives an account login request from the predetermined exclusive user to obtain the data in the temporary table through the predetermined exclusive user; the second client uses the predetermined exclusive user to initiate a data write request to the second server to write the data in the temporary table into the second database table.
[0082] When the computer program is executed by the processor to back up the data written to the first database table to the temporary table, the processor specifically executes the following steps: obtaining meta information of the data written to the first database table; storing the meta information in the temporary table to obtain the data in the first database table through the meta information.
[0083] The computer program is executed by the processor before the first server detects whether the user who writes data in the first database table is a predetermined exclusive user, and the processor also executes the following steps: the first client receives an account login request from the predetermined exclusive user; the first client uses the predetermined exclusive user to initiate a data write request to the first server; in response to the data write request, the data is written in the first database table of the first server.
[0084] The above-mentioned reserved exclusive users include: multiple accounts with exclusive tags.
[0085] When the computer program is executed by the processor and the first client detects whether there is data in the temporary table, the processor specifically executes the following steps: the first client detects whether there is data in the temporary table according to a predetermined period.
[0086] After the computer program is executed by the processor and the first server detects whether the user who writes data in the first database table is a predetermined exclusive user, the processor also executes the following steps: if the user who writes the data is the predetermined exclusive user, save the data written to the first database table.
[0087] The embodiment of the present invention sets up a predetermined exclusive user for data synchronization. When data is written into the database table by the predetermined exclusive user, it means that the data is data transmitted from the outside and needs to be synchronized. By identifying whether the user who writes the data is the predetermined exclusive user, the synchronized data can be prevented from being transmitted back. The whole process only needs to add simple logic, the operation is simple, and the effective use of system resources is ensured.
[0088] In addition, although exemplary embodiments have been described herein, the scope includes any and all embodiments based on the present invention with equivalent elements, modifications, omissions, combinations (e.g., various embodiments intersecting schemes), adaptations or changes. The elements in the claims will be interpreted broadly based on the language adopted in the claims, and are not limited to the examples described in this specification or during the implementation of this application, and the examples will be interpreted as non-exclusive. Therefore, this specification and examples are intended to be considered as examples only, and the true scope and spirit are indicated by the following claims and the full scope of their equivalents.
[0089] The above description is intended to be illustrative rather than restrictive. For example, the above examples (or one or more of them) can be used in combination with each other. For example, a person of ordinary skill in the art can use other embodiments when reading the above description. In addition, in the above-mentioned specific embodiments, various features can be grouped together to simplify the present invention. This should not be interpreted as an intention that a disclosed feature that is not required to be protected is necessary for any claim. On the contrary, the subject matter of the present invention may be less than all the features of a specific disclosed embodiment. Thus, the following claims are incorporated into the specific embodiments as examples or embodiments, wherein each claim is independently used as a separate embodiment, and it is considered that these embodiments can be combined with each other in various combinations or arrangements. The scope of the present invention should be determined with reference to the attached claims and the full scope of equivalent forms granted by these claims.
[0090] A number of embodiments of the present invention have been described in detail above, but the present invention is not limited to these specific embodiments. Those skilled in the art can make various variations and modifications to the embodiments based on the concept of the present invention, and these variations and modifications should all fall within the scope of protection claimed by the present invention.
Claims
1. A method for synchronizing bidirectional data, characterized in that: include: The first server detects whether the user who writes data in the first database table is a predetermined exclusive user; In the case that the user who writes the data is not the predetermined exclusive user, the first server backs up the data written to the first database table into a temporary table and saves the data written to the first database table; A first client detects whether there is data in the temporary table, wherein the first client is a client corresponding to the first server; In the case that data exists in the temporary table, the first client sends a data synchronization request to the second client, so as to synchronize the data in the first database table on the second client using the predetermined exclusive user.
2. The method according to claim 1, characterized in that After the first client sends a data synchronization request to the second client, the method further includes: The second client writes the data in the temporary table into the second database table of the second server through the predetermined exclusive user.
3. The method according to claim 2, characterized in that The second client writes the data in the temporary table into the second database table of the second server through the predetermined exclusive user, including: The second client receives an account login request of the predetermined exclusive user to obtain data in the temporary table through the predetermined exclusive user; The second client uses the predetermined exclusive user to initiate a data write request to the second server to write the data in the temporary table into the second database table.
4. The method according to claim 1, characterized in that The first server backs up the data written to the first database table into a temporary table, including: Obtaining meta information of data written to the first database table; The meta information is stored in the temporary table, so as to obtain the data in the first database table through the meta information.
5. The method according to any one of claims 1 to 4, characterized in that Before the first server detects whether the user who writes data in the first database table is a predetermined exclusive user, the method further includes: The first client receives an account login request from the predetermined exclusive user; The first client uses the predetermined exclusive user to initiate a data writing request to the first server; In response to the data write request, data is written into the first database table of the first server.
6. The method according to any one of claims 1 to 4, characterized in that The predetermined exclusive users include: multiple accounts with exclusive tags.
7. The method according to any one of claims 1 to 4, characterized in that The first client detects whether there is data in the temporary table, including: The first client detects whether there is data in the temporary table according to a predetermined period.
8. The method according to any one of claims 1 to 4, characterized in that After the first server detects whether the user who writes data in the first database table is a predetermined exclusive user, the method further includes: In a case where the user who writes the data is the predetermined exclusive user, the data written to the first database table is saved.
9. A computer program product storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
10. A computer device, comprising at least a memory and a processor, wherein a computer program is stored in the memory, wherein: The processor implements the steps of the method of any one of claims 1 to 8 when executing the computer program on the memory.
11. A storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
A table-level bidirectional synchronization realization method and system based on trigger
CN109271444A
Bidirectional synchronization method and synchronization device for heterogeneous database based on log analysis
CN112035463A
Cited By
Database synchronization method, electronic equipment, storage medium and program product
CN121071033A
