CN110909007B - Data synchronization method, data synchronization device and storage medium - Google Patents
Data synchronization method, data synchronization device and storage medium Download PDFInfo
- Publication number
- CN110909007B CN110909007B CN201911025083.9A CN201911025083A CN110909007B CN 110909007 B CN110909007 B CN 110909007B CN 201911025083 A CN201911025083 A CN 201911025083A CN 110909007 B CN110909007 B CN 110909007B
- Authority
- CN
- China
- Prior art keywords
- data
- client
- server
- changed
- change
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 73
- 230000008859 change Effects 0.000 claims abstract description 53
- 238000013506 data mapping Methods 0.000 claims abstract description 25
- 238000012545 processing Methods 0.000 claims abstract description 19
- 230000008569 process Effects 0.000 claims abstract description 17
- 230000006870 function Effects 0.000 claims description 9
- 238000004590 computer program Methods 0.000 claims description 8
- 230000005540 biological transmission Effects 0.000 abstract description 12
- 230000009286 beneficial effect Effects 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 8
- 238000004891 communication Methods 0.000 description 4
- 238000013507 mapping Methods 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000013473 artificial intelligence Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000004806 packaging method and process Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 238000012508 change request Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2365—Ensuring data consistency and integrity
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a data synchronization method, which is based on a server, through pre-establishing data mapping of client data and server data, when data synchronization transmission is carried out, after client change data of a client is obtained, the data to be changed of the server corresponding to the client change data can be determined according to the pre-established data mapping, and therefore, the change of the data to be changed of the server can be completed according to the client change data. It can be seen that, through the data mapping of the client data and the server data in advance, the data can be transmitted in a small data block manner without being packaged with the associated data, so that the data transmission process in the data synchronization task can occupy smaller bandwidth, the stability and the fluency in the data synchronization process are improved, and the data synchronization method is more suitable for the data processing requirements of high-level services compared with the prior art. The invention also discloses a data synchronization device, data synchronization equipment and a storage medium, which have the beneficial effects.
Description
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a data synchronization method, a data synchronization apparatus, a data synchronization device, and a storage medium.
Background
Data synchronization is a common data processing task in a system or a device. In the existing basic method, a semaphore, a message queue, and other mechanisms are generally used to transfer data between different processes. Semaphores (sometimes called semaphores) are a facility used in a multi-threaded environment that can be used to ensure that two or more critical code sections are not called concurrently, that a thread must acquire a Semaphore before entering a critical code section, that the thread must release the Semaphore once the critical code section is complete, and that other threads that want to enter the critical code section must wait until the first thread releases the Semaphore. A "message queue" is a container that holds messages during the transmission of the messages, the message queue manager acts as a man-in-the-middle in relaying a message from its source to its destination, the primary purpose of the queue is to provide routing and to guarantee delivery of the message; if the recipient is not available when the message is sent, the message queue will hold the message until it can be successfully delivered.
In the existing data synchronization task, data transmission is often performed based on the two principles, but the basic methods can be simply used in a small business range, but for business level businesses, the business requirements cannot be met at all only by using the basic methods, the logic becomes more complex, and more maintenance cost is increased. The reason for this is that when data is transmitted in a semaphore manner, in order to ensure integrity of data information, it is often necessary to package and send the changed data and data associated with the changed data to a receiving end, and a large data block for transmission brings challenges to the operating speed and execution efficiency of a system.
The technical problem to be solved by the technical personnel in the field is to provide a data synchronization method which meets the data processing requirement of high-level services and improves the stability and the fluency in the data synchronization process.
Disclosure of Invention
The invention aims to provide a data synchronization method, a data synchronization device, data synchronization equipment and a storage medium, which are used for improving the stability and the fluency in the data synchronization process and adapting to the data processing requirements of high-level services.
In order to solve the above technical problem, the present invention provides a data synchronization method, which is based on a server and includes:
pre-establishing data mapping of client data and server data;
acquiring client change data of a client;
searching the data to be changed of the server corresponding to the changed data of the client according to the data mapping;
and changing the data to be changed of the server side according to the client side changed data.
Optionally, the establishing of the data mapping between the client data and the server data specifically includes:
establishing a data ID of the client data and a data ID of the server data; wherein only a corresponding pair of the client data and the server data have the same data ID;
correspondingly, the acquiring of the client change data of the client specifically includes:
receiving a data ID of the client changing data, and acquiring the client address calculated according to the data ID of the client changing data;
acquiring the client changing data according to the client address;
the searching for the data to be changed of the server corresponding to the client changed data according to the data mapping specifically comprises:
and searching the data to be changed of the server according to the data ID of the changed data of the client.
Optionally, the establishing the data ID of the client data and the data ID of the server data specifically includes:
numbering a pair of the client data and the server data in a for loop traversal mode to obtain a data ID of the client data and a data ID of the server data.
Optionally, the obtaining of the client address calculated according to the data ID specifically includes:
and acquiring the client address which is sent by the client and calculated by utilizing a callback function according to the data ID of the client change data.
Optionally, before the obtaining the client change data according to the client address, the method further includes:
and storing the client address in a preset temporary data space.
Optionally, the changing the data to be changed at the server side according to the client side changed data specifically includes:
judging whether the client changed data is consistent with the data to be changed of the server;
if so, not changing the data to be changed of the server;
and if not, changing the data to be changed of the server side according to the client side changed data.
Optionally, after the data to be changed of the server is changed according to the client changed data, the method further includes:
and sending a data change notification to a client of another device so that the client of the another device and a server of the another device complete the change of data to be changed of the server of the another device.
In order to solve the above technical problem, the present invention further provides a data synchronization apparatus, including:
the data mapping unit is used for pre-establishing data mapping between the client data and the server data;
an acquisition unit configured to acquire client change data of a client;
the searching unit is used for searching the data to be changed of the server corresponding to the client changed data according to the data mapping;
and the synchronization unit is used for changing the data to be changed of the server side according to the client side changed data.
In order to solve the above technical problem, the present invention further provides a data synchronization apparatus, including:
a memory for storing instructions, the instructions comprising the steps of any of the above described data synchronization methods;
a processor to execute the instructions.
To solve the above technical problem, the present invention further provides a storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the data synchronization method according to any one of the above items.
The data synchronization method provided by the invention is based on the server, and the data to be changed of the server corresponding to the client changed data can be determined according to the pre-established data mapping after the client changed data of the client is acquired during the data synchronization transmission by pre-establishing the data mapping between the client data and the server data, so that the data to be changed of the server can be changed according to the client changed data. It can be seen that, through the data mapping of the client data and the server data in advance, the data can be transmitted in a small data block manner without data packaging associated with the data. By reducing the data blocks to be transmitted, the data transmission process in the data synchronization task can occupy smaller bandwidth, the stability and the fluency in the data synchronization process are improved, and the data synchronization method is more suitable for the data processing requirements of high-level services compared with the prior art. The invention also provides a data synchronization device, data synchronization equipment and a storage medium, which have the beneficial effects and are not described herein again.
Drawings
In order to more clearly illustrate the embodiments or technical solutions of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
Fig. 1 is an architecture diagram of a data synchronization system according to an embodiment of the present invention;
fig. 2 is a flowchart of a data synchronization method according to an embodiment of the present invention;
FIG. 3 is a flow chart of another data synchronization method according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a data transmission process according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a data synchronization apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a data synchronization device according to an embodiment of the present invention.
Detailed Description
The core of the invention is to provide a data synchronization method, a data synchronization device, data synchronization equipment and a storage medium, which are used for improving the stability and the fluency in the data synchronization process and adapting to the data processing requirements of high-level services.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is an architecture diagram of a data synchronization system according to an embodiment of the present invention.
For ease of understanding, a system architecture to which the present invention is applicable will first be described. The embodiments of the present invention may be applied to data synchronization between modules in a device (e.g., data synchronization between different processes), and data synchronization between devices in a system. The client and the server mentioned in the embodiments of the present invention both refer to the client and the server located in the same module, that is, on the same module, the client corresponds to local data, and the server corresponds to actual data being run. After the client side carries out data change, the client side is synchronized to the server side, and then the server side informs the client sides of other modules to carry out data synchronization.
As shown in fig. 1, the data synchronization system to which the present invention is applied includes a first module 100 and a second module 200, where the first module 100 includes a first client 101 and a second server 202, and the second module 200 includes a second client 201 and a second server 202.
In practical application, after receiving the data change of the local data of the first module 100, the first client 101 sends a data change request to the first server 102, and after completing the data change of the actual data according to the data change of the local data, the first server 102 notifies the second client 201 of the second module 200, and repeats the above processes.
It will be appreciated that there are other modules besides the second module 200, which can synchronize data between and across modules in the manner described above.
Based on the above framework, the following describes a data synchronization method provided by an embodiment of the present invention with reference to the accompanying drawings.
Fig. 2 is a flowchart of a data synchronization method according to an embodiment of the present invention.
As shown in fig. 2, the data synchronization method provided in the embodiment of the present invention includes:
s201: a data mapping of client data and server data is pre-established.
Establishing the data mapping of the client data and the server data is to establish a one-to-one correspondence relationship between the client data and the server data. To this end, an address mapping between the address of the client data and the address of the server data may be established, but may change from time to time since the address of the client data is a temporary address. Therefore, a better implementation is to directly establish mapping between data, such as establishing the same identifier for a corresponding pair of client data and server data, so as to uniquely determine a pair of client data and server data by the identifier.
For the data synchronization system applicable to the invention, the step is carried out on each module, and in order to reduce the mapping tables required to be maintained, the same identification can be established for the corresponding data in each module.
S202: and after the data change occurs in the client, sending a data synchronization request to the server.
S203: and the server side acquires client side change data of the client side.
And after the client side changes the data, sending a data synchronization request to the server side, and acquiring client side changed data of the client side by the server. In a specific implementation, the client change data may be directly sent to the server for the client, where a message queue mechanism is further adopted. Or, the client may send only the address or identifier of the client data to the server, and the server obtains the client change data from the client.
S204: and the server searches the data to be changed of the server corresponding to the changed data of the client according to the data mapping.
According to the data mapping, the server can find the data to be changed of the server corresponding to the changed data of the client.
S205: and the server side changes the data to be changed of the server side according to the client side changed data.
In specific implementation, the server may directly replace the data to be changed by the client changing data. In order to reduce unnecessary replacement, step S205 may specifically include:
judging whether the client changed data is consistent with the data to be changed of the server;
if so, not changing the data to be changed of the server;
if not, changing the data to be changed of the server side according to the client changed data.
The steps are used for transmitting data between the client and the server on the same module, and data synchronization between local data and actual data on the module is achieved. After step S205, the method further includes:
and the server side sends a data change notification to the client side of the other device so that the client side of the other device and the server side of the other device complete the change of the data to be changed of the server side of the other device.
The other device here refers to the second module in the structure shown in fig. 1, that is, the module has the same client/server architecture as the module where the client and the server that perform the above steps are located, and after receiving the data change notification, the client of the module performs steps S202 to S205 until the data synchronization of all modules is completed.
The data synchronization method provided by the embodiment of the invention is based on the server, and the data to be changed of the server corresponding to the client changed data can be determined according to the pre-established data mapping after the client changed data of the client is acquired during the data synchronization transmission by pre-establishing the data mapping between the client data and the server data, so that the data to be changed of the server can be changed according to the client changed data. It can be seen that, through the data mapping of the client data and the server data in advance, the data can be transmitted in a small data block manner without data packaging associated with the data. By reducing the data blocks to be transmitted, the data transmission process in the data synchronization task can occupy smaller bandwidth, the stability and the fluency in the data synchronization process are improved, and the data synchronization method is more suitable for the data processing requirements of high-level services compared with the prior art.
FIG. 3 is a flow chart of another data synchronization method according to an embodiment of the present invention; fig. 4 is a schematic diagram of a data transmission process according to an embodiment of the present invention.
On the basis of the foregoing embodiment, in the data synchronization method provided in the embodiment of the present invention, step S201 specifically is:
s301: and establishing a data ID of the client data and a data ID of the server data.
Wherein only a corresponding pair of client data has the same data ID as the server data.
In the above embodiment, it is mentioned that an address mapping between the address of the client data and the address of the server data may be established, but since the address of the client data is a temporary address, which may change from time to time, it is very difficult for the enterprise-level service to maintain the correspondence between the temporary address and the actual address. Thus, a unique identification of a pair of client data and server data is determined in the form of a data ID.
In the specific implementation, in the system initialization stage, firstly, a data memory is applied for a client through a malloc (dynamic memory allocation) function, and after the client application is completed, the data memory is created at a server in a memcopy mode, so that the relative positions of data are kept consistent.
The corresponding client data and server data are numbered, and the data ID is 0,1,2,3, etc. to indicate the position of the data, so that the data mapping between the client data and the server data is established by the data ID.
Specifically, a for loop traversal mode may be adopted to number a pair of client data and server data to obtain a data ID of the client data and a data ID of the server data.
Step S202 is described above with reference to an embodiment.
Step S203 specifically includes:
s302: and the client calculates the client address of the client change data according to the data ID of the client change data.
S303: and the client sends the data ID and the client address of the client change data to the server.
S304: the server receives the data ID and the client address of the client change data.
S305: and the server side acquires the client side change data according to the client side address.
Step S204 specifically includes:
s306: and the server side searches the data to be changed of the server side according to the data ID of the changed data of the client side.
And establishing a callback function (callback) on the data block of the client, and calculating the address of the changed data through the callback function when the data of the corresponding client changes. After the system is initialized, when the client data is changed, the client sends the data ID of the client changed data and the temporary address of the client changed data calculated by using the callback function to the server, and the server can acquire the client changed data according to the data ID and/or the temporary address.
In specific implementation, the client can directly send the client change data to the server, and the server compares the obtained client change data with the server to-be-changed data with the same ID to perform data synchronization. The server side can also obtain the client side changed data by using the temporary address of the client side changed data after determining the data to be changed of the server side according to the data ID, and then the client side changed data is compared and synchronized.
In the above embodiment, when the server performs data synchronization, it may first determine whether the client change data is consistent with the server data to be changed, and if not, perform resynchronization, so for step S305, after the server obtains the client change data according to the client address, the server does not transmit the client change data, and knows that the client change data is compared with the server data to be changed, and when the client change data is not consistent with the server data, the server obtains the client change data to change the server data to be changed, thereby further reducing the transmission amount of data.
Step S205 is described above with reference to an embodiment.
Further, before step S305, the method further includes:
s307: and the server stores the client address in a preset temporary data space.
In the above steps, the data interaction process between the client and the server may also take the form of a message queue, but when the amount of data is large, the form of sequential processing may also result in low efficiency. Therefore, when the system is initialized, after the server associates the data ID, the data memory is sequentially applied for storing temporary address data, that is, a temporary data space, through the malloc function.
Then, in step S303, the client specifically sends the data ID of the client change data to the server, and sends the calculated temporary address of the client change data to the temporary data space. For step S304, the server acquires the temporary address of the client change data from the temporary data space. Thus, it is possible for step S205 to process the synchronization tasks of the plurality of client change data in parallel.
As shown in fig. 4, by applying the data synchronization method provided by the embodiment of the present invention, the client data and the server data form a data map by setting the data ID to 0,1,2, and 3, and store the corresponding relationship between the temporary address of the data and the data ID through the temporary data space of the server. Assuming that data with a data ID of 2 on the module 1 is changed, the client only needs to send a data block with a data ID of 2 to the server, and simultaneously triggers a callback function to send the calculated temporary address of the client changed data to the data ID corresponding to the temporary data space, and the server can obtain the temporary address of the client changed data from the temporary data space through the data ID. After completing the data synchronization of the actual data of the module 1, the server side notifies the other modules of the data change message, and repeats the above process.
On the basis of the above detailed description of the embodiments corresponding to the data synchronization method, the invention also discloses a data synchronization device, equipment and a computer readable storage medium corresponding to the above method.
Fig. 5 is a schematic structural diagram of a data synchronization apparatus according to an embodiment of the present invention.
As shown in fig. 5, the data synchronization apparatus provided in the embodiment of the present invention includes:
a data mapping unit 501, configured to pre-establish a data mapping between client data and server data;
an obtaining unit 502, configured to obtain client change data of a client;
the searching unit 503 is configured to search, according to the data mapping, data to be changed at the server corresponding to the client changed data;
a synchronization unit 504, configured to change the data to be changed at the server according to the client change data.
Since the embodiments of the apparatus portion and the method portion correspond to each other, please refer to the description of the embodiments of the method portion for the embodiments of the apparatus portion, which is not repeated here.
Further, the embodiment of the invention also provides data synchronization equipment.
Fig. 6 is a structural diagram of a data synchronization apparatus according to an embodiment of the present invention.
As shown in fig. 6, the data synchronization apparatus provided in the embodiment of the present invention includes:
a memory 610 for storing instructions comprising the steps of the data synchronization method of any of the above embodiments;
a processor 620 for executing the instructions.
Among other things, processor 620 may include one or more processing cores, such as a 3-core processor, an 8-core processor, and so forth. The processor 620 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 620 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 620 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 620 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 610 may include one or more computer-readable storage media, which may be non-transitory. Memory 610 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 610 is at least used for storing the following computer program 611, wherein after the computer program 611 is loaded and executed by the processor 620, the relevant steps in the data synchronization method disclosed in any of the foregoing embodiments can be implemented. In addition, the resources stored by the memory 610 may also include an operating system 612, data 613, and the like, and the storage manner may be a transient storage or a permanent storage. The operating system 612 may be Windows, among others. The data 613 may include, but is not limited to, data involved in the above-described methods.
In some embodiments, the data synchronization device may also include a display 630, a power supply 640, a communication interface 650, an input output interface 660, a sensor 670, and a communication bus 680.
Those skilled in the art will appreciate that the configuration shown in fig. 6 does not constitute a limitation of the data synchronization apparatus and may include more or fewer components than those shown.
The data synchronization device provided by the embodiment of the application comprises the memory and the processor, and the processor can realize the data synchronization method when executing the program stored in the memory, and the effect is the same as that of the data synchronization method.
It should be noted that the above-described embodiments of the apparatus and device are merely illustrative, for example, the division of modules is only one division of logical functions, and there may be other divisions when actually implementing, for example, a plurality of modules or components may be combined or integrated into another system, or some features may be omitted or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form. Modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
To this end, an embodiment of the present invention further provides a storage medium, where a computer program is stored on the storage medium, and the computer program, when executed by a processor, implements the steps of the data synchronization method.
It is to be understood that if the method in the above embodiments is implemented in the form of a software functional unit and sold or used as a stand-alone product, it may be stored in a storage medium. The storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The storage medium provided in this embodiment contains a computer program that, when executed by a processor, can implement the steps of the data synchronization method described above, and the same effects are obtained.
The data synchronization method, the data synchronization device and the storage medium provided by the invention are described in detail above. The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device, the equipment and the storage medium disclosed by the embodiment correspond to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Claims (8)
1. A data synchronization method is characterized in that based on a server, the method comprises the following steps:
pre-establishing a data ID of client data and a data ID of server data; wherein only a corresponding pair of the client data and the server data have the same data ID;
receiving a data ID of client changing data of a client, and acquiring a client address calculated by the client according to the data ID of the client changing data;
storing the client addresses in a preset temporary data space to process all the client addresses in parallel;
acquiring the client changing data according to the client address;
searching data to be changed of a server corresponding to the client changed data according to the data ID of the client changed data;
and changing the data to be changed of the server side according to the client side changed data.
2. The data synchronization method according to claim 1, wherein the establishing the data ID of the client data and the data ID of the server data specifically comprises:
numbering a pair of the client data and the server data in a for loop traversal mode to obtain a data ID of the client data and a data ID of the server data.
3. The data synchronization method according to claim 1, wherein the obtaining of the client address calculated according to the data ID specifically includes:
and acquiring the client address which is sent by the client and calculated by utilizing a callback function according to the data ID of the client change data.
4. The data synchronization method according to claim 1, wherein the changing the data to be changed at the server according to the client change data specifically comprises:
judging whether the client changed data is consistent with the data to be changed of the server;
if so, not changing the data to be changed of the server;
and if not, changing the data to be changed of the server side according to the client side changed data.
5. The data synchronization method according to claim 1, further comprising, after the changing of the data to be changed at the server side according to the client side change data:
and sending a data change notification to a client of another device so that the client of the another device and a server of the another device complete the change of data to be changed of the server of the another device.
6. A data synchronization apparatus, comprising:
the data mapping unit is used for pre-establishing a data ID of the client data and a data ID of the server data; wherein only a corresponding pair of the client data and the server data have the same data ID;
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for receiving a data ID of client change data of a client and acquiring a client address calculated by the client according to the data ID of the client change data; storing the client addresses in a preset temporary data space to process all the client addresses in parallel; acquiring the client changing data according to the client address;
the searching unit is used for searching the data to be changed of the server corresponding to the client changed data according to the data ID of the client changed data;
and the synchronization unit is used for changing the data to be changed of the server side according to the client side changed data.
7. A data synchronization apparatus, comprising:
a memory for storing instructions, the instructions comprising the steps of the data synchronization method of any one of claims 1 to 5;
a processor to execute the instructions.
8. A storage medium having stored thereon a computer program for implementing the steps of the data synchronization method according to any one of claims 1 to 5 when executed by a processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911025083.9A CN110909007B (en) | 2019-10-25 | 2019-10-25 | Data synchronization method, data synchronization device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911025083.9A CN110909007B (en) | 2019-10-25 | 2019-10-25 | Data synchronization method, data synchronization device and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110909007A CN110909007A (en) | 2020-03-24 |
CN110909007B true CN110909007B (en) | 2021-10-15 |
Family
ID=69815643
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911025083.9A Active CN110909007B (en) | 2019-10-25 | 2019-10-25 | Data synchronization method, data synchronization device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110909007B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101599974A (en) * | 2008-05-27 | 2009-12-09 | 苏州华脉通讯科技有限公司 | The method of real-time updating mobile multimedia name card |
CN105306585A (en) * | 2015-11-12 | 2016-02-03 | 焦点科技股份有限公司 | Data synchronization method for plurality of data centers |
CN105868231A (en) * | 2015-12-01 | 2016-08-17 | 乐视体育文化产业发展(北京)有限公司 | Cache data updating method and device |
CN109064345A (en) * | 2018-08-14 | 2018-12-21 | 中国平安人寿保险股份有限公司 | Message treatment method, system and computer readable storage medium |
-
2019
- 2019-10-25 CN CN201911025083.9A patent/CN110909007B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101599974A (en) * | 2008-05-27 | 2009-12-09 | 苏州华脉通讯科技有限公司 | The method of real-time updating mobile multimedia name card |
CN105306585A (en) * | 2015-11-12 | 2016-02-03 | 焦点科技股份有限公司 | Data synchronization method for plurality of data centers |
CN105868231A (en) * | 2015-12-01 | 2016-08-17 | 乐视体育文化产业发展(北京)有限公司 | Cache data updating method and device |
CN109064345A (en) * | 2018-08-14 | 2018-12-21 | 中国平安人寿保险股份有限公司 | Message treatment method, system and computer readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN110909007A (en) | 2020-03-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109117252B (en) | Method and system for task processing based on container and container cluster management system | |
CN110502310B (en) | Time synchronization method and device of virtual machine | |
CN109145238A (en) | Card display method and device and mobile device | |
CN108347477A (en) | Data transmission method for uplink, device and server | |
CN109104368B (en) | Connection request method, device, server and computer readable storage medium | |
CN110290166B (en) | Cross-cluster data interaction method, system and device and readable storage medium | |
CN113193947B (en) | Method, apparatus, medium, and program product for implementing distributed global ordering | |
CN109634764A (en) | Work-flow control method, apparatus, equipment, storage medium and system | |
CN110083341A (en) | A kind of front end development platform, front end development approach and page display method | |
CN114285695B (en) | Communication method, device, apparatus, system and storage medium | |
CN112486825B (en) | Multi-lane environment architecture system, message consumption method, device, equipment and medium | |
CN105653347B (en) | A kind of server, method for managing resource and virtual machine manager | |
EP3276914A1 (en) | Data sharing method and device for virtual desktop | |
CN111383038A (en) | Advertisement display method and device of mobile terminal, mobile terminal and storage medium | |
CN110909007B (en) | Data synchronization method, data synchronization device and storage medium | |
CN106933646B (en) | Method and device for creating virtual machine | |
CN109582242B (en) | Address determination method and device for cascade memory array system and electronic equipment | |
CN117149248A (en) | Micro front end construction method, device, equipment and storage medium | |
CN104821939B (en) | It is a kind of to be used to implement computer and the method and apparatus of mobile equipment room asynchronous communication | |
CN115225586B (en) | Data packet transmitting method, device, equipment and computer readable storage medium | |
CN115378937A (en) | Distributed concurrency method, device and equipment for tasks and readable storage medium | |
KR20190069960A (en) | Industrial communication system and method | |
CN103051528B (en) | A kind of message rapid distribution method for bus and device | |
CN113901015A (en) | Distributed data sharing method and device, storage node card and computer equipment | |
CN114979128A (en) | Cross-region communication method and device and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |