CN107741994B - Data updating method and device - Google Patents
Data updating method and device Download PDFInfo
- Publication number
- CN107741994B CN107741994B CN201711096589.XA CN201711096589A CN107741994B CN 107741994 B CN107741994 B CN 107741994B CN 201711096589 A CN201711096589 A CN 201711096589A CN 107741994 B CN107741994 B CN 107741994B
- Authority
- CN
- China
- Prior art keywords
- user data
- update
- updating
- timestamp
- server
- 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
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/2379—Updates performed during online database operations; commit processing
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/2308—Concurrency control
- G06F16/2315—Optimistic concurrency control
- G06F16/2322—Optimistic concurrency control using timestamps
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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)
- Computing Systems (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The embodiment of the application provides a data updating method and device, which are applied to a server and used for receiving a data updating request sent by a user through a client; determining a first timestamp of a server-side user data table, wherein the first timestamp is the maximum timestamp in timestamps of last updating of each user data item in the server-side user data table; acquiring all update data items of which the generation time stamps are later than the first time stamp in an update log table; for each update data item, updating the service end user data table by using the update data item, and determining the generation timestamp of the update data item as the timestamp of the last update of the user data item updated by the update data item in the service end user data table; and updating the client user data table indicated by the data updating request based on the updated server user data table, so that the occurrence of the condition of overlarge system load is reduced on the basis of realizing data updating.
Description
Technical Field
The present invention relates to the field of computers, and in particular, to a data updating method and apparatus.
Background
With the popularization of the internet, information real-time sharing and synchronization become more important, but due to asymmetry of each client, the information real-time sharing and synchronization cannot work in a P2P mode, and only can work in a client/server mode.
At present, in a client/server mode, a server user data table corresponding to each user is set at a server, a client user data table corresponding to each user is set at a client, and when an update requirement exists, the server user data table is directly updated, and the client user data table and the updated server user data table are subjected to a data synchronization mode, so that data update is realized. However, as the amount of data increases, although the current client/server mode can implement data update, the problem of overloading the system is often caused.
In view of this, a data updating method and apparatus are provided to reduce the occurrence of an excessive system load when the data updating is implemented in the current client/server mode.
Disclosure of Invention
In view of the above, an object of the present invention is to provide a data updating method and apparatus, so as to reduce the occurrence of system load process when the current client/server mode implements data updating, and the specific implementation scheme is as follows:
a data updating method is applied to a server side, and the method comprises the following steps:
receiving a data updating request sent by a user through a client;
determining an update log table stored by a server and a server user data table related to the user;
determining a first timestamp of the server-side user data table, wherein the first timestamp is the maximum timestamp in timestamps of last updating of each user data item in the server-side user data table;
acquiring all update data items of which the generation time stamps are later than the first time stamp in the update log table;
for each update data item, updating the service end user data table by using the update data item, and determining the generation timestamp of the update data item as the timestamp of the last update of the user data item updated by the update data item in the service end user data table;
and updating the client user data table indicated by the data updating request based on the updated server user data table.
Preferably, for each of the update data items, updating the service-side user data table with the update data item includes:
for each of the update data items, determining whether the update data item indicates the user;
if the user is indicated by the updating data item, determining the operation type indicated by the updating data item;
and updating the service end user data table based on the operation type.
Preferably, the updating the service-side user data table based on the operation type includes:
determining whether the operation type indicates a data information identifier;
if yes, acquiring data information corresponding to the data information identifier from a server data record table;
and updating the service end user data table based on the operation type and the data information.
Preferably, the updating the client user data table indicated by the data update request based on the updated server user data table includes:
determining a second timestamp of a client user data table related to the user, which is carried by the data updating request, wherein the second timestamp is the maximum timestamp in timestamps of the last updating of each user data item in the client user data table;
determining a user data item in the updated server user data table, wherein the timestamp of the last update is earlier than the second timestamp;
generating update information respectively corresponding to each determined user data item;
and returning the generated updating information to the client so that the client can update the client user data table by using the updating information, and determining the timestamp of the last update of the user data item corresponding to the updating information as the timestamp of the last update of the user data item updated by the updating information in the client user data table.
Preferably, the data update request also carries an update quantity; after determining the user data item in the updated server user data table whose last updated timestamp is earlier than the second timestamp, the method further includes:
selecting the user data items with the same number as the updating number from the determined user data items according to the sequence of the timestamps of the last updating of the user data items;
the generating of the update information respectively corresponding to each determined user data item includes: and generating updating information respectively corresponding to each selected user data item.
A data updating device applied to a server side comprises:
the data updating request receiving unit is used for receiving a data updating request sent by a user through a client;
the data table determining unit is used for determining an update log table stored by the server and a server user data table related to the user;
a first timestamp determining unit, configured to determine a first timestamp of the server-side user data table, where the first timestamp is a maximum timestamp of timestamps of last updates of each user data item in the server-side user data table;
an update data item acquisition unit configured to acquire all update data items in the update log table whose generation time stamps are later than the first time stamp;
a first updating unit, configured to update, for each update data item, the server-side user data table with the update data item, and determine a generation timestamp of the update data item as a timestamp of a last update of a user data item updated by the update data item in the server-side user data table;
and the second updating unit is used for updating the client user data table indicated by the data updating request based on the updated server user data table.
Preferably, the first updating unit includes:
a first determination unit configured to determine, for each of the update data items, whether the update data item indicates the user;
a second determining unit, configured to determine, if the update data item indicates that the user exists, an operation type indicated by the update data item;
and the first updating subunit is used for updating the service end user data table based on the operation type.
Preferably, the first updating subunit includes:
a data information identifier determining unit, configured to determine whether the operation type indicates a data information identifier;
the data information acquisition unit is used for acquiring data information corresponding to the data information identifier from a server data record table if the data information identifier is the data information identifier;
and the server user data table updating unit is used for updating the server user data table based on the operation type and the data information.
Preferably, the second updating unit includes:
a second timestamp determining unit, configured to determine a second timestamp of a client user data table, which is carried by the data update request and is related to the user, where the second timestamp is a largest timestamp in timestamps of last updates of each user data item in the client user data table;
a user data item determining unit, configured to determine a user data item, in the updated server user data table, whose last updated timestamp is earlier than the second timestamp;
an update information generation unit configured to generate update information corresponding to each of the determined user data items, respectively;
and the client user data table updating unit is used for returning the generated updating information to the client so that the client can update the client user data table by using the updating information, and determining the timestamp of the last update of the user data item corresponding to the updating information as the timestamp of the last update of the user data item updated by the updating information in the client user data table.
Preferably, the data update request further carries an update quantity, and the second update unit further includes:
a selecting unit, configured to select, from the determined user data items, user data items with the same number as the update number according to a sequence of timestamps of the last update of the user data items;
the update information generation unit is specifically configured to: and generating updating information respectively corresponding to each selected user data item.
The embodiment of the application provides a data updating method and device, which are applied to a server and used for receiving a data updating request sent by a user through a client; determining a first timestamp of a server-side user data table, wherein the first timestamp is the maximum timestamp in timestamps of last updating of each user data item in the server-side user data table; acquiring all update data items of which the generation time stamps are later than the first time stamp in an update log table; for each update data item, updating the service end user data table by using the update data item, and determining the generation timestamp of the update data item as the timestamp of the last update of the user data item updated by the update data item in the service end user data table; and updating the client user data table indicated by the data updating request based on the updated server user data table, so that the occurrence of the condition of overlarge system load is reduced on the basis of realizing data updating.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a data updating method according to an embodiment of the present application;
fig. 2 is a flowchart of a method for updating the service-side user data table by using each update data item according to an embodiment of the present application;
fig. 3 is a flowchart of a method for updating the service-side user data table based on the operation type according to an embodiment of the present application;
fig. 4 is a flowchart of a method for updating a client user data table indicated by the data update request based on an updated server user data table according to an embodiment of the present application;
fig. 5 is a flowchart of another method for updating a client user data table indicated by the data update request based on an updated server user data table according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a data updating apparatus according to an embodiment of the present application.
Detailed Description
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.
Example (b):
fig. 1 is a flowchart of a data updating method according to an embodiment of the present application.
Specifically, the data updating method shown in fig. 1 is applied to a server, and as shown in fig. 1, the method includes:
s101, receiving a data updating request sent by a user through a client;
optionally, the user may install a client through a terminal held by the user, and the client on the user application terminal logs in the client by inputting a legal account for logging in the client on the client, so that the user may send a data update request to a server corresponding to the client through the client.
In this embodiment of the present application, preferably, the server provides service support for the client, and the user may send a data update request to the server through the clients on different terminals.
Optionally, the client is a front end of an application program, and the server is a server cluster providing service support for the application program. The above is only a preferred mode of the client/server provided in the embodiment of the present application, and the inventor may arbitrarily set a specific expression form of the client/server according to his own needs, which is not limited herein.
S102, determining an update log table stored by a server and a server user data table related to the user;
optionally, after receiving the data update request, the server determines an update log table stored by the server and a server user data table related to the user.
In this embodiment of the present application, preferably, an update log table and a server user data table respectively associated with each user are preset in the server, and an initial value of the preset update log table is null, and an initial value of the server user data table respectively associated with each user is null.
For example, before the application program corresponding to the client is released, an update log table with an empty initial value is created at the server; after the application program is issued, as long as a user registers an account through a client corresponding to the application program, a server user data table which has an initial value of null and is related to the user (which can be considered as the account of the user) is created for the user at a server.
Optionally, no matter the user operates the content in the account thereof through the client, or the service operates the content in the account of at least one user applying the application program (i.e., for each operation performed on the content in the account of the user), an update data item is generated for the operation, and the generated update data item is stored in the update log table. That is, in the embodiment of the present application, it is preferable to generate one update data item for each operation and store the generated update data item in the update log table.
In the embodiment of the present application, preferably, the update data item includes at least: and generating a timestamp (the generated timestamp is the operation time of the operation for generating the update data item, namely when the operation is performed on the content in the account of the user, the update data item corresponding to the operation is generated, and the time of the operation is the generated timestamp of the generated update data item).
The above is only a preferred way of updating the data item provided in the embodiment of the present application, and the inventors can arbitrarily set the specific content of the update data item according to their own needs, which is not limited herein.
S103, determining a first time stamp of the server-side user data table, wherein the first time stamp is the maximum time stamp in the last updated time stamps of each user data item in the server-side user data table;
optionally, determining the first timestamp of the server-side user data table includes: determining whether a user data item exists in the service end user data table; if it is determined that no user data item exists in the service end user data table, determining that a first timestamp of the service end user data table is empty; if it is determined that the user data items exist in the service-side user data table (at this time, the first time stamp is not empty), the last update time stamp of each user data item in the service-side user data table is respectively determined, and the maximum time stamp (the maximum time stamp here is the time stamp representing the latest time in all the determined last update time stamps according to the time sequence) in all the determined last update time stamps is determined as the first time stamp.
S104, acquiring all update data items of which the generation time stamps are later than the first time stamp in the update log table;
optionally, when the first timestamp is null, determining each update data item in the update log table as an obtained update data item in the update log table whose generation timestamp is later than the first timestamp; and when the first time stamp is not empty, all the updating data items with the generation time stamps later than the first time stamp are obtained from the updating log table.
S105, aiming at each updating data item, updating the service end user data table by using the updating data item, and determining the generation time stamp of the updating data item as the time stamp of the last updating of the data item updated by the updating data item in the service end user data table;
optionally, for each update data item acquired in step S104, the server-side user data table is updated by using the update data item, and a generation timestamp of the update data item is determined as a timestamp of the last update of the user data item updated by the update data item in the server-side user data table.
In the embodiment of the present application, preferably, the update data item includes a generation timestamp, an operation type, and an operation object; the operation type is a user data item adding type, a user data item deleting type or a user data item modifying type; the operation object indicates an operated user (here, an account of the user).
Further, in this embodiment of the application, preferably, when the operation type is an add user data item type or a modify user data item type, the operation type further indicates a data information identifier, and the data information identifier corresponds to unique data information.
In the data updating method provided by the embodiment of the application, a server data record table is further provided. Optionally, before the application program corresponding to the client is issued, a server data record table with an empty initial value is created at the server; when the operation is performed on the content in the account of the user, generating an update data item corresponding to the operation, determining data information corresponding to the operation if the operation type of the operation is a type of modifying a user data item or a type of adding a user data item, allocating a unique data information identifier to the data information, storing the data information corresponding to the unique data information identifier in the server data record table, and indicating the unique data information identifier allocated to the data information in the operation type of the generated update data item.
Optionally, the manner for updating the service-side user data table by using the update data item includes: determining whether an operation object included in the update data item indicates a user who sends the data update request; if the operation object included in the update data item is determined to indicate the user sending the data update request, updating the service end user data table by using the update data item (the service end user data table is the service end user data table related to the user sending the data update request); otherwise, the service end user data table is not updated by the updating data item.
Optionally, if it is determined that the operation object included in the update data item indicates the user who sent the data update request, the operation type included in the update data item is determined.
In this embodiment of the present application, preferably, when the operation type is a delete user data item type, determining a user data item to be deleted, indicated by the operation type, in the server user data table related to the user sending the data update request; deleting the determined user data item in the server-side user data table, and determining the generation timestamp of the update data item as the timestamp of the last update of the deleted user data item.
In this embodiment of the present application, preferably, when the operation type is a modify user data item type, determining a user data item to be modified, indicated by the operation type, in the server user data table related to the user sending the data update request, and a data information identifier indicated by the operation type; acquiring data information corresponding to the data information identifier indicated by the operation type from the server data record table; and updating the user data items to be modified in the service end user data table indicated by the operation type according to the acquired data information.
In this embodiment of the present application, preferably, when the operation type is an add user data item type, determining a data information identifier of data information indicated by the operation type to be added to a user data item in the server user data table related to the user sending the data update request; acquiring data information corresponding to the determined data information identifier from the server data record table; and adding a user data item in the server user data table related to the user, wherein the data information of the added user data item is the data information which is acquired from the server data record table and corresponds to the determined data information identifier.
And S106, updating the client user data table indicated by the data updating request based on the updated server user data table.
Optionally, updating the client user data table indicated by the data update request based on the updated server user data table refers to: and synchronously updating the client user data table indicated by the data updating request and the updated server user data table.
In order to facilitate understanding of the data updating method provided by the embodiment of the present application, a method of "updating the server-side user data table with each update data item" in the data updating method provided by the embodiment of the present application is described in detail.
Fig. 2 is a flowchart of a method for updating the service-side user data table by using each update data item according to an embodiment of the present application.
As shown in fig. 2, the method includes:
s201, determining whether the update data item indicates the user or not aiming at each update data item;
s202, if the user is indicated by the updating data item, determining the operation type indicated by the updating data item;
s203, updating the service end user data table based on the operation type.
In order to facilitate understanding of the data updating method provided in the embodiment of the present application, a method of "updating the server-side user data table based on the operation type" in the data updating method provided in the embodiment of the present application will now be described in detail.
Fig. 3 is a flowchart of a method for updating the service-side user data table based on the operation type according to an embodiment of the present application.
As shown in fig. 3, the method includes:
s301, determining whether the operation type indicates a data information identifier; if yes, go to step S302;
s302, acquiring data information corresponding to the data information identifier from a server data record table;
s303, updating the service end user data table based on the operation type and the data information.
In order to facilitate understanding of the data updating method provided in the embodiment of the present application, a method of "updating the client user data table indicated by the data updating request based on the updated server user data table" in the data updating method provided in the embodiment of the present application will now be described in detail.
Fig. 4 is a flowchart of a method for updating a client user data table indicated by the data update request based on an updated server user data table according to an embodiment of the present application.
As shown in fig. 4, the method includes:
s401, determining a second timestamp of a client user data table related to the user, which is carried by the data updating request, wherein the second timestamp is the maximum timestamp in timestamps of the last updating of each user data item in the client user data table;
optionally, the data update request further carries a second timestamp of a client user data table related to the user, and the client user data table related to the user is stored in the client.
In this embodiment of the present application, it is preferable that the client user data table is empty before any operation is performed on the client user data table related to the user. For example, after a user registers an account in an application program corresponding to the client through the client, a client user data table related to the user is created, and the client user data table is stored in the client, wherein an initial value of the client user data table is null.
Optionally, when the user data item is not included in the client user data table, it is determined that a maximum timestamp of timestamps of the last update of each user data item in the client user data table is empty, that is, the second timestamp is empty.
S402, determining a user data item which is in the updated service end user data table and has the timestamp updated last time earlier than the second timestamp;
optionally, each user data item with the timestamp of the last update earlier than the second timestamp is found from all the user data items in the service-side user data table. And when the second timestamp is null, determining that the timestamp of the last update of each user data item in the server-side user data table is earlier than the second timestamp.
S403, generating updating information corresponding to each determined user data item;
optionally, for each user data item determined in step S402, update information corresponding to the user data item is generated, and the generated update information is returned to the client, so that the client updates the client user data table based on the received update information.
S404, returning the generated updating information to the client so that the client can update the client user data table by using the updating information, and determining the timestamp of the last update of the user data item corresponding to the updating information as the timestamp of the last update of the user data item updated by the updating information in the client user data table.
Optionally, the update information includes an operation type, where the operation type is a user data item addition type, a user data item modification type, or a user data item deletion type.
When the operation type included in the update information is a user data item adding type, adding a user data item in the client user data table, where the data information of the added user data item is the data information indicated by the update information (where the data information indicated by the update information is the data information of the user data item in the server user data table corresponding to the update information), and determining the timestamp of the last update of the user data item in the server user data table corresponding to the update information as the timestamp of the last update of the user data item added to the client user data table.
When the operation type included in the update information is a user data item modification type, determining a user data item to be modified corresponding to the update information in the client user data table, modifying the data information in the user data item to be modified into the data information indicated by the update information (the data information indicated by the update information is the data information of the user data item in the server user data table corresponding to the update information), and determining the timestamp of the last update of the user data item in the server user data table corresponding to the update information as the timestamp of the last update of the modified user data item in the client user data table.
When the operation type included in the update information is a user data item deletion type, determining a user data item to be deleted corresponding to the update information in a client user data table, deleting the user data item to be deleted from the client user data table, and determining a timestamp of the last update of the user data item in a server user data table corresponding to the update information as a timestamp of the last update of the deleted user data item in the client user data table.
In order to facilitate understanding of a data updating method provided in the embodiment of the present application, a method for updating a client user data table indicated by a data updating request based on an updated server user data table provided in the embodiment of the present application will now be described in detail.
As shown in fig. 5, the method includes:
s501, determining a second timestamp of a client user data table related to the user, which is carried by the data updating request, wherein the second timestamp is the maximum timestamp in timestamps of the last updating of each user data item in the client user data table;
s502, determining a user data item of which the last updated time stamp is earlier than the second time stamp in the updated server user data table;
s503, selecting the user data items with the same updating quantity as the user data items from the determined user data items according to the sequence of the timestamps of the last updating of the user data items;
s504, generating updating information corresponding to each selected user data item;
and S505, returning the generated updating information to the client so that the client updates the client user data table by using the updating information, and determining the timestamp of the last update of the user data item corresponding to the updating information as the timestamp of the last update of the user data item updated by the updating information in the client user data table.
Further, a data updating method provided in the embodiment of the present application further includes: receiving a data page turning update request related to the data update request, wherein the data page turning update request indicates the number of data in each page; determining the maximum timestamp in the timestamps of the last update of each user data item in the client user data table; determining a user data item with a timestamp which is updated last time and is earlier than the maximum timestamp in the updated server user data table; selecting the user data items with the same number as the data pieces from the determined user data items according to the sequence of the timestamps updated last time of the user data items; generating update information corresponding to each of the selected user data items, respectively; and returning the generated updating information to the client so that the client can update the client user data table by using the updating information, and determining the timestamp of the last update of the user data item corresponding to the updating information as the timestamp of the last update of the user data item updated by the updating information in the client user data table.
The embodiment of the application provides a data updating method, which is applied to a server and used for receiving a data updating request sent by a user through a client; determining a first timestamp of a server-side user data table, wherein the first timestamp is the maximum timestamp in timestamps of last updating of each user data item in the server-side user data table; acquiring all update data items of which the generation time stamps are later than the first time stamp in an update log table; for each update data item, updating the service end user data table by using the update data item, and determining the generation timestamp of the update data item as the timestamp of the last update of the user data item updated by the update data item in the service end user data table; and updating the client user data table indicated by the data updating request based on the updated server user data table, so that the occurrence of the condition of overlarge system load is reduced on the basis of realizing data updating.
Fig. 6 is a schematic structural diagram of a data updating apparatus according to an embodiment of the present application.
The data updating apparatus shown in fig. 6 is applied to a server, and the apparatus includes:
a data update request receiving unit 61, configured to receive a data update request sent by a user through a client;
a data table determining unit 62, configured to determine an update log table stored by the server and a server user data table related to the user;
a first timestamp determining unit 63, configured to determine a first timestamp of the server-side user data table, where the first timestamp is a maximum timestamp of timestamps of last updates of each user data item in the server-side user data table;
an update data item acquisition unit 64 configured to acquire all update data items in the update log table whose generation time stamps are later than the first time stamp;
a first updating unit 65, configured to update, for each of the update data items, the server-side user data table with the update data item, and determine a generation timestamp of the update data item as a timestamp of a last update of a user data item in the server-side user data table that is updated by the update data item;
and a second updating unit 66, configured to update the client user data table indicated by the data updating request based on the updated server user data table.
Optionally, the first updating unit includes: a first determination unit configured to determine, for each of the update data items, whether the update data item indicates the user; a second determining unit, configured to determine, if the update data item indicates that the user exists, an operation type indicated by the update data item; and the first updating subunit is used for updating the service end user data table based on the operation type.
Optionally, the first updating subunit includes: a data information identifier determining unit, configured to determine whether the operation type indicates a data information identifier; the data information acquisition unit is used for acquiring data information corresponding to the data information identifier from a server data record table if the data information identifier is the data information identifier; and the server user data table updating unit is used for updating the server user data table based on the operation type and the data information.
Optionally, the second updating unit includes:
a second timestamp determining unit, configured to determine a second timestamp of a client user data table, which is carried by the data update request and is related to the user, where the second timestamp is a largest timestamp in timestamps of last updates of each user data item in the client user data table;
a user data item determining unit, configured to determine a user data item, in the updated server user data table, whose last updated timestamp is earlier than the second timestamp;
an update information generation unit configured to generate update information corresponding to each of the determined user data items, respectively;
and the client user data table updating unit is used for returning the generated updating information to the client so that the client can update the client user data table by using the updating information, and determining the timestamp of the last update of the user data item corresponding to the updating information as the timestamp of the last update of the user data item updated by the updating information in the client user data table.
Further, the data update request also carries an update number, and the second update unit provided in the embodiment of the present application further includes a selection unit, configured to select, from the determined user data items, a user data item having the same update number as the update number according to a sequence of timestamps of the last update of the user data item. Correspondingly, the update information generating unit is specifically configured to: and generating updating information respectively corresponding to each selected user data item.
The embodiment of the application provides a data updating device, which is applied to a server and used for receiving a data updating request sent by a user through a client; determining a first timestamp of a server-side user data table, wherein the first timestamp is the maximum timestamp in timestamps of last updating of each user data item in the server-side user data table; acquiring all update data items of which the generation time stamps are later than the first time stamp in an update log table; for each update data item, updating the service end user data table by using the update data item, and determining the generation timestamp of the update data item as the timestamp of the last update of the user data item updated by the update data item in the service end user data table; and updating the client user data table indicated by the data updating request based on the updated server user data table, so that the occurrence of the condition of overlarge system load is reduced on the basis of realizing data updating.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units 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 units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (8)
1. A data updating method is applied to a server side, and the method comprises the following steps:
receiving a data updating request sent by a user through a client;
determining an update log table stored by a server and a server user data table related to the user;
determining a first timestamp of the server-side user data table, wherein the first timestamp is the maximum timestamp in timestamps of last updating of each user data item in the server-side user data table;
acquiring all update data items of which the generation time stamps are later than the first time stamp in the update log table;
for each update data item, updating the service end user data table by using the update data item, and determining the generation timestamp of the update data item as the timestamp of the last update of the user data item updated by the update data item in the service end user data table;
updating the client user data table indicated by the data updating request based on the updated server user data table, including:
determining a second timestamp of a client user data table related to the user, which is carried by the data updating request, wherein the second timestamp is the maximum timestamp in timestamps of the last updating of each user data item in the client user data table;
determining a user data item in the updated server user data table, wherein the timestamp of the last update is earlier than the second timestamp;
generating update information respectively corresponding to each determined user data item;
and returning the generated updating information to the client so that the client can update the client user data table by using the updating information, and determining the timestamp of the last update of the user data item corresponding to the updating information as the timestamp of the last update of the user data item updated by the updating information in the client user data table.
2. The method according to claim 1, wherein the updating the server-side user data table with each of the update data items comprises:
for each of the update data items, determining whether the update data item indicates the user;
if the user is indicated by the updating data item, determining the operation type indicated by the updating data item;
and updating the service end user data table based on the operation type.
3. The method of claim 2, wherein said updating the server-side user data table based on the operation type comprises:
determining whether the operation type indicates a data information identifier;
if yes, acquiring data information corresponding to the data information identifier from a server data record table;
and updating the service end user data table based on the operation type and the data information.
4. The method of claim 1, wherein the data update request further carries an update quantity; after determining the user data item in the updated server user data table whose last updated timestamp is earlier than the second timestamp, the method further includes:
selecting the user data items with the same number as the updating number from the determined user data items according to the sequence of the timestamps of the last updating of the user data items;
the generating of the update information respectively corresponding to each determined user data item includes: and generating updating information respectively corresponding to each selected user data item.
5. A data updating apparatus, applied to a server, the apparatus comprising:
the data updating request receiving unit is used for receiving a data updating request sent by a user through a client;
the data table determining unit is used for determining an update log table stored by the server and a server user data table related to the user;
a first timestamp determining unit, configured to determine a first timestamp of the server-side user data table, where the first timestamp is a maximum timestamp of timestamps of last updates of each user data item in the server-side user data table;
an update data item acquisition unit configured to acquire all update data items in the update log table whose generation time stamps are later than the first time stamp;
a first updating unit, configured to update, for each update data item, the server-side user data table with the update data item, and determine a generation timestamp of the update data item as a timestamp of a last update of a user data item updated by the update data item in the server-side user data table;
the second updating unit is used for updating the client user data table indicated by the data updating request based on the updated server user data table;
a second timestamp determining unit, configured to determine a second timestamp of a client user data table, which is carried by the data update request and is related to the user, where the second timestamp is a largest timestamp in timestamps of last updates of each user data item in the client user data table;
a user data item determining unit, configured to determine a user data item, in the updated server user data table, whose last updated timestamp is earlier than the second timestamp;
an update information generation unit configured to generate update information corresponding to each of the determined user data items, respectively;
and the client user data table updating unit is used for returning the generated updating information to the client so that the client can update the client user data table by using the updating information, and determining the timestamp of the last update of the user data item corresponding to the updating information as the timestamp of the last update of the user data item updated by the updating information in the client user data table.
6. The apparatus of claim 5, wherein the first updating unit comprises:
a first determination unit configured to determine, for each of the update data items, whether the update data item indicates the user;
a second determining unit, configured to determine, if the update data item indicates that the user exists, an operation type indicated by the update data item;
and the first updating subunit is used for updating the service end user data table based on the operation type.
7. The apparatus of claim 6, wherein the first update subunit comprises:
a data information identifier determining unit, configured to determine whether the operation type indicates a data information identifier;
the data information acquisition unit is used for acquiring data information corresponding to the data information identifier from a server data record table if the data information identifier is the data information identifier;
and the server user data table updating unit is used for updating the server user data table based on the operation type and the data information.
8. The apparatus of claim 5, wherein the data update request further carries an update quantity, and wherein the second update unit further comprises:
a selecting unit, configured to select, from the determined user data items, user data items with the same number as the update number according to a sequence of timestamps of the last update of the user data items;
the update information generation unit is specifically configured to: and generating updating information respectively corresponding to each selected user data item.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201711096589.XA CN107741994B (en) | 2017-11-09 | 2017-11-09 | Data updating method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201711096589.XA CN107741994B (en) | 2017-11-09 | 2017-11-09 | Data updating method and device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN107741994A CN107741994A (en) | 2018-02-27 |
| CN107741994B true CN107741994B (en) | 2021-09-07 |
Family
ID=61234356
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201711096589.XA Active CN107741994B (en) | 2017-11-09 | 2017-11-09 | Data updating method and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN107741994B (en) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109067913A (en) * | 2018-09-19 | 2018-12-21 | 量子云未来(北京)信息科技有限公司 | A kind of method and device for maintaining data synchronous |
| CN111835855A (en) * | 2020-07-17 | 2020-10-27 | 浪潮软件股份有限公司 | A data synchronization method and system |
| CN112765275A (en) * | 2021-01-26 | 2021-05-07 | 成都佳发安泰教育科技股份有限公司 | Data synchronous exchange method, equipment and medium based on single time coordinate system |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102904887A (en) * | 2012-09-26 | 2013-01-30 | 东软集团股份有限公司 | Method and system for data synchronization of Web client and server |
| CN103440317A (en) * | 2013-08-28 | 2013-12-11 | 电子科技大学 | Incremental data inquiry method based on database time labels |
| CN103442042A (en) * | 2013-08-14 | 2013-12-11 | 福建天晴数码有限公司 | Incremental data synchronization method and system |
| CN106648917A (en) * | 2016-09-19 | 2017-05-10 | 福建天泉教育科技有限公司 | Cache data differential updating method and system |
| CN106844689A (en) * | 2017-01-23 | 2017-06-13 | 北京皮尔布莱尼软件有限公司 | A kind of paged data synchronous method, apparatus and system |
| CN107229649A (en) * | 2016-03-25 | 2017-10-03 | 腾讯科技(深圳)有限公司 | Data update system and method |
Family Cites Families (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101990119B (en) * | 2009-08-03 | 2014-11-12 | 鸿富锦精密工业(深圳)有限公司 | Music video server and music video personalized setting method thereof |
| CN103841004B (en) * | 2012-11-26 | 2017-12-22 | 腾讯科技(深圳)有限公司 | Method for information display and information server |
| CN103916474B (en) * | 2014-04-04 | 2018-05-22 | 北京搜狗科技发展有限公司 | The definite method, apparatus and system of cache-time |
| CN105243067B (en) * | 2014-07-07 | 2019-06-28 | 北京明略软件系统有限公司 | A kind of method and device for realizing real-time incremental synchrodata |
| CN114756520A (en) * | 2015-10-02 | 2022-07-15 | 谷歌有限责任公司 | Method and system for synchronizing offline data in a computing system |
| CN106649415B (en) * | 2015-11-03 | 2019-12-20 | 广州市动景计算机科技有限公司 | Client data checking and updating method and device |
-
2017
- 2017-11-09 CN CN201711096589.XA patent/CN107741994B/en active Active
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102904887A (en) * | 2012-09-26 | 2013-01-30 | 东软集团股份有限公司 | Method and system for data synchronization of Web client and server |
| CN103442042A (en) * | 2013-08-14 | 2013-12-11 | 福建天晴数码有限公司 | Incremental data synchronization method and system |
| CN103440317A (en) * | 2013-08-28 | 2013-12-11 | 电子科技大学 | Incremental data inquiry method based on database time labels |
| CN107229649A (en) * | 2016-03-25 | 2017-10-03 | 腾讯科技(深圳)有限公司 | Data update system and method |
| CN106648917A (en) * | 2016-09-19 | 2017-05-10 | 福建天泉教育科技有限公司 | Cache data differential updating method and system |
| CN106844689A (en) * | 2017-01-23 | 2017-06-13 | 北京皮尔布莱尼软件有限公司 | A kind of paged data synchronous method, apparatus and system |
Also Published As
| Publication number | Publication date |
|---|---|
| CN107741994A (en) | 2018-02-27 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN109902071B (en) | Service log storage method, system, device and equipment | |
| CN111176976A (en) | Test data generation method and device, storage medium and electronic device | |
| CN110162529B (en) | Data processing method, service server and data processing system | |
| CN107819870A (en) | Incremental data pulling method and device, storage medium, terminal equipment and server | |
| CN107357896A (en) | Expansion method, device, system and the data base cluster system of data-base cluster | |
| CN103841170A (en) | Cloud storage method and server | |
| CN108377247B (en) | A message push method and device | |
| CN107741994B (en) | Data updating method and device | |
| CN103475721B (en) | A kind of digital asset updates the digital asset update method of system | |
| US10158642B2 (en) | Coherent distributed logging | |
| CN111400334B (en) | Data processing method, data processing device, storage medium and electronic device | |
| CN108183965A (en) | A kind of method of data synchronization, device, equipment, system and readable storage medium storing program for executing | |
| CN109873839B (en) | Data access method, server and distributed system | |
| JP6582445B2 (en) | Thin client system, connection management device, virtual machine operating device, method, and program | |
| CN113342746A (en) | File management system, file management method, electronic device, and storage medium | |
| CN108875035B (en) | Data storage method of distributed file system and related equipment | |
| CN109949026B (en) | Red packet information generation method and device, terminal and server | |
| CN111159219A (en) | Data management method, device, server and storage medium | |
| JP2009157437A (en) | Distributed storage system | |
| CN105763535B (en) | Conversation message list processing method, equipment and system | |
| CN104239486A (en) | Method and system for processing data, and related device | |
| CN103347253B (en) | The extensive distributed transmitting system of off-line short message and method | |
| CN108111598B (en) | Cloud disk data issuing method and device and storage medium | |
| CN109391658B (en) | Account data synchronization method and equipment, storage medium and terminal thereof | |
| CN109842497B (en) | Configuration updating method and device of DNS (Domain name Server), terminal equipment and configuration updating system |
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 |