WO2022170771A1 - 数据库同步方法及装置、存储介质、设备 - Google Patents

数据库同步方法及装置、存储介质、设备 Download PDF

Info

Publication number
WO2022170771A1
WO2022170771A1 PCT/CN2021/121416 CN2021121416W WO2022170771A1 WO 2022170771 A1 WO2022170771 A1 WO 2022170771A1 CN 2021121416 W CN2021121416 W CN 2021121416W WO 2022170771 A1 WO2022170771 A1 WO 2022170771A1
Authority
WO
WIPO (PCT)
Prior art keywords
cloud
incremental update
update
terminal
version number
Prior art date
Application number
PCT/CN2021/121416
Other languages
English (en)
French (fr)
Inventor
秦泽民
Original Assignee
上海商汤智能科技有限公司
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 上海商汤智能科技有限公司 filed Critical 上海商汤智能科技有限公司
Publication of WO2022170771A1 publication Critical patent/WO2022170771A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/219Managing data history or versioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/51Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/58Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/583Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation
    • G06V40/166Detection; Localisation; Normalisation using acquisition arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/401Transaction verification
    • G06Q20/4014Identity check for transactions
    • G06Q20/40145Biometric identity checks
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07CTIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
    • G07C9/00Individual registration on entry or exit
    • G07C9/30Individual registration on entry or exit not involving the use of a pass
    • G07C9/32Individual registration on entry or exit not involving the use of a pass in combination with an identity check
    • G07C9/37Individual registration on entry or exit not involving the use of a pass in combination with an identity check using biometric data, e.g. fingerprints, iris scans or voice recognition

Definitions

  • the present disclosure relates to the field of data processing, and in particular, to a database synchronization method and device, a storage medium, and a device.
  • the present disclosure provides a database synchronization method and device, a storage medium, and a device.
  • a method for synchronizing a database including: receiving an incremental update download request sent by a terminal; wherein the incremental update download request is used for requesting to download data required for incremental update package; determine the target incremental update data package corresponding to the incremental update download request; send the target incremental update data package to the terminal.
  • the incremental update download request includes a first version number and a first information digest; wherein the first version number is a version number of a database currently stored by the terminal, and the first The information summary is an information summary obtained by the terminal based on the database content corresponding to the first version number; the determining the target incremental update data package corresponding to the incremental update download request includes: according to the first information summary and the first version number, determine whether to allow the terminal to perform incremental update; in response to determining that the terminal is allowed to perform incremental update, determine the target increment according to the first version number and the second version number updating the data package; wherein, the second version number is the latest version number in at least one database version currently stored in the cloud.
  • the method further includes: in response to determining that the terminal is not allowed to perform incremental update, sending target indication information to the terminal; wherein the target indication information is used to instruct the cloud not to Incremental updates to the terminal are allowed.
  • the determining whether to allow the terminal to perform incremental update according to the first information digest and the first version number includes: according to the correspondence between the pre-stored information digest and the version number relationship, determining the second information digest currently stored in the cloud and corresponding to the first version number; in response to determining that the first information digest matches the second information digest, determining that the terminal is allowed to perform incremental update , otherwise it is determined that the terminal is not allowed to perform incremental update.
  • the determining the target incremental update data package according to the first version number and the second version number includes: according to the first version number, the second version number, and The pre-stored incremental update data package corresponding to every two adjacent version numbers is used to determine the target incremental update data package.
  • the method further includes: sending a second version number and a third information digest to the terminal; wherein the second version number is a version of at least one database version currently stored in the cloud.
  • the latest version number, and the third information digest is an information digest obtained by the cloud based on the database content corresponding to the second version number.
  • the method before the receiving an incremental update download request sent by the terminal, the method further includes: receiving an update request sent by the terminal; wherein the update request is used to request an incremental update.
  • the method further includes: determining a first number of terminals sending the update request within a first time period; sending the first number and the second number to the terminals sending the update request number; wherein, the second number is the maximum number of terminals currently allowed by the cloud to synchronize incremental update downloads.
  • the method further includes: receiving a full update download request sent by the terminal; wherein the full update download request is used for requesting to download a data package for full update; downloading according to the full update request, and send a target full update data package to the terminal; wherein, the target full update data package includes full data corresponding to the latest version in at least one database version currently stored in the cloud.
  • the database includes a base library of feature information required to perform visual task processing.
  • a method for synchronizing a database including: sending an incremental update download request to the cloud; wherein the incremental update download request is used to request to download a data package required for incremental update ; download the target incremental update data package determined by the cloud based on the incremental update download request; and incrementally update the currently stored database content based on the target incremental update data package.
  • the incremental update download request includes a first version number and a first information digest; wherein the first version number is a version number of a database currently stored by the terminal, and the first The information summary is an information summary obtained by the terminal based on the database content corresponding to the first version number.
  • the method further includes: receiving a second version number and a third information digest sent by the cloud; wherein the second version number is in at least one database version currently stored in the cloud the latest version number, the third information summary is the information summary obtained by the cloud based on the database content corresponding to the second version number; the fourth information summary is determined based on the incrementally updated database content; in response to determining the The third information digest matches the fourth information digest, it is determined that the incremental update is successful, and the version number of the currently stored database is updated to the second version number.
  • the method further includes: in response to determining that the incremental update fails, sending an incremental update download request to the cloud again, and based on the target incremental update data package sent by the cloud again, for The currently stored database contents are incrementally updated again.
  • the method further includes: in response to receiving the target indication information sent by the cloud or determining that the number of incremental update failures reaches a preset number of times, sending a full update download request to the cloud; wherein , the target indication information is used to indicate that the cloud does not allow the terminal to perform incremental update, and the full update download request is used to request the download of a data package for full update; download the target full update data package determined by the cloud Then, based on the target full update data package, the currently stored database content is fully updated; wherein the target full update data package includes full data corresponding to the latest version in at least one database version currently stored in the cloud.
  • the method before the sending an incremental update download request to the cloud, further includes: sending an update request to the cloud; wherein the update request is used to request an incremental update; The first number and the second number sent by the cloud; wherein, the first number is the number of terminals that the cloud has received to send an update request within the first time period, and the second number is currently allowed by the cloud The maximum number of terminals that synchronously perform incremental update downloads; in response to determining that the first number is less than or equal to the second number, determine to send the incremental update download request to the cloud in a second time period; wherein, the The second time period is the next time period adjacent to the first time period.
  • the method further includes: in response to determining that the first number is greater than the second number, determining a time period for sending the incremental update download request to the cloud within the second time period a first probability value, and/or a second probability value of sending the update request to the cloud again within the second time period; based on the first probability value, sending the update request to the cloud within the second time period The cloud sends the incremental update download request, or based on the second probability value, sends the update request to the cloud again within the second time period.
  • the database includes a base library of feature information required to perform visual task processing; the method further includes: acquiring feature information to be processed; With the latest database content, perform visual task processing to obtain visual task processing results; and perform corresponding target operations based on the visual task processing results.
  • the visual task processing includes face recognition; the target operation includes at least one of the following: an access control switch operation and a payment operation.
  • a database synchronization apparatus including: a first receiving module configured to receive an incremental update download request sent by a terminal; wherein the incremental update download request is used to request a download to be performed a data package required for incremental update; a first determining module for determining a target incremental update data package corresponding to the incremental update download request; a first sending module for sending the target incremental update to the terminal Update package.
  • the incremental update download request includes a first version number and a first information digest; wherein the first version number is a version number of a database currently stored by the terminal, and the first The information summary is an information summary obtained by the terminal based on the database content corresponding to the first version number; the first determination module includes: a first determination sub-module, configured to a version number, to determine whether to allow the terminal to perform incremental update; a second determination submodule, configured to respond to determining that the terminal is allowed to perform incremental update, according to the first version number and the second version number, to determine the A target incremental update data package; wherein the second version number is the latest version number in at least one database version currently stored in the cloud.
  • the apparatus further includes: a third sending module, configured to send target indication information to the terminal in response to determining that the terminal is not allowed to perform incremental update; wherein the target indication information It is used to instruct the cloud not to allow the terminal to perform incremental update.
  • the first determination sub-module includes: a first determination unit, configured to determine, according to the correspondence between the pre-stored information digest and the version number, the current stored in the cloud and the first a second information digest corresponding to the version number; a second determination unit, configured to, in response to determining that the first information digest matches the second information digest, determine to allow the terminal to perform incremental update, otherwise determine not to allow the terminal Terminal for incremental update.
  • the second determination sub-module includes: a third determination unit, configured to correspond to the first version number, the second version number, and every two adjacent version numbers pre-stored an incremental update packet of the target incremental update packet is determined.
  • the apparatus further includes: a fourth sending module, configured to send a second version number and a third information digest to the terminal; wherein the second version number is at least one currently stored in the cloud.
  • the latest version number in a database version, and the third information summary is an information summary obtained by the cloud based on the database content corresponding to the second version number.
  • the apparatus further includes: a second receiving module, configured to receive an update request sent by the terminal; wherein the update request is used to request an incremental update.
  • the apparatus further includes: a second determining module, configured to determine a first number of terminals that send the update request within a first time period; a fifth sending module, configured to send the update request to the Send the first number and the second number to the terminal of the update request; wherein, the second number is the maximum number of terminals currently allowed by the cloud to synchronize incremental update downloads.
  • the apparatus further includes: a third receiving module, configured to receive a full update download request sent by the terminal; wherein the full update download request is used for requesting to download a data package for full update
  • the sixth sending module is used to send a target full-scale update data packet to the terminal according to the full-scale update download request; wherein, the target full-scale update data packet includes the latest version corresponding to at least one database version currently stored in the cloud of full data.
  • the database includes a base library of feature information required to perform visual task processing.
  • a database synchronization apparatus including: a second sending module, configured to send an incremental update download request to the cloud; wherein the incremental update download request is used to request download for incremental update The data package required for the incremental update; the download module is used to download the target incremental update data package determined by the cloud based on the incremental update download request; the incremental update module is used to incrementally update the data package based on the target , which incrementally updates the currently stored database contents.
  • the incremental update download request includes a first version number and a first information digest; wherein the first version number is a version number of a database currently stored by the terminal, and the first information digest is an information digest obtained by the terminal based on the database content corresponding to the first version number.
  • the apparatus further includes: a fourth receiving module, configured to receive the second version number and the third information digest sent by the cloud; wherein the second version number is the current The latest version number in the stored at least one database version, and the third information summary is the information summary obtained by the cloud based on the database content corresponding to the second version number; The content of the database is determined, and the fourth information digest is determined; the first execution module is configured to, in response to determining that the third information digest matches the fourth information digest, determine that the incremental update is successful, and change the version number of the currently stored database Update to the second version number.
  • a fourth receiving module configured to receive the second version number and the third information digest sent by the cloud
  • the second version number is the current The latest version number in the stored at least one database version
  • the third information summary is the information summary obtained by the cloud based on the database content corresponding to the second version number
  • the content of the database is determined, and the fourth information digest is determined
  • the first execution module is configured to, in response to determining that the third information digest matches the fourth information
  • the apparatus further includes: a second execution module, configured to send an incremental update download request to the cloud again in response to determining that the incremental update fails after it is determined that the incremental update is allowed, And based on the target incremental update data package sent again by the cloud, the currently stored database content is incrementally updated again.
  • a second execution module configured to send an incremental update download request to the cloud again in response to determining that the incremental update fails after it is determined that the incremental update is allowed, And based on the target incremental update data package sent again by the cloud, the currently stored database content is incrementally updated again.
  • the apparatus further includes: a seventh sending module, configured to send a message to the cloud in response to receiving the target indication information sent by the cloud or determining that the number of failures of incremental update reaches a preset number of times.
  • Send a full update download request wherein, the target indication information is used to instruct the cloud not to allow the terminal to perform incremental update, and the full update download request is used to request downloading of a data package for full update;
  • the full update module After downloading the target full update data package sent by the cloud, based on the target full update data package, the current stored database content is fully updated; wherein, the target full update data package includes the current storage of the cloud.
  • the apparatus further includes: an eighth sending module, configured to send an update request to the cloud; wherein, the update request is used to request an incremental update; and a fifth receiving module, configured to Receive the first number and the second number sent by the cloud; wherein, the first number is the number of terminals that the cloud has received to send an update request within the first time period, and the second number is the current number of the cloud The maximum number of terminals allowed to synchronize incremental update downloads; the fourth determination module is configured to, in response to determining that the first number is less than or equal to the second number, determine to send the cloud to the cloud in a second time period An incremental update download request; wherein the second time period is the next time period adjacent to the first time period.
  • the apparatus further includes: a fifth determination module, configured to, in response to determining that the first number is greater than the second number, determine to send the data to the cloud within the second time period. the first probability value of the incremental update download request, and/or the second probability value of sending the update request to the cloud again within the second time period; a ninth sending module is configured to send the update request based on the second probability value. a probability value, sending the incremental update download request to the cloud within the second time period, or sending the update to the cloud again within the second time period based on the second probability value ask.
  • the database includes a base library of feature information required to perform visual task processing; the apparatus further includes: an acquisition module for acquiring feature information to be processed; a visual task processing module for The feature information to be processed and the latest database content currently stored in the terminal are used for visual task processing to obtain a visual task processing result; a third execution module is configured to execute a corresponding target operation based on the visual task processing result.
  • the visual task processing includes face recognition; the target operation includes at least one of the following: an access control switch operation and a payment operation.
  • a computer-readable storage medium which stores a computer program, and the computer program is used to execute the above-mentioned database synchronization method.
  • a database synchronization device comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to call the memory stored in the memory Executable instructions to implement the above database synchronization method.
  • a computer program product comprising computer-readable codes and stored in a computer-readable storage medium, when the computer-readable codes are executed on a device, a processor in the device executes commands for Instructions that implement the database synchronization method described above.
  • the cloud may determine the target incremental update data package requested by the terminal according to the incremental update download request sent by the terminal, so that the terminal downloads the incremental update data package.
  • the present disclosure can use an incremental update method to synchronize the database content in the cloud to the terminal, which occupies less bandwidth resources and shortens the synchronization time.
  • FIG. 1 is a flowchart of a database synchronization method according to an exemplary embodiment of the present disclosure
  • FIG. 2 is a flowchart of another database synchronization method shown in the present disclosure according to an exemplary embodiment
  • FIG. 3 is a flowchart of another database synchronization method shown in the present disclosure according to an exemplary embodiment
  • FIG. 4 is a flowchart of another database synchronization method shown in the present disclosure according to an exemplary embodiment
  • FIG. 5 is a block diagram of a database synchronization apparatus according to an exemplary embodiment of the present disclosure.
  • FIG. 6 is a block diagram of another database synchronization apparatus according to an exemplary embodiment of the present disclosure.
  • FIG. 7 is a schematic structural diagram of a database synchronization apparatus according to an exemplary embodiment of the present disclosure.
  • first, second, third, etc. may be used in this disclosure to describe various pieces of information, such information should not be limited by these terms. These terms are only used to distinguish the same type of information from each other.
  • first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information, without departing from the scope of the present disclosure.
  • word "if” as used herein can be interpreted as "at the time of” or "when” or "in response to determining.”
  • the database content can include a large number of face feature information of faces, if the terminal that performs face payment regularly updates the database content to the terminal from the cloud, the full update will occupy more bandwidth resources and the update time will be long.
  • an embodiment of the present disclosure provides a database synchronization solution, in the above scenario, the database content in the cloud can be synchronized to the terminal in an incremental update manner.
  • an exemplary embodiment of the present disclosure provides a database synchronization method, which can be used in a cloud or a server.
  • the following embodiments will take the cloud as an example for description, including the following steps 101 to 103 .
  • step 101 the incremental update download request sent by the terminal is received.
  • the incremental update download request is used to request to download a data package required for incremental update.
  • the incremental update refers to only synchronizing the different contents of two databases.
  • the incremental update refers to synchronizing the latest version of the database content in at least one database version currently stored in the cloud with the database currently stored in the terminal. Different contents between contents are synchronized to the terminal.
  • step 102 a target incremental update data package corresponding to the incremental update download request is determined.
  • the target incremental update data package may update the database content currently stored in the terminal to the latest version of the database content currently stored in the cloud, and the target incremental update data package may include at least one of an add instruction and a delete instruction. one.
  • the add command is used to add at least one new database content
  • the delete command is used to delete the existing content of the database.
  • the terminal may update the addition instruction in the data packet according to the target increment, add at least one piece of data to the database currently stored by the terminal, update the delete instruction in the data packet according to the target increment, and delete the current storage of the terminal.
  • At least one piece of data in the database In the database currently stored by the terminal, each piece of data may include at least one data item, and the data item included in each piece of data may be used to indicate different data contents of the same data.
  • the entire piece of data can be deleted through a delete instruction in the target incremental data packet, and then a new whole piece of data can be added through an add instruction.
  • the entire piece of data contains the updated at least one data item.
  • step 103 the target incremental update data packet is sent to the terminal.
  • the target incremental update data packet may be sent to the terminal by the cloud through the network with the terminal.
  • the networks involved in this disclosure include but are not limited to 4G, 5G and other networks.
  • the cloud may determine the target incremental update data package requested by the terminal according to the incremental update download request sent by the terminal, so that the terminal downloads the target incremental update data package for incremental update.
  • the present disclosure can use an incremental update method to synchronize the database in the cloud to the terminal, which occupies less bandwidth resources and shortens the synchronization time.
  • the incremental update download request may include a first version number and a first information summary, where the first version number is the version number of the database currently stored by the terminal, for example, the version number of the database currently stored by the terminal The version number is 2.0, then the first version number is 2.0.
  • the first information digest is an information digest obtained by the terminal based on the database content corresponding to the first version number.
  • the information digest is a character string with a fixed length obtained based on the information content
  • the first information digest is a character string obtained by the terminal based on the database content (which may be the entire content of the database) corresponding to the first version number.
  • the terminal may use a hash encryption algorithm to obtain the first information digest based on the entire contents of the database corresponding to the first version number.
  • the hash encryption algorithm includes, but is not limited to, at least one of MD5, SHA-256 and other algorithms.
  • step 102 may include the following steps 102-1 to 102-2.
  • step 102-1 according to the first information digest and the first version number, it is determined whether to allow the terminal to perform incremental update.
  • the database content currently stored by the terminal matches the database content of the corresponding version stored in the cloud, and if so, it is determined that the terminal is allowed to increment renew. If it does not match, it means that there is an error in the database content currently stored by the terminal. Even if the terminal performs incremental update, the existing error cannot be overcome. Therefore, the cloud will not allow the terminal to perform incremental update in this case.
  • the content of the database currently stored by the terminal is exactly the same as the content of the database of the corresponding version stored in the cloud, or the indicated content is the same but the expression is different (for example, at least one of the storage order and data format of entries in the database is different) In the case of , it is determined that the contents of the two databases match, otherwise, it is determined that the contents of the two databases do not match.
  • step 102-2 in response to determining that the terminal is allowed to perform incremental update, the target incremental update data packet is determined according to the first version number and the second version number.
  • the second version number is the latest version number in at least one database version currently stored in the cloud.
  • the target incremental update data package may be determined according to the first version number and the second version number of the database version currently stored by the terminal.
  • the cloud may determine whether to run the terminal to perform incremental update according to the first version number and the first information summary included in the incremental update download request, so as to ensure the accuracy of the database content currently stored by the terminal.
  • the above method may further include the following step 104: in step 104, in response to determining that the terminal is not allowed to perform incremental update, send target indication information to the terminal.
  • the target indication information is used to indicate that the cloud does not allow the terminal to perform incremental update.
  • the cloud may send target indication information to the terminal when it is determined that the content of the database currently stored by the terminal does not match the content of the database of the corresponding version stored in the cloud, so that the terminal can perform a full update later.
  • the cloud can send target indication information to the terminal on the basis of determining that the terminal is not allowed to perform incremental update, so that the terminal can perform a full update later, so as to ensure that the terminal is finally synchronized to the latest version of the database content currently stored in the cloud. To ensure the accuracy of database synchronization.
  • step 102-1 may include the following steps 102-11 to 102-12.
  • step 102-11 according to the correspondence between the pre-stored information digest and the version number, the second information digest currently stored in the cloud and corresponding to the first version number is determined.
  • the cloud can determine the latest version number of the database version after updating the database content stored by itself, and at the same time, based on the database content corresponding to the latest version number, use a hash encryption algorithm to determine the corresponding information digest, and obtain the above correspondence.
  • the correspondence between the information abstract and the version number includes: database version 1.0 corresponds to information abstract 1, database version 2.0 corresponds to information abstract 2, and so on.
  • the cloud may determine the second information digest corresponding to the first version number sent by the terminal currently stored in the cloud according to the pre-stored correspondence.
  • step 102-12 in response to determining that the first information digest matches the second information digest, it is determined that the terminal is allowed to perform an incremental update, otherwise it is determined that the terminal is not allowed to perform an incremental update.
  • matching the first information abstract with the second information abstract may include, but is not limited to, the first information abstract and the second information abstract are completely identical, or the content is the same but the expression is different, which is not limited in the present disclosure. If the first information digest corresponding to the first version number sent by the terminal matches the second information digest corresponding to the first version number stored in the cloud, it can be determined that the database content corresponding to the first version number currently stored by the terminal matches the The content of the database corresponding to the first version number of the cloud matches, which allows the terminal to perform incremental update based on the content of the currently stored database. Otherwise, it is determined that the terminal is not allowed to perform incremental updates.
  • the cloud can compare whether the second information digest stored by itself and corresponding to the first version number matches the first information digest sent by the terminal, so as to determine whether to allow the terminal to perform incremental update, and ensure the database content stored by the terminal.
  • the accuracy of the database also ensures the accuracy of the database content obtained by the terminal through subsequent incremental updates.
  • the cloud may store a corresponding incremental update data package for every two adjacent version numbers.
  • the incremental update data package can be used to update the database version currently stored in the terminal from a version with a lower version number to an adjacent higher version.
  • two adjacent version numbers 1.0 and 2.0 correspond to an incremental update packet 1
  • two adjacent version numbers 2.0 and 3.0 correspond to an incremental update packet 2
  • the incremental update data package 1 is used to update the database version currently stored by the terminal from version number 1.0 to version number 2.0
  • the incremental update data package 2 is used to update the database version currently stored by the terminal from version number 2.0 to version number 3.0, And so on, and so on.
  • n can be a positive integer.
  • the cloud can determine the target increase requested by the terminal according to the first version number sent by the terminal, the second version number currently stored in the cloud, and the incremental update data packets corresponding to each two adjacent version numbers pre-stored in the cloud. volume update packets.
  • the incremental update data package corresponding to the first version number and the second version number is directly used as the target incremental update data package.
  • the first version number is 1.0 and the second version number is 2.0
  • the incremental update data package 1 corresponding to the version numbers 1.0 and 2.0 can be directly used as the target incremental update data package.
  • the target incremental update data package needs to be determined according to the first version number, the second version number, and the version number spaced therebetween .
  • the first version number is 1.0
  • the second version number is 3.0
  • the intermediate interval version number is 2.0
  • the incremental update data corresponding to version numbers 2.0 and 3.0 can be Package 2 also serves as the target incremental update package.
  • the cloud can pre-store a corresponding incremental update data package for every two adjacent version numbers, so as to prevent the incremental update data packages corresponding to different database version numbers from occupying too many cloud resources, and the availability is high. .
  • the above method may further include the following step 105: in step 105, send the second version number and the third information digest to the terminal.
  • the second version number is the latest version number in at least one database version currently stored in the cloud
  • the third information digest is an information digest obtained by the cloud based on the database content corresponding to the second version number
  • the cloud sends the second version number and the third information digest to the terminal, so that the terminal can determine whether the incremental update is successful based on the third information digest, and after the incremental update is successful, determine its own updated database version based on the second version number.
  • the cloud can send the latest version number stored by itself, that is, the second version number and the third information digest corresponding to the second version number to the terminal, so that the terminal can perform the incremental update after downloading the target incremental update data package.
  • determining whether the incremental update is successful and determining the updated database version ensures the accuracy of the incremental update.
  • the above method may further include step 106: in step 106, an update request sent by the terminal is received.
  • the cloud may receive the update request sent by the terminal before receiving the incremental update download request sent by the terminal.
  • the update request is used to request incremental update.
  • the terminal informs the cloud through the update request that the terminal requests an incremental update.
  • the cloud can receive the update request sent by the terminal before receiving the incremental update download request sent by the terminal, so as to determine the number of terminals requesting incremental update within a certain period of time, so that the terminal can follow up. Determine whether to download the incremental update data package, avoid a large number of terminals synchronously download the corresponding target incremental update data package, cause the congestion of the transmission path between the cloud and the terminal, and even cause the cloud to be down, and the availability is high.
  • the method may further include the following steps 107 to 108: in step 107, determine a first number of terminals that send the update request within a first time period.
  • a time period may be represented by a time slice, and the first time period, that is, the duration T of the first time slice, may be configured by the cloud according to terminal services, including but not limited to 60 seconds or more.
  • the cloud counts the first number N t of terminals that have sent the update request received within the first time slice t i .
  • the first number N t may be a natural number such as 0, 1, 2, and so on.
  • step 108 the first number and the second number are sent to the terminal that sent the update request.
  • the second number C t is the maximum number of terminals currently allowed by the cloud for synchronous incremental update download, and the second number C t may be determined according to the operation capability of the cloud.
  • the running capabilities of the cloud in different time slices may be the same or different.
  • the maximum number of terminals supported by the cloud for synchronization and incremental update download in different time slices may be the same or different.
  • the cloud can send to the terminal the first number of terminals that send update requests in the first time slice, and the maximum number of terminals currently allowed by the cloud to synchronize incremental update downloads (ie, the second number), so that the The terminal determines whether to download the incremental update data package, so as to avoid a large number of terminals synchronously downloading the corresponding target incremental update data package, resulting in congestion of the transmission path between the cloud and the terminal, and even causing the cloud to be down.
  • the availability is high.
  • the cloud supports all terminals that initiate update requests in the first time slice, and synchronize in the second time period (ie, the second time slice). Download the corresponding target incremental update package.
  • the second time period may be a next time slice adjacent to the first time slice, and is equal to the duration of the first time slice.
  • the cloud can calculate the first probability value for these terminals to send incremental update download requests within the second time slice and the second probability value for sending the update request again. Probability value, select the terminal that can send the incremental update download request among the terminals that send the update request, tell these terminals to send the incremental update download request in the second time slice, and tell other terminals to send the update again in the second time slice ask.
  • the cloud can select 2 of them as terminals that can send incremental update download requests in the second time slice.
  • the other 8 terminals can send the update request again in the second time slice.
  • the terminal may randomly select a terminal that can send an incremental update download request from among the terminals that send the update request based on the first probability value.
  • the terminal may, based on the first probability value, sequentially select the terminals that can send the incremental update download request according to the time sequence of receiving the update request.
  • the terminal may, based on the first probability value, select the terminal that can send the incremental update download request in descending order of the number of times the terminal has sent the incremental update download request.
  • the terminal may also use, but is not limited to, other methods based on the first probability value to select a terminal that can send an incremental update download request among the terminals that send the update request, which is not limited in the present disclosure.
  • the cloud can also select the terminal that can send the incremental update download request in the second time slice from the terminals that send the update request in the first time slice, and the terminal that can send the update request again, so that multiple terminals can be selected.
  • the download of incremental update data packets can be performed at different peaks, which greatly reduces the congestion of the transmission path between the cloud and the terminal caused by excessive requests and the possibility of cloud downtime.
  • the method may further include the following steps 109 to 110:
  • step 109 a full update download request sent by the terminal is received.
  • the terminal may initiate a full update download request to the cloud when it receives the target indication information sent by the cloud and determines that the cloud does not allow the terminal to perform incremental update.
  • the terminal may also initiate a full update download request to the cloud when the number of failed incremental updates reaches a preset number of times.
  • the preset number of times may be determined by the terminal according to its own computing capability, the preset number of times corresponding to each terminal may be the same or different, and the preset number of times is a positive integer.
  • the full update download request is used for requesting to download a data package for full update.
  • the full update refers to synchronizing all the contents of the latest version of the database in the cloud to the terminal at one time.
  • step 109 according to the full update download request, send a target full update data packet to the terminal.
  • the target full update data package includes full data corresponding to the latest version in at least one database version currently stored in the cloud.
  • the cloud can support incremental update of the terminal, and also support the terminal to perform full update under certain circumstances, so as to ensure the synchronization of the database content stored in the terminal with the latest version of the database content stored in the cloud, and the availability is high.
  • the database may include a base of feature information required to perform vision task processing.
  • the visual task processing includes face recognition, and the corresponding feature information includes face feature information.
  • the database is the base library that stores the facial feature information.
  • FIG. 2 shows another database synchronization method according to an exemplary embodiment.
  • the method can be used for terminals, including but not limited to computer equipment for visual task processing, such as mobile phone terminals, charging terminals,
  • the billing terminal, access control terminal, etc. on the bus include the following steps 201 to 203:
  • step 201 an incremental update download request is sent to the cloud.
  • the incremental update download request is used to request to download a data package for incremental update.
  • step 202 the target incremental update data package determined by the cloud based on the incremental update download request is downloaded.
  • the cloud after the cloud determines that the terminal is allowed to perform incremental update, it will send at least one target incremental update data packet.
  • the target incremental update data package can update the database content currently stored in the terminal to the latest version of the database content currently stored in the cloud.
  • the terminal may download the target incremental update data package through the network between the terminal and the cloud.
  • the network may include, but is not limited to, 4G, 5G, and other networks.
  • step 203 incrementally update the currently stored database content based on the target incremental update data package.
  • the terminal may update the adding instruction in the data packet according to the target increment, add at least one piece of data in the database currently stored by the terminal, and delete at least one piece of data in the database currently stored by the terminal according to the deletion instruction therein , so as to achieve incremental updates.
  • the terminal may use an incremental update method to synchronize the database content in the cloud to the terminal, which occupies less bandwidth resources and takes a shorter synchronization time.
  • the incremental update download request includes a first version number and a first information digest.
  • the first version number is the version number of the database currently stored by the terminal
  • the first information digest is an information digest obtained by the terminal based on the database content corresponding to the first version number.
  • the cloud can determine the second information digest corresponding to the first version number currently stored in the cloud according to the corresponding relationship between the pre-stored version number and the information digest, so as to judge based on whether the first information digest and the second information digest match. Whether the database content corresponding to the first version number stored in the terminal matches the database content corresponding to the first version number stored in the cloud, so as to determine whether to allow the terminal to perform incremental update.
  • the terminal can send the first version number and the first information summary to the cloud through the incremental update download request, so that the cloud can determine whether to allow the terminal to perform incremental update, which ensures the accuracy of the incremental update.
  • the above method may further include steps 204 to 206 .
  • step 204 the second version number and the third information digest sent by the cloud are received.
  • the second version number is the latest version number in at least one database version currently stored in the cloud
  • the third information summary is an information summary obtained by the cloud based on the database content corresponding to the second version number . That is, the third information digest may be an information digest determined by the cloud using a hash encryption algorithm and based on the entire content of the database corresponding to the second version number.
  • a fourth information digest is determined based on the incrementally updated database content.
  • the terminal determines a corresponding fourth information digest by adopting a hash encryption algorithm according to the entire contents of the incrementally updated database.
  • step 206 in response to determining that the third information digest matches the fourth information digest, it is determined that the incremental update is successful, and the version number of the currently stored database is updated to the second version number.
  • the terminal may determine that the third information digest and the fourth information digest are the same Matching, further, it can be determined that the incremental update is successful, and the version number of the database currently stored in the terminal is updated to the second version number.
  • the terminal can determine whether the incremental update is successful according to the third information digest sent by the cloud, and determine the latest version number after the incremental update according to the second version number, which has high availability.
  • the above method may further include step 207:
  • step 207 in response to determining that the incremental update fails, send an incremental update download request including the first information digest to the cloud again, and according to the target incremental update data package sent by the cloud again, the currently stored The database contents are incrementally updated again.
  • the terminal determines that the third information digest does not match the fourth information digest, it can be considered that the incremental update fails, and the terminal can send the incremental update download request to the cloud again, and according to the The target incremental update data package sent by the cloud again will incrementally update the currently stored database content again.
  • the terminal may perform the incremental update again in the case that the incremental update fails to ensure the accuracy of the incremental update.
  • the above method may further include steps 208 to 209 .
  • step 208 in response to receiving the target indication information sent by the cloud or determining that the number of failures of incremental update reaches a preset number of times, a full update download request is sent to the cloud.
  • the target indication information is used to indicate that the cloud does not allow the terminal to perform incremental update, and the full update download request is used to request to download a data package for full update.
  • the terminal if the terminal receives the target indication information sent by the cloud, it can be determined that the cloud does not allow the terminal to perform incremental update, and at this time, the terminal can send a full update download request to the cloud for full update.
  • Full update refers to synchronizing all the contents of the latest version of the database in the cloud to the terminal at one time.
  • the cloud allows the terminal to perform incremental update, but the terminal fails to perform the incremental update a preset number of times, then the terminal may not perform the incremental update, but perform the full update.
  • the preset number of times can be determined by the terminal and can be any positive integer.
  • step 209 after downloading the target full update data package sent by the cloud, based on the target full update data package, the current stored database content is fully updated.
  • the target full update data package includes full data corresponding to the latest version in at least one database version currently stored in the cloud.
  • the terminal downloads the target full update data package based on the network with the cloud, and fully updates its own database.
  • the terminal can perform a full update when the cloud does not allow the terminal to perform incremental update or the number of incremental update failures reaches a preset number to ensure that the latest version of the database content in the cloud can be synchronized to the terminal, and the availability is high.
  • the above method may further include steps 210 to 212 .
  • step 210 an update request is sent to the cloud.
  • the terminal may send an update request to the cloud before performing step 201, that is, before sending the incremental update download request to the cloud.
  • the update request is used to request incremental update.
  • step 211 the first number and the second number sent by the cloud are received.
  • the first number is the number of terminals that the cloud has received to send an update request within the first time period (ie, the first time slice), and the second number is the incremental update currently allowed by the cloud The maximum number of terminals to download.
  • step 212 in response to determining that the first number is less than or equal to the second number, it is determined that the incremental update download request can be sent to the cloud during a second time period.
  • the second time period may be represented by a second time slice, and the second time slice is the next time slice adjacent to the first time slice and has the same duration as the first time slice.
  • the first time slice is t i
  • the second time slice is t i+1
  • the duration of each time slice may be T. If the maximum number of terminals currently supported or allowed by the cloud for synchronous incremental update download is greater than or equal to the number of terminals that have sent update requests in the first time slice t i , that is, the first number N t is less than or equal to the second number C t , Then, the terminal can directly send the incremental update download request to the cloud in the second time slice t i+1 , so as to perform the incremental update, and the cloud can satisfy the incremental update download request initiated by the terminal.
  • the terminals that initiate the update request are all in the second time slice.
  • An incremental update download request can be initiated to prevent a large number of terminals from synchronously downloading the corresponding target incremental update data packets, causing congestion of the transmission path between the cloud and the terminal, and even causing the cloud to be down, and the availability is high.
  • the above method may further include steps 213 to 214:
  • step 213 in response to determining that the first number is greater than the second number, determining a first probability value of sending the incremental update download request to the cloud within the second time slice, and/or The second probability value of sending the update request to the cloud again within the second time slice.
  • the first number N t is greater than the second number C t , it indicates that the service capability of the cloud cannot satisfy so many terminals to synchronously download incremental data packets.
  • the first probability value may be C t /N t and the second probability value may be (N t -C t )/N t .
  • step 214 based on the first probability value, send the incremental update download request to the cloud within the second time period, or based on the second probability value, within the second time period Send the update request to the cloud again within the same time.
  • the terminal may calculate a random probability value through a preset program. If the random probability value is greater than the first probability value, the terminal may send an incremental update download request to the cloud within the second time slice t i+1 , otherwise the terminal may send the update request to the cloud again within the second time slice t i+1 .
  • the preset program is a pre-written computer program for calculating the probability that the terminal initiates an incremental update download request and can be downloaded to the target incremental update data package.
  • the terminal may determine the probability values of sending the incremental update download request and sending the update request again in the next time slice respectively, so that in the next Based on the corresponding probability value in the time slice, the incremental update download request is sent or the update request is sent again, so that multiple terminals can download the incremental update data packets at off-peak times, which greatly reduces the transmission path congestion caused by too many requests. And the possibility of cloud downtime.
  • the above-mentioned first probability value and second probability value may also be calculated by the cloud, and the cloud directly selects the terminal that can send the incremental update download request from the terminals that send the update request according to the first probability value.
  • the terminals are notified to send incremental update download requests within the second time period, and other terminals are notified to send the update requests again within the second time period.
  • the terminal may directly send the update download request or send the update request again in the second time slice according to the instructions of the cloud.
  • the cloud can also select the terminal that can send the incremental update download request in the second time slice from the terminals that send the update request in the first time slice, and the terminal that can send the update request again, so that multiple terminals can be selected.
  • the download of incremental update data packets can be performed at off-peak times, which greatly reduces the transmission channel congestion caused by excessive requests and the possibility of cloud downtime.
  • the database includes a base library of feature information required to perform visual task processing.
  • the above method may further include the following steps 215 to 217:
  • step 215 the feature information to be processed is obtained.
  • the terminal may collect an image corresponding to the visual processing task according to the camera, and perform feature extraction on the image to obtain the required feature information to be processed.
  • step 216 visual task processing is performed according to the feature information to be processed and the latest database content currently stored by the terminal to obtain a visual task processing result.
  • the smallest database content currently stored by the terminal may be the latest database content obtained after incremental update.
  • the visual task processing includes face recognition
  • the visual task processing results may include face recognition results
  • step 217 a corresponding target operation is performed based on the visual task processing result.
  • the target operation includes at least one of the following: access control switch operation, payment operation.
  • the face recognition result indicates that the face in the image belongs to the face of the employees in the park
  • the access control device can be controlled to automatically turn on, if the face recognition result indicates that the face in the image does not belong to the employees of the park Face, can control the access control equipment to keep closed, and give an alarm prompt.
  • the terminal can send an incremental update download request to the cloud, and the cloud stores the base database of facial feature information belonging to multiple employees in the park.
  • the cloud determines the target incremental update data package. Assume that the version number of the database version currently stored on the terminal is 1.0, the latest version number of the database currently stored in the cloud is 2.0, and the cloud determines that two adjacent version numbers 1.0 and 2.0 correspond to an incremental update data package 1 is the target incremental update data Bag.
  • the target incremental update data package includes an addition instruction for adding facial feature information of newly recruited employees, and/or a deletion instruction for deleting facial feature information of resigned employees.
  • the version number of the database version stored by itself can be updated to 2.0, so that when the face of the new employee is detected, the access control device can be controlled to automatically turn on, while avoiding Turn on access control devices for employees who have left.
  • the terminal may choose to perform incremental update during the time period when the number of employees entering and leaving the park is small, such as the time period from 22:00 every evening to 6:00 am the next day. Ensure that the face feature information stored by itself matches the base database of face feature information stored in the cloud.
  • the face recognition result indicates that the face in the image belongs to the user face with the corresponding payment account, then the corresponding amount, such as the cost of the ride, can be automatically deducted from the corresponding payment account. , or the cost of purchasing items, etc.
  • the terminal used for automatic payment can send incremental update download requests to the cloud, and the cloud stores the face feature information base and corresponding payment information that belong to the automatic bus payment function that has been activated, such as payment. Account number, maximum amount allowed for a single payment, payment password, etc. Assume that the version number of the database version currently stored on the terminal is 1.0, the latest version number of the database currently stored in the cloud is 2.0, and the cloud determines that two adjacent version numbers 1.0 and 2.0 correspond to an incremental update data package 1 is the target incremental update data Bag.
  • the target incremental update data package may include an instruction to add the face feature information of the newly activated automatic ride-hailing payment function and the corresponding payment information, and/or delete the face feature information and the corresponding payment for which the automatic ride-hailing payment function has been turned off Instructions for deletion of information.
  • the terminal may initiate an incremental update download request when it is determined that the unmanned ticket-selling bus is not in the running process.
  • the terminal can initiate an incremental update download request when the unmanned ticketed bus arrives at any terminal of the route, and the time until the next departure time exceeds a preset time and the network conditions are good , so as to avoid the problem that the passenger cannot complete the payment for the ride normally due to the incremental update of the terminal.
  • the feature information base included in the cloud and required to perform the visual task processing can be synchronized to the terminal in an incremental update manner. In the worst case, ensure the accuracy of visual task processing.
  • step 301 the terminal sends an incremental update download request to the cloud.
  • the incremental update download request is used for requesting to download a data package for incremental update.
  • the incremental update download request includes a first version number and a first information summary; wherein, the first version number is the version number of the database currently stored by the terminal, and the first information summary is based on the first information summary by the terminal. A summary of the information obtained from the database content corresponding to the version number.
  • step 302 the cloud determines a second information digest corresponding to the first version number currently stored in the cloud according to the correspondence between the pre-stored information digest and the version number.
  • step 303 in response to determining that the first information digest matches the second information digest, the cloud determines that the terminal is allowed to perform incremental update, otherwise it determines that the terminal is not allowed to perform incremental update.
  • steps 304 to 310 are performed, otherwise, steps 311 to 314 are performed.
  • step 304 the cloud determines the target incremental update data package according to the first version number, the second version number, and a pre-stored incremental update data package corresponding to every two adjacent version numbers.
  • step 305 the cloud sends the target incremental update data packet to the terminal.
  • step 306 the terminal incrementally updates the currently stored database content based on the downloaded target incremental update data package.
  • step 307 the cloud sends the second version number and the third information digest to the terminal.
  • the second version number is the latest version number in at least one database version currently stored in the cloud
  • the third information digest is an information digest obtained by the cloud based on the database content corresponding to the second version number.
  • step 308 the terminal determines a fourth information digest based on the incrementally updated database content.
  • step 309 in response to determining that the third information digest matches the fourth information digest, the terminal determines that the incremental update is successful, and updates the version number of the database currently stored by the terminal to the second version number .
  • step 310 in response to determining that the incremental update fails, the terminal sends an incremental update download request to the cloud again, and increases the currently stored database content again according to the target incremental update data package sent again by the cloud. volume update.
  • step 311 the cloud sends target indication information to the terminal.
  • the target indication information is used to indicate that the cloud does not allow the terminal to perform incremental update.
  • steps 310 or 311 After steps 310 or 311 are completed, steps 312 to 314 may be performed.
  • step 312 the terminal sends a full update download request to the cloud in response to receiving the target indication information sent by the cloud or determining that the number of failed incremental updates reaches a preset number of times.
  • the full update download request is used for requesting to download a data package for full update.
  • step 313 the cloud sends a target full update data packet to the terminal according to the full update download request.
  • the target full update data package includes full data corresponding to the latest version in at least one database version currently stored in the cloud.
  • step 314 the terminal performs a full update of the currently stored database content based on the target full update data package sent by the cloud.
  • the cloud may determine the target incremental update data package requested by the terminal according to the incremental update download request sent by the terminal, so that the terminal downloads the target incremental update data package for incremental update.
  • the present disclosure can use an incremental update method to synchronize the database content in the cloud to the terminal, which occupies less bandwidth resources and shortens the synchronization time.
  • N is any positive integer. Due to the inability to construct a dedicated line network, the terminal cannot send the feature information to be processed acquired in real time to the cloud for real-time comparison processing. After synchronizing the latest version of the database content in the cloud on the terminal side, the comparison is based on the database content stored in the terminal. , If the database content of the latest version of the cloud is synchronized to the terminal every time in the way of full update, it will take a long time and occupy a lot of bandwidth resources.
  • the incremental update method can be used to synchronize the content of the face data base database to the terminal through incremental update each time, so that when the terminal needs to perform visual task processing, it can be based on the terminal side.
  • the incrementally updated database content is directly subjected to face recognition, and the corresponding visual task processing results are obtained. Then complete the access control switch operation, payment operation and so on. For example, automatic opening of park access control, offline payment on mobile buses, offline payment in schools or park canteens, shops and other places, etc., make the application based on face 1:N in the corresponding scenario more usable.
  • the number of terminals shown in FIG. 4 may be at least one.
  • FIG. 4 only takes one terminal as an example for description, including the following steps 401 to 406 .
  • step 401 the terminal sends an update request to the cloud.
  • step 402 the cloud determines a first number of terminals that send the update request within the first time slice.
  • step 403 the cloud sends the first number and the second number to the terminal.
  • the second number is the maximum number of terminals currently allowed by the cloud to synchronize incremental update downloads.
  • step 404 in response to determining that the first number is less than or equal to the second number, the terminal determines to send the incremental update download request to the cloud in a second time slice.
  • the terminal sends an incremental update download request to the cloud within the second time slice according to the contents of the above steps 301 to 314, so as to perform incremental update, which will not be repeated here.
  • step 405 in response to determining that the first number is greater than the second number, the terminal determines a first probability value of sending the incremental update download request to the cloud within the second time slice, and/or The second probability value of the update request is sent to the cloud again within the second time slice.
  • step 406 based on the first probability value, the terminal sends the incremental update download request to the cloud in the second time slice, or based on the second probability value, in the second time slice send the update request to the cloud again within the
  • the terminal can download the corresponding target incremental update data package from the cloud at staggered peak, so as to reduce the concurrency pressure on the cloud, avoid the congestion of the transmission path between the cloud and the terminal, and even cause the cloud to be down, and the availability is high.
  • the present disclosure also provides device embodiments.
  • the present disclosure provides a database synchronization apparatus according to an exemplary embodiment, including: a first receiving module 510, configured to receive an incremental update download request sent by a terminal; wherein the incremental update download request used for requesting to download the data package required for incremental update; the first determination module 520 is used to determine the target incremental update data package corresponding to the incremental update download request; the first sending module 530 is used to send the incremental update data package to the The terminal sends the target incremental update data packet.
  • the incremental update download request includes a first version number and a first information digest; wherein the first version number is a version number of a database currently stored by the terminal, and the first The information summary is an information summary obtained by the terminal based on the database content corresponding to the first version number; the first determination module includes: a first determination sub-module, configured to a version number, to determine whether to allow the terminal to perform incremental update; a second determination submodule, configured to respond to determining that the terminal is allowed to perform incremental update, according to the first version number and the second version number, to determine the A target incremental update data package; wherein the second version number is the latest version number in at least one database version currently stored in the cloud.
  • the apparatus further includes: a third sending module, configured to send target indication information to the terminal in response to determining that the terminal is not allowed to perform incremental update; wherein the target indication information It is used to instruct the cloud not to allow the terminal to perform incremental update.
  • the first determination sub-module includes: a first determination unit, configured to determine, according to the correspondence between the pre-stored information digest and the version number, the current stored in the cloud and the first a second information digest corresponding to the version number; a second determination unit, configured to, in response to determining that the first information digest matches the second information digest, determine to allow the terminal to perform incremental update, otherwise determine not to allow the terminal Terminal for incremental update.
  • the second determination sub-module includes: a third determination unit, configured to correspond to the first version number, the second version number, and every two adjacent version numbers pre-stored an incremental update packet of the target incremental update packet is determined.
  • the apparatus further includes: a fourth sending module, configured to send a second version number and a third information digest to the terminal; wherein the second version number is at least one currently stored in the cloud.
  • the latest version number in a database version, and the third information summary is an information summary obtained by the cloud based on the database content corresponding to the second version number.
  • the apparatus further includes: a second receiving module, configured to receive an update request sent by the terminal; wherein the update request is used to request an incremental update.
  • the apparatus further includes: a second determining module, configured to determine a first number of terminals that send the update request within a first time period; a fifth sending module, configured to send the update request to the Send the first number and the second number to the terminal of the update request; wherein, the second number is the maximum number of terminals currently allowed by the cloud to synchronize incremental update downloads.
  • the apparatus further includes: a third receiving module, configured to receive a full update download request sent by the terminal; wherein the full update download request is used for requesting to download a data package for full update
  • the sixth sending module is used to send a target full-scale update data packet to the terminal according to the full-scale update download request; wherein, the target full-scale update data packet includes the latest version corresponding to at least one database version currently stored in the cloud of full data.
  • the database includes a base library of feature information required to perform visual task processing.
  • the present disclosure provides a database synchronization apparatus according to an exemplary embodiment, including: a second sending module 610, configured to send an incremental update download request to the cloud; wherein, the incremental update download request uses request to download the data package required for incremental update; the download module 620 is used to download the target incremental update data package determined by the cloud based on the incremental update download request; the incremental update module 630 is used to download the target incremental update data package based on the incremental update download request; The target incremental update data package is used to incrementally update the currently stored database content.
  • a second sending module 610 configured to send an incremental update download request to the cloud
  • the incremental update download request uses request to download the data package required for incremental update
  • the download module 620 is used to download the target incremental update data package determined by the cloud based on the incremental update download request
  • the incremental update module 630 is used to download the target incremental update data package based on the incremental update download request
  • the target incremental update data package is used to incrementally update the currently stored database content.
  • the incremental update download request includes a first version number and a first information digest; wherein the first version number is a version number of a database currently stored by the terminal, and the first information digest is an information digest obtained by the terminal based on the database content corresponding to the first version number.
  • the apparatus further includes: a fourth receiving module, configured to receive the second version number and the third information digest sent by the cloud; wherein the second version number is the current The latest version number in the stored at least one database version, and the third information summary is the information summary obtained by the cloud based on the database content corresponding to the second version number; The content of the database is determined, and the fourth information digest is determined; the first execution module is configured to, in response to determining that the third information digest matches the fourth information digest, determine that the incremental update is successful, and change the version number of the currently stored database Update to the second version number.
  • a fourth receiving module configured to receive the second version number and the third information digest sent by the cloud
  • the second version number is the current The latest version number in the stored at least one database version
  • the third information summary is the information summary obtained by the cloud based on the database content corresponding to the second version number
  • the content of the database is determined, and the fourth information digest is determined
  • the first execution module is configured to, in response to determining that the third information digest matches the fourth information
  • the apparatus further includes: a second execution module, configured to send an incremental update download request to the cloud again in response to determining that the incremental update fails, and based on the target sent by the cloud again Incremental update data package to incrementally update the currently stored database content again.
  • a second execution module configured to send an incremental update download request to the cloud again in response to determining that the incremental update fails, and based on the target sent by the cloud again Incremental update data package to incrementally update the currently stored database content again.
  • the apparatus further includes: a seventh sending module, configured to send a message to the cloud in response to receiving the target indication information sent by the cloud or determining that the number of failures of incremental update reaches a preset number of times.
  • Send a full update download request wherein, the target indication information is used to instruct the cloud not to allow the terminal to perform incremental update, and the full update download request is used to request downloading of a data package for full update;
  • the full update module After downloading the target full update data package sent by the cloud, based on the target full update data package, the current stored database content is fully updated; wherein, the target full update data package includes the current storage of the cloud.
  • the apparatus further includes: an eighth sending module, configured to send an update request to the cloud; wherein, the update request is used to request an incremental update; and a fifth receiving module, configured to Receive the first number and the second number sent by the cloud; wherein, the first number is the number of terminals that the cloud has received to send an update request within the first time period, and the second number is the current number of the cloud The maximum number of terminals allowed to synchronize incremental update downloads; the fourth determination module is configured to, in response to determining that the first number is less than or equal to the second number, determine to send the cloud to the cloud in a second time period An incremental update download request; wherein the second time period is the next time period adjacent to the first time period.
  • the apparatus further includes: a fifth determination module, configured to, in response to determining that the first number is greater than the second number, determine to send the data to the cloud within the second time period. the first probability value of the incremental update download request, and/or the second probability value of sending the update request to the cloud again within the second time period; a ninth sending module is configured to send the update request based on the second probability value. a probability value, sending the incremental update download request to the cloud within the second time period, or sending the update to the cloud again within the second time period based on the second probability value ask.
  • the database includes a base library of feature information required to perform visual task processing; the apparatus further includes: an acquisition module for acquiring feature information to be processed; a visual task processing module for The feature information to be processed and the latest database content currently stored in the terminal are used for visual task processing to obtain a visual task processing result; a third execution module is configured to execute a corresponding target operation based on the visual task processing result.
  • the visual task processing includes face recognition; the target operation includes at least one of the following: an access control switch operation and a payment operation.
  • An embodiment of the present disclosure further provides a database synchronization system, including a cloud and a terminal, and the terminal can synchronize the latest version of the database content of the cloud to the terminal by means of incremental synchronization.
  • the cloud may include any of the above-mentioned database synchronization apparatuses for the cloud
  • the terminal may include any of the above-mentioned database synchronization apparatuses for the terminal.
  • An embodiment of the present disclosure further provides a computer-readable storage medium, which stores a computer program, and the computer program is used to execute any one of the above-mentioned database synchronization methods.
  • embodiments of the present disclosure provide a computer program product that includes computer-readable codes and is stored in a computer-readable storage medium.
  • a processor in the device Execute the instructions for implementing the database synchronization method provided by any of the above embodiments.
  • the embodiments of the present disclosure further provide another computer program product for storing computer-readable instructions, which, when executed, cause the computer to execute the database synchronization method provided in any of the foregoing embodiments.
  • the computer program product can be specifically implemented by hardware, software or a combination thereof.
  • the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), etc. Wait.
  • a software development kit Software Development Kit, SDK
  • An embodiment of the present disclosure further provides a database synchronization apparatus, including: a processor; a memory for storing executable instructions of the processor; wherein the processor is configured to call the executable instructions stored in the memory to implement any of the above A database synchronization method provided by an embodiment.
  • FIG. 7 is a schematic diagram of a hardware structure of a database synchronization apparatus according to an embodiment of the present disclosure.
  • the database synchronization device 710 includes a processor 711 , and may further include an input device 712 , an output device 713 and a memory 714 .
  • the input device 712, the output device 713, the memory 714 and the processor 711 are connected to each other through a bus.
  • Memory includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read only memory (EPROM), or portable Read-only memory (compact disc read-only memory, CD-ROM), which is used for related instructions and data.
  • RAM random access memory
  • ROM read-only memory
  • EPROM erasable programmable read only memory
  • CD-ROM compact disc read-only memory
  • Input means are used for inputting data and/or signals, and output means are used for outputting data and/or signals.
  • the output device and the input device can be independent devices or an integral device.
  • the processor may include one or more processors, such as one or more central processing units (CPUs).
  • processors such as one or more central processing units (CPUs).
  • CPUs central processing units
  • the CPU may be a single-core CPU, or a Multi-core CPU.
  • Memory is used to store program codes and data for network devices.
  • the processor is configured to call the program code and data in the memory to execute the steps in the above method embodiments. For details, refer to the description in the method embodiment, which is not repeated here.
  • FIG. 7 only shows a simplified design of a database synchronization apparatus.
  • the database synchronization apparatus may also include other necessary elements, including but not limited to any number of input/output devices, processors, controllers, memories, etc., and all database synchronization apparatuses that can implement the embodiments of the present disclosure. All fall within the protection scope of the present disclosure.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • Human Computer Interaction (AREA)
  • Library & Information Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种数据库同步方法及装置、存储介质、设备,其中,应用于云端的所述方法可包括:接收终端发送的增量更新下载请求(101);其中,所述增量更新下载请求用于请求下载进行增量更新所需的数据包;确定所述增量更新下载请求对应的目标增量更新数据包(102);向所述终端发送所述目标增量更新数据包(103)。

Description

数据库同步方法及装置、存储介质、设备
相关申请的交叉引用
本公开要求于2021年2月10日提交的、申请号为2021101846050、发明名称为“数据库同步方法及装置、存储介质、设备”的中国专利申请的优先权,该申请以引用的方式并入本文中。
技术领域
本公开涉及数据处理领域,尤其涉及一种数据库同步方法及装置、存储介质、设备。
背景技术
目前,在一些离线进行人脸比对的场景中,一旦云端的人脸数据库发生变化,为了保证同步的准确性,大多采用全量同步的方式,带宽开销较大,且同步时间较长。
发明内容
本公开提供了一种数据库同步方法及装置、存储介质、设备。
根据本公开实施例的第一方面,提供一种数据库同步方法,包括:接收终端发送的增量更新下载请求;其中,所述增量更新下载请求用于请求下载进行增量更新所需的数据包;确定所述增量更新下载请求对应的目标增量更新数据包;向所述终端发送所述目标增量更新数据包。
在一些可选实施例中,所述增量更新下载请求包括第一版本号和第一信息摘要;其中,所述第一版本号是所述终端当前存储的数据库的版本号,所述第一信息摘要是所述终端基于所述第一版本号对应的数据库内容得到的信息摘要;所述确定所述增量更新下载请求对应的目标增量更新数据包,包括:根据所述第一信息摘要和所述第一版本号,确定是否允许所述终端进行增量更新;响应于确定允许所述终端进行增量更新,根据所述第一版本号和第二版本号,确定所述目标增量更新数据包;其中,所述第二版本号是所述云端当前存储的至少一个数据库版本中的最新版本号。
在一些可选实施例中,所述方法还包括:响应于确定不允许所述终端进行增量更新,向所述终端发送目标指示信息;其中,所述目标指示信息用于指示所述云端不允许所述终端进行增量更新。
在一些可选实施例中,所述根据所述第一信息摘要和所述第一版本号,确定是否允许所述终端进行增量更新,包括:根据预存的信息摘要和版本号之间的对应关系,确定所述云端当前存储的与所述第一版本号对应的第二信息摘要;响应于确定所述第一信息摘要与所述第二信息摘要匹配,确定允许所述终端进行增量更新,否则确定不允许所述终端进行增量更新。
在一些可选实施例中,所述根据所述第一版本号和第二版本号,确定所述目标增量更新数据包,包括:根据所述第一版本号、所述第二版本号以及预存的每两个相邻的版本号对应的一个增量更新数据包,确定所述目标增量更新数据包。
在一些可选实施例中,所述方法还包括:向所述终端发送第二版本号和第三信息摘要;其中,所述第二版本号是所述云端当前存储的至少一个数据库版本中的最新版本号,所述第三信息摘要是所述云端基于所述第二版本号对应的数据库内容得到的信息摘要。
在一些可选实施例中,所述接收终端发送的增量更新下载请求之前,所述方法还包括:接收所述终端发送的更新请求;其中,所述更新请求用于请求进行增量更新。
在一些可选实施例中,所述方法还包括:确定在第一时间段内发送所述更新请求的 终端的第一数目;向发送所述更新请求的终端发送所述第一数目和第二数目;其中,所述第二数目是所述云端当前允许的同步进行增量更新下载的最大终端数目。
在一些可选实施例中,所述方法还包括:接收所述终端发送的全量更新下载请求;其中,所述全量更新下载请求用于请求下载进行全量更新的数据包;根据所述全量更新下载请求,向所述终端发送目标全量更新数据包;其中,所述目标全量更新数据包中包括云端当前存储的至少一个数据库版本中最新版本对应的全量数据。
在一些可选实施例中,所述数据库包括执行视觉任务处理所需要的特征信息底库。
根据本公开实施例的第二方面,提供一种数据库同步方法,包括:向云端发送增量更新下载请求;其中,所述增量更新下载请求用于请求下载进行增量更新所需的数据包;下载所述云端基于所述增量更新下载请求确定的目标增量更新数据包;基于所述目标增量更新数据包,对当前存储的数据库内容进行增量更新。
在一些可选实施例中,所述增量更新下载请求包括第一版本号和第一信息摘要;其中,所述第一版本号是所述终端当前存储的数据库的版本号,所述第一信息摘要是所述终端基于所述第一版本号对应的数据库内容得到的信息摘要。
在一些可选实施例中,所述方法还包括:接收所述云端发送的第二版本号和第三信息摘要;其中,所述第二版本号是所述云端当前存储的至少一个数据库版本中的最新版本号,所述第三信息摘要是所述云端基于所述第二版本号对应的数据库内容得到的信息摘要;基于增量更新后的数据库内容,确定第四信息摘要;响应于确定所述第三信息摘要与所述第四信息摘要匹配,确定增量更新成功,并将当前存储的数据库的版本号更新为所述第二版本号。
在一些可选实施例中,所述方法还包括:响应于确定增量更新失败,再次向所述云端发送增量更新下载请求,并基于所述云端再次发送的目标增量更新数据包,对当前存储的数据库内容再次进行增量更新。
在一些可选实施例中,所述方法还包括:响应于接收到所述云端发送的目标指示信息或确定增量更新的失败次数达到预设次数,向所述云端发送全量更新下载请求;其中,所述目标指示信息用于指示所述云端不允许所述终端进行增量更新,所述全量更新下载请求用于请求下载进行全量更新的数据包;下载所述云端确定的目标全量更新数据包后,基于所述目标全量更新数据包,对当前存储的数据库内容进行全量更新;其中,所述目标全量更新数据包中包括所述云端当前存储的至少一个数据库版本中最新版本对应的全量数据。
在一些可选实施例中,所述向云端发送增量更新下载请求之前,所述方法还包括:向所述云端发送更新请求;其中,所述更新请求用于请求进行增量更新;接收所述云端发送的第一数目和第二数目;其中,所述第一数目是所述云端在第一时间段内接收到发送更新请求的终端数目,所述第二数目是所述云端当前允许的同步进行增量更新下载的最大终端数目;响应于确定所述第一数目小于或等于所述第二数目,确定在第二时间段向所述云端发送所述增量更新下载请求;其中,所述第二时间段是与所述第一时间段相邻的下一个时间段。
在一些可选实施例中,所述方法还包括:响应于确定所述第一数目大于所述第二数目,确定在所述第二时间段内向所述云端发送所述增量更新下载请求的第一概率值,和/或在所述第二时间段内再次向所述云端发送所述更新请求的第二概率值;基于所述第一概率值,在所述第二时间段内向所述云端发送所述增量更新下载请求,或基于所述第二概率值,在所述第二时间段内再次向所述云端发送所述更新请求。
在一些可选实施例中,所述数据库包括执行视觉任务处理所需要的特征信息底库;所述方法还包括:获取待处理特征信息;根据所述待处理特征信息与所述终端当前存储的最新的数据库内容,进行视觉任务处理,得到视觉任务处理结果;基于所述视觉任务处理结果,执行相应的目标操作。
在一些可选实施例中,所述视觉任务处理包括人脸识别;所述目标操作包括以下至少一项:门禁开关操作、支付操作。
根据本公开实施例的第三方面,提供一种数据库同步装置,包括:第一接收模块,用于接收终端发送的增量更新下载请求;其中,所述增量更新下载请求用于请求下载进行增量更新所需的数据包;第一确定模块,用于确定所述增量更新下载请求对应的目标增量更新数据包;第一发送模块,用于向所述终端发送所述目标增量更新数据包。
在一些可选实施例中,所述增量更新下载请求包括第一版本号和第一信息摘要;其中,所述第一版本号是所述终端当前存储的数据库的版本号,所述第一信息摘要是所述终端基于所述第一版本号对应的数据库内容得到的信息摘要;所述第一确定模块包括:第一确定子模块,用于根据所述第一信息摘要和所述第一版本号,确定是否允许所述终端进行增量更新;第二确定子模块,用于响应于确定允许所述终端进行增量更新,根据所述第一版本号和第二版本号,确定所述目标增量更新数据包;其中,所述第二版本号是所述云端当前存储的至少一个数据库版本中的最新版本号。
在一些可选实施例中,所述装置还包括:第三发送模块,用于响应于确定不允许所述终端进行增量更新,向所述终端发送目标指示信息;其中,所述目标指示信息用于指示所述云端不允许所述终端进行增量更新。
在一些可选实施例中,所述第一确定子模块包括:第一确定单元,用于根据预存的信息摘要和版本号之间的对应关系,确定所述云端当前存储的与所述第一版本号对应的第二信息摘要;第二确定单元,用于响应于确定所述第一信息摘要与所述第二信息摘要匹配,确定允许所述终端进行增量更新,否则确定不允许所述终端进行增量更新。
在一些可选实施例中,所述第二确定子模块包括:第三确定单元,用于根据所述第一版本号、所述第二版本号以及预存的每两个相邻的版本号对应的一个增量更新数据包,确定所述目标增量更新数据包。
在一些可选实施例中,所述装置还包括:第四发送模块,用于向所述终端发送第二版本号和第三信息摘要;其中,所述第二版本号是云端当前存储的至少一个数据库版本中的最新版本号,所述第三信息摘要是所述云端基于所述第二版本号对应的数据库内容得到的信息摘要。
在一些可选实施例中,所述装置还包括:第二接收模块,用于接收所述终端发送的更新请求;其中,所述更新请求用于请求进行增量更新。
在一些可选实施例中,所述装置还包括:第二确定模块,用于确定在第一时间段内发送所述更新请求的终端的第一数目;第五发送模块,用于向发送所述更新请求的终端发送所述第一数目和第二数目;其中,所述第二数目是所述云端当前允许的同步进行增量更新下载的最大终端数目。
在一些可选实施例中,所述装置还包括:第三接收模块,用于接收所述终端发送的全量更新下载请求;其中,所述全量更新下载请求用于请求下载进行全量更新的数据包;第六发送模块,用于根据所述全量更新下载请求,向所述终端发送目标全量更新数据包;其中,所述目标全量更新数据包中包括云端当前存储的至少一个数据库版本中最新版本对应的全量数据。
在一些可选实施例中,所述数据库包括执行视觉任务处理所需要的特征信息底库。
根据本公开实施例的第四方面,提供一种数据库同步装置,包括:第二发送模块,用于向云端发送增量更新下载请求;其中,所述增量更新下载请求用于请求下载进行增量更新所需的数据包;下载模块,用于下载所述云端基于所述增量更新下载请求确定的目标增量更新数据包;增量更新模块,用于基于所述目标增量更新数据包,对当前存储的数据库内容进行增量更新。
在一些可选实施例中,所述增量更新下载请求包括第一版本号和第一信息摘要;其中,所述第一版本号是终端当前存储的数据库的版本号,所述第一信息摘要是所述终端 基于所述第一版本号对应的数据库内容得到的信息摘要。
在一些可选实施例中,所述装置还包括:第四接收模块,用于接收所述云端发送的第二版本号和第三信息摘要;其中,所述第二版本号是所述云端当前存储的至少一个数据库版本中的最新版本号,所述第三信息摘要是所述云端基于所述第二版本号对应的数据库内容得到的信息摘要;第三确定模块,用于基于增量更新后的数据库内容,确定第四信息摘要;第一执行模块,用于响应于确定所述第三信息摘要与所述第四信息摘要匹配,确定增量更新成功,并将当前存储的数据库的版本号更新为所述第二版本号。
在一些可选实施例中,所述装置还包括:第二执行模块,在确定允许进行增量更新后,用于响应于确定增量更新失败,再次向所述云端发送增量更新下载请求,并基于所述云端再次发送的目标增量更新数据包,对当前存储的数据库内容再次进行增量更新。
在一些可选实施例中,所述装置还包括:第七发送模块,用于响应于接收到所述云端发送的目标指示信息或确定增量更新的失败次数达到预设次数,向所述云端发送全量更新下载请求;其中,所述目标指示信息用于指示所述云端不允许所述终端进行增量更新,所述全量更新下载请求用于请求下载进行全量更新的数据包;全量更新模块,用于下载所述云端发送的目标全量更新数据包后,基于所述目标全量更新数据包,对当前存储的数据库内容进行全量更新;其中,所述目标全量更新数据包中包括所述云端当前存储的至少一个数据库版本中最新版本对应的全量数据。
在一些可选实施例中,所述装置还包括:第八发送模块,用于向所述云端发送更新请求;其中,所述更新请求用于请求进行增量更新;第五接收模块,用于接收所述云端发送的第一数目和第二数目;其中,所述第一数目是所述云端在第一时间段内接收到发送更新请求的终端数目,所述第二数目是所述云端当前允许的同步进行增量更新下载的最大终端数目;第四确定模块,用于响应于确定所述第一数目小于或等于所述第二数目,确定在第二时间段向所述云端发送所述增量更新下载请求;其中,所述第二时间段是与所述第一时间段相邻的下一个时间段。
在一些可选实施例中,所述装置还包括:第五确定模块,用于响应于确定所述第一数目大于所述第二数目,确定在所述第二时间段内向所述云端发送所述增量更新下载请求的第一概率值,和/或在所述第二时间段内再次向所述云端发送所述更新请求的第二概率值;第九发送模块,用于基于所述第一概率值,在所述第二时间段内向所述云端发送所述增量更新下载请求,或基于所述第二概率值,在所述第二时间段内再次向所述云端发送所述更新请求。
在一些可选实施例中,所述数据库包括执行视觉任务处理所需要的特征信息底库;所述装置还包括:获取模块,用于获取待处理特征信息;视觉任务处理模块,用于根据所述待处理特征信息与所述终端当前存储的最新的数据库内容,进行视觉任务处理,得到视觉任务处理结果;第三执行模块,用于基于所述视觉任务处理结果,执行相应的目标操作。
在一些可选实施例中,所述视觉任务处理包括人脸识别;所述目标操作包括以下至少一项:门禁开关操作、支付操作。
根据本公开实施例的第五方面,提供一种计算机可读存储介质,其存储有计算机程序,所述计算机程序用于执行上述的数据库同步方法。
根据本公开实施例的第六方面,提供一种数据库同步设备,包括:处理器;用于存储所述处理器可执行指令的存储器;其中,所述处理器被配置为调用所述存储器中存储的可执行指令,实现上述的数据库同步方法。
根据本公开实施例的第七方面,提供一种计算机程序产品,包括计算机可读代码并存储于计算机可读存储介质,当计算机可读代码在设备上运行时,设备中的处理器执行用于实现上述的数据库同步方法的指令。
本公开的实施例提供的技术方案可以包括以下有益效果:本公开实施例中,云端可 以根据终端发送的增量更新下载请求,确定终端所请求的目标增量更新数据包,以便终端下载进行增量更新的目标增量更新数据包。本公开可以采用增量更新方式,将云端的数据库内容同步到终端,占用的带宽资源较少,同步时间较短。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。
图1是本公开根据一示例性实施例示出的一种数据库同步方法的流程图;
图2是本公开根据一示例性实施例示出的另一种数据库同步方法的流程图;
图3是本公开根据一示例性实施例示出的另一种数据库同步方法的流程图;
图4是本公开根据一示例性实施例示出的另一种数据库同步方法的流程图;
图5是本公开根据一示例性实施例示出的一种数据库同步装置的框图;
图6是本公开根据一示例性实施例示出的另一种数据库同步装置的框图;
图7是本公开根据一示例性实施例示出的一种数据库同步装置的结构示意图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。
在本公开使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本公开。在本公开和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。
应当理解,尽管在本公开可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本公开范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。
目前,在一些网络环境受限的场景中,例如,在校园、园区食堂、或者公交车上进行人脸支付时,由于网络环境限制,无法进行专线网络的搭建。由于数据库内容可以包括大量人脸的人脸特征信息,如果进行人脸支付的终端定期从云端将数据库内容全量更新到终端,那么全量更新会占用较多的带宽资源,且更新时间较长。
为了解决上述问题,本公开实施例提供了一种数据库同步方案,可以在上述场景中,将云端的数据库内容,采用增量更新方式同步到终端。
例如图1所示,本公开一示例性实施例提供一种数据库同步方法,该方法可以用于云端或服务器,以下实施例将以云端为例进行说明,包括以下步骤101至步骤103。
在步骤101中,接收终端发送的增量更新下载请求。
在本公开实施例中,增量更新下载请求用于请求下载进行增量更新所需的数据包。其中,增量更新是指只同步两个数据库不同的内容,在本公开实施例中,增量更新是指将云端当前存储的至少一个数据库版本中的最新版本的数据库内容与终端当前存储的数据库内容之间的不同内容同步到终端。
在步骤102中,确定所述增量更新下载请求对应的目标增量更新数据包。
在本公开实施例中,目标增量更新数据包可以将终端当前存储的数据库内容更新为云端当前存储的最新版本的数据库内容,目标增量更新数据包中可以包括增加指令和删除指令中的至少一项。增加指令用于增加至少一条新的数据库内容,删除指令用于删除数据库已有内容。
在本公开实施例中,终端可以根据目标增量更新数据包中的增加指令,在终端当前存储的数据库中增加至少一条数据,根据目标增量更新数据包中的删除指令,删除终端当前存储的数据库中的至少一条数据。终端当前存储的数据库中,每条数据可以包括至少一个数据项,其中,每条数据包括的数据项可以用于指示同一数据的不同数据内容。在需要更新某条数据的至少一个数据项的情况下,可以在目标增量数据包中先通过删除指令,删除整条数据,然后通过增加指令,增加新的一整条数据,该新的一整条数据包含更新后的至少一个数据项。
在步骤103中,向所述终端发送所述目标增量更新数据包。
在本公开实施例中,可以由云端通过与终端之间的网络将目标增量更新数据包发送给所述终端。本公开中涉及到的网络包括但不限于4G、5G等网络。
上述实施例中,云端可以根据终端发送的增量更新下载请求,确定终端所请求的目标增量更新数据包,以便终端下载进行增量更新的目标增量更新数据包。本公开可以采用增量更新方式,将云端的数据库同步到终端,占用的带宽资源较少,同步时间较短。
在一些可选实施例中,增量更新下载请求可以包括第一版本号和第一信息摘要,其中,第一版本号是所述终端当前存储的数据库的版本号,例如终端当前存储的数据库的版本号为2.0,那么第一版本号就为2.0。
在本公开实施例中,第一信息摘要是终端基于所述第一版本号对应的数据库内容得到的信息摘要。在此,信息摘要是基于信息内容得到的一个长度固定的字符串,第一信息摘要就是终端基于第一版本号对应的数据库内容(可以是数据库的全部内容)所得到的字符串。本公开实施例中,终端可以采用散列加密算法,基于第一版本号对应的数据库的全部内容,得到第一信息摘要。散列加密算法包括但不限于MD5、SHA-256等算法中的至少一个。
相应地,步骤102可以包括以下步骤102-1至步骤102-2。
在步骤102-1中,根据所述第一信息摘要和所述第一版本号,确定是否允许所述终端进行增量更新。
在本公开实施例中,可以基于终端发送的第一版本号和第一信息摘要,确定终端当前存储的数据库内容与云端存储的对应版本的数据库内容是否匹配,如果匹配,确定允许终端进行增量更新。如果不匹配,说明终端当前存储的数据库内容存在错误,终端即使进行增量更新也无法克服已存在的错误,因此,云端会在这种情况下,不允许终端进行增量更新。其中,终端当前存储的数据库内容与云端存储的对应版本的数据库内容完全相同,或所指示的内容相同但表现形式不同(例如,在数据库中表项存放顺序和数据格式等中至少一项不同)的情况下,确定两个数据库内容匹配,否则确定两个数据库内容不匹配。
在步骤102-2中,响应于确定允许所述终端进行增量更新,根据所述第一版本号和第二版本号,确定所述目标增量更新数据包。
在本公开实施例中,第二版本号是所述云端当前存储的至少一个数据库版本中的最新版本号。
云端允许终端采用增量更新方式进行同步的情况下,可以根据终端当前存储的数据库版本的第一版本号和第二版本号,确定目标增量更新数据包。
上述实施例中,云端可以根据增量更新下载请求包括的第一版本号和第一信息摘要,来确定是否运行终端进行增量更新,确保终端当前存储的数据库内容的准确性。
一些可选实施例中,上述方法还可以包括以下步骤104:在步骤104中,响应于确 定不允许所述终端进行增量更新,向所述终端发送目标指示信息。
在本公开实施例中,目标指示信息用于指示所述云端不允许所述终端进行增量更新。云端可以在确定终端当前存储的数据库内容与云端存储的对应版本的数据库内容不匹配的情况下,发送目标指示信息给终端,以便终端后续进行全量更新。
上述实施例中,云端可以在确定不允许终端进行增量更新的基础上,发送目标指示信息给终端,以便终端后续进行全量更新,从而确保终端最终同步到云端当前存储的最新版本的数据库内容,确保了数据库同步的准确性。
在一些可选实施例中,步骤102-1可以包括以下步骤102-11至步骤102-12。
在步骤102-11中,根据预存的信息摘要和版本号之间的对应关系,确定所述云端当前存储的与所述第一版本号对应的第二信息摘要。
在本公开实施例中,云端可以在每次更新自身存储的数据库内容后,确定数据库版本的最新版本号,同时基于最新版本号对应的数据库内容,采用散列加密算法确定对应的信息摘要,得到上述对应关系。例如,信息摘要和版本号之间的对应关系包括:数据库版本1.0对应信息摘要1,数据库版本2.0对应信息摘要2,等等。
在本公开实施例中,云端可以根据预存的上述对应关系,确定所述云端当前存储的终端发送的第一版本号所对应的第二信息摘要。
在步骤102-12中,响应于确定所述第一信息摘要与所述第二信息摘要匹配,确定允许所述终端进行增量更新,否则确定不允许所述终端进行增量更新。
在本公开实施例中,第一信息摘要与第二信息摘要匹配可以包括但不限于第一信息摘要与第二信息摘要完全相同,或者内容相同但表现形式不同,本公开对此不作限定。如果终端发送的与第一版本号对应的第一信息摘要,与云端存储的与第一版本号对应的第二信息摘要相匹配,那么可以确定终端当前存储的第一版本号对应的数据库内容与云端的第一版本号对应的数据库内容匹配,可以允许终端在当前存储的数据库内容的基础上,进行增量更新。否则确定不允许终端进行增量更新。
上述实施例中,云端可以比较自身存储的与第一版本号对应的第二信息摘要和终端发送的第一信息摘要是否匹配,从而确定是否允许终端进行增量更新,确保了终端存储的数据库内容的准确性,也确保了终端后续采用增量更新得到的数据库内容的准确性。
在一些可选实施例中,针对上述步骤102-2,云端如果存在多个不同的数据库版本,那么云端可以针对每两个相邻的版本号存储一个对应的增量更新数据包,这个预存的增量更新数据包可以用于将终端当前存储的数据库版本由版本号低的版本更新为相邻的高版本。
例如,两个相邻的版本号1.0和2.0对应一个增量更新数据包1,两个相邻的版本号2.0和3.0对应一个增量更新数据包2,等等,以此类推。增量更新数据包1用于将终端当前存储的数据库版本由版本号1.0更新为版本号2.0,增量更新数据包2用于将终端当前存储的数据库版本由版本号2.0更新为版本号3.0,等等,以此类推。采用上述方式,可以避免云端存储大量的与不同两个版本号对应的增量更新数据包,占用大量的云端资源的问题。例如,如果云端针对任意两个版本号均保存一个对应的增量更新数据包,云端当前存储的最新数据库版本为n.0,那么需要保存n×(n-1)/2个增量数据包,n的值越大,云端需要保存的增量数据包越多,这样会占用大量的云端资源。但是采用本公开的方式,只针对每两个相邻的版本号保存一个对应的增量更新数据包,那么同样在云端当前存储的最新数据库版本为n.0的情况下,云端只需要保存(n-1)个增量数据包,很明显可以避免占用过多的云端资源。其中,n可以为正整数。
进一步地,云端可以根据终端发送的第一版本号和云端当前存储的第二版本号,以及云端预存的每两个相邻的版本号对应的增量更新数据包,确定终端所请求的目标增量更新数据包。
在一个示例中,如果第一版本号和第二版本号相邻,直接将第一版本号和第二版本 号对应的增量更新数据包作为目标增量更新数据包。例如,第一版本号为1.0,第二版本号为2.0,那么直接将版本号1.0和2.0对应的增量更新数据包1作为目标增量更新数据包即可。
在另一个示例中,如果第一版本号和第二版本号不相邻,那么需要根据第一版本号、第二版本号以及两者之间间隔的版本号,来确定目标增量更新数据包。例如,第一版本号为1.0,第二版本号为3.0,中间间隔版本号2.0,那么可以将版本号1.0和2.0对应的增量更新数据包1、版本号2.0和3.0对应的增量更新数据包2同时作为目标增量更新数据包。
上述实施例中,云端可以针对每两个相邻的版本号预存对应的一个增量更新数据包,避免不同的数据库版本号之间对应的增量更新数据包占用过多的云端资源,可用性高。
在一些可选实施例中,上述方法还可以包括以下步骤105:在步骤105中,向所述终端发送第二版本号和第三信息摘要。
在本公开实施例中,第二版本号是云端当前存储的至少一个数据库版本中的最新版本号,第三信息摘要是云端基于第二版本号对应的数据库内容得到的信息摘要。
云端将第二版本号和第三信息摘要发送给终端,便于终端基于第三信息摘要确定增量更新是否成功,以及在增量更新成功后,基于第二版本号确定自身更新后的数据库版本。
上述实施例中,云端可以将自身存储的最新版本号,即第二版本号和第二版本号对应的第三信息摘要发送给终端,以便终端在下载了目标增量更新数据包执行了增量更新后,确定增量更新是否成功,以及确定更新后的数据库版本,确保了增量更新的准确性。
在一些可选实施例中,考虑到云端在同一时间段内接收到大量终端发起的增量更新下载请求,会导致大量终端同步下载对应的目标增量更新数据包,容易造成云端与终端之间的传输通路的拥塞,甚至可能导致云端宕机,为了解决这一问题,上述方法还可以包括步骤106:在步骤106中,接收所述终端发送的更新请求。
在本公开实施例中,云端可以在接收到终端发送的增量更新下载请求之前,就接收到该终端发送的更新请求。其中,更新请求用于请求进行增量更新。终端通过更新请求告知云端该终端请求进行增量更新。
上述实施例中,云端可以在在接收终端到发送的增量更新下载请求之前,先接收该终端发送的更新请求,以便确定某个时间段内请求进行增量更新的终端数目,从而让终端后续确定是否进行增量更新数据包的下载,避免大量终端同步下载对应的目标增量更新数据包,造成云端与终端之间传输通路的拥塞,甚至导致云端宕机的问题,可用性高。
在一些可选实施例中,该方法还可以包括以下步骤107至108:在步骤107中,确定在第一时间段内发送所述更新请求的终端的第一数目。
在本公开实施例中,可以用时间片表示时间段,第一时间段即第一时间片的持续时长T可以由云端根据终端业务进行配置,包括但不限于60秒或更多。
云端统计在第一时间片t i内接收到的发送了更新请求的终端的第一数目N t。第一数目N t可以是自然数,例如0、1、2等等。
在步骤108中,向发送所述更新请求的终端发送所述第一数目和第二数目。
其中,第二数目C t是云端当前允许的同步进行增量更新下载的最大终端数目,第二数目C t可以根据云端的运行能力确定。在本公开实施例中,云端在不同时间片的运行能力可能相同或不同,相应地,在不同时间片内云端支持的同步进行增量更新下载的最大终端数目可以相同或不同。
上述实施例中,云端可以将第一时间片内发送更新请求的终端的第一数目,以及云端当前允许的同步进行增量更新下载的最大终端数目(即第二数目)发送给终端,从而让终端确定是否进行增量更新数据包的下载,避免大量终端同步下载对应的目标增 量更新数据包,造成云端与终端之间传输通路的拥塞,甚至导致云端宕机的问题,可用性高。
在一些可选实施例中,如果第一数目小于或等于第二数目,那么说明云端支持在第一时间片内所有发起更新请求的终端,在第二时间段(即第二时间片)内同步下载对应的目标增量更新数据包。第二时间段可以是与所述第一时间片相邻的下一个时间片,且与第一时间片的持续时长相等。
如果第一数目大于第二数目,说明云端无法支持在第一时间片内所有发起更新请求的终端在第二时间片内都同步下载对应的目标增量更新数据包。为了避免传输通路拥塞或云端宕机,可以由云端计算出这些终端在第二时间片内发送增量更新下载请求的第一概率值和再次发送更新请求的第二概率值,云端直接根据第一概率值,在发送更新请求的终端中选择可以发送增量更新下载请求的终端,告知这些终端在第二时间片内发送增量更新下载请求,并告知其他终端在第二时间片内再次发送更新请求。
例如,第一概率值为20%,终端有10台,那么云端可以选择其中2台为可以在第二时间片内发送增量更新下载请求的终端。其他8台终端可以在第二时间片内再次发送更新请求。
在一个可能的实现方式中,终端可以基于第一概率值,在发送更新请求的终端中,随机选择可以发送增量更新下载请求的终端。
在另一个可能的实现方式中,终端可以基于第一概率值,按照接收到更新请求的时间顺序,依次选择可以发送增量更新下载请求的终端。
在另一个可能的实现方式,终端可以基于第一概率值,按照终端已发送增量更新下载请求的次数由多到少的顺序,选择可以发送增量更新下载请求的终端。
在本公开实施例中,终端也可以采用但不限于其他方式基于第一概率值,在发送更新请求的终端中,选择可以发送增量更新下载请求的终端,本公开对此不作限定。
上述实施例中,也可以由云端在第一时间片内发送更新请求的终端中选择在第二时间片内可以发送增量更新下载请求的终端,以及再次发送更新请求的终端,使得多个终端可以错峰进行增量更新数据包的下载,大幅度降低了因请求过多造成的云端与终端之间传输通路的拥塞以及云端宕机的可能。
在一些可选实施例中,该方法还可以包括以下步骤109至110:
在步骤109中,接收所述终端发送的全量更新下载请求。
在本公开实施例中,终端可以在接收到云端发送的目标指示信息,确定云端不允许终端进行增量更新的情况下,向云端发起全量更新下载请求。或者终端还可以在进行增量更新失败次数达到预设次数的情况下,向云端发起全量更新下载请求。预设次数可以由终端根据自身的计算能力来确定,每个终端对应的预设次数可以相同或不同,预设次数为正整数。其中,全量更新下载请求用于请求下载进行全量更新的数据包。本公开实施例中,全量更新是指一次性将云端最新版本的数据库的全部内容同步到终端。
在步骤109中,根据所述全量更新下载请求,向所述终端发送目标全量更新数据包。
在本公开实施例中,所述目标全量更新数据包中包括云端当前存储的至少一个数据库版本中最新版本对应的全量数据。
上述实施例中,云端可以支持终端进行增量更新,同时也支持终端在特定情况下进行全量更新,确保终端存储的数据库内容与云端存储的最新版本的数据库内容的同步,可用性高。
在一些可选实施例中,数据库可以包括执行视觉任务处理所需要的特征信息底库。
在一个实例中,视觉任务处理包括人脸识别,那么对应的特征信息包括人脸特征信息。该数据库就是存储了人脸特征信息的底库。
例如图2所示,图2是根据一示例性实施例示出的另一种数据库同步方法,该方法可以用于终端,包括但不限于进行视觉任务处理的计算机设备,例如手机终端、收费终端、公交车上的计费终端、门禁控制终端等,包括以下步骤201至步骤203:
在步骤201中,向云端发送增量更新下载请求。
在本公开实施例中,增量更新下载请求用于请求下载进行增量更新的数据包。
在步骤202中,下载所述云端基于所述增量更新下载请求确定的目标增量更新数据包。
在本公开实施例中,云端确定允许终端进行增量更新后,会发送至少一个目标增量更新数据包。目标增量更新数据包可以将终端当前存储的数据库内容更新给云端当前存储的最新版本的数据库内容。终端可以通过与云端之间的网络下载该目标增量更新数据包,本公开实施例中,网络可以包括但不限于4G、5G等网络。
步骤203中,基于所述目标增量更新数据包,对当前存储的数据库内容进行增量更新。
在本公开实施例中,终端可以根据目标增量更新数据包中的增加指令,在终端当前存储的数据库中增加至少一条数据,根据其中的删除指令,删除终端当前存储的数据库中的至少一条数据,从而实现增量更新。
上述实施例中,终端可以采用增量更新方式,将云端的数据库内容同步到终端,占用的带宽资源较少,同步时间较短。
在一些可选实施例中,增量更新下载请求包括第一版本号和第一信息摘要。其中,所述第一版本号是所述终端当前存储的数据库的版本号,所述第一信息摘要是所述终端基于所述第一版本号对应的数据库内容得到的信息摘要。
云端可以根据预存的版本号和信息摘要之间的对应关系,确定所述云端当前存储的第一版本号对应的第二信息摘要,从而基于第一信息摘要与第二信息摘要是否匹配,来判断终端存储的第一版本号对应的数据库内容与云端存储的第一版本号对应的数据库内容是否匹配,以便确定是否允许终端进行增量更新。
上述实施例中,可以由终端通过增量更新下载请求,将第一版本号和第一信息摘要发送给云端,以便云端确定是否允许终端进行增量更新,确保了增量更新的准确性。
在一些可选实施例中,上述方法还可以包括步骤204至206。
在步骤204中,接收所述云端发送的第二版本号和第三信息摘要。
其中,所述第二版本号是所述云端当前存储的至少一个数据库版本中的最新版本号,所述第三信息摘要是所述云端基于所述第二版本号对应的数据库内容得到的信息摘要。即第三信息摘要可以是云端采用散列加密算法,基于第二版本号对应的数据库的全部内容确定的信息摘要。
在步骤205中,基于增量更新后的数据库内容,确定第四信息摘要。
在本公开实施例中,终端根据增量更新后的数据库全部内容,采用散列加密算法,确定对应的一个第四信息摘要。
在步骤206中,响应于确定所述第三信息摘要与所述第四信息摘要匹配,确定增量更新成功,并将当前存储的数据库的版本号更新为所述第二版本号。
在本公开实施例中,在第三信息摘要与所述第四信息摘要完全相同,或虽然表现形式不同但所指示的摘要内容相同的情况下,终端可以确定第三信息摘要与第四信息摘要匹配,进一步地,可以确定增量更新成功,将终端当前存储的数据库的版本号更新为所述第二版本号。
上述实施例中,终端可以根据云端发送的第三信息摘要,确定增量更新是否成功,并根据第二版本号,确定增量更新后的最新版本号,可用性高。
在一些可选实施例中,上述方法还可以包括步骤207:
在步骤207中,响应于确定增量更新失败,再次向所述云端发送包括第一信息 摘要的增量更新下载请求,并根据所述云端再次发送的目标增量更新数据包,对当前存储的数据库内容再次进行增量更新。
在本公开实施例中,如果终端确定第三信息摘要与所述第四信息摘要不匹配,可以认为增量更新失败,那么终端可以再次发送增量更新下载请求给所述云端,并根据所述云端再次发送的目标增量更新数据包,对当前存储的数据库内容再次进行增量更新。
上述实施例中,终端可以在增量更新失败的情况下,再次进行增量更新,确保增量更新的准确性。
在一些可选实施例中,上述方法还可以包括步骤208至步骤209。
在步骤208中,响应于接收到所述云端发送的目标指示信息或确定增量更新的失败次数达到预设次数,向所述云端发送全量更新下载请求。
其中,所述目标指示信息用于指示所述云端不允许所述终端进行增量更新,全量更新下载请求用于请求下载进行全量更新的数据包。
在本公开实施例中,如果终端接收到云端发送的目标指示信息,可以确定云端不允许所述终端进行增量更新,此时终端可以发送全量更新下载请求给所述云端,以便进行全量更新。全量更新是指一次性将云端最新版本的数据库的全部内容同步到终端。
或者云端允许终端进行增量更新,但是终端进行增量更新的失败次数达到预设次数,那么终端也可以不再进行增量更新,而是进行全量更新。预设次数可以由终端决定,可以为任意正整数。
在步骤209中,下载所述云端发送的目标全量更新数据包后,基于所述目标全量更新数据包,对当前存储的数据库内容进行全量更新。
在本公开实施例中,目标全量更新数据包中包括所述云端当前存储的至少一个数据库版本中最新版本对应的全量数据。终端基于与云端之间的网络下载目标全量更新数据包,对自身的数据库进行全量更新。
上述实施例中,终端可以在云端不允许终端进行增量更新或增量更新失败次数达到预设次数的情况下,进行全量更新,确保可以将云端最新版本的数据库内容同步到终端,可用性高。
在一些可选实施例中,上述方法还可以包括步骤210至步骤212。
在步骤210中,向所述云端发送更新请求。
在本公开实施例中,终端可以在执行步骤201之前,即,发送增量更新下载请求到云端之前,先发送更新请求到云端。其中,所述更新请求用于请求进行增量更新。
在步骤211中,接收所述云端发送的第一数目和第二数目。
其中,所述第一数目是所述云端在第一时间段(即第一时间片)内接收到发送更新请求的终端数目,所述第二数目是所述云端当前允许的同步进行增量更新下载的最大终端数目。
在步骤212中,响应于确定所述第一数目小于或等于所述第二数目,确定可以在第二时间段发送所述增量更新下载请求给所述云端。
在本实施例中,第二时间段可以用第二时间片表示,第二时间片是与所述第一时间片相邻的下一个时间片,且与第一时间片的持续时长相等。
在本公开实施例中,第一时间片为t i,第二时间片为t i+1,每个时间片持续时长可以均为T。如果云端当前支持或允许的同步进行增量更新下载的最大终端数目大于或等于在第一时间片t i发送了更新请求的终端数目,即第一数目N t小于或等于第二数目C t,那么终端可以直接在第二时间片t i+1发送增量更新下载请求给云端,从而进行增量更新,云端都可以满足终端发起的增量更新下载请求。
上述实施例中,如果云端支持的同步发起增量更新下载请求的最大终端数目大于或等于在第一时间片发起该更新请求的终端数目,那么这些发起了更新请求的终端在第二时间片均可以发起增量更新下载请求,避免大量终端同步下载对应的目标增量更新 数据包,造成云端与终端之间传输通路的拥塞,甚至导致云端宕机的问题,可用性高。
在一些可选实施例中,上述方法还可以包括步骤213至步骤214:
在步骤213中,响应于确定所述第一数目大于所述第二数目,确定在所述第二时间片内发送所述增量更新下载请求给所述云端的第一概率值,和/或在所述第二时间片内再次发送所述更新请求给所述云端的第二概率值。
在本公开实施例中,第一数目N t如果大于第二数目C t,说明云端的服务能力无法满足这么多终端同步进行增量数据包下载,因此,可以分别确定在下一个时间片(即第二时间片)内发送增量更新下载请求的第一概率值,以及在第二时间片内再次发送更新请求的第二概率值。
在一个示例中,第一概率值可以为C t/N t,第二概率值可以为(N t-C t)/N t
在步骤214中,基于所述第一概率值,在所述第二时间段内发送所述增量更新下载请求给所述云端,或基于所述第二概率值,在所述第二时间段内再次发送所述更新请求给所述云端。
在本公开实施例中,终端可以通过预设程序计算一个随机概率值,如果随机概率值大于第一概率值,那么终端可以在第二时间片t i+1内发送增量更新下载请求给云端,否则终端可以在第二时间片t i+1内再次发送更新请求给云端。
其中,预设程序是预先写好的用于计算终端发起增量更新下载请求,且可以下载到目标增量更新数据包的概率值的计算机程序。
上述实施例中,终端可以在云端无法支持较多终端同步进行增量数据包下载的情况下,分别确定在下一个时间片内发送增量更新下载请求和再次发送更新请求的概率值,从而在下一个时间片内基于对应的概率值,发送增量更新下载请求或再次发送更新请求,使得多个终端可以错峰进行增量更新数据包的下载,大幅度降低了因请求过多造成的传输通路拥塞以及云端宕机的可能。
在一些可选实施例中,也可以由云端计算出上述的第一概率值和第二概率值,云端直接根据第一概率值,在发送更新请求的终端中选择可以发送增量更新下载请求的终端,告知这些终端在第二时间段内发送增量更新下载请求,并告知其他终端在第二时间段内再次发送更新请求。终端直接根据云端指示,在第二时间片发送更新下载请求或再次发送更新请求即可。
上述实施例中,也可以由云端在第一时间片内发送更新请求的终端中选择在第二时间片内可以发送增量更新下载请求的终端,以及再次发送更新请求的终端,使得多个终端可以错峰进行增量更新数据包的下载,大幅度降低了因请求过多造成的传输通路拥塞以及云端宕机的可能。
在一些可选实施例中,数据库包括执行视觉任务处理所需要的特征信息底库,相应地,上述方法还可以包括以下步骤215至217:
在步骤215中,获取待处理特征信息。
在本公开实施例中,终端可以根据摄像头采集视觉处理任务对应的图像,对图像进行特征提取,得到所需要的待处理特征信息。
在步骤216中,根据所述待处理特征信息与所述终端当前存储的最新的数据库内容,进行视觉任务处理,得到视觉任务处理结果。
在本公开实施例中,终端当前存储的最小的数据库内容可以是增量更新后得到的最新的数据库内容。
在一个示例中,视觉任务处理包括人脸识别,视觉任务处理结果可以包括人脸识别结果。
在步骤217中,基于所述视觉任务处理结果,执行相应的目标操作。
目标操作包括以下至少一项:门禁开关操作、支付操作。
在一些可选实施例中,人脸识别结果指示该图像中的人脸属于园区员工的人脸, 可以控制门禁设备自动开启,如果人脸识别结果指示该图像中的人脸不属于园区员工的人脸,可以控制门禁设备保持关闭,且进行报警提示。
其中,终端可以向云端发送增量更新下载请求,云端存放了属于该园区多个员工的人脸特征信息底库。云端接收到增量更新下载请求后,确定目标增量更新数据包。假设终端当前存储的数据库版本的版本号为1.0,云端当前存储的数据库最新版本号为2.0,云端确定两个相邻的版本号1.0和2.0对应一个增量更新数据包1为目标增量更新数据包。该目标增量更新数据包中包括增加新入职员工的人脸特征信息的增加指令,和/或删除已离职员工的人脸特征信息的删除指令。
终端根据目标增量更新数据包进行增量更新后,可以让自身存储的数据库版本的版本号更新为2.0,从而在检测到新入职员工的人脸的情况下,控制门禁设备自动开启,同时避免为已离职员工开启门禁设备。
在本公开实施例中,为了避免影响园区员工正常进出园区,终端可以选择在进出员工人数较少的时间段,例如每天晚上22:00至次日早上6:00的时间段进行增量更新,确保自身存储的人脸特征信息与云端存储的人脸特征信息底库的匹配。在一些可选实施例中,人脸识别结果指示该图像中的人脸属于存在对应支付账户的用户人脸,那么可以自动从对应的支付账户上扣除此次对应的金额,例如乘车的费用,或者购买物品的费用等。
以无人售票公交为例,用于自动支付的终端可以向云端发送增量更新下载请求,云端存放了属于已开通自动乘车支付功能的人脸特征信息底库和对应的支付信息,例如支付账号、允许单次支付的最大金额、支付密码等。假设终端当前存储的数据库版本的版本号为1.0,云端当前存储的数据库最新版本号为2.0,云端确定两个相邻的版本号1.0和2.0对应一个增量更新数据包1为目标增量更新数据包。目标增量更新数据包可以包括增加新开通自动乘车支付功能的人脸特征信息和对应的支付信息的增加指令,和/或删除已关闭自动乘车支付功能的人脸特征信息和对应的支付信息的删除指令。
终端可以在确定无人售票公交车未处于行驶过程的情况下,发起增量更新下载请求。在一个示例中,终端可以在无人售票公交车到达了该路线的任一终点站,且距离下一次发车时间点的时长超过预设时长,网络条件也较好时,发起增量更新下载请求,从而避免因终端进行增量更新,导致乘车人员无法正常完成乘车支付的问题。
上述实施例中,在需要通过终端执行视觉任务处理的情况下,可以将云端包括的执行视觉任务处理所需要的特征信息底库,采用增量更新的方式同步到终端,在终端与云端网络条件较差的情况下,确保视觉任务处理的准确性。
在一些可选实施例中,例如图3所示,包括以下步骤301至步骤314。
在步骤301中,终端向云端发送增量更新下载请求。
其中,增量更新下载请求用于请求下载进行增量更新的数据包。增量更新下载请求包括第一版本号和第一信息摘要;其中,所述第一版本号是所述终端当前存储的数据库的版本号,所述第一信息摘要是所述终端基于所述第一版本号对应的数据库内容得到的信息摘要。
在步骤302中,云端根据预存的信息摘要和版本号之间的对应关系,确定云端当前存储的与第一版本号对应的第二信息摘要。
在步骤303中,云端响应于确定第一信息摘要与所述第二信息摘要匹配,确定允许所述终端进行增量更新,否则确定不允许所述终端进行增量更新。
如果云端确定允许终端进行增量更新,则执行步骤304至步骤310,否则执行步骤311至314。
在步骤304中,云端根据所述第一版本号、所述第二版本号以及预存的每两个相邻的版本号对应的一个增量更新数据包,确定所述目标增量更新数据包。
在步骤305中,云端向所述终端发送所述目标增量更新数据包。
在步骤306中,终端基于下载的所述目标增量更新数据包,对当前存储的数据库内容进行增量更新。
在步骤307中,云端向所述终端发送第二版本号和第三信息摘要。
其中,所述第二版本号是所述云端当前存储的至少一个数据库版本中的最新版本号,所述第三信息摘要是云端基于所述第二版本号对应的数据库内容得到的信息摘要。
在步骤308中,终端基于增量更新后的数据库内容,确定第四信息摘要。
在步骤309中,终端响应于确定所述第三信息摘要与所述第四信息摘要匹配,确定增量更新成功,并将所述终端当前存储的数据库的版本号更新为所述第二版本号。
在步骤310中,终端响应于确定增量更新失败,再次向所述云端发送增量更新下载请求,并根据所述云端再次发送的目标增量更新数据包,对当前存储的数据库内容再次进行增量更新。
在步骤311中,云端向所述终端发送目标指示信息。
其中,所述目标指示信息用于指示所述云端不允许所述终端进行增量更新。
在完成步骤310或311之后,都可以执行步骤312至步骤314。
在步骤312中,终端响应于接收到所述云端发送的目标指示信息或确定增量更新的失败次数达到预设次数,向所述云端发送全量更新下载请求。
其中,所述全量更新下载请求用于请求下载进行全量更新的数据包。
在步骤313中,云端根据所述全量更新下载请求,向所述终端发送目标全量更新数据包。
其中,所述目标全量更新数据包中包括所述云端当前存储的至少一个数据库版本中最新版本对应的全量数据。
在步骤314中,终端基于所述云端发送的目标全量更新数据包,对当前存储的数据库内容进行全量更新。
上述实施例中,云端可以根据终端发送的增量更新下载请求,确定终端所请求的目标增量更新数据包,以便终端下载进行增量更新的目标增量更新数据包。本公开可以采用增量更新方式,将云端的数据库内容同步到终端,占用的带宽资源较少,同步时间较短。
对上述实施例进一步举例说明如下。
在人脸识别(例如,人脸1:N模式)实际应用场景中,其中N为任意正整数。由于无法进行专线网络建设,导致终端无法将实时获取到的待处理特征信息发送到云端进行实时比对处理,需要在终端侧同步云端最新版本的数据库内容后,基于终端存储的数据库内容进行比对,如果采用全量更新的方式每次将云端的最新版本的数据库内容全部同步到终端,会造成耗时久,占用带宽资源多的问题。
而在本公开实施例中,可以采用增量更新的方式,将人脸数据底库的内容每次通过增量更新的方式同步到终端,这样终端在需要执行视觉任务处理时,可以基于终端侧增量更新的数据库内容直接进行人脸识别,得到对应的视觉任务处理结果。进而完成门禁开关操作、支付操作等等。例如自动开启园区门禁,在移动的公交车上进行离线支付,在学校或园区食堂、商店等场所进行离线支付等,使得对应场景下的基于人脸1:N的应用具有更高可用性。
在一些可选实施例中,例如图4所示,图4中示出的终端的数目可以为至少一个,图4仅以一个终端为例进行说明,包括以下步骤401至步骤406。
在步骤401中,终端向云端发送更新请求。
在步骤402中,云端确定在第一时间片内发送所述更新请求的终端的第一数目。
在步骤403中,云端向所述终端发送所述第一数目和第二数目。
其中,所述第二数目是所述云端当前允许的同步进行增量更新下载的最大终端数目。
在步骤404中,终端响应于确定所述第一数目小于或等于所述第二数目,确定在第二时间片向所述云端发送所述增量更新下载请求。
进一步地,终端按照上述步骤301至314的内容,在第二时间片内发送增量更新下载请求给云端,从而进行增量更新即可,在此不再赘述。
在步骤405中,终端响应于确定所述第一数目大于所述第二数目,确定在所述第二时间片内向所述云端发送所述增量更新下载请求的第一概率值,和/或在所述第二时间片内再次向所述云端发送所述更新请求的第二概率值。
在步骤406中,终端基于所述第一概率值,在所述第二时间片内向所述云端发送所述增量更新下载请求,或基于所述第二概率值,在所述第二时间片内再次向所述云端发送所述更新请求。
上述实施例中,终端可以错峰从云端下载对应的目标增量更新数据包,减轻云端的并发压力,避免云端与终端之间传输通路的拥塞,甚至导致云端宕机的问题,可用性高。
与前述方法实施例相对应,本公开还提供了装置的实施例。
如图5所示,本公开根据一示例性实施例提供一种数据库同步装置,包括:第一接收模块510,用于接收终端发送的增量更新下载请求;其中,所述增量更新下载请求用于请求下载进行增量更新所需的数据包;第一确定模块520,用于确定所述增量更新下载请求对应的目标增量更新数据包;第一发送模块530,用于向所述终端发送所述目标增量更新数据包。
在一些可选实施例中,所述增量更新下载请求包括第一版本号和第一信息摘要;其中,所述第一版本号是所述终端当前存储的数据库的版本号,所述第一信息摘要是所述终端基于所述第一版本号对应的数据库内容得到的信息摘要;所述第一确定模块包括:第一确定子模块,用于根据所述第一信息摘要和所述第一版本号,确定是否允许所述终端进行增量更新;第二确定子模块,用于响应于确定允许所述终端进行增量更新,根据所述第一版本号和第二版本号,确定所述目标增量更新数据包;其中,所述第二版本号是云端当前存储的至少一个数据库版本中的最新版本号。
在一些可选实施例中,所述装置还包括:第三发送模块,用于响应于确定不允许所述终端进行增量更新,向所述终端发送目标指示信息;其中,所述目标指示信息用于指示所述云端不允许所述终端进行增量更新。
在一些可选实施例中,所述第一确定子模块包括:第一确定单元,用于根据预存的信息摘要和版本号之间的对应关系,确定所述云端当前存储的与所述第一版本号对应的第二信息摘要;第二确定单元,用于响应于确定所述第一信息摘要与所述第二信息摘要匹配,确定允许所述终端进行增量更新,否则确定不允许所述终端进行增量更新。
在一些可选实施例中,所述第二确定子模块包括:第三确定单元,用于根据所述第一版本号、所述第二版本号以及预存的每两个相邻的版本号对应的一个增量更新数据包,确定所述目标增量更新数据包。
在一些可选实施例中,所述装置还包括:第四发送模块,用于向所述终端发送第二版本号和第三信息摘要;其中,所述第二版本号是云端当前存储的至少一个数据库版本中的最新版本号,所述第三信息摘要是所述云端基于所述第二版本号对应的数据库内容得到的信息摘要。
在一些可选实施例中,所述装置还包括:第二接收模块,用于接收所述终端发送的更新请求;其中,所述更新请求用于请求进行增量更新。
在一些可选实施例中,所述装置还包括:第二确定模块,用于确定在第一时间段内发送所述更新请求的终端的第一数目;第五发送模块,用于向发送所述更新请求的终端发送所述第一数目和第二数目;其中,所述第二数目是云端当前允许的同步进行增量更新下载的最大终端数目。
在一些可选实施例中,所述装置还包括:第三接收模块,用于接收所述终端发送的全量更新下载请求;其中,所述全量更新下载请求用于请求下载进行全量更新的数据包;第六发送模块,用于根据所述全量更新下载请求,向所述终端发送目标全量更新数据包;其中,所述目标全量更新数据包中包括云端当前存储的至少一个数据库版本中最新版本对应的全量数据。
在一些可选实施例中,所述数据库包括执行视觉任务处理所需要的特征信息底库。
如图6所示,本公开根据一示例性实施例提供一种数据库同步装置,包括:第二发送模块610,用于向云端发送增量更新下载请求;其中,所述增量更新下载请求用于请求下载进行增量更新所需的数据包;下载模块620,用于下载所述云端基于所述增量更新下载请求确定的目标增量更新数据包;增量更新模块630,用于基于所述目标增量更新数据包,对当前存储的数据库内容进行增量更新。
在一些可选实施例中,所述增量更新下载请求包括第一版本号和第一信息摘要;其中,所述第一版本号是终端当前存储的数据库的版本号,所述第一信息摘要是所述终端基于所述第一版本号对应的数据库内容得到的信息摘要。
在一些可选实施例中,所述装置还包括:第四接收模块,用于接收所述云端发送的第二版本号和第三信息摘要;其中,所述第二版本号是所述云端当前存储的至少一个数据库版本中的最新版本号,所述第三信息摘要是所述云端基于所述第二版本号对应的数据库内容得到的信息摘要;第三确定模块,用于基于增量更新后的数据库内容,确定第四信息摘要;第一执行模块,用于响应于确定所述第三信息摘要与所述第四信息摘要匹配,确定增量更新成功,并将当前存储的数据库的版本号更新为所述第二版本号。
在一些可选实施例中,所述装置还包括:第二执行模块,用于响应于确定增量更新失败,再次向所述云端发送增量更新下载请求,并基于所述云端再次发送的目标增量更新数据包,对当前存储的数据库内容再次进行增量更新。
在一些可选实施例中,所述装置还包括:第七发送模块,用于响应于接收到所述云端发送的目标指示信息或确定增量更新的失败次数达到预设次数,向所述云端发送全量更新下载请求;其中,所述目标指示信息用于指示所述云端不允许所述终端进行增量更新,所述全量更新下载请求用于请求下载进行全量更新的数据包;全量更新模块,用于下载所述云端发送的目标全量更新数据包后,基于所述目标全量更新数据包,对当前存储的数据库内容进行全量更新;其中,所述目标全量更新数据包中包括所述云端当前存储的至少一个数据库版本中最新版本对应的全量数据。
在一些可选实施例中,所述装置还包括:第八发送模块,用于向所述云端发送更新请求;其中,所述更新请求用于请求进行增量更新;第五接收模块,用于接收所述云端发送的第一数目和第二数目;其中,所述第一数目是所述云端在第一时间段内接收到发送更新请求的终端数目,所述第二数目是所述云端当前允许的同步进行增量更新下载的最大终端数目;第四确定模块,用于响应于确定所述第一数目小于或等于所述第二数目,确定在第二时间段向所述云端发送所述增量更新下载请求;其中,所述第二时间段是与所述第一时间段相邻的下一个时间段。
在一些可选实施例中,所述装置还包括:第五确定模块,用于响应于确定所述第一数目大于所述第二数目,确定在所述第二时间段内向所述云端发送所述增量更新下载请求的第一概率值,和/或在所述第二时间段内再次向所述云端发送所述更新请求的第二概率值;第九发送模块,用于基于所述第一概率值,在所述第二时间段内向所述云端发送所述增量更新下载请求,或基于所述第二概率值,在所述第二时间段内再次向所述云端发送所述更新请求。
在一些可选实施例中,所述数据库包括执行视觉任务处理所需要的特征信息底库;所述装置还包括:获取模块,用于获取待处理特征信息;视觉任务处理模块,用于 根据所述待处理特征信息与所述终端当前存储的最新的数据库内容,进行视觉任务处理,得到视觉任务处理结果;第三执行模块,用于基于所述视觉任务处理结果,执行相应的目标操作。
在一些可选实施例中,所述视觉任务处理包括人脸识别;所述目标操作包括以下至少一项:门禁开关操作、支付操作。
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本公开方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
本公开实施例还提供了一种数据库同步***,包括云端和终端,终端可以采用增量同步的方式将云端的最新版本的数据库内容同步到终端。其中,云端可以包括上述用于云端的任一数据库同步装置,终端可以包括上述用于终端的任一数据库同步装置。
本公开实施例还提供了一种计算机可读存储介质,其存储有计算机程序,计算机程序用于执行上述任一所述的数据库同步方法。
在一些可选实施例中,本公开实施例提供了一种计算机程序产品,包括计算机可读代码并存储于计算机可读存储介质,当计算机可读代码在设备上运行时,设备中的处理器执行用于实现如上任一实施例提供的数据库同步方法的指令。
在一些可选实施例中,本公开实施例还提供了另一种计算机程序产品,用于存储计算机可读指令,指令被执行时使得计算机执行上述任一实施例提供的数据库同步方法。
该计算机程序产品可以具体通过硬件、软件或其结合的方式实现。在一个可选实施例中,所述计算机程序产品具体体现为计算机存储介质,在另一个可选实施例中,计算机程序产品具体体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。
本公开实施例还提供了一种数据库同步装置,包括:处理器;用于存储处理器可执行指令的存储器;其中,处理器被配置为调用所述存储器中存储的可执行指令,实现上述任一实施例提供的数据库同步方法。
图7为本公开实施例提供的一种数据库同步装置的硬件结构示意图。该数据库同步装置710包括处理器711,还可以包括输入装置712、输出装置713和存储器714。该输入装置712、输出装置713、存储器714和处理器711之间通过总线相互连接。
存储器包括但不限于是随机存储记忆体(random access memory,RAM)、只读存储器(read-only memory,ROM)、可擦除可编程只读存储器(erasable programmable read only memory,EPROM)、或便携式只读存储器(compact disc read-only memory,CD-ROM),该存储器用于相关指令及数据。
输入装置用于输入数据和/或信号,以及输出装置用于输出数据和/或信号。输出装置和输入装置可以是独立的器件,也可以是一个整体的器件。
处理器可以包括是一个或多个处理器,例如包括一个或多个中央处理器(central processing unit,CPU),在处理器是一个CPU的情况下,该CPU可以是单核CPU,也可以是多核CPU。
存储器用于存储网络设备的程序代码和数据。
处理器用于调用该存储器中的程序代码和数据,执行上述方法实施例中的步骤。具体可参见方法实施例中的描述,在此不再赘述。
可以理解的是,图7仅仅示出了一种数据库同步装置的简化设计。在实际应用中,数据库同步装置还可以分别包含必要的其他元件,包含但不限于任意数量的输入/ 输出装置、处理器、控制器、存储器等,而所有可以实现本公开实施例的数据库同步装置都在本公开的保护范围之内。
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本公开的其它实施方案。本公开旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或者惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由下面的权利要求指出。
以上所述仅为本公开的较佳实施例而已,并不用以限制本公开,凡在本公开的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本公开保护的范围之内。

Claims (21)

  1. 一种数据库同步方法,应用于云端,包括:
    接收终端发送的增量更新下载请求;其中,所述增量更新下载请求用于请求下载进行增量更新所需的数据包;
    确定所述增量更新下载请求对应的目标增量更新数据包;
    向所述终端发送所述目标增量更新数据包。
  2. 根据权利要求1所述的方法,其特征在于,
    所述增量更新下载请求包括:
    第一版本号,所述第一版本号是所述终端当前存储的数据库的版本号,
    第一信息摘要,所述第一信息摘要是所述终端基于所述第一版本号对应的数据库内容得到的信息摘要;
    所述确定所述增量更新下载请求对应的目标增量更新数据包,包括:
    根据所述第一信息摘要和所述第一版本号,确定是否允许所述终端进行增量更新;
    响应于确定允许所述终端进行增量更新,根据所述第一版本号和第二版本号,确定所述目标增量更新数据包;其中,所述第二版本号是所述云端当前存储的至少一个数据库版本中的最新版本号。
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:
    响应于确定不允许所述终端进行增量更新,向所述终端发送目标指示信息;其中,所述目标指示信息用于指示所述云端不允许所述终端进行增量更新。
  4. 根据权利要求2或3所述的方法,其特征在于,所述根据所述第一信息摘要和所述第一版本号,确定是否允许所述终端进行增量更新,包括:
    根据预存的信息摘要和版本号之间的对应关系,确定所述云端当前存储的与所述第一版本号对应的第二信息摘要;
    响应于所述第一信息摘要与所述第二信息摘要匹配,确定允许所述终端进行增量更新,否则确定不允许所述终端进行增量更新。
  5. 根据权利要求2至4任一项所述的方法,其特征在于,所述根据所述第一版本号和第二版本号,确定所述目标增量更新数据包,包括:
    根据所述第一版本号、所述第二版本号以及预存的每两个相邻的版本号对应的一个增量更新数据包,确定所述目标增量更新数据包。
  6. 根据权利要求2至5任一项所述的方法,其特征在于,所述方法还包括:
    向所述终端发送所述第二版本号和第三信息摘要;其中,所述第三信息摘要是所述云端基于所述第二版本号对应的数据库内容得到的信息摘要。
  7. 根据权利要求1至6任一项所述的方法,其特征在于,所述接收终端发送的增量更新下载请求之前,所述方法还包括:
    接收所述终端发送的更新请求;其中,所述更新请求用于请求进行增量更新。
  8. 根据权利要求7所述的方法,其特征在于,所述方法还包括:
    确定在第一时间段内发送所述更新请求的终端的第一数目;
    向发送所述更新请求的终端发送所述第一数目和第二数目;其中,所述第二数目是所述云端当前允许的同步进行增量更新下载的最大终端数目。
  9. 根据权利要求1至8任一项所述的方法,其特征在于,所述方法还包括:
    接收所述终端发送的全量更新下载请求;其中,所述全量更新下载请求用于请求下载进行全量更新的数据包;
    根据所述全量更新下载请求,向所述终端发送目标全量更新数据包;其中,所述目标全量更新数据包中包括所述云端当前存储的至少一个数据库版本中最新版本对应的全量数据。
  10. 一种数据库同步方法,应用于终端,包括:
    向云端发送增量更新下载请求;其中,所述增量更新下载请求用于请求下载进行增量更新所需的数据包;
    下载所述云端基于所述增量更新下载请求确定的目标增量更新数据包;
    基于所述目标增量更新数据包,对当前存储的数据库内容进行增量更新。
  11. 根据权利要求10所述的方法,其特征在于,所述增量更新下载请求包括:
    第一版本号,所述第一版本号是所述终端当前存储的数据库的版本号,
    第一信息摘要,所述第一信息摘要是所述终端基于所述第一版本号对应的数据库内容得到的信息摘要。
  12. 根据权利要求11所述的方法,其特征在于,所述方法还包括:
    接收所述云端发送的第二版本号和第三信息摘要;其中,所述第二版本号是所述云端当前存储的至少一个数据库版本中的最新版本号,所述第三信息摘要是所述云端基于所述第二版本号对应的数据库内容得到的信息摘要;
    基于增量更新后的数据库内容,确定第四信息摘要;
    响应于所述第三信息摘要与所述第四信息摘要匹配,确定增量更新成功,并将当前存储的数据库的版本号更新为所述第二版本号。
  13. 根据权利要求10至12任一项所述的方法,其特征在于,所述方法还包括:
    响应于确定增量更新失败,再次向所述云端发送增量更新下载请求,并
    基于所述云端再次发送的目标增量更新数据包,对当前存储的数据库内容再次进行增量更新。
  14. 根据权利要求10至13任一项所述的方法,其特征在于,所述方法还包括:
    响应于接收到所述云端发送的目标指示信息或确定增量更新的失败次数达到预设次数,向所述云端发送全量更新下载请求;其中,所述目标指示信息用于指示所述云端不允许所述终端进行增量更新,所述全量更新下载请求用于请求下载进行全量更新的数据包;
    下载所述云端发送的目标全量更新数据包后,基于所述目标全量更新数据包,对当前存储的数据库内容进行全量更新;其中,所述目标全量更新数据包中包括所述云端当前存储的至少一个数据库版本中最新版本对应的全量数据。
  15. 根据权利要求10至14任一项所述的方法,其特征在于,所述向云端发送增量更新下载请求之前,所述方法还包括:
    向所述云端发送更新请求;其中,所述更新请求用于请求进行增量更新;
    接收所述云端发送的第一数目和第二数目;其中,所述第一数目是所述云端在第一时间段内接收到发送更新请求的终端数目,所述第二数目是所述云端当前允许的同步进行增量更新下载的最大终端数目;
    响应于确定所述第一数目小于或等于所述第二数目,确定在第二时间段向所述云端发送所述增量更新下载请求;其中,所述第二时间段是与所述第一时间段相邻的下一个时间段。
  16. 根据权利要求15所述的方法,其特征在于,所述方法还包括:
    响应于确定所述第一数目大于所述第二数目,确定在所述第二时间段内向所述云端发送所述增量更新下载请求的第一概率值,和/或在所述第二时间段内再次向所述云端发送所述更新请求的第二概率值;
    基于所述第一概率值,在所述第二时间段内向所述云端发送所述增量更新下载请求,或基于所述第二概率值,在所述第二时间段内再次向所述云端发送所述更新请求。
  17. 一种数据库同步装置,应用于云端,包括:
    第一接收模块,用于接收终端发送的增量更新下载请求;其中,所述增量更新下载请求用于请求下载进行增量更新所需的数据包;
    第一确定模块,用于确定所述增量更新下载请求对应的目标增量更新数据包;
    第一发送模块,用于向所述终端发送所述目标增量更新数据包。
  18. 一种数据库同步装置,应用于终端,包括:
    第二发送模块,用于向云端发送增量更新下载请求;其中,所述增量更新下载请求用于请求下载进行增量更新所需的数据包;
    下载模块,用于下载所述云端基于所述增量更新下载请求确定的目标增量更新数据包;
    增量更新模块,用于基于所述目标增量更新数据包,对当前存储的数据库内容进行增量更新。
  19. 一种计算机可读存储介质,其存储有计算机程序,所述计算机程序用于执行上述权利要求1至16任一项所述的数据库同步方法。
  20. 一种数据库同步设备,包括:
    处理器;
    用于存储所述处理器可执行指令的存储器;
    其中,所述处理器被配置为调用所述存储器中存储的可执行指令,实现权利要求1至16中任一项所述的数据库同步方法。
  21. 一种计算机程序产品,包括计算机可读代码并存储于计算机可读存储介质,当计算机可读代码在设备上运行时,设备中的处理器执行用于实现权利要求1至16中任一项所述的数据库同步方法的指令。
PCT/CN2021/121416 2021-02-10 2021-09-28 数据库同步方法及装置、存储介质、设备 WO2022170771A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110184605.0 2021-02-10
CN202110184605.0A CN112860797A (zh) 2021-02-10 2021-02-10 数据库同步方法及装置、存储介质、设备

Publications (1)

Publication Number Publication Date
WO2022170771A1 true WO2022170771A1 (zh) 2022-08-18

Family

ID=75989599

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/121416 WO2022170771A1 (zh) 2021-02-10 2021-09-28 数据库同步方法及装置、存储介质、设备

Country Status (2)

Country Link
CN (1) CN112860797A (zh)
WO (1) WO2022170771A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117675842A (zh) * 2023-12-07 2024-03-08 上海钛翮信息科技有限公司 基于多设备数据的增量同步方法及***

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112860797A (zh) * 2021-02-10 2021-05-28 上海商汤智能科技有限公司 数据库同步方法及装置、存储介质、设备
CN114969203A (zh) * 2022-05-11 2022-08-30 深圳无一科技有限公司 数据实时同步方法、装置、设备及介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015024437A1 (en) * 2013-08-21 2015-02-26 Tencent Technology (Shenzhen) Company Limited Method and apparatus for processing timedly-published data
CN106973099A (zh) * 2017-03-28 2017-07-21 广东欧珀移动通信有限公司 一种数据更新方法、装置及***
CN108111331A (zh) * 2017-11-06 2018-06-01 北京趣拿软件科技有限公司 更新数据包的获取方法、装置、存储介质、处理器及***
CN112052020A (zh) * 2019-06-06 2020-12-08 广州市百果园信息技术有限公司 一种数据更新方法、装置、***、计算机设备及存储介质
CN112860797A (zh) * 2021-02-10 2021-05-28 上海商汤智能科技有限公司 数据库同步方法及装置、存储介质、设备

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20140077435A (ko) * 2012-12-14 2014-06-24 삼성전자주식회사 모바일 단말의 소프트웨어 업데이트 서비스 방법 및 장치
CN109788027B (zh) * 2018-12-13 2022-04-15 平安科技(深圳)有限公司 数据同步方法、装置、服务器及计算机存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015024437A1 (en) * 2013-08-21 2015-02-26 Tencent Technology (Shenzhen) Company Limited Method and apparatus for processing timedly-published data
CN106973099A (zh) * 2017-03-28 2017-07-21 广东欧珀移动通信有限公司 一种数据更新方法、装置及***
CN108111331A (zh) * 2017-11-06 2018-06-01 北京趣拿软件科技有限公司 更新数据包的获取方法、装置、存储介质、处理器及***
CN112052020A (zh) * 2019-06-06 2020-12-08 广州市百果园信息技术有限公司 一种数据更新方法、装置、***、计算机设备及存储介质
CN112860797A (zh) * 2021-02-10 2021-05-28 上海商汤智能科技有限公司 数据库同步方法及装置、存储介质、设备

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117675842A (zh) * 2023-12-07 2024-03-08 上海钛翮信息科技有限公司 基于多设备数据的增量同步方法及***
CN117675842B (zh) * 2023-12-07 2024-05-07 上海钛翮信息科技有限公司 基于多设备数据的增量同步方法及***

Also Published As

Publication number Publication date
CN112860797A (zh) 2021-05-28

Similar Documents

Publication Publication Date Title
WO2022170771A1 (zh) 数据库同步方法及装置、存储介质、设备
CN111641583B (zh) 一种物联网资源接入***及资源接入方法
CN108566290B (zh) 服务配置管理方法、***、存储介质和服务器
WO2020134549A1 (zh) 一种框架管理的方法及装置
CN106888233B (zh) 数据更新***及方法
US20180159920A1 (en) Server load balancing method, apparatus, and server device
WO2013178082A1 (zh) 图片上传方法、***、客户端及网络服务器、计算机存储介质
CN113961312A (zh) 目标服务的部署方法、装置和电子设备
WO2019024679A1 (zh) 网络功能的升级方法及升级管理实体
CN112860282B (zh) 集群插件的升级方法、装置和服务器
CN105144109A (zh) 分布式数据中心技术
CN111770355A (zh) 媒体服务器确定方法、装置、服务器以及存储介质
US20200004427A1 (en) Method, apparatus and system for controlling mounting of file system
CN111258726B (zh) 任务调度方法和装置
WO2017097210A1 (zh) 软件升级方法、装置及***
WO2023155819A1 (zh) 一种应用部署方法和***
US10650025B2 (en) Method and apparatus for checking and updating data on a client terminal
CN115499447A (zh) 一种集群主节点确认方法、装置、电子设备及存储介质
CN113452770A (zh) 数据同步方法、装置、计算机设备及存储介质
CN112114856A (zh) 一种热更新方法及装置
US12026501B2 (en) Automated process and system update scheduling in a computer network
US10250515B2 (en) Method and device for forwarding data messages
US11567799B2 (en) System and method for updating applications with current instance configurations in real-time
CN115086194A (zh) 云应用的数据传输方法、计算设备及计算机存储介质
CN113986401A (zh) 数据处理方法及装置、电子设备和存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21925422

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 19/01/2024)