[go: up one dir, main page]

CN101064630B - Data synchronization method and system - Google Patents

Data synchronization method and system Download PDF

Info

Publication number
CN101064630B
CN101064630B CN2006100760274A CN200610076027A CN101064630B CN 101064630 B CN101064630 B CN 101064630B CN 2006100760274 A CN2006100760274 A CN 2006100760274A CN 200610076027 A CN200610076027 A CN 200610076027A CN 101064630 B CN101064630 B CN 101064630B
Authority
CN
China
Prior art keywords
data
version number
client
server
record
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
Application number
CN2006100760274A
Other languages
Chinese (zh)
Other versions
CN101064630A (en
Inventor
尚万军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN2006100760274A priority Critical patent/CN101064630B/en
Publication of CN101064630A publication Critical patent/CN101064630A/en
Application granted granted Critical
Publication of CN101064630B publication Critical patent/CN101064630B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a data synchronization method which is used in data synchronization between client and server. It includes: the user data recording is set with recording version number which is increased by degrees as operation sequence; the client takes the maximum recording version number of local-storage user data recording as the overall recording version number of client data; when client logs on server, the client sends data synchronization request to server, with said overall recording version number of client data; server judges whether said overall recording version number of client data is the same with overall recording version number of user data, when they are different, server sends data recording whose recording version number is bigger than overall recording version number of client data to client for data synchronization. The invention also discloses a corresponding data synchronization system. The invention can realize real time data synchronization between client and server efficiently.

Description

Data synchronization method and system
Technical Field
The present invention relates to data synchronization, and more particularly, to a data synchronization method and system based on a client/server model.
Background
The internet provides rich services for people, such as address book management and chat record management. These services are characterized by a client/server (C/S) model, through which users interact with the server. Due to the large number of clients, the clients need to send data and process requests back to the server frequently, the performance requirements on the server are very high, the situation is worsened in the case of low bandwidth or high latency, and the resulting performance problems may lead to a large reduction in application availability and user efficiency. In order to improve the performance of client operation, many current systems deploy codes and data at the client, execute and access data locally, and reduce the amount of data transmitted from the client to the server through local data caching, thereby improving the performance and the practicability of the system. In this processing mode, data exists in both the client and the server, and the system needs to perform necessary data synchronization. Such as: in the chat tool, a user maintains an address book at a client, adds contact information, modifies contact numbers, deletes contacts and the like, a system modifies data of the client after modifying server data, and the operations can be performed at a plurality of clients, so that the data of each client and the server data are possibly inconsistent, and the problem that the data operated by the client is not the latest data is caused.
The synchronization scheme of the prior art one is as follows:
and (3) completely downloading the synchronization scheme, wherein before the client operates the local database each time, a user downloads all data of the relevant table from the server to complete synchronization and then performs maintenance operation.
The first prior art has the following defects:
the data table generally has a large data volume, frequently and completely downloads data, has low efficiency, seriously affects the performance of the server, conflicts with the target of improving the performance of the local data scheme, and cannot be used in a system with a large data volume.
The synchronization scheme of the prior art two is as follows:
the database system is responsible for synchronous processing, the system defines which tables need to be synchronous, and the column-level and row-level detection of the database ensures synchronization.
The second prior art has the following defects:
the scheme requires the client to be provided with the local database, and has higher requirement on the running equipment of the client.
Disclosure of Invention
The invention provides a data synchronization method, which is used for solving the problems that the data synchronization efficiency between a client and a server is low and the requirements on the server and client equipment are high in the prior art.
According to the method provided by the invention, the invention also provides a corresponding data synchronization system.
The method comprises the following steps: in a server, aiming at each user, setting a corresponding record version number for each record of user data of the user, wherein the record version number is set as an increasing integer according to the operation sequence of the user data records; the server takes the maximum record version number of the user data record of the user which is locally stored as the total version number of the user data; when the user data record is operated, the total version number of the user data is correspondingly changed; when a user client logs in the server for the first time, the server sends all locally stored user data records of the user and a corresponding user data total version number to the client; the client stores the user data record locally, and takes the total version number of the user data sent by the server as the total version number of the local client data, so as to realize the complete synchronization of the data for the first time;
when the client logs in the server again, the following steps are executed:
A. the client side sends a data synchronization request to the server, and the data synchronization request carries the total version number of the client side data;
B. the server judges whether the total version number of the client data is the same as the total version number of the user data, and when the total version number of the client data is different from the total version number of the user data, the server sends the user data record with the locally stored record version number larger than the total version number of the client data to the client for data synchronization.
The step A is also preceded by: the client judges whether the local data file exists or is damaged; when the local data file does not exist or is damaged, a new data file is created;
in the step A, the client side initiates a data synchronization request to the server, and the total version number of the data carried by the client side is 0; in the step B, the server sends all locally stored user data records of the user to the client, performs complete data synchronization and records complete synchronization time.
According to the method, after the client logs in the server, a data recording operation request is initiated to the server, and the data recording operation request carries operation type information;
the server executes corresponding operation on the user data record according to the requested operation type, and returns operation result information and the total version number of the user data stored in the current server;
and the client performs corresponding operation on the local user data record and updates the total version number of the client data to the total version number of the user data returned by the server.
According to the method, when the client side sends a new data record request to the server, the carried operation type is a new record;
adding a new user data record to the server, and setting the record version number of the added record; updating the total version number of the user data stored in the server; acquiring address information of the client, and returning a newly-added recording operation result and the updated total version number of the user data;
and the client adds a corresponding user data record and updates the total version number of the client data to the total version number of the user data returned by the server.
According to the method, when the client side sends a data record deleting request to the server, the carrying operation type is record deleting;
the server sets a deletion mark for the user data record requested to be deleted and updates the record version number of the user data record; updating the total version number of the user data stored in the server; obtaining the address information of the client, and returning the deletion record operation result and the updated total version number of the user data;
and the client deletes the locally corresponding user data record in real time and updates the total version number of the client data to the total version number of the user data returned by the server, wherein the real deletion refers to the real deletion of the record provided with the deletion mark from the local.
According to the method, the server periodically executes real deletion operation to delete the user data records with local deletion marks; and records the corresponding time of the last execution of the real delete operation.
According to the method, when a client logs in a server to initiate a data synchronization request, the server also judges whether the complete synchronization time of the client is earlier than the time of executing real deletion operation at the last time; if yes, all data records of the user which are stored locally are sent to the client side, data are completely synchronized, and the total version number of the user data is carried.
According to the method, when the client side sends a data record modification request to the server, the carried operation type is a modified record;
the server deletes the user data record requested to be modified in real time, adds a corresponding data record, and sets the record version number of the added record; updating the total version number of the user data stored in the server; obtaining the address information of the client, and returning a record modification operation result and the updated total version number of the user data;
and the client modifies the local corresponding user data record and updates the total version number of the client data to the total version number of the user data returned by the server.
According to the method, when a user logs in the server at the same time by two or more clients, and the server operates the user data records according to the data record operation request initiated by one client, the address information of the logged other clients is obtained, and the changed user data records and the changed total version number of the user data are sent to the other clients;
and the other clients respectively perform corresponding operation on the local user data records, and update the locally stored total version number of the client data to the total version number of the user data returned by the server.
The invention provides a data synchronization system, which comprises a client and a server, wherein the client comprises a synchronization request execution unit, and is used for initiating a data synchronization request to the server when the client logs in the server again, and the data synchronization request carries a total version number of client data;
the server comprises a synchronization judgment execution unit used for receiving a data synchronization request of a client and judging whether the total version number of the client data is the same as the total version number of the user data; when the two are different, the server sends the user data record with the locally stored record version number larger than the total version number of the client data to the client for data synchronization;
wherein,
the client is also used for receiving all user data records of the user and the corresponding total version number of the user data issued by the server when the client logs in the server for the first time; storing user data records locally, and taking the total version number of the user data sent by the server as the total version number of the data of the local client to realize complete data synchronization for the first time; receiving the data record of the user, which is sent by the server and has the locally stored record version number larger than the total version number of the client data, and carrying out data synchronization;
the server is also used for setting a corresponding record version number for each record of the user data of each user, the record version number is set as an increasing integer according to the operation sequence of the user data records, and the maximum record version number of the locally stored user data records of the user is used as the total version number of the data; when the user data record is operated, the total version number of the user data is correspondingly changed; when a client of a user logs in the server for the first time, all user data records of the user and corresponding user data total version numbers which are locally stored are sent to the client.
The client further comprises a first data recording operation unit, which is used for initiating a data recording operation request to the server and carrying operation type information; after receiving the operation result information and the total version number of the user data returned by the server, performing corresponding operation on the local user data record, and updating the total version number of the client data to the total version number of the user data returned by the server;
the server also comprises a second data record operation unit which is used for executing corresponding operation on the user data record according to the operation type requested by the client and returning operation result information and the total version number of the user data stored in the current server to the client;
wherein the second data recording operation unit includes:
the recording operation execution module executes corresponding operation on the user data record according to the operation type requested by the client;
a record version number generation module for generating a new incremental record version number for the operated user data record;
and the user data total version updating and sending module is used for taking the maximum record version number of the locally stored user data record as the user data total version number and sending the user data total version number to the client.
A data synchronization method is applied to data synchronization between a client and a server;
in a server, aiming at each user, setting a corresponding record version number for each record of user data of the user, wherein the record version number is a timestamp corresponding to the operation time of the current record; the server takes the latest timestamp of the user data record of the user stored locally as the total version number of the user data; when the user data record is operated, the total version number of the user data is correspondingly changed; when a user client logs in the server for the first time, the server sends all locally stored user data records of the user and a corresponding user data total version number to the client; the client stores the user data record locally, and takes the total version number of the user data sent by the server as the total version number of the local client data, so as to realize the complete synchronization of the data for the first time;
when the client logs in the server again, the following steps are executed:
A. the client side sends a data synchronization request to the server, and the data synchronization request carries the total version number of the client side data;
B. the server judges whether the total version number of the client data is the same as the total version number of the user data, and when the total version number of the client data is different from the total version number of the user data, the server sends the user data record with the locally stored record version number larger than the total version number of the client data to the client for data synchronization.
A data synchronization system comprises a client and a server;
the client comprises a synchronous request execution unit which is used for initiating a data synchronous request to the server when the client logs in the server again and carries the total version number of the client data;
the server comprises a synchronization judgment execution unit used for receiving a data synchronization request of a client and judging whether the total version number of the client data is the same as the total version number of the user data; when the two are different, the server sends the data record of the user with the locally stored record version number larger than the total version number of the client data to the client for data synchronization;
wherein,
the client is also used for receiving all user data records of the user and the corresponding total version number of the user data issued by the server when the client logs in the server for the first time; storing user data records locally, and taking the total version number of the user data sent by the server as the total version number of the data of the local client to realize complete data synchronization for the first time; receiving the data record of the user, which is sent by the server and has the locally stored record version number larger than the total version number of the client data, and carrying out data synchronization;
the server is also used for setting a corresponding record version number for each record of the user data of each user, wherein the record version number is a timestamp corresponding to the operation time of the current record, and the latest timestamp of the locally stored user data record of the user is used as the total version number of the user data; when the user data record is operated, the total version number of the user data is correspondingly changed; when a client of a user logs in the server for the first time, all user data records of the user and corresponding user data total version numbers which are locally stored are sent to the client.
The invention has the following beneficial effects:
the invention adopts the method that the incremental record version number is set for the user data record according to the operation sequence; the client takes the maximum record version number of the locally stored user data record as the total version number of the client data; the server takes the maximum record version number of the user data record stored locally as the total version number of the user data; when a client logs in a server, the client initiates a data synchronization request to the server, and the data synchronization request carries a total version number of client data; the server judges whether the total version number of the client data is the same as the total version number of the user data, and when the total version number of the client data is different from the total version number of the user data, the server sends the data record of the user, of which the locally stored record version number is greater than the total version number of the client data, to the client for data synchronization. Therefore, the data synchronization amount is only the difference part between the client and the server, the synchronous data amount is small, the interactive data amount and the interactive times of the client and the server are reduced, and the data synchronization efficiency is improved.
(2) When a user logs in a server at the same time by two or more clients, and the server operates the user data records according to a data record operation request initiated by one of the clients, the address information of the other logged clients is obtained, and the changed data records and the changed total version number of the user data are sent to the other clients; and the other clients respectively perform corresponding operation on the local user data records, and update the locally stored total version number of the client data to the total version number of the user data returned by the server. Therefore, real-time synchronization is realized for a plurality of client data of the same user, and the accuracy and the integrity of each client data are ensured.
Drawings
Fig. 1 is a signaling interaction flowchart of a client logging in a server according to an embodiment of the present invention;
FIG. 2 is a signaling flow diagram illustrating a request for newly adding a user data record after a client logs in a server according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of the system of the present invention.
Detailed Description
The data synchronization method provided by the invention is applied to data synchronization between the client and the server. The method of the present invention is described in detail below with reference to the accompanying drawings.
And at the server side, establishing one or more user data tables for each user, and storing the user data records of the users. Between the server and the client, it is the user data of the user that needs to be synchronized.
In the server, a corresponding record version number is set for each record of user data of each user, and the record version number is set to be an increasing integer value according to the operation sequence of the user data record, or set to be a corresponding timestamp, such as YYYYMMDDHHMMSS, which indicates that the operation time of the current record is a certain minute and a certain second of a certain day of a certain month and a certain month of a certain year, and is used as the record version number of the data record.
In the server, the user data of each user corresponds to a total version number of the user data at the server side. Adopting the record version number corresponding to the operated last user data record as the total version number of the user data at the server end of the user; that is, the server takes the maximum record version number of the locally stored user record as the total version number of the user data. And if the timestamp is used as the record version number, the total version number of the user data at the server end is the latest timestamp.
The invention also processes the user data record to be deleted in two steps: firstly, setting a deletion mark on a server side for user data records needing to be deleted, wherein the deletion mark is called pseudo deletion; and in the second step, the server periodically executes real deletion operation, and the record with the deletion mark set is really deleted from the local.
In order to implement management and data synchronization for each user, the server needs to store some corresponding management information. For example:
(1) the server stores a user complete synchronization record table, as shown in table 1 below:
table 1:
user name Last time full synchronization time
AAA 20050627090909
BBB 20050627110906
…… ……
ZZZ 20050627132308
(2) Storing a user data total version number recording table at the server side, as shown in the following table 2:
table 2:
user name The total version number of the user data at the server end
AAA 3
BBB 4
…… ……
ZZZ 20
The total version number of user data in table 2 may also be a timestamp, and when an operation is performed on a user data record, a corresponding change is made. For example, when the server modifies a piece of user record data of the user AAA, the record version number of the piece of record must be changed to an integer value greater than 3, and assuming that the record version number of the piece of record becomes 4, the total version number of the current data of the user AAA at the server side also becomes 4.
(3) The call log table of the user is stored in the server as shown in table 3 below:
table 3:
user name Log identification Record version number of user data Type of operation
AAA 1 2 Adding new
AAA 2 3 Modifying
BBB 3 5 Modifying
BBB 4 4 Adding new
BBB 5 3 Deleting
…… …… …… ……
In table 3, the record version number of the user data does not have two records having the same record version number for the same user; but may have the same record version number for different users. As the user AAA in table 3 requests to modify the user data with its own record version number of 3; the user BBB requests to delete the user data with the recording version number of 3; although the record version numbers of both data records are 3, since data separately belonging to different users, it is possible to have the same record version number.
(4) The client login information table is stored in the server, as shown in table 4 below:
table 4:
user name Client IP Client port number
AAA 192.168.11.110 5060
BBB 192.168.23.173 3089
…… ……
ZZZ 192.168.19.181 4080
And storing the latest time for executing real deletion operation on the user data in the server, and when the full synchronization time of the client is earlier than the latest time for executing real deletion operation by the server, performing full synchronization on the client: namely, deleting the client data file, reestablishing a new data file, and sending all the recorded data of the user stored in the server to the client of the user.
After a user client logs in a server for the first time, the server sends all locally stored user data of the user and a corresponding total version number of the user data to the client; the client stores the user data locally, and takes the total version number of the user data sent by the server as the total version number of the data of the local client, so as to realize the complete synchronization of the data for the first time.
After the client logs in the server again, actively initiating a data synchronization request to the server, wherein the data synchronization request carries a locally stored client data total version number; the server compares the received total version number of the client data with the total version number of the user data stored by the server, and if the received total version number of the client data is the same as the user data, the server indicates that the user data is synchronized; if the total version number of the client data is smaller, the client data and the server data are out of synchronization, and the server sends the recorded data of the user, the locally stored recorded version number of which is larger than the total version number of the client data, to the client for data synchronization.
Taking the synchronization of personal address book as an example, the specific steps of the flowchart shown in fig. 1 include:
1. a user initiates a request for logging in a server through a client;
2. the server carries out legality authentication on the user, records the IP address and the port number of the client after the authentication is passed, returns corresponding information, and is presented to the user by the client (such as some operable function lists, some personal data of the user, and the like);
3. the client firstly judges whether the address book file of the personal client exists or is damaged; if the file does not exist or is damaged, executing step 4; otherwise, directly executing the step 5;
4. if the file does not exist, creating the file, and setting the total version number of the client data to be 0; if the file is damaged, deleting the damaged file, then creating a new file, and setting the total version number of the client data to be 0; if the file exists and is not corrupted, continue with step 5;
5. the client side initiates a data synchronization request carrying the information of the total version number of the client side data;
6. if the server judges that the total version number of the client data is equal to 0, reading the user address book data in the server, and carrying out complete synchronization;
if the server judges that the total version number of the client data is greater than 0, further judging whether the last full synchronization time of the user data is earlier than the latest real deletion time of the server, if so, performing full synchronization; otherwise, the server selects the record with the address book data record version number larger than the total version number of the client data carried in the synchronous request, and sends the record to the client; if no corresponding record with the data record version number larger than the total version number of the client data exists in the server, the data is synchronized;
7. the server returns the synchronous identification, the address book record of the user obtained in the step 6 and the total version number of the user data of the user at the server end to the client;
8. the client analyzes whether complete synchronization or partial synchronization is needed according to the synchronization identification; if the data files are required to be completely synchronized, deleting the data files of the client, rebuilding new data files and recording the complete synchronization time;
if only partial synchronization is needed, corresponding processing is carried out according to the operation type corresponding to the record needing synchronization; if the operation type is a new type, adding a corresponding record at the client; if the operation type is the modification type, deleting the corresponding record in the client data file, and then adding a record; if the operation type is a deletion type, recording and deleting are carried out in the client data file; and updating the total version number of the client data to the total version number of the user data returned by the server.
The above process realizes data synchronization when the client logs in the server. After the client logs in the server, the client may initiate a data recording operation application to the server, carrying the operation type information, for example: the client requests a server to add, delete or modify a record; and after receiving the recording operation request initiated by the client, the server operates the corresponding record according to the operation type and returns the operation result information and the updated total version number of the user data.
If the user logs in the server by two or more clients at the same time, the server operates the user data record according to the data record operation request initiated by one of the clients, acquires the address information of the other logged clients, and sends the changed data record and the changed total version number of the user data to the other clients; and the other clients respectively perform corresponding operation on the local user data records, and update the locally stored total version number of the client data to the total version number of the user data returned by the server, so that data synchronization is realized.
As shown in fig. 2, when a client 1 of a user requests to add a new record to an address book, a data synchronization flowchart is implemented by a server, and the specific steps include:
1. a user adds a contact person into an address book through a client 1, the client inquires local data, judges that no record exists, and initiates a new record application to a server;
2 and 3, if the server judges that the record does not exist, adding a new user data record; setting the operation type of the record as new, setting the record version number of the record, and updating the total version number of the user data at the server end;
if the server judges that the record exists, the latest operation type of the record at the server end is a deletion type because the client performs data synchronization with the server during login, and under the condition, the server changes the operation type of the record into a new one, sets the record version number of the record and updates the total data version number of the user at the server end;
4. the server acquires the IP address and the port number of the client 1, and returns operation result information and the total version number of the user data of the user at the server;
5. the client 1 adds a corresponding record locally;
6. the client 1 updates the locally stored total version number of the client data to the total version number of the user data sent by the server.
If the server adds the newly added record into the address book of other logged clients of the user at the same time, the data synchronization of other logged clients of the user is needed, and the specific steps include:
4', the server acquires the IP addresses and port numbers of other logged-on clients 2, sends a synchronous updating message, informs the clients 2 of adding a new record and carries the total version number of the user data at the server;
5' the client 2 adds a corresponding record locally;
6', the client 2 updates the locally stored client data total version number to the user data total version number sent by the server.
According to the above method provided by the present invention, the present invention further provides a corresponding data synchronization system, a schematic structural diagram of which is shown in fig. 3, including: including client and server, wherein:
the client comprises a synchronous request execution unit which is used for initiating a data synchronous request to the server and carrying the total version number of the client data; the total version number of the client data is the maximum record version number of the user data record locally stored by the client;
the server comprises a synchronization judgment execution unit which is used for receiving a data synchronization request of a client and judging whether the total version number of the client data is the same as the total version number of the user data, wherein the total version number of the user data is the maximum record version number of the user data record stored by the server; when the two are different, the server sends the data record of the user with the locally stored record version number larger than the total version number of the client data to the client for data synchronization.
The client also comprises a first data recording operation unit which initiates a data recording operation request to the server and carries operation type information; after receiving the operation result information and the total version number of the user data returned by the server, performing corresponding operation on the local user data record, and updating the total version number of the client data to the total version number of the user data returned by the server;
the server also comprises a second data record operation unit which executes corresponding operation on the user data record according to the operation type requested by the client and returns operation result information and the total version number of the user data stored in the current server to the client.
The second data recording operation unit may further include:
the recording operation execution module executes corresponding operation on the user data record according to the operation type requested by the client;
a record version number generation module for generating a new incremental record version number for the operated user data record;
and the user data total version updating and sending module is used for taking the maximum record version number of the locally stored user data record as the user data total version number and sending the user data total version number to the client.
In summary, in the process of logging in the server by the client, the client actively initiates a data synchronization request, and the server only sends the data record of the user, of which the locally stored record version number is greater than the total version number of the client data, to the client, so that the data synchronization amount is only the difference part between the client and the server, the synchronous data amount is small, the interactive data amount and the interactive times of the client and the server are reduced, and the data synchronization efficiency is improved.
After logging in the server, the client can initiate data recording operation requests, such as data addition, data deletion and data modification, and the server and the client perform synchronous updating. When a user logs in the server at the same time by two or more clients, and the server operates the user data record according to a data record operation request initiated by one of the clients, the changed data record and the changed total version number of the user data are sent to the other clients by acquiring the address information of the other logged clients; and the other clients respectively perform corresponding operation on the local user data records, and update the locally stored total version number of the client data to the total version number of the user data returned by the server. Therefore, real-time synchronization is realized for a plurality of client data of the same user, and the accuracy and the integrity of each client data are ensured.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (13)

1. A data synchronization method is applied to data synchronization between a client and a server, and is characterized by comprising the following steps: in a server, aiming at each user, setting a corresponding record version number for each record of user data of the user, wherein the record version number is set as an increasing integer according to the operation sequence of the user data records; the server takes the maximum record version number of the user data record of the user which is locally stored as the total version number of the user data; when the user data record is operated, the total version number of the user data is correspondingly changed; when a user client logs in the server for the first time, the server sends all locally stored user data records of the user and a corresponding user data total version number to the client; the client stores the user data record locally, and takes the total version number of the user data sent by the server as the total version number of the local client data, so as to realize the complete synchronization of the data for the first time;
when the client logs in the server again, the following steps are executed:
A. the client side sends a data synchronization request to the server, and the data synchronization request carries the total version number of the client side data;
B. the server judges whether the total version number of the client data is the same as the total version number of the user data, and when the total version number of the client data is different from the total version number of the user data, the server sends the user data record with the locally stored record version number larger than the total version number of the client data to the client for data synchronization.
2. The method of claim 1, wherein step a is preceded by: the client judges whether the local data file exists or is damaged; when the local data file does not exist or is damaged, a new data file is created;
in the step A, the client side initiates a data synchronization request to the server, and the total version number of the data carried by the client side is 0; in the step B, the server sends all locally stored user data records of the user to the client, performs complete data synchronization and records complete synchronization time.
3. The method of claim 2, further comprising initiating a data recording operation request to the server after the client logs in the server, the data recording operation request carrying operation type information;
the server executes corresponding operation on the user data record according to the requested operation type, and returns operation result information and the total version number of the user data stored in the current server;
and the client performs corresponding operation on the local user data record and updates the total version number of the client data to the total version number of the user data returned by the server.
4. The method of claim 3, wherein when the client initiates a new data record request to the server, the carrying operation type is a new record;
adding a new user data record to the server, and setting the record version number of the added record; updating the total version number of the user data stored in the server; acquiring address information of the client, and returning a newly-added recording operation result and the updated total version number of the user data;
and the client adds a corresponding user data record and updates the total version number of the client data to the total version number of the user data returned by the server.
5. The method of claim 3, wherein when the client initiates a delete data record request to the server, the carrying operation type is delete record;
the server sets a deletion mark for the user data record requested to be deleted and updates the record version number of the user data record; updating the total version number of the user data stored in the server; obtaining the address information of the client, and returning the deletion record operation result and the updated total version number of the user data;
and the client deletes the locally corresponding user data record in real time and updates the total version number of the client data to the total version number of the user data returned by the server, wherein the real deletion refers to the real deletion of the record provided with the deletion mark from the local.
6. The method of claim 5, wherein the server periodically performs a real delete operation to delete a user data record having a delete flag locally; and records the corresponding time of the last execution of the real delete operation.
7. The method of claim 6, wherein when a client logs in to a server to initiate a data synchronization request, the server further determines whether the full synchronization time of the client is earlier than the time of the last real deletion operation; if yes, all data records of the user which are stored locally are sent to the client side, data are completely synchronized, and the total version number of the user data is carried.
8. The method of claim 3, wherein when the client initiates a request to modify a data record to the server, the carrying operation type is a modified record;
the server firstly carries out real deletion on the user data record which is requested to be modified, then adds a corresponding data record, and sets the record version number of the added record, wherein the real deletion refers to the real deletion of the record with the deletion mark from the local; updating the total version number of the user data stored in the server; obtaining the address information of the client, and returning a record modification operation result and the updated total version number of the user data;
and the client modifies the local corresponding user data record and updates the total version number of the client data to the total version number of the user data returned by the server.
9. The method according to any one of claims 1-8, wherein when a user logs in the server at the same time by two or more clients, and the server operates the user data record according to a data record operation request initiated by one of the clients, obtains address information of the other logged-in clients, and sends the changed user data record and the changed total version number of the user data to the other clients;
and the other clients respectively perform corresponding operation on the local user data records, and update the locally stored total version number of the client data to the total version number of the user data returned by the server.
10. A data synchronization system comprises a client and a server, and is characterized in that:
the client comprises a synchronous request execution unit which is used for initiating a data synchronous request to the server when the client logs in the server again and carries the total version number of the client data;
the server comprises a synchronization judgment execution unit used for receiving a data synchronization request of a client and judging whether the total version number of the client data is the same as the total version number of the user data; when the two are different, the server sends the user data record with the locally stored record version number larger than the total version number of the client data to the client for data synchronization;
wherein,
the client is also used for receiving all user data records of the user and the corresponding total version number of the user data issued by the server when the client logs in the server for the first time; storing user data records locally, and taking the total version number of the user data sent by the server as the total version number of the data of the local client to realize complete data synchronization for the first time; receiving the data record of the user, which is sent by the server and has the locally stored record version number larger than the total version number of the client data, and carrying out data synchronization;
the server is also used for setting a corresponding record version number for each record of the user data of each user, the record version number is set as an increasing integer according to the operation sequence of the user data records, and the maximum record version number of the locally stored user data records of the user is used as the total version number of the data; when the user data record is operated, the total version number of the user data is correspondingly changed; when a client of a user logs in the server for the first time, all user data records of the user and corresponding user data total version numbers which are locally stored are sent to the client.
11. The data synchronization system of claim 10, wherein the client further comprises a first data recording operation unit, configured to initiate a data recording operation request to the server, and carry operation type information; after receiving the operation result information and the total version number of the user data returned by the server, performing corresponding operation on the local user data record, and updating the total version number of the client data to the total version number of the user data returned by the server;
the server also comprises a second data record operation unit which is used for executing corresponding operation on the user data record according to the operation type requested by the client and returning operation result information and the total version number of the user data stored in the current server to the client;
wherein the second data recording operation unit includes:
the recording operation execution module executes corresponding operation on the user data record according to the operation type requested by the client;
a record version number generation module for generating a new incremental record version number for the operated user data record;
and the user data total version updating and sending module is used for taking the maximum record version number of the locally stored user data record as the user data total version number and sending the user data total version number to the client.
12. A data synchronization method is applied to data synchronization between a client and a server, and is characterized by comprising the following steps: in a server, aiming at each user, setting a corresponding record version number for each record of user data of the user, wherein the record version number is a timestamp corresponding to the operation time of the current record; the server takes the latest timestamp of the user data record of the user stored locally as the total version number of the user data; when the user data record is operated, the total version number of the user data is correspondingly changed; when a user client logs in the server for the first time, the server sends all locally stored user data records of the user and a corresponding user data total version number to the client; the client stores the user data record locally, and takes the total version number of the user data sent by the server as the total version number of the local client data, so as to realize the complete synchronization of the data for the first time;
when the client logs in the server again, the following steps are executed:
A. the client side sends a data synchronization request to the server, and the data synchronization request carries the total version number of the client side data;
B. the server judges whether the total version number of the client data is the same as the total version number of the user data, and when the total version number of the client data is different from the total version number of the user data, the server sends the user data record with the locally stored record version number larger than the total version number of the client data to the client for data synchronization.
13. A data synchronization system comprises a client and a server, and is characterized in that:
the client comprises a synchronous request execution unit which is used for initiating a data synchronous request to the server when the client logs in the server again and carries the total version number of the client data;
the server comprises a synchronization judgment execution unit used for receiving a data synchronization request of a client and judging whether the total version number of the client data is the same as the total version number of the user data; when the two are different, the server sends the data record of the user with the locally stored record version number larger than the total version number of the client data to the client for data synchronization;
wherein,
the client is also used for receiving all user data records of the user and the corresponding total version number of the user data issued by the server when the client logs in the server for the first time; storing user data records locally, and taking the total version number of the user data sent by the server as the total version number of the data of the local client to realize complete data synchronization for the first time; receiving the data record of the user, which is sent by the server and has the locally stored record version number larger than the total version number of the client data, and carrying out data synchronization;
the server is also used for setting a corresponding record version number for each record of the user data of each user, wherein the record version number is a timestamp corresponding to the operation time of the current record, and the latest timestamp of the locally stored user data record of the user is used as the total version number of the user data; when the user data record is operated, the total version number of the user data is correspondingly changed; when a client of a user logs in the server for the first time, all user data records of the user and corresponding user data total version numbers which are locally stored are sent to the client.
CN2006100760274A 2006-04-24 2006-04-24 Data synchronization method and system Active CN101064630B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2006100760274A CN101064630B (en) 2006-04-24 2006-04-24 Data synchronization method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2006100760274A CN101064630B (en) 2006-04-24 2006-04-24 Data synchronization method and system

Publications (2)

Publication Number Publication Date
CN101064630A CN101064630A (en) 2007-10-31
CN101064630B true CN101064630B (en) 2011-09-21

Family

ID=38965374

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2006100760274A Active CN101064630B (en) 2006-04-24 2006-04-24 Data synchronization method and system

Country Status (1)

Country Link
CN (1) CN101064630B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102571935A (en) * 2011-12-23 2012-07-11 华为技术有限公司 Data transmission method, client, server and system

Families Citing this family (61)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101794297B (en) * 2010-01-15 2012-07-25 北京中创信测科技股份有限公司 Method and system for processing information data
CN102130929A (en) * 2010-01-20 2011-07-20 金蝶软件(中国)有限公司 Method and device for updating client testing server and testing server
CN101902613B (en) * 2010-07-21 2014-06-04 中兴通讯股份有限公司 Information synchronization method and system, set top box and server in IPTV (Internet Protocol Television) system
KR101697979B1 (en) * 2010-11-23 2017-01-19 삼성전자주식회사 Method and apparatus for syncronizing data in connected devices
CN102546208B (en) * 2010-12-13 2015-04-08 北大方正集团有限公司 Device management method, system and device management server
CN102063494A (en) * 2010-12-31 2011-05-18 青岛海信网络科技股份有限公司 Database synchronizing method and device
EP2501106B1 (en) * 2011-03-10 2020-04-29 Amadeus S.A.S. System and method for session synchronization with independent external systems
CN102231881B (en) * 2011-07-05 2015-07-15 广州市动景计算机科技有限公司 Method, server and system for processing user data of mobile terminal
CN102325367B (en) * 2011-09-29 2013-09-11 用友软件股份有限公司 Data packet synchronizing device and method for client application
CN103136200B (en) * 2011-11-22 2018-02-02 中兴通讯股份有限公司 Data fresh information acquisition methods, device and method of data synchronization, device
CN102571923A (en) * 2011-12-13 2012-07-11 中国电子科技集团公司第十五研究所 Data synchronization system and method
CN103457905B (en) * 2012-05-28 2015-09-09 腾讯科技(深圳)有限公司 Method of data synchronization, system and equipment
CN103532920B (en) * 2012-07-06 2018-01-23 腾讯科技(深圳)有限公司 Cookie update methods and cookie more new systems
CN103685191B (en) * 2012-09-18 2017-02-01 英业达科技有限公司 Data synchronizing system and method
CN102904887B (en) * 2012-09-26 2016-01-20 东软集团股份有限公司 The method of data synchronization of a kind of Web client and server and system
CN103793400B (en) * 2012-10-30 2018-06-01 金蝶软件(中国)有限公司 The batch regulation method and device of tables of data
CN103916423A (en) * 2012-12-31 2014-07-09 华为技术有限公司 Data synchronization method and device
CN103152390B (en) * 2013-02-04 2016-03-30 华为技术有限公司 The node configuration method of distributed memory system, device, node and system
CN103716370B (en) * 2013-10-13 2018-01-02 北界创想(北京)软件有限公司 The method and apparatus that data syn-chronization is carried out between multiple client
CN103595707A (en) * 2013-10-17 2014-02-19 广东电网公司茂名供电局 Automatic file network synchronization method based on SVN
CN103560906B (en) * 2013-10-22 2017-01-25 珠海多玩信息技术有限公司 Data replication method and device
CN104951454A (en) * 2014-03-27 2015-09-30 河南省中科物联网有限公司 File full life cycle tracking and controlling method
CN105101197A (en) * 2014-05-07 2015-11-25 中兴通讯股份有限公司 User contract-signing information response and request method and device
CN104009979A (en) * 2014-05-12 2014-08-27 刘喆 Method for data transmission
CN103997525B (en) * 2014-05-21 2017-10-20 北京天禾元创软件股份有限公司 A kind of Distributed Data Synchronization method and system
CN103986773A (en) * 2014-05-26 2014-08-13 北京奇艺世纪科技有限公司 Data request response method and device
CN104158870A (en) * 2014-08-07 2014-11-19 刘喆 Data transmission method and system
CN104158897B (en) * 2014-08-25 2017-06-23 曙光信息产业股份有限公司 The update method of file layout in a kind of distributed file system
CN104270303A (en) * 2014-09-29 2015-01-07 中国农业银行股份有限公司宿迁分行 Automatic data information sending method and system
CN104468707A (en) * 2014-10-27 2015-03-25 刘喆 Data transmitting method and system
CN105635074A (en) * 2014-11-06 2016-06-01 中兴通讯股份有限公司 Method, server, client and system for realizing data synchronization
CN105653544B (en) * 2014-11-12 2019-06-25 联想(北京)有限公司 A kind of information processing unit and method
CN104462477B (en) * 2014-12-18 2018-03-30 深圳市科漫达智能管理科技有限公司 The method, apparatus and system of data syn-chronization based on timestamp
CN104580425A (en) * 2014-12-26 2015-04-29 北京中交兴路车联网科技有限公司 Client data synchronization method and system
CN104580522A (en) * 2015-01-30 2015-04-29 宁波凯智信息科技有限公司 Client-server data synchronization method and system
CN104902021B (en) * 2015-05-25 2018-07-20 北京嘀嘀无限科技发展有限公司 The method and device of synchronizing information
CN106657170B (en) * 2015-10-28 2021-03-30 斑马智行网络(香港)有限公司 Data synchronization method and device
CN106708842B (en) * 2015-11-12 2021-02-09 创新先进技术有限公司 Method for loading data by application system, database and application system
CN106878362B (en) * 2015-12-11 2020-04-24 展讯通信(上海)有限公司 Client for testing version updating system, system and method
CN105743970A (en) * 2015-12-31 2016-07-06 武汉传神信息技术有限公司 Asynchronous data synchronization method for distributed systems
CN105718542A (en) * 2016-01-18 2016-06-29 厦门雅迅网络股份有限公司 Data cache and updating method and system
CN105791401B (en) * 2016-03-01 2019-09-20 张君 Client and server-side data interactive method, system under net and off-network state
CN106230927A (en) * 2016-07-29 2016-12-14 努比亚技术有限公司 Contact person's synchronous method, Apparatus and system
CN107783824B (en) * 2016-08-25 2020-07-31 北京京东尚科信息技术有限公司 Method for controlling intelligent household equipment and server device
CN107870571B (en) * 2016-09-26 2021-09-03 北京京东尚科信息技术有限公司 Method and device for controlling intelligent equipment and intelligent equipment
CN108073595B (en) * 2016-11-10 2020-09-18 北京国双科技有限公司 A method and device for realizing data update and snapshot in OLAP database
CN107682431A (en) * 2017-09-28 2018-02-09 成都路行通信息技术有限公司 A kind of more data synchronization between devices optimization methods and system
CN107704607A (en) * 2017-10-17 2018-02-16 武汉楚鼎信息技术有限公司 A kind of method of database in phase
CN109768910B (en) * 2017-11-09 2021-06-25 腾讯科技(深圳)有限公司 Information processing method, related device, equipment and system
CN107911434A (en) * 2017-11-10 2018-04-13 浪潮软件集团有限公司 A tobacco data synchronization system and method
CN107819870A (en) * 2017-11-21 2018-03-20 广州视睿电子科技有限公司 Incremental data pulling method and device, storage medium, terminal equipment and server
CN108259562B (en) * 2017-12-11 2022-02-25 杭州品茗安控信息技术股份有限公司 Data synchronization method and device based on multiple endpoints
CN108696443A (en) * 2018-04-28 2018-10-23 北京五八信息技术有限公司 A kind of method, apparatus, equipment and storage medium that terminal data synchronizes
CN109194711B (en) * 2018-07-27 2020-12-15 腾讯科技(深圳)有限公司 Synchronization method, client, server and medium for organization architecture
CN110769061B (en) * 2019-10-24 2021-02-26 华为技术有限公司 Data synchronization method and equipment
CN111309747A (en) * 2020-02-18 2020-06-19 京东数字科技控股有限公司 Data synchronization method, system and device
CN112463882A (en) * 2020-11-20 2021-03-09 广东省安心加科技有限公司 Data synchronization method, cloud platform and edge terminal
CN114760320B (en) * 2020-12-29 2023-09-12 广州视源电子科技股份有限公司 Data synchronization method and system for client and middle server and client
CN112988708B (en) * 2021-03-11 2024-11-29 中国邮政储蓄银行股份有限公司 Version updating method and device, computer readable storage medium and processor
CN113778480B (en) * 2021-07-28 2024-01-30 赤子城网络技术(北京)有限公司 Data updating method and device in weak networking environment, electronic equipment and storage medium
CN113641764B (en) * 2021-08-31 2024-03-19 江苏中科云墨数字科技有限公司 A data synchronization implementation method based on digital twins

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1288199A (en) * 1999-09-09 2001-03-21 日本电气株式会社 Method for updating customer's mounting data respons costomer raising events
CN1407475A (en) * 2001-08-24 2003-04-02 前锦网络信息技术(上海)有限公司 Synchronous updating personnel resume database method based on internet
US6694335B1 (en) * 1999-10-04 2004-02-17 Microsoft Corporation Method, computer readable medium, and system for monitoring the state of a collection of resources
CN1480858A (en) * 2002-09-03 2004-03-10 鸿富锦精密工业(深圳)有限公司 Non Structured data synchronous system and method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1288199A (en) * 1999-09-09 2001-03-21 日本电气株式会社 Method for updating customer's mounting data respons costomer raising events
US6694335B1 (en) * 1999-10-04 2004-02-17 Microsoft Corporation Method, computer readable medium, and system for monitoring the state of a collection of resources
CN1407475A (en) * 2001-08-24 2003-04-02 前锦网络信息技术(上海)有限公司 Synchronous updating personnel resume database method based on internet
CN1480858A (en) * 2002-09-03 2004-03-10 鸿富锦精密工业(深圳)有限公司 Non Structured data synchronous system and method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102571935A (en) * 2011-12-23 2012-07-11 华为技术有限公司 Data transmission method, client, server and system
CN102571935B (en) * 2011-12-23 2015-11-25 华为技术有限公司 A kind of method of transfer of data, client, server and system

Also Published As

Publication number Publication date
CN101064630A (en) 2007-10-31

Similar Documents

Publication Publication Date Title
CN101064630B (en) Data synchronization method and system
CN106603713B (en) Session management method and system
US7603483B2 (en) Method and system for class-based management of dynamic content in a networked environment
US8838679B2 (en) Providing state service for online application users
CN103685590B (en) Obtain the method and system of IP address
WO2017092351A1 (en) Cache data update method and device
US20160323238A1 (en) Ip management method, client and server
CN100579122C (en) Method for realizing browse service COOKIE of wireless application protocol gateway
US20070094334A1 (en) Service/client synchronization
CN107040576A (en) Information-pushing method and device, communication system
US20060085485A1 (en) Protocol agnostic database change tracking
CN113918857A (en) Three-level cache acceleration method for improving performance of distributed WEB application system
CN113342746A (en) File management system, file management method, electronic device, and storage medium
CN112749172A (en) Data synchronization method and system between cache and database
CN113010328B (en) Information sharing method, device, terminal equipment and storage medium
CN110233902B (en) Session processing method and device, electronic equipment and machine-readable storage medium
CN108271420B (en) Method for managing files, file system and server system
JP5109901B2 (en) Session data sharing method
US9852031B2 (en) Computer system and method of identifying a failure
WO2024066503A1 (en) Service invocation method and apparatus
JP7568898B2 (en) COMMUNICATION PROGRAM, COMMUNICATION METHOD, AND COMMUNICATION DEVICE
CN111586438B (en) Method, device and system for processing service data
JP2005190221A (en) Cache control apparatus and method, and computer program
CN108874319A (en) A kind of metadata updates method, apparatus, equipment and readable storage medium storing program for executing
CN113872994B (en) Organization architecture synchronization method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant