In-memory database synchronization method, system, device and storage medium

By inserting and parsing identification instructions into the data transferred between memory databases, the problem of dead loop in the two-way synchronization of memory databases under the dual-center system architecture is solved, and the data is not synchronized and consistently transmitted.

CN114579662BActive Publication Date: 2025-04-29CHINA MOBILE INFORMATION TECHNOLOGY CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011376922.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-30
Publication Date
2025-04-29
Estimated Expiration
2040-11-30

AI Technical Summary

Technical Problem

Under the dual-center system deployment architecture, the existing in-memory database data synchronization middleware cannot achieve bidirectional synchronization, which is prone to vicious cycle synchronization.

Method used

To avoid a dead loop by inserting identification instructions into data transferred between in-memory databases, parsing and deleting these instructions. The specific method includes inserting a first identification instruction into the data sent by the first memory database, and deleting the instruction after the second memory database receives the data, preventing the data from being re-echoed. Similarly, a second identification instruction is inserted into the data generated by the second memory database, and the instruction is deleted after the first memory database receives the data.

Benefits of technology

It realizes the non-deadly cycle data transmission of two-way synchronization of in-memory databases, ensuring the synchronization consistency of data between two in-memory databases, and avoiding the problem of data inconsistency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114579662B_ABST
    Figure CN114579662B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a method, system, device and storage medium for synchronizing a memory database, the method comprising: receiving first data from a first memory database; updating data of a second memory database based on the first data; determining the first data as second data that needs to be sent to the first memory database; parsing the second data to obtain a parsing result; if the parsing result includes a first identification instruction, deleting the first identification instruction and prohibiting the second data from being sent to the first memory database, the first identification instruction being instruction data that the first memory database inserts into the first data when sending the first data. The method according to the embodiment of the present invention can realize bidirectional synchronization of memory databases and avoid an infinite loop during synchronization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of databases, and in particular relates to a method, system, device and storage medium for synchronizing a memory database. Background Art

[0002] With the continuous development of the Internet era, Internet systems are undergoing "dual-center" construction. Dual centers generally have two types: "disaster recovery" (single computer room carries business) and "dual active" (dual computer rooms carry business at the same time). Under the dual-center system deployment architecture, there will be problems such as data migration, data sharing, and real-time synchronization.

[0003] The official database provides some data migration functions, but they are not suitable for the "dual-center" deployment architecture. The in-memory database data synchronization middleware on the market is generally more suitable for "disaster recovery" dual centers, but not for "active-active" dual centers. It only supports one-way synchronization and cannot solve the problem of two-way synchronization. During two-way synchronization, an infinite synchronization loop will occur between the two memory databases. For example, when data changes in the first memory database, it needs to be synchronized to the second memory database. Similarly, when data changes in the second memory database, it must also be synchronized to the first memory database. However, the data synchronized from the first memory database to the second memory database cannot be returned from the second memory database to the first memory database, otherwise an infinite synchronization loop will occur. Summary of the invention

[0004] The embodiments of the present invention provide a method, system, device and storage medium for synchronizing a memory database, which can avoid the occurrence of an infinite loop synchronization in bidirectional synchronization of a memory database.

[0005] In a first aspect, an embodiment of the present invention provides a method for synchronizing an in-memory database, the method comprising: receiving first data from a first in-memory database; updating data in a second in-memory database based on the first data; determining the first data as second data that needs to be sent to the first in-memory database; parsing the second data to obtain a parsing result; when the parsing result includes a first identification instruction, deleting the first identification instruction and prohibiting the second data from being sent to the first in-memory database, the first identification instruction being instruction data that the first in-memory database inserts into the first data when sending the first data.

[0006] In an optional embodiment, the method further includes:

[0007] Acquire third data, where the third data is data that needs to be synchronized to the first memory database;

[0008] inserting a second identification instruction into the third data;

[0009] The third data carrying the second identification instruction is sent to the first memory database, so that the first memory database completes data update based on the third data.

[0010] In an optional implementation, when the third data is a transaction operation instruction set, the second identification instruction includes a first sub-instruction and a second sub-instruction;

[0011] In the third data, inserting a second identification instruction includes:

[0012] The first sub-instruction and the second sub-instruction are respectively inserted into the head and tail of the third data, so that the first memory database deletes the first sub-instruction and the second sub-instruction when parsing the second sub-instruction, and does not determine the third data as data that needs to be synchronized to the second memory database.

[0013] In an optional implementation, when the third data is a basic data structure instruction, inserting a second identification instruction into the third data includes:

[0014] A second identification instruction is inserted into the header of the third data.

[0015] In an optional implementation, updating the data of the second memory database based on the first data specifically includes:

[0016] Parsing the first data to obtain first parsed data;

[0017] When the first parsed data includes the first identification instruction, the third identification instruction and the first target data, the first target data is stored, where the first target data is the updated data in the first memory database, and

[0018] The first identification instruction and the third identification instruction are deleted, and the first data is not determined as the second data that needs to be sent to the first memory database;

[0019] When the first parsed data only includes the first identification instruction and the first target data, the first identification instruction and the first target data are stored, and the first target data is the updated data in the first memory database.

[0020] In a second aspect, an embodiment of the present invention provides a memory database synchronization system, the system comprising:

[0021] A first acquisition module is configured to receive first data from a first memory database;

[0022] A first update module is configured to update data on the second memory database based on the first data;

[0023] An information processing module is configured to determine the first data as second data that needs to be sent to the first memory database;

[0024] A first parsing module is configured to parse the second data to obtain a parsing result;

[0025] The first judgment module is configured to delete the first identification instruction and prohibit sending the second data to the first memory database when the parsing result includes the first identification instruction. The first identification instruction is instruction data inserted into the first data by the first memory database when sending the first data.

[0026] In a third aspect, an embodiment of the present invention provides a memory database synchronization device, the device comprising: a processor, and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the memory database synchronization method provided in the first aspect and any optional implementation manner in the first aspect.

[0027] In a fourth aspect, an embodiment of the present invention provides a computer storage medium having computer program instructions stored thereon, which, when executed by a processor, implements the memory database synchronization method provided in the first aspect and any optional implementation manner in the first aspect.

[0028] According to the in-memory database bidirectional synchronization method, system, device and storage medium of the embodiments of the present invention, the second in-memory database can complete data update based on the first data, and after the data update, the first data is determined as the second data that needs to be synchronized to the first in-memory database. When the first identification data in the second data is parsed, the first identification data is deleted to complete the data synchronization, and the second data is stopped from being sent to the first in-memory database, so as to avoid an infinite loop problem during synchronization. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the technical solution of the embodiment of the present invention, the following is a brief introduction to the drawings required for use in the embodiment of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0030] Figure 1 is a schematic diagram of an infinite loop process during bidirectional synchronization in an embodiment of the present invention;

[0031] Figure 2 It is a flowchart of a method for bidirectional synchronization of a memory database provided by an embodiment of the present invention;

[0032] Figure 3 It is a schematic diagram of a bidirectional synchronization process of a transaction operation instruction set provided by an embodiment of the present invention;

[0033] Figure 4 It is a schematic diagram of a bidirectional synchronization process of a basic data structure provided by an embodiment of the present invention;

[0034] Figure 5 It is a structural diagram of a bidirectional synchronization system of an in-memory database provided by an embodiment of the present invention;

[0035] Figure 6 It is a structural diagram of a memory database bidirectional synchronization device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0036] The features and exemplary embodiments of various aspects of the present invention will be described in detail below. In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present invention, rather than to limit the present invention. For those skilled in the art, the present invention can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present invention by illustrating examples of the present invention.

[0037] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0038] With the continuous development of the Internet era, Internet systems with extremely high real-time requirements are undergoing "dual" center construction. Dual centers generally have two types: "disaster recovery" (single computer room carries business) and "dual active" (dual computer rooms carry business at the same time). Under the dual-center system deployment architecture, there will be many problems such as data migration, data sharing, and real-time synchronization.

[0039] The official relational database provides data synchronization solutions, such as the Oracle database synchronization solution (Oracle Golden Gate, OGG), and the MySQL database Dual Master synchronization solution. The in-memory database also provides data synchronization solutions, such as master-slave replication. However, the data migration function officially provided by the in-memory database is not suitable for the "dual-center" deployment architecture. In the case of two centers sharing a set of in-memory databases, there will be cross-center data access, and the network delay between the two centers will affect the access and operation efficiency. Therefore, in order to solve the in-memory database to cope with the "dual-center" scenario, many open source project groups in the industry have developed data synchronization middleware. The characteristics of these middleware are as follows:

[0040] 1. Support parsing of data files or instructions of the memory database, and realize backup and recovery functions based on data files or instructions;

[0041] 2. Under certain conditions, the full synchronization and incremental real-time synchronization of data between two memory database nodes can be realized, and the synchronized data can be selected and filtered according to certain rules;

[0042] 3. It has higher performance and will not affect the data recovery and synchronization rate due to the introduction of the middleware itself.

[0043] However, the current in-memory database data synchronization middleware on the market or open source, in order to ensure its versatility and flexibility, is generally positioned as a data migration tool. This type of middleware is generally more suitable for "disaster recovery" dual centers, but not for "active-active" dual centers. The main reasons are as follows:

[0044] 1. It only supports one-way synchronization and cannot solve the problem of two-way synchronization. Figure 1 As shown in the figure, two sets of master-slave Redis memory databases R1 and R2, as well as two data synchronization middlewares M1 and M2 are deployed in centers A and B respectively. Bidirectional synchronization will cause the following "dead loop" problem:

[0045] ① An instruction is executed in the memory database R1 of center A;

[0046] ② The data synchronization middleware M1 of center A will synchronize the instruction to the memory database of center B;

[0047] ③ The memory database R2 of center B is synchronized successfully, and the data synchronization middleware M2 of center B will still synchronize the instruction to the memory database of center A.

[0048] 2. In the "active-active" architecture, conflict-free replicated data (CRDT) is prone to data inconsistency. This is also a common problem encountered by all two-way synchronization solutions, and to a certain extent also limits the data synchronization problem of "non-hot data" (that is, data that is not frequently modified in an extremely short unit of time).

[0049] Based on this, the embodiments of the present application provide a memory database synchronization method, system, device and storage medium for "non-hot data", which can be applied to the "less write and more read" business scenario under the active-active deployment architecture. In the process of two-way synchronization of the "dual active-active" memory database, the problem of data inconsistency caused by two-way synchronization is reduced, and the "dead loop" problem caused by two-way synchronization is solved. Ultimately, under the "dual-center" deployment architecture, two different computer room memory databases execute different instructions respectively, which can be synchronized to the memory database of the opposite computer room. The following embodiments are mainly described in detail using the Redis memory database as an example.

[0050] The following first introduces a memory database synchronization method provided by an embodiment of the present invention. Figure 2 , a flowchart of a memory database synchronization method provided by an embodiment of the present application. The execution subject of each step of the method is the aforementioned synchronization middleware, and the method may include steps S101 to S105.

[0051] S101. Receive first data from a first memory database.

[0052] During the bidirectional synchronization process, the second memory database can receive the first data synchronized from the first memory database, where the first data includes the updated data in the first memory database, wherein the updated data in the first memory database can be a basic data structure instruction or a transaction operation instruction set.

[0053] S102. Update the second memory database based on the first data.

[0054] The second memory database can parse the received first data, and then store the parsed content to complete the data update of the second memory database. The parsed content at least includes the updated data in the first memory database.

[0055] S103. Determine the first data as second data that needs to be sent to the first memory database.

[0056] After the second memory database parses and stores the parsed content, the data in the second database is updated compared to before the data is stored. Therefore, the second memory database determines the updated content, that is, the first data, as the content that needs to be synchronized to the first memory database, that is, the second data.

[0057] S104. Analyze the second data to obtain analysis results.

[0058] After the second memory database determines the second data, before sending the second data to the first memory database, the second memory database will parse the second data again to obtain a parsing result.

[0059] S105. When the parsing result includes a first identification instruction, delete the first identification instruction and prohibit sending the second data to the first memory database. The first identification instruction is instruction data inserted into the first data by the first memory database when sending the first data.

[0060] When the second memory database parses the second data to contain a preset first identification instruction, the second memory database will delete the first identification instruction. Among them, the first identification instruction is the identification data of the first database, and is also the instruction data inserted into the first data by the first memory database before sending the first data to the second memory database. After deleting the first identification instruction, the second memory database will terminate the operation of sending the second data to the first memory database, avoiding the problem of an infinite loop. Moreover, after deleting the first identification instruction, the data in the second memory database is consistent with the first memory database, achieving synchronization, removing redundant data, namely the first identification instruction data, and solving the problem of inconsistent CRDT data under the "active-active" architecture.

[0061] An embodiment of the present application provides a memory database synchronization method, in which a second memory database can complete data update based on first data, and after the data update, the first data is determined as second data that needs to be synchronized to the first memory database, and when first identification data in the second data is parsed, the first identification data is deleted to complete data synchronization, and the second data is stopped from being sent to the first memory database, thereby achieving conflict-free data replication and avoiding an infinite loop problem during synchronization.

[0062] The memory database synchronization method provided in the above embodiment only provides a synchronization method when the update data comes from the peer memory database, that is, the first database. However, in actual use, the update of the second database may also be generated by its own operation. Therefore, the memory database synchronization method provided in the embodiment of the present application may also include steps S106-S108.

[0063] S106. Obtain third data, where the third data is data that needs to be synchronized to the first memory database.

[0064] In bidirectional synchronization, when the second memory database updates its own data, it needs to synchronize its updated data to the first memory database. The second memory database needs to obtain the updated data first, that is, the third data.

[0065] S107. Insert a second identification instruction into the third data.

[0066] The second identification instruction should be customized in combination with the memory database kernel and the tag value. The tag value can be generated by using the third data as an input value through an algorithm. The generation algorithm must ensure that the tag value after the algorithm processing uniquely corresponds to the input value before the algorithm processing. The tag algorithm can be but not limited to MD5, DES, etc. The tag value can also use a non-data-related algorithm, which can be but not limited to a timestamp, etc.

[0067] The third data acquired by the second memory database needs to be synchronized to the first memory database. In the process of two-way synchronization, in order to avoid an infinite loop, before sending the updated data, i.e., the third data, to the first memory database, a second identification instruction can be inserted into the third data. The second identification instruction is the identification data of the second database, and is also the instruction data used to avoid an infinite loop.

[0068] S108. Send the third data carrying the second identification instruction to the first memory database, so that the first memory database completes data update based on the third data.

[0069] After inserting the second identification instruction into the third data, the second memory database sends the third data to the first memory database. The first memory database can complete data synchronization according to steps similar to steps S101-S105, because the third data includes the second identification instruction, which is equivalent to the first identification instruction in steps S101-S105, so there will be no dead loop synchronization, and the first database will delete the second identification instruction at the end, removing redundant data and solving the problem of CRDT data inconsistency under the "active-active" architecture.

[0070] In one example, in bidirectional synchronization, step S107 may perform different processing according to the data operation type of the third data, where the data operation type includes a transaction operation instruction set and a basic data structure instruction.

[0071] In a specific example, when the third data is a transaction operation instruction set, the second identification instruction includes a first sub-instruction and a second sub-instruction;

[0072] At this time, step S107 may specifically include inserting the first sub-instruction and the second sub-instruction at the head and tail of the third data, respectively, so that the first memory database deletes the first sub-instruction and the second sub-instruction when parsing the second sub-instruction, and does not determine the third data as data that needs to be synchronized to the second memory database.

[0073] In order to better understand the specific synchronization method in the example of the present application when the third data is a transaction operation instruction set, a specific example is used to introduce it in detail below.

[0074] like Figure 3 As shown, a transaction operation is executed in the Redis database of center A. After the transaction is completed, the data synchronization middleware of center A will pull the transaction operation, and then convert different transaction operations into a preset format. When it is found that the transaction instruction does not contain the first identification instruction, it means that the transaction instruction set is executed for the first time, so the first sub-instruction and the second sub-instruction are inserted at the beginning and end of the transaction, and packaged and sent to the memory database of the peer center for execution. After the execution of the memory database of center B is successful, the first sub-instruction and the second sub-instruction will be deleted, and the transaction operation will be prohibited from being sent to center A. Therefore, the entire transaction operation is no longer synchronized, thereby solving the "dead loop" problem of two-way synchronization of transaction operations.

[0075] In another specific example, when the third data is a basic data structure instruction, step S107 specifically includes inserting a second identification instruction into the header of the third data.

[0076] In order to better understand the specific synchronization method in the example of this application when the third data is the basic data structure instruction, a detailed introduction is given below through a specific example.

[0077] like Figure 4 As shown, the Redis memory database of center A executes the basic data structure instruction. After the instruction is completed, the synchronization middleware of center A will pull the instruction, and the parsing module will generate an identifier for the instruction through the marking algorithm, and then package the second identification instruction and the basic data structure instruction into a transaction and synchronize it to the memory database of center B. After the memory database of center B is synchronized, the synchronization middleware of center B will still pull the instruction. First, it will parse that there is a second identification instruction in the transaction operation. It can be judged that the basic data structure instruction in the transaction is synchronized from the peer center and has been executed successfully, so it will no longer synchronize and delete the second identification instruction, ensuring that there is no redundant redundant data in the Redis memory database of center B, thereby solving the "dead loop" problem of two-way synchronization of basic data structures.

[0078] In one example, the above two examples are processed differently according to the data operation type of the third data, and both can adopt the processing method for the transaction operation instruction set, that is, inserting the first sub-instruction and the second sub-instruction at the head and tail of the third data respectively to solve the "dead loop" problem of bidirectional synchronization, because the advantage of this method is that it will not generate redundant data after execution in the target memory database. However, considering that most of the instructions of the basic data structure type are one, adding two instructions before and after will increase the memory and network overhead to a certain extent compared with adding one marking instruction, so targeted adjustments are made for this.

[0079] In one embodiment, step S102 may specifically include steps S1021 - S1023 .

[0080] S1021. Analyze the first data to obtain first analyzed data;

[0081] S1022. When the first parsed data includes the first identification instruction, the third identification instruction and the first target data, the first target data is stored, and the first target data is the data updated in the first memory database, and

[0082] The first identification instruction and the third identification instruction are deleted, and the first data is not determined as the second data that needs to be sent to the first memory database;

[0083] S1023. When the first parsed data only includes the first identification instruction and the first target data, the first identification instruction and the first target data are stored, and the first target data is the updated data in the first memory database.

[0084] Corresponding to the memory database synchronization method provided in the embodiment of the present application, the embodiment of the present application also provides a memory database synchronization system, please refer to Figure 5 , the system may include:

[0085] A first acquisition module 501 is configured to receive first data from a first memory database;

[0086] A first updating module 502 is configured to update data on the second memory database based on the first data;

[0087] The information processing module 503 is configured to determine the first data as second data that needs to be sent to the first memory database;

[0088] A first parsing module 504 is configured to parse the second data to obtain a parsing result;

[0089] The first judgment module 505 is configured to delete the first identification instruction and prohibit sending the second data to the first memory database when the parsing result includes the first identification instruction. The first identification instruction is instruction data inserted into the first data by the first memory database when sending the first data.

[0090] An in-memory database synchronization system provided by an embodiment of the present application can realize bidirectional synchronization of two in-memory databases and can effectively avoid the occurrence of dead loop synchronization during the bidirectional synchronization process.

[0091] In one embodiment, Figure 5 Compared with the in-memory database synchronization system shown in the embodiment, it can also include a second acquisition module, a first insertion module, and a first sending module.

[0092] A second acquisition module is configured to acquire third data, where the third data is data that needs to be synchronized to the first memory database;

[0093] A first inserting module is configured to insert a second identification instruction into the third data;

[0094] The first sending module is configured to send the third data carrying the second identification instruction to the first memory database, so that the first memory database completes data update based on the third data.

[0095] In one example, the first insertion module is specifically configured to, when the third data is a transaction operation instruction set, include the second identification instruction as the first sub-instruction and the second sub-instruction, and to insert the first sub-instruction and the second sub-instruction at the head and tail of the third data, respectively, so that the first memory database deletes the first sub-instruction and the second sub-instruction when parsing the second sub-instruction, and does not determine the third data as data that needs to be synchronized to the second memory database.

[0096] In one example, the first insertion module is specifically configured to insert the second identification instruction into the third data when the third data is a basic data structure instruction, and insert the second identification instruction into the header of the third data.

[0097] In one embodiment, Figure 5 Compared with the in-memory database synchronization system shown in the embodiment, the first update module 502 may include a first parsing submodule, a first information processing submodule, and a second information processing submodule.

[0098] A first parsing submodule is configured to parse the first data to obtain first parsed data;

[0099] A first information processing submodule is configured to store the first target data when the first parsed data includes the first identification instruction, the third identification instruction and the first target data, wherein the first target data is the updated data in the first memory database, and

[0100] The first identification instruction and the third identification instruction are deleted, and the first data is not determined as the second data that needs to be sent to the first memory database;

[0101] The second information processing submodule is configured to store the first identification instruction and the first target data when the first parsed data only includes the first identification instruction and the first target data, and the first target data is the updated data in the first memory database.

[0102] The memory database synchronization method provided in the above embodiments can be implemented by Figure 6 The in-memory database synchronization device execution is shown.

[0103] The memory database synchronization device may include a processor 601 and a memory 602 storing computer program instructions.

[0104] Specifically, the processor 601 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiment of the present invention.

[0105] The memory 602 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 602 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In one example, the memory 602 may include a removable or non-removable (or fixed) medium, or the memory 602 is a non-volatile solid-state memory. The memory 602 may be inside or outside the integrated gateway disaster recovery device.

[0106] In one example, the memory 602 may be a read-only memory (ROM). In one example, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or a flash memory, or a combination of two or more of these.

[0107] The memory 602 may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, in general, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.

[0108] The processor 601 reads and executes the computer program instructions stored in the memory 602 to implement the memory database synchronization method provided by any of the above embodiments and achieve the corresponding technical effects achieved by the method, which will not be repeated here for the sake of brevity.

[0109] In one example, the memory database synchronization device may further include a communication interface 603 and a bus 610. Figure 6 As shown, the processor 601, the memory 602, and the communication interface 603 are connected via a bus 610 and communicate with each other.

[0110] The communication interface 603 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiment of the present invention.

[0111] Bus 610 includes hardware, software or both, and couples the components of online data traffic billing equipment to each other. For example, but not limitation, the bus may include Accelerated Graphics Port (AGP) or other graphics bus, Enhanced Industry Standard Architecture (EISA) bus, Front Side Bus (FSB), Hyper Transport (HT) interconnection, Industry Standard Architecture (ISA) bus, InfiniBand interconnection, Low Pin Count (LPC) bus, Memory bus, Micro Channel Architecture (MCA) bus, Peripheral Component Interconnect (PCI) bus, PCI-Express (PCI-X) bus, Serial Advanced Technology Attachment (SATA) bus, Video Electronics Standards Association Local (VLB) bus or other suitable bus or two or more of these combinations. Where appropriate, bus 610 may include one or more buses. Although the embodiments of the present invention describe and illustrate specific buses, the present invention contemplates any suitable bus or interconnection.

[0112] The memory database synchronization device can realize two-way synchronization of two memory databases, and can effectively avoid the situation of dead loop synchronization during the two-way synchronization process.

[0113] In combination with the memory database synchronization method in the above embodiment, the embodiment of the present invention can provide a computer storage medium to implement. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any memory database synchronization method in the above embodiment is implemented.

[0114] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.

[0115] The functional blocks shown in the structural block diagram described above can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier. "Machine-readable medium" may include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROMs, flash memories, erasable ROMs (EROMs), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, and the like. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.

[0116] It should also be noted that the exemplary embodiments mentioned in the present invention describe some methods or systems based on a series of steps or devices. However, the present invention is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiments, or in a different order from the embodiments, or several steps can be performed simultaneously.

[0117] Aspects of the present disclosure are described above with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the functions / actions specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0118] The above is only a specific implementation of the present invention. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the system, module and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. It should be understood that the protection scope of the present invention is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be covered within the protection scope of the present invention.

Claims

1. A method for synchronizing a memory database, characterized in that: include: Receiving first data from a first memory database, wherein the first data includes updated data in the first memory database; Update the second memory database based on the first data; Determining the first data as second data that needs to be sent to the first memory database; parsing the second data to obtain a parsing result; In a case where the parsing result includes a first identification instruction, deleting the first identification instruction and prohibiting the second data from being sent to the first memory database, wherein the first identification instruction is instruction data inserted into the first data by the first memory database when sending the first data; Acquire third data, where the third data is data that needs to be synchronized to the first memory database, and the third data is update data generated by the second memory database based on its own operation; inserting a second identification instruction into the third data; Sending the third data carrying the second identification instruction to the first memory database, so that the first memory database completes data update based on the third data; When the third data is a transaction operation instruction set, the second identification instruction includes a first sub-instruction and a second sub-instruction; The inserting of the second identification instruction into the third data comprises: inserting a first sub-instruction and a second sub-instruction into the head and tail of the third data respectively, so that the first memory database deletes the first sub-instruction and the second sub-instruction when parsing the second sub-instruction, and does not determine the third data as data that needs to be synchronized to the second memory database; When the third data is a basic data structure instruction, inserting a second identification instruction into the third data includes: Inserting a second identification instruction into the header of the third data; The second identification instruction is generated based on the memory database kernel and the tag value, and the tag value is generated by an algorithm using the third data as an input value, and the generation algorithm can ensure that the tag value after algorithm processing uniquely corresponds to the input value before algorithm processing.

2. The method according to claim 1, characterized in that The updating of data in the second memory database based on the first data specifically includes: Parsing the first data to obtain first parsed data; When the first parsed data includes a first identification instruction, a third identification instruction, and first target data, storing the first target data, where the first target data is updated data in the first memory database, and deleting the first identification instruction and the third identification instruction, and not determining the first data as second data that needs to be sent to the first memory database; When the first parsed data only includes the first identification instruction and the first target data, the first identification instruction and the first target data are stored, and the first target data is the updated data in the first memory database.

3. A memory database synchronization system, characterized in that: include: A first acquisition module is configured to receive first data from a first memory database, wherein the first data includes updated data in the first memory database; A first updating module is configured to update data on a second memory database based on the first data; an information processing module, configured to determine the first data as second data that needs to be sent to the first memory database; A first parsing module is configured to parse the second data to obtain a parsing result; a first judgment module, configured to delete a first identification instruction and prohibit sending the second data to the first memory database when the parsing result includes the first identification instruction, wherein the first identification instruction is instruction data inserted into the first data by the first memory database when sending the first data; A second acquisition module is configured to acquire third data, where the third data is data that needs to be synchronized to the first memory database, and the third data is update data generated by the second memory database based on its own operation; A first inserting module, configured to insert a second identification instruction into the third data; A first sending module is configured to send the third data carrying the second identification instruction to the first memory database, so that the first memory database completes data update based on the third data; The first insertion module is specifically configured to, when the third data is a transaction operation instruction set, the second identification instruction includes a first sub-instruction and a second sub-instruction, and insert the first sub-instruction and the second sub-instruction into the head and tail of the third data respectively, so that the first memory database deletes the first sub-instruction and the second sub-instruction when parsing the second sub-instruction, and does not determine the third data as data that needs to be synchronized to the second memory database; The first inserting module is specifically configured to insert a second identification instruction into the header of the third data when the third data is a basic data structure instruction; The second identification instruction is generated based on the memory database kernel and the tag value, and the tag value is generated by an algorithm using the third data as an input value, and the generation algorithm can ensure that the tag value after algorithm processing uniquely corresponds to the input value before algorithm processing.

4. A memory database synchronization device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the memory database synchronization method according to any one of claims 1-2.

5. A computer storage medium, characterized in that: The computer storage medium stores computer program instructions, and when the computer program instructions are executed by the processor, the memory database synchronization method according to any one of claims 1 to 2 is implemented.

Citation Information

Patent Citations

  • A table-level bidirectional synchronization realization method and system based on trigger

    CN109271444A

  • Cross-machine-room synchronous distributed cache cluster device and method

    CN110990432A