WO2021147197A1 - 数据同步方法、装置、计算机设备及存储介质 - Google Patents

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

Info

Publication number
WO2021147197A1
WO2021147197A1 PCT/CN2020/087130 CN2020087130W WO2021147197A1 WO 2021147197 A1 WO2021147197 A1 WO 2021147197A1 CN 2020087130 W CN2020087130 W CN 2020087130W WO 2021147197 A1 WO2021147197 A1 WO 2021147197A1
Authority
WO
WIPO (PCT)
Prior art keywords
synchronization
data
completed
data synchronization
preset
Prior art date
Application number
PCT/CN2020/087130
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 WO2021147197A1 publication Critical patent/WO2021147197A1/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/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • 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

Definitions

  • This application relates to the field of computer technology, and in particular to a data synchronization method, device, computer equipment, and storage medium.
  • the embodiments of the present application provide a data synchronization method, device, computer equipment, and storage medium, aiming to solve the problem of low reliability of data information usage when data information synchronization is performed in the prior art method.
  • an embodiment of the present application provides a data synchronization method, which includes:
  • the data information in the initial database corresponding to the data synchronization log table is synchronously stored in the preset free directory of the database to be synchronized, and the synchronization start time is recorded ;
  • an embodiment of the present application provides a data synchronization device, which includes:
  • the data synchronization log table judging unit is used for judging whether the preset data synchronization log table contains new synchronization records when the preset synchronization time point is reached;
  • the data information synchronization unit is configured to, if the data synchronization log table contains new synchronization records, synchronously store the data information in the initial database corresponding to the data synchronization log table to the preset free directory of the database to be synchronized , And record the synchronization start time;
  • a synchronization judging unit configured to judge whether the free directory has completed data synchronization according to the newly added synchronization record if the preset time limit is reached from the synchronization start time interval to obtain the first judgment result;
  • the prompt information feedback unit is configured to feed back prompt information that the data synchronization is completed if the first judgment result is that the data synchronization is completed.
  • an embodiment of the present application provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and running on the processor, and the processor executes the computer
  • the data synchronization method described in the first aspect is implemented during the program, that is, the specific method includes:
  • the data information in the initial database corresponding to the data synchronization log table is synchronously stored in the preset free directory of the database to be synchronized, and the synchronization start time is recorded ;
  • the embodiments of the present application also provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the above-mentioned first
  • the data synchronization method that is, the specific method includes:
  • the data information in the initial database corresponding to the data synchronization log table is synchronously stored in the preset free directory of the database to be synchronized, and the synchronization start time is recorded ;
  • the embodiments of the present application provide a data synchronization method, device, computer equipment, and storage medium.
  • the preset synchronization time point determines whether the data synchronization log contains a new synchronization record. If it contains a new synchronization record, synchronously store the data information in the initial database to the free directory of the database to be synchronized and record the synchronization start time.
  • the preset time limit is reached and the synchronization start time interval is reached
  • the first judgment result is obtained by judging whether the free directory has completed data synchronization according to the newly added synchronization record. If the first judgment result is that the data synchronization is completed, a prompt message indicating that the data synchronization is completed is fed back .
  • FIG. 1 is a schematic flowchart of a data synchronization method provided by an embodiment of the application
  • FIG. 2 is a schematic diagram of a sub-flow of a data synchronization method provided by an embodiment of this application;
  • FIG. 3 is a schematic diagram of another flow of a data synchronization method provided by an embodiment of the application.
  • FIG. 4 is a schematic diagram of another sub-flow of the data synchronization method provided by an embodiment of this application.
  • FIG. 5 is a schematic diagram of another process of a data synchronization method provided by an embodiment of this application.
  • FIG. 6 is a schematic diagram of another sub-flow of the data synchronization method provided by an embodiment of the application.
  • FIG. 7 is a schematic flowchart of another data synchronization method provided by an embodiment of the application.
  • FIG. 8 is a schematic block diagram of a data synchronization device provided by an embodiment of the application.
  • FIG. 9 is a schematic block diagram of a computer device provided by an embodiment of the application.
  • FIG. 1 is a schematic flowchart of a data synchronization method provided by an embodiment of the present application.
  • the data synchronization method is applied to a user terminal, and the method is executed by application software installed in the user terminal.
  • the user terminal is a terminal device used to perform a data synchronization method to synchronize data information, such as a desktop computer and a notebook computer. , Tablet or mobile phone, etc.
  • the method includes steps S110 to S140.
  • the data synchronization log table is the log table that records the synchronization update of the data information in the initial database.
  • the data synchronization log table is the log table that records the synchronization update of the data information in the initial database.
  • the initial database can be a MYSQL database. Because the MYSQL database has low performance when reading and writing data information with a data volume of hundreds of millions of levels, and the data information in the MYSQL database is synchronously updated, it cannot be stored in the database.
  • the stored data information is used, so in this case, the method of synchronizing the data information in the MYSQL database to the database to be synchronized is adopted to enhance the reliability of the use of data information in the database to be synchronized.
  • Synchronization record number synchronised time The amount of data M010015 2019-03-31, 15:03:05 145361841 M010016 2019-04-01, 10:15:44 145362973 M010017 2019-04-03, 13:47:18 145364316
  • the corresponding newly added synchronization record can be obtained according to the synchronization time of each synchronization record. Specifically, the synchronization time of each synchronization record can be judged according to the preset time judgment rule, The synchronization record that meets the preset time judgment rule is obtained as the new synchronization record, and the new synchronization record can be one or more.
  • the preset time judgment rule is within 24 hours before the preset synchronization time point, then the interval between the synchronization time of each synchronization record and the preset synchronization time point is judged Whether the duration is less than 24 hours, the synchronization record whose interval between the synchronization time and the preset synchronization time point is less than 24 hours is obtained according to the judgment result as a new synchronization record.
  • the data synchronization log table contains a newly-added synchronization record, synchronously store the data information in the initial database corresponding to the data synchronization log table in a preset free directory of the database to be synchronized, and record the synchronization start Start time.
  • the data synchronization log table contains new synchronization records
  • the data information in the initial database corresponding to the data synchronization log table is synchronously stored in the preset free directory of the database to be synchronized, and the synchronization start time is recorded .
  • the data synchronization log table contains a new synchronization record, it indicates that the data information in the initial database of the previous day has been synchronously updated, and the data information can be synchronously stored in the free directory of the database to be synchronized according to the initial database that has been synchronized and updated.
  • the database to be synchronized can be the ElasticSearch search engine database.
  • ElasticSearch is a distributed, high-scalable, high-real-time search and storage engine.
  • the ElasticSearch search engine database Contains multiple catalogs (Index), each catalog contains multiple data types (types), and each type stores corresponding documents (Docments) that match the type, and records fields in the documents (Fields) and the corresponding fields data.
  • the database to be synchronized contains two directories as an example.
  • the two directories in the database to be synchronized store two copies of data information.
  • One directory is used as the main directory for docking and using with other business systems, and the other directory is used as a pair.
  • the backup directory for data information backup. The functions of the main directory and the backup directory can be flexibly switched according to actual needs.
  • the data information in the directory cannot be synchronized, and the other directory is not used as the backup directory, then the data information in the backup directory can be synchronized.
  • the backup directory is synchronized Switch to the main directory for use, and synchronize the data in the other directory again in the same way.
  • step S120 includes sub-steps S121 and S122.
  • S121 Determine whether the usage status of each directory in the database to be synchronized is idle, so as to obtain free directories in the database to be synchronized.
  • each directory in the database to be synchronized It is judged whether the usage status of each directory in the database to be synchronized is free, so as to obtain the free directory in the database to be synchronized.
  • the data information in the directory being used cannot be synchronized. You need to obtain the unused directory as a free directory for data synchronization.
  • each directory contains information about the use status, which can be based on the use of each directory. Whether the status is free to obtain the free directory in the database to be synchronized.
  • the data information stored in the free directory is cleared, the data information contained in the initial database corresponding to the data synchronization log table is synchronously stored in the free directory, and the synchronization start time is recorded.
  • the synchronization start time is also the point in time when the data information starts to be synchronized.
  • a preset time limit is reached from the synchronization start time interval, determine whether the free directory completes data synchronization according to the newly added synchronization record to obtain a first determination result. After starting the data synchronization process of the free directory, it is necessary to determine whether the data synchronization is completed based on the amount of data in the free directory after the data synchronization is performed after the preset time interval with the synchronization start time interval. Since the amount of data contained in the free directory is very large, compared to judging whether the data synchronization is completed in real time, judging whether the data synchronization is completed at an appropriate time can greatly relieve the computational pressure and improve the efficiency and accuracy of judgment.
  • steps S1301, S1302, and S1303 are further included before step S130.
  • the synchronization time is basically the same, and the historical synchronization time of the free directory will be recorded for each data synchronization for reference during the next data synchronization. It can be judged whether the historical synchronization data corresponding to the idle target is recorded in the database to be synchronized.
  • the corresponding historical synchronization time is not recorded in the database to be synchronized; if it is not the first time for the idle directory to be synchronized
  • the corresponding historical synchronization time must be recorded in the database to be synchronized.
  • the historical synchronization time corresponding to the free directory has been recorded in the to-be-synchronized database, the historical synchronization time is determined as the preset time limit.
  • the historical synchronization time corresponding to the free directory has been recorded in the to-be-synchronized database, the historical synchronization time is determined as the preset time limit. If this is not the first time that the free directory is synchronized, the corresponding historical synchronization time must be recorded in the database to be synchronized.
  • the historical synchronization time can be used as the preset time limit, which is separated from the synchronization start time.
  • the time consuming synchronization is the time suitable for judging whether the data synchronization has been completed this time.
  • a preset default time limit is determined as the preset time limit.
  • the preset default time limit is determined as the preset time limit. If this is the first time that the free directory is synchronized, the corresponding historical synchronization time is not recorded in the database to be synchronized.
  • the default time limit preset by the manager can be used as the preset time limit, which is the interval from the synchronization start time
  • the preset default time limit is the appropriate time for judging whether the data synchronization has been completed.
  • step S130 includes sub-steps S131 and S132.
  • the new synchronization record contains the corresponding data volume.
  • the data volume of the new synchronization record is the data volume after the data information in the initial database is synchronized and updated. After the data information is synchronized to the free directory, the data information contained in the free target can be checked The data volume of the free directory can be obtained by counting the number of, specifically, the data volume of the free directory can be obtained by adding the data information contained in the free directory one by one.
  • the prompt information for completing the data synchronization is fed back, and the prompt information can be used to prompt that the data information in the free directory of the manager has completed synchronization.
  • the free directory can be switched to the main directory for docking and use with other business systems, and the data information of another directory in the to-be-synchronized database can be synchronized again in the same manner.
  • steps S141, S142, and S143 are further included after step S130.
  • the synchronization judgment rule includes the cycle period, the number of cycles N, and the interval number threshold.
  • the cycle period is the cycle time information for cyclically judging the data amount of the free directory
  • the cycle number N is the number information for obtaining the cycle judgment result.
  • N is a preset integer greater than zero
  • the interval number threshold is the number preset for judging the difference between the amount of data between the newly added synchronization record and the free directory.
  • step S141 includes sub-steps S1411 and S1412.
  • the data volume of the free directory is acquired, and the data volume of the free directory acquired this time is the same as the data volume of the free directory acquired last time.
  • the judgment result of whether the data volume of the free directory has increased If the amount of data in the free directory has not increased, it indicates that there is no data information added to the free directory at this time, and the data synchronization process can be terminated; if the amount of data in the free directory increases, it indicates that there is still unsynchronized data in the initial database The data information stored in the free directory needs to continue the data synchronization process at this time.
  • the quantity threshold is used to obtain the second judgment result of whether the data synchronization is completed. Specifically, the data quantity of the new synchronization record is subtracted from the data quantity of the free directory to obtain the data quantity difference, and it is judged whether the data quantity difference is less than the interval quantity prediction. Set.
  • the data amount difference is less than the interval number threshold, it indicates that the data amount difference between the free directory and the newly added synchronization record is within a reasonable range, and the second judgment result that the data synchronization has been completed is obtained. If the data amount difference is not less than the interval number threshold, it indicates that there is an abnormality in the data synchronization of the free directory.
  • step S140 the step of feeding back the prompt information for completing the data synchronization is performed, that is, step S140 is performed, and the prompt information can be used to prompt that the data information in the free directory of the manager has completed synchronization.
  • the free directory can be switched to the main directory for docking and use with other business systems, and the data information of another directory in the to-be-synchronized database can be synchronized again in the same manner.
  • a prompt message indicating that there is an abnormality in this data synchronization can be sent to the manager to remind the manager that there is an abnormality in this data synchronization.
  • step S140 is included after step S150.
  • the time-consuming update of the historical synchronization of the free directory is performed according to the acquisition time and the synchronization start time of the first judgment result, and if the second judgment result is completed.
  • the data synchronization is completed, and the historical synchronization time-consuming of the free directory is updated according to the acquisition time and the synchronization start time of the second judgment result.
  • the first judgment result is that data synchronization has been completed
  • the first time difference between the synchronization start time and the acquisition time of the first judgment result may be obtained, and the first time difference may be used as the new history of the free directory Synchronization is time-consuming
  • the second judgment result is that data synchronization has been completed
  • the second time difference between the synchronization start time and the acquisition time of the second judgment result is obtained, and the second time difference is used as the new history synchronization of the free directory time consuming.
  • the data synchronization method when the preset synchronization time point is reached, it is determined whether the data synchronization log contains a newly-added synchronization record. If the newly-added synchronization record is included, the data information in the initial database is synchronized and stored to the waiting time. In the free directory of the synchronization database, the synchronization start time is recorded, and the time that is the preset time interval between the synchronization start time and the synchronization start time is reached. The first judgment result is obtained by judging whether the free directory has completed data synchronization according to the newly added synchronization record. The result is that the data synchronization is completed, and the prompt message that the data synchronization is completed is fed back.
  • the reliability of database usage during data information synchronization can be improved, the maintainability of the database during data information synchronization can be improved, and the maintenance cost of the database can be greatly reduced.
  • FIG. 7 is a schematic block diagram of a data synchronization device provided in an embodiment of the present application.
  • the data synchronization device can be configured in the user terminal.
  • the data synchronization device 100 includes a data synchronization log table judgment unit 110, a data information synchronization unit 120, a synchronization judgment unit 130, and a prompt information feedback unit 140.
  • the data synchronization log table determining unit 110 is configured to determine whether the preset data synchronization log table includes a new synchronization record when the preset synchronization time point is reached.
  • the data information synchronization unit 120 is configured to, if the data synchronization log table contains newly-added synchronization records, synchronously store the data information in the initial database corresponding to the data synchronization log table to a preset free directory of the database to be synchronized , And record the synchronization start time.
  • the data information synchronization unit 120 includes sub-units: a usage status judgment unit 121 and a synchronization storage unit 122.
  • the usage status judging unit 121 is configured to judge whether the usage status of each directory in the to-be-synchronized database is idle, so as to obtain the free catalog in the to-be-synchronized database; the synchronization storage unit 122 is configured to clear the idle For the data information stored in the directory, the data information contained in the initial database corresponding to the data synchronization log table is synchronously stored in the free directory, and the synchronization start time is recorded.
  • the synchronization judging unit 130 is configured to determine whether the free directory has completed data synchronization according to the newly added synchronization record if the preset time limit is reached from the synchronization start time interval to obtain the first judgment result.
  • the data synchronization device 100 further includes sub-units: a historical synchronization time-consuming determination unit 1301, a first preset time limit determination unit 1302, and a second preset time limit determination unit 1303.
  • the historical synchronization time-consuming determination unit 1301 is configured to determine whether the historical synchronization time-consuming corresponding to the free directory has been recorded in the to-be-synchronized database;
  • the first preset time limit determining unit 1302 is configured to determine whether the to-be-synchronized database is in the The historical synchronization time corresponding to the free directory has been recorded, and the historical synchronization time is determined as the preset time limit;
  • the second preset time limit determining unit 1303 is configured to: The historical synchronization corresponding to the free directory is time-consuming, and the preset default time limit is determined as the preset time limit.
  • the synchronization judgment unit 130 includes sub-units: a data amount acquisition unit 131 and a data amount judgment unit 132.
  • the data amount obtaining unit 131 is configured to obtain the data amount of the newly added synchronization record and the free directory respectively; the data amount judging unit 132 is configured to determine whether the data amount of the newly added synchronization record and the free directory are equal A judgment is made to obtain the first judgment result of whether the data synchronization is completed.
  • the prompt information feedback unit 140 is configured to feed back prompt information that the data synchronization is completed if the first judgment result is that the data synchronization is completed.
  • the data synchronization device 100 further includes sub-units: a synchronization data cycle judging unit 141, a synchronization prompt information feedback unit 142, and an abnormal prompt information feedback unit 143.
  • the synchronization data cycle judging unit 141 is configured to, if the first judgment result is that data synchronization is not completed, judge whether the free directory has completed data synchronization according to the preset synchronization judgment rule and the newly added synchronization record to obtain a second judgment result.
  • the synchronous data cycle judging unit 141 includes sub-units: a cycle judging unit 1411 and a data amount difference judging unit 1412.
  • the cycle judging unit 1411 is configured to determine whether the amount of data in the free directory has increased every time the cycle period is separated from the acquisition time of the first judgment result; the data amount difference judging unit 1412 is configured to determine whether the amount of data in the free directory has increased.
  • the data amount of the free directory does not increase, stop the loop judgment and judge whether the data amount difference between the newly added synchronization record and the free directory is less than the interval number threshold to obtain The second judgment result of whether the data synchronization is completed.
  • the synchronization prompt information feedback unit 142 is configured to perform the step of feeding back the prompt information of the completion of data synchronization if the second judgment result is that the data synchronization is completed;
  • the abnormal prompt information feedback unit 143 is configured to perform the step of feeding back the prompt information of the completion of the data synchronization if the second judgment result is In order to not complete the data synchronization, feedback the prompt message that there is an abnormality in the data synchronization this time.
  • the data synchronization device 100 further includes a sub-unit: a historical synchronization time-consuming update unit 150.
  • the historical synchronization time-consuming update unit 150 is configured to update the historical synchronization time-consuming of the free directory according to the acquisition time of the first judgment result or the acquisition time of the second judgment result and the synchronization start time.
  • the data synchronization method when the preset synchronization time point is reached, it is determined whether the data synchronization log contains a newly-added synchronization record. If the newly-added synchronization record is included, the data information in the initial database is synchronized and stored to the waiting time. In the free directory of the synchronization database, the synchronization start time is recorded, and the time that is the preset time interval between the synchronization start time and the synchronization start time is reached. The first judgment result is obtained by judging whether the free directory has completed data synchronization according to the newly added synchronization record. The result is that the data synchronization is completed, and the prompt message that the data synchronization is completed is fed back.
  • the reliability of database usage during data information synchronization can be improved, the maintainability of the database during data information synchronization can be improved, and the maintenance cost of the database can be greatly reduced.
  • the above-mentioned data synchronization device can be implemented in the form of a computer program, and the computer program can be run on a computer device as shown in FIG. 8.
  • FIG. 8 is a schematic block diagram of a computer device according to an embodiment of the present application.
  • the computer device 500 includes a processor 502, a memory, and a network interface 505 connected through a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
  • the non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032.
  • the processor 502 can execute the data synchronization method, including: when the preset synchronization time point is reached, judging whether the preset data synchronization log table contains a new synchronization record; if the data is synchronized The log table contains newly-added synchronization records.
  • the data information in the initial database corresponding to the data synchronization log table is synchronously stored in the preset free directory of the database to be synchronized, and the synchronization start time is recorded;
  • the synchronization start time interval is a preset time limit, and it is judged according to the newly added synchronization record whether the free directory has completed data synchronization to obtain the first judgment result; if the first judgment result is that the data synchronization is completed, the completed data is fed back Synchronized prompt information.
  • the processor 502 is used to provide calculation and control capabilities, and support the operation of the entire computer device 500.
  • the internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503.
  • the processor 502 can execute the data synchronization method.
  • the network interface 505 is used for network communication, such as providing data information transmission.
  • the structure shown in FIG. 8 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied.
  • the specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
  • the processor 502 is configured to run a computer program 5032 stored in the memory to realize the following function: when the preset synchronization time point is reached, determine whether the preset data synchronization log table contains a new synchronization record; if The data synchronization log table includes a newly-added synchronization record, the data information in the initial database corresponding to the data synchronization log table is synchronously stored in a preset free directory of the database to be synchronized, and the synchronization start time is recorded; If it reaches the preset time limit of the synchronization start time interval, determine whether the free directory has completed data synchronization according to the newly added synchronization record to obtain the first judgment result; if the first judgment result is that the data synchronization is completed , Feedback the prompt message of completing the data synchronization.
  • the processor 502 executes, if the data synchronization log table includes a newly-added synchronization record, the data information in the initial database corresponding to the data synchronization log table is synchronously stored in a preset database to be synchronized.
  • the synchronization start time is recorded in the free directory of the database, the following operation is performed: judging whether the usage status of each directory in the database to be synchronized is idle, so as to obtain the free directory in the database to be synchronized; The data information stored in the free directory is cleared, the data information contained in the initial database corresponding to the data synchronization log table is synchronously stored in the free directory, and the synchronization start time is recorded.
  • the processor 502 executes the process of determining whether the free directory has completed data synchronization according to the newly-added synchronization record when the preset time limit is reached from the synchronization start time interval to obtain the first determination result
  • the following operations are also performed: determine whether the historical synchronization time-consuming corresponding to the free directory has been recorded in the to-be-synchronized database; if the historical synchronization time-consuming corresponding to the free directory has been recorded in the to-be-synchronized database , The historical synchronization time is determined as the preset time limit; if the historical synchronization time corresponding to the free directory is not recorded in the to-be-synchronized database, the preset default time limit is determined as the preset time limit .
  • the processor 502 executes the process of determining whether the free directory has completed data synchronization according to the newly-added synchronization record when the preset time limit is reached from the synchronization start time interval to obtain the first determination result
  • the processor 502 further executes the following operations: if the first judgment result is Data synchronization has not been completed, according to the preset synchronization judgment rules and the newly added synchronization records, it is judged whether the free directory has completed data synchronization to obtain the second judgment result; if the second judgment result is that the data synchronization is completed, execute the The step of feeding back the prompt information that the data synchronization is completed; if the second judgment result is that the data synchronization is not completed, the prompt information that the current data synchronization is abnormal is fed back.
  • the processor 502 is executing that if the first judgment result is that the data synchronization is not completed, it judges whether the free directory has completed data synchronization according to the preset synchronization judgment rule and the newly added synchronization record to obtain the first 2.
  • the step of judging the result perform the following operations: every time the cycle period is separated from the acquisition time of the first judgment result, it is judged whether the amount of data in the free directory has increased; The data volume of the free directory has not increased, stop the loop judgment and determine whether the data volume difference between the newly added synchronization record and the free directory is less than the interval number threshold, so as to obtain the first step of whether the data synchronization is completed. 2. Judgment results.
  • the processor 502 further performs the following operations: the historical synchronization consumption of the free directory according to the acquisition time of the first judgment result or the acquisition time of the second judgment result and the synchronization start time. Update when.
  • the embodiment of the computer device shown in FIG. 8 does not constitute a limitation on the specific configuration of the computer device.
  • the computer device may include more or less components than those shown in the figure. Or some parts are combined, or different parts are arranged.
  • the computer device may only include a memory and a processor. In such an embodiment, the structure and function of the memory and the processor are consistent with the embodiment shown in FIG. 8 and will not be repeated here.
  • the processor 502 may be a central processing unit (Central Processing Unit, CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor.
  • a computer-readable storage medium may be non-volatile or volatile.
  • the computer-readable storage medium stores a computer program, where the computer program is executed by the processor to implement the following steps: when the preset synchronization time point is reached, determine whether the preset data synchronization log table contains a new synchronization record;
  • the data synchronization log table includes a newly-added synchronization record, the data information in the initial database corresponding to the data synchronization log table is synchronously stored in a preset free directory of the database to be synchronized, and the synchronization start time is recorded; if When the preset time limit is reached from the synchronization start time interval, determine whether the free directory has completed data synchronization according to the newly added synchronization record to obtain the first judgment result; if the first judgment result is that the data synchronization is completed, The prompt message for completing the data synchronization is fed back.
  • the data information in the initial database corresponding to the data synchronization log table is synchronously stored in a preset free directory of the database to be synchronized
  • the step of recording the synchronization start time includes: judging whether the usage status of each directory in the database to be synchronized is idle, so as to obtain the free directory in the database to be synchronized; and emptying the free directory
  • the data information contained in the initial database corresponding to the data synchronization log table is synchronously stored in the free directory, and the synchronization start time is recorded.
  • the preset time limit is reached from the synchronization start time interval, It also includes: judging whether the historical synchronization time-consuming corresponding to the free directory has been recorded in the to-be-synchronized database; if the historical synchronization time-consuming corresponding to the free directory has been recorded in the to-be-synchronized database, the history The synchronization time is determined as the preset time limit; if the historical synchronization time corresponding to the free directory is not recorded in the to-be-synchronized database, the preset default time limit is determined as the preset time limit.
  • the step of judging whether the free directory has completed data synchronization to obtain the first judgment result according to the newly added synchronization record if it reaches the preset time limit between the synchronization start time interval and the synchronization start time interval includes : Obtain the data volume of the newly added synchronization record and the free directory respectively; determine whether the data volume of the newly added synchronization record and the free directory are equal to obtain a first judgment result of whether the data synchronization is completed.
  • the method further includes: if the first judgment result is that the data synchronization is not completed, According to the preset synchronization judgment rule and the newly added synchronization record, it is judged whether the free directory has completed data synchronization to obtain the second judgment result; if the second judgment result is that the data synchronization is completed, execute the feedback completion of the data synchronization The step of prompting information; if the second judgment result is that the data synchronization has not been completed, the prompt information that the current data synchronization is abnormal is fed back.
  • the steps include: each cycle period separated from the acquisition time of the first judgment result, circularly judging whether the data volume of the free directory has increased; if the data volume of the free directory in the last N circular judgments is equal If it does not increase, stop the loop judgment and judge whether the data amount difference between the newly added synchronization record and the free directory is less than the interval number threshold, so as to obtain a second judgment result of whether the data synchronization is completed.
  • the method further includes: updating the historical synchronization time-consuming of the free directory according to the acquisition time of the first judgment result or the acquisition time of the second judgment result and the synchronization start time.
  • the disclosed equipment, device, and method may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods, or the units with the same function may be combined into one. Units, for example, multiple units or components can be combined or integrated into another system, or some features can be omitted or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms of connection.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments of the present application.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the technical solution of this application is essentially or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product can be stored in a computer.
  • the read storage medium includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium is a physical, non-transitory storage medium, such as a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a magnetic disk, or an optical disk that can store program codes. Storage medium.

Abstract

本申请公开了数据同步方法、装置、计算机设备及存储介质。方法包括:到达预设同步时间点,判断数据同步日志中是否包含新增同步记录,若包含新增同步记录,将初始数据库中的数据信息同步存储至待同步数据库的空闲目录中并记录同步起始时间,到达与同步起始时间间隔预置时限的时间,根据新增同步记录判断空闲目录是否完成数据同步得到第一判断结果,若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。本申请基于数据同步技术,可提高进行数据信息同步时数据库使用的可靠性,提高进行数据信息同步时数据库的可维护性,大幅缩减了数据库的维护成本。

Description

数据同步方法、装置、计算机设备及存储介质
本申请要求于2020年1月20日提交中国专利局、申请号为202010066094.8,发明名称为“数据同步方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,尤其涉及一种数据同步方法、装置、计算机设备及存储介质。
背景技术
大型企业中经常涉及对海量数据信息的存储及使用,如大型企业中用户数据信息的数据量可达亿级。企业通常将海量数据信息存储至数据库中,并定期对数据库中的数据信息进行同步,发明人意识到,传统数据库在存储海量数据信息后对全量数据信息进行同步需耗费较长时间,同步过程会对该数据库的连接使用造成影响,因此还需投入大量人力对同步过程进行维护,因同步效率较低导致数据信息使用的可靠性不高。因此,现有的技术方法中数据信息同步方法存在数据信息使用的可靠性较低的问题。
发明内容
本申请实施例提供了一种数据同步方法、装置、计算机设备及存储介质,旨在解决现有技术方法进行数据信息同步时存在数据信息使用的可靠性较低的问题。
第一方面,本申请实施例提供了一种数据同步方法,其包括:
在到达预设同步时间点时,判断预置的数据同步日志表中是否包含新增同步记录;
若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间;
若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果;
若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。
第二方面,本申请实施例提供了一种数据同步装置,其包括:
数据同步日志表判断单元,用于在到达预设同步时间点时,判断预置的数据同步日志表中是否包含新增同步记录;
数据信息同步单元,用于若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间;
同步判断单元,用于若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果;
提示信息反馈单元,用于若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。
第三方面,本申请实施例又提供了一种计算机设备,其包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述第一方面所述的数据同步方法,即具体方法包括:
在到达预设同步时间点时,判断预置的数据同步日志表中是否包含新增同步记录;
若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间;
若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲 目录是否完成数据同步以得到第一判断结果;
若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。
第四方面,本申请实施例还提供了一种计算机可读存储介质,其中所述计算机可读存储介质存储有计算机程序,所述计算机程序当被处理器执行时使所述处理器执行上述第一方面所述的数据同步方法,即具体方法包括:
在到达预设同步时间点时,判断预置的数据同步日志表中是否包含新增同步记录;
若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间;
若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果;
若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。
本申请实施例提供了一种数据同步方法、装置、计算机设备及存储介质。到达预设同步时间点,判断数据同步日志中是否包含新增同步记录,若包含新增同步记录,将初始数据库中的数据信息同步存储至待同步数据库的空闲目录中并记录同步起始时间,到达与同步起始时间间隔预置时限的时间,根据新增同步记录判断空闲目录是否完成数据同步得到第一判断结果,若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。通过上述方法,可提高进行数据信息同步时数据库使用的可靠性,提高进行数据信息同步时数据库的可维护性,大幅缩减了数据库的维护成本。
附图说明
图1为本申请实施例提供的数据同步方法的流程示意图;
图2为本申请实施例提供的数据同步方法的子流程示意图;
图3为本申请实施例提供的数据同步方法的另一流程示意图;
图4为本申请实施例提供的数据同步方法的另一子流程示意图;
图5为本申请实施例提供的数据同步方法的另一流程示意图;
图6为本申请实施例提供的数据同步方法的另一子流程示意图;
图7为本申请实施例提供的数据同步方法的另一流程示意图;
图8为本申请实施例提供的数据同步装置的示意性框图;
图9为本申请实施例提供的计算机设备的示意性框图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。
还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。
请参阅图1,图1是本申请实施例提供的数据同步方法的流程示意图。该数据同步方法应用于用户终端中,该方法通过安装于用户终端中的应用软件进行执行,用户终端即是用于执行数据同步方法以对数据信息进行同步的终端设备,例如台式电脑、笔记本电脑、平板电 脑或手机等。
如图1所示,该方法包括步骤S110~S140。
S110、在到达预设同步时间点时,判断预置的数据同步日志表中是否包含新增同步记录。
在到达预设同步时间点时,判断预置的数据同步日志表中是否包含新增同步记录。数据同步日志表即是对初始数据库中数据信息的同步更新进行记录的日志表,初始数据库中的数据信息每进行一次同步,则对该次同步的具体信息进行记录得到一条同步记录,同步记录中包含同步时间、数据量等信息。其中,初始数据库可以是MYSQL数据库,由于MYSQL数据库在对亿级数据量的数据信息进行读写时性能偏低,且在对MYSQL数据库中的数据信息进行同步更新的过程中,无法对该数据库中所存储的数据信息进行使用,因此本案中采用将MYSQL数据库中的数据信息同步至待同步数据库的方式,以增强待同步数据库中数据信息使用的可靠性。
例如,数据同步日志表中所包含的部分信息如表1所示。
同步记录编号 同步时间 数据量
M010015 2019-03-31,15:03:05 145361841
M010016 2019-04-01,10:15:44 145362973
M010017 2019-04-03,13:47:18 145364316
表1
在到达预设同步时间点时,则可根据每一同步记录的同步时间获取对应的新增同步记录,具体的,可根据预置时间判断规则对每一所述同步记录的同步时间进行判断,以获取满足预置时间判断规则的同步记录作为新增同步记录,新增同步记录可以为一条或多条。
例如,可设置每天的00:00为预设同步时间点,预置时间判断规则为预设同步时间点前24小时之内,则判断每一同步记录的同步时间与预设同步时间点的间隔时长是否小于24小时,根据判断结果获取同步时间与预设同步时间点的间隔时长小于24小时的同步记录作为新增同步记录。
S120、若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间。
若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间。若数据同步日志表中包含新增同步记录,则表明前一天初始数据库中的数据信息被同步更新,可根据已同步更新的初始数据库将其中的数据信息同步存储至待同步数据库的空闲目录中。其中,待同步数据库可以是ElasticSearch搜索引擎数据库,ElasticSearch是一个分布式、高扩展、高实时的搜索与存储引擎,对亿级数据量的数据信息进行读写时效率较高,ElasticSearch搜索引擎数据库中包含多个目录(Index),每一目录中包含多种数据类型(type),每一类型中对应存储与该类型相匹配的文档(Docments),文档中记录字段(Fields)及与字段对应的数据。本案中以待同步数据库中包含两个目录进行举例说明,待同步数据库中的两个目录分别存储两份数据信息,一个目录作为与其他业务系统进行对接、使用的主目录,另一个目录作为对数据信息进行备份的备用目录,主目录与备用目录的功能可根据实际需求进行灵活切换。当一个目录作为主目录被使用时,该目录中的数据信息无法进行数据同步,另一个目录作为备用目录未被使用,则可对该备用目录中的数据信息进行数据同步,备用目录完成同步后切换为主目录进行使用,并以相同方式再次对另一目录中的数据信息进行数据同步。
在一实施例中,如图2所示,步骤S120包括子步骤S121和S122。
S121、对所述待同步数据库中每一目录的使用状态是否为空闲进行判断,以获取所述待同步数据库中的空闲目录。
对所述待同步数据库中每一目录的使用状态是否为空闲进行判断,以获取所述待同步数据库中的空闲目录。正在被使用的目录中的数据信息无法进行数据同步,则需获取未被使用的目录作为可数据同步的空闲目录,具体的,每一目录均包含使用状态的信息,可基于每一 目录的使用状态是否为空闲获取待同步数据库中的空闲目录。
S122、清空所述空闲目录中存储的数据信息,将与所述数据同步日志表对应的初始数据库所包含的数据信息同步存储至所述空闲目录,并记录同步起始时间。
清空所述空闲目录中存储的数据信息,将与所述数据同步日志表对应的初始数据库所包含的数据信息同步存储至所述空闲目录,并记录同步起始时间。同步起始时间也即是开始对数据信息进行同步的时间点。
S130、若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果。
若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果。启动对空闲目录进行数据同步的进程后,需在与同步起始时间间隔预置时限的时间后基于进行数据同步后空闲目录中的数据量判断是否完成数据同步。由于空闲目录内所包含的数据量十分庞大,相比实时判断是否完成数据同步,在合适的时间对是否完成数据同步进行判断可极大缓解计算压力,提高判断的效率及精准性。
在一实施例中,如图3所示,步骤S130之前还包括步骤S1301、S1302和S1303。
S1301、判断所述待同步数据库中是否已记录与所述空闲目录对应的历史同步耗时。
判断所述待同步数据库中是否已记录与所述空闲目录对应的历史同步耗时。具体的,在需进行数据同步的数据量增幅较小的情况下,同步耗时基本相同,每次数据同步均会记录空闲目录的历史同步耗时,以供下次进行数据同步时进行参考,可判断空闲目标对应的历史同步数据是否记录于待同步数据库中,若为第一次对空闲目录进行数据同步,则待同步数据库中未记录对应的历史同步耗时;若并非第一次对空闲目录进行数据同步,则待同步数据库中必定记录了对应的历史同步耗时。
S1302、若所述待同步数据库中已记录与所述空闲目录对应的历史同步耗时,将所述历史同步耗时确定为所述预置时限。
若所述待同步数据库中已记录与所述空闲目录对应的历史同步耗时,将所述历史同步耗时确定为所述预置时限。若本次并非第一次对该空闲目录进行数据同步,则待同步数据库中必定会记录对应的历史同步耗时,可将该历史同步耗时作为预置时限,则与同步起始时间间隔历史同步耗时的时间即为合适对本次数据同步是否已完成进行判断的时间。
S1303、若所述待同步数据库中未记录与所述空闲目录对应的历史同步耗时,将预置的默认时限确定为所述预置时限。
若所述待同步数据库中未记录与所述空闲目录对应的历史同步耗时,将预置的默认时限确定为所述预置时限。若本次为第一次对该空闲目录进行数据同步,则待同步数据库中未记录对应的历史同步耗时,可将管理人员预置的默认时限作为预置时限,则与同步起始时间间隔预置默认时限的时间即为合适对本次数据同步是否已完成进行判断的时间。
在一实施例中,如图4所示,步骤S130包括子步骤S131和S132。
S131、分别获取所述新增同步记录及所述空闲目录的数据量。
分别获取所述新增同步记录及所述空闲目录的数据量。新增同步记录中包含对应的数据量,新增同步记录的数据量即为对初始数据库中数据信息进行同步更新后的数据量,数据信息同步至空闲目录后可对空闲目标中所包含数据信息的数量进行统计,即可得到空闲目录的数据量,具体的,对空闲目录所包含的数据信息逐条进行相加即可得到空闲目录的数据量。
S132、对所述新增同步记录与所述空闲目录的数据量是否相等进行判断,以得到是否完成数据同步的第一判断结果。
对所述新增同步记录与所述空闲目录的数据量是否相等进行判断,以得到是否完成数据同步的第一判断结果。在对空闲目录进行数据同步的过程中,空闲目录中所包含数据信息的数量只会增加而不会减少,且空闲目录的数据量不大于新增同步记录的数据量,判断新增同步记录与空闲目录的数据量是否相等即可得到空闲目录是否完成数据同步的第一判断结果,若空闲目录与新增同步记录的数据量相等,则表明空闲目录已完成数据同步,得到完成数据 同步的第一判断结果;若空闲目录与新增同步记录的数据量不相等,得到未完成数据同步的第一判断结果,还需对空闲目录进行进一步判断。
S140、若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。
若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息,提示信息即可用于提示管理人员空闲目录中的数据信息已完成同步。对空闲目录中的数据信息进行数据同步后,可将该空闲目录切换为与其他业务系统进行对接、使用的主目录,并以相同方式再次对待同步数据库中另一目录的数据信息进行数据同步。
在一实施例中,如图5所示,步骤S130之后还包括步骤S141、S142和S143。
S141、若所述第一判断结果为未完成数据同步,根据预置的同步判断规则及所述新增同步记录判断所述空闲目录是否完成数据同步以得到第二判断结果。
若所述第一判断结果为未完成数据同步,根据预置的同步判断规则及所述新增同步记录判断所述空闲目录是否完成数据同步以得到第二判断结果。若第一判断结果为未完成数据同步,则还需根据同步判断规则对空闲目录是否完成数据同步进行进一步判断,也即是在部分情况下空闲目录已完成数据同步,但空闲目录与新增同步记录的数据量并不相等。其中,所述同步判断规则中包括循环周期、循环次数N及间隔数量阈值,循环周期即为对空闲目录的数据量进行循环判断的周期时间信息,循环次数N即为获取循环判断结果的数量信息,其中N为预置的大于零的整数,间隔数量阈值即为对新增同步记录与空闲目录之间数据量差值进行判断的数量预置。
在一实施例中,如图6所示,步骤S141包括子步骤S1411和S1412。
S1411、与所述第一判断结果的获取时间每间隔一个所述循环周期,循环判断所述空闲目录的数据量是否增加。
若与第一判断结果的获取时间每间隔一个循环周期,则获取空闲目录的数据量,并将本次获取到的空闲目录的数据量与上一次获取到的空闲目录的数据量是否相同进行判断以得到空闲目录的数据量是否增加的判断结果。若空闲目录的数据量未增加,则表明此时并未有新增至空闲目录中的数据信息,则可终止数据同步进程;若空闲目录的数据量增加,则表明初始数据库中还有未同步存储至空闲目录的数据信息,此时需继续执行数据同步进程。
例如,循环周期为2分钟,则与第一判断结果的获取时间每间隔2分钟,对空闲目录的数据量是否增加进行判断,得到一次循环判断结果。
S1412、若最近N次循环判断中所述空闲目录的数据量均未增加,停止所述循环判断并判断所述新增同步记录与所述空闲目录之间的数据量差值是否小于所述间隔数量阈值,以得到是否完成数据同步的第二判断结果。
若最近N次循环判断中所述空闲目录的数据量均未增加,停止所述循环判断,并进一步判断所述新增同步记录与所述空闲目录之间的数据量差值是否小于所述间隔数量阈值,得到是否完成数据同步的第二判断结果,具体的,将新增同步记录的数据量减去空闲目录的数据量,得到数据量差值,并判断数据量差值是否小于间隔数量预置。
例如,若N=5,间隔数量阈值为1000,则判断最近5次循环判断过程中空闲目录的数据量是否均未增加,若最近5次循环判断过程中空闲目录的数据量均未增加,则对应判断新增同步记录与空闲目录之间数据量差值是否小于1000。
若数据量差值小于间隔数量阈值,则表明空闲目录与新增同步记录之间的数据量差值在合理范围内,得到已完成数据同步的第二判断结果。若数据量差值不小于间隔数量阈值,则表明空闲目录的数据同步存在异常。
S142、若所述第二判断结果为完成数据同步,执行所述反馈完成数据同步的提示信息的步骤。
若所述第二判断结果为完成数据同步,执行所述反馈完成数据同步的提示信息的步骤,也即是执行步骤S140,提示信息即可用于提示管理人员空闲目录中的数据信息已完成同步。对空闲目录中的数据信息进行数据同步后,可将该空闲目录切换为与其他业务系统进行对接、 使用的主目录,并以相同方式再次对待同步数据库中另一目录的数据信息进行数据同步。
S143、若所述第二判断结果为未完成数据同步,反馈本次数据同步存在异常的提示信息。
得到未完成数据同步的第二判断结果时,可向管理人员发出本次数据同步存在异常的提示信息以提示管理人员本次数据同步存在异常。
在一实施例中,如图7所示,步骤S140之后包括步骤S150。
S150、根据所述第一判断结果的获取时间或所述第二判断结果的获取时间及所述同步起始时间对所述空闲目录的历史同步耗时进行更新。
若所述第一判断结果为已完成数据同步,根据所述第一判断结果的获取时间及同步起始时间对所述空闲目录的历史同步耗时进行更新,若所述第二判断结果为已完成数据同步,根据所述第二判断结果的获取时间及同步起始时间对所述空闲目录的历史同步耗时进行更新。具体的,若所述第一判断结果为已完成数据同步,可获取同步起始时间与第一判断结果的获取时间之间的第一时间差,将该第一时间差作为该空闲目录的新的历史同步耗时;若第二判断结果为已完成数据同步,则获取同步起始时间与第二判断结果的获取时间之间的第二时间差,将该第二时间差作为该空闲目录的新的历史同步耗时。对空闲目录的历史同步耗时进行更新后,在下次对该空闲目录进行数据同步时,可基于该空闲目录的历史同步耗时判断是否已完成数据同步,大幅提高提高判断的效率及精准性。
在本申请实施例所提供的数据同步方法中,到达预设同步时间点,判断数据同步日志中是否包含新增同步记录,若包含新增同步记录,将初始数据库中的数据信息同步存储至待同步数据库的空闲目录中并记录同步起始时间,到达与同步起始时间间隔预置时限的时间,根据新增同步记录判断空闲目录是否完成数据同步得到第一判断结果,若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。通过上述方法,可提高进行数据信息同步时数据库使用的可靠性,提高进行数据信息同步时数据库的可维护性,大幅缩减了数据库的维护成本。
本申请实施例还提供一种数据同步装置,该数据同步装置用于执行前述数据同步方法的任一实施例。具体地,请参阅图7,图7是本申请实施例提供的数据同步装置的示意性框图。该数据同步装置可以配置于用户终端中。
如图7所示,数据同步装置100包括数据同步日志表判断单元110、数据信息同步单元120、同步判断单元130和提示信息反馈单元140。
数据同步日志表判断单元110,用于在到达预设同步时间点时,判断预置的数据同步日志表中是否包含新增同步记录。
数据信息同步单元120,用于若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间。
其他发明实施例中,所述数据信息同步单元120包括子单元:使用状态判断单元121和同步存储单元122。
使用状态判断单元121,用于对所述待同步数据库中每一目录的使用状态是否为空闲进行判断,以获取所述待同步数据库中的空闲目录;同步存储单元122,用于清空所述空闲目录中存储的数据信息,将与所述数据同步日志表对应的初始数据库所包含的数据信息同步存储至所述空闲目录,并记录同步起始时间。
同步判断单元130,用于若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果。
其他发明实施例中,所述数据同步装置100还包括子单元:历史同步耗时判断单元1301、第一预置时限确定单元1302和第二预置时限确定单元1303。
历史同步耗时判断单元1301,用于判断所述待同步数据库中是否已记录与所述空闲目录对应的历史同步耗时;第一预置时限确定单元1302,用于若所述待同步数据库中已记录与所述空闲目录对应的历史同步耗时,将所述历史同步耗时确定为所述预置时限;第二预置时限 确定单元1303,用于若所述待同步数据库中未记录与所述空闲目录对应的历史同步耗时,将预置的默认时限确定为所述预置时限。
其他发明实施例中,所述同步判断单元130包括子单元:数据量获取单元131和数据量判断单元132。
数据量获取单元131,用于分别获取所述新增同步记录及所述空闲目录的数据量;数据量判断单元132,用于对所述新增同步记录与所述空闲目录的数据量是否相等进行判断,以得到是否完成数据同步的第一判断结果。
提示信息反馈单元140,用于若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。
其他发明实施例中,所述数据同步装置100还包括子单元:同步数据循环判断单元141、同步提示信息反馈单元142和异常提示信息反馈单元143。
同步数据循环判断单元141,用于若所述第一判断结果为未完成数据同步,根据预置的同步判断规则及所述新增同步记录判断所述空闲目录是否完成数据同步以得到第二判断结果。
其他发明实施例中,所述同步数据循环判断单元141包括子单元:循环判断单元1411和数据量差值判断单元1412。
循环判断单元1411,用于与所述第一判断结果的获取时间每间隔一个所述循环周期,循环判断所述空闲目录的数据量是否增加;数据量差值判断单元1412,用于若最近N次循环判断中所述空闲目录的数据量均未增加,停止所述循环判断并判断所述新增同步记录与所述空闲目录之间的数据量差值是否小于所述间隔数量阈值,以得到是否完成数据同步的第二判断结果。
同步提示信息反馈单元142,用于若所述第二判断结果为完成数据同步,执行所述反馈完成数据同步的提示信息的步骤;异常提示信息反馈单元143,用于若所述第二判断结果为未完成数据同步,反馈本次数据同步存在异常的提示信息。
其他发明实施例中,所述数据同步装置100还包括子单元:历史同步耗时更新单元150。
历史同步耗时更新单元150,用于根据所述第一判断结果的获取时间或所述第二判断结果的获取时间及所述同步起始时间对所述空闲目录的历史同步耗时进行更新。
在本申请实施例所提供的数据同步方法中,到达预设同步时间点,判断数据同步日志中是否包含新增同步记录,若包含新增同步记录,将初始数据库中的数据信息同步存储至待同步数据库的空闲目录中并记录同步起始时间,到达与同步起始时间间隔预置时限的时间,根据新增同步记录判断空闲目录是否完成数据同步得到第一判断结果,若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。通过上述方法,可提高进行数据信息同步时数据库使用的可靠性,提高进行数据信息同步时数据库的可维护性,大幅缩减了数据库的维护成本。
上述数据同步装置可以实现为计算机程序的形式,该计算机程序可以在如图8所示的计算机设备上运行。
请参阅图8,图8是本申请实施例提供的计算机设备的示意性框图。
参阅图8,该计算机设备500包括通过系统总线501连接的处理器502、存储器和网络接口505,其中,存储器可以包括非易失性存储介质503和内存储器504。
该非易失性存储介质503可存储操作系统5031和计算机程序5032。该计算机程序5032被执行时,可使得处理器502执行数据同步方法,包括:在到达预设同步时间点时,判断预置的数据同步日志表中是否包含新增同步记录;若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间;若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果;若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。
该处理器502用于提供计算和控制能力,支撑整个计算机设备500的运行。
该内存储器504为非易失性存储介质503中的计算机程序5032的运行提供环境,该计算机程序5032被处理器502执行时,可使得处理器502执行数据同步方法。
该网络接口505用于进行网络通信,如提供数据信息的传输等。本领域技术人员可以理解,图8中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备500的限定,具体的计算机设备500可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
其中,所述处理器502用于运行存储在存储器中的计算机程序5032,以实现如下功能:在到达预设同步时间点时,判断预置的数据同步日志表中是否包含新增同步记录;若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间;若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果;若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。
在一实施例中,处理器502在执行若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间的步骤时,执行如下操作:对所述待同步数据库中每一目录的使用状态是否为空闲进行判断,以获取所述待同步数据库中的空闲目录;清空所述空闲目录中存储的数据信息,将与所述数据同步日志表对应的初始数据库所包含的数据信息同步存储至所述空闲目录,并记录同步起始时间。
在一实施例中,处理器502在执行若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果的步骤之前,还执行如下操作:判断所述待同步数据库中是否已记录与所述空闲目录对应的历史同步耗时;若所述待同步数据库中已记录与所述空闲目录对应的历史同步耗时,将所述历史同步耗时确定为所述预置时限;若所述待同步数据库中未记录与所述空闲目录对应的历史同步耗时,将预置的默认时限确定为所述预置时限。
在一实施例中,处理器502在执行若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果的步骤时,执行如下操作:分别获取所述新增同步记录及所述空闲目录的数据量;对所述新增同步记录与所述空闲目录的数据量是否相等进行判断得到是否完成数据同步的第一判断结果。
在一实施例中,处理器502在执行根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果的步骤之后,还执行如下操作:若所述第一判断结果为未完成数据同步,根据预置的同步判断规则及所述新增同步记录判断所述空闲目录是否完成数据同步以得到第二判断结果;若所述第二判断结果为完成数据同步,执行所述反馈完成数据同步的提示信息的步骤;若所述第二判断结果为未完成数据同步,反馈本次数据同步存在异常的提示信息。
在一实施例中,处理器502在执行若所述第一判断结果为未完成数据同步,根据预置的同步判断规则及所述新增同步记录判断所述空闲目录是否完成数据同步以得到第二判断结果的步骤时,执行如下操作:与所述第一判断结果的获取时间每间隔一个所述循环周期,循环判断所述空闲目录的数据量是否增加;若最近N次循环判断中所述空闲目录的数据量均未增加,停止所述循环判断并判断所述新增同步记录与所述空闲目录之间的数据量差值是否小于所述间隔数量阈值,以得到是否完成数据同步的第二判断结果。
在一实施例中,处理器502还执行如下操作:根据所述第一判断结果的获取时间或所述第二判断结果的获取时间及所述同步起始时间对所述空闲目录的历史同步耗时进行更新。
本领域技术人员可以理解,图8中示出的计算机设备的实施例并不构成对计算机设备具体构成的限定,在其他实施例中,计算机设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。例如,在一些实施例中,计算机设备可以仅包括存储器及处理器,在这样的实施例中,存储器及处理器的结构及功能与图8所示实施例一致,在此不 再赘述。
应当理解,在本申请实施例中,处理器502可以是中央处理单元(Central Processing Unit,CPU),该处理器502还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。其中,通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
在本申请的另一实施例中提供计算机可读存储介质。该计算机可读存储介质可以是非易失性,也可以是易失性。该计算机可读存储介质存储有计算机程序,其中计算机程序被处理器执行时实现以下步骤:在到达预设同步时间点时,判断预置的数据同步日志表中是否包含新增同步记录;若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间;若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果;若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。
在一实施例中,所述若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间的步骤,包括:对所述待同步数据库中每一目录的使用状态是否为空闲进行判断,以获取所述待同步数据库中的空闲目录;清空所述空闲目录中存储的数据信息,将与所述数据同步日志表对应的初始数据库所包含的数据信息同步存储至所述空闲目录,并记录同步起始时间。
在一实施例中,所述若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果的步骤之前,还包括:判断所述待同步数据库中是否已记录与所述空闲目录对应的历史同步耗时;若所述待同步数据库中已记录与所述空闲目录对应的历史同步耗时,将所述历史同步耗时确定为所述预置时限;若所述待同步数据库中未记录与所述空闲目录对应的历史同步耗时,将预置的默认时限确定为所述预置时限。
在一实施例中,所述若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果的步骤,包括:分别获取所述新增同步记录及所述空闲目录的数据量;对所述新增同步记录与所述空闲目录的数据量是否相等进行判断得到是否完成数据同步的第一判断结果。
在一实施例中,所述根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果的步骤之后,还包括:若所述第一判断结果为未完成数据同步,根据预置的同步判断规则及所述新增同步记录判断所述空闲目录是否完成数据同步以得到第二判断结果;若所述第二判断结果为完成数据同步,执行所述反馈完成数据同步的提示信息的步骤;若所述第二判断结果为未完成数据同步,反馈本次数据同步存在异常的提示信息。
在一实施例中,所述若所述第一判断结果为未完成数据同步,根据预置的同步判断规则及所述新增同步记录判断所述空闲目录是否完成数据同步以得到第二判断结果的步骤,包括:与所述第一判断结果的获取时间每间隔一个所述循环周期,循环判断所述空闲目录的数据量是否增加;若最近N次循环判断中所述空闲目录的数据量均未增加,停止所述循环判断并判断所述新增同步记录与所述空闲目录之间的数据量差值是否小于所述间隔数量阈值,以得到是否完成数据同步的第二判断结果。
在一实施例中,还包括:根据所述第一判断结果的获取时间或所述第二判断结果的获取时间及所述同步起始时间对所述空闲目录的历史同步耗时进行更新。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的设备、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。本领域 普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的几个实施例中,应该理解到,所揭露的设备、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为逻辑功能划分,实际实现时可以有另外的划分方式,也可以将具有相同功能的单元集合成一个单元,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、装置或单元的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本申请实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个计算机可读存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。
而前述的存储介质为实体的、非瞬时性的存储介质,例如可以是U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的实体存储介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。

Claims (20)

  1. 一种数据同步方法,应用于用户终端,其中,包括:
    在到达预设同步时间点时,判断预置的数据同步日志表中是否包含新增同步记录;
    若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间;
    若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果;
    若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。
  2. 根据权利要求1所述的数据同步方法,其中,所述将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间,包括:
    对所述待同步数据库中每一目录的使用状态是否为空闲进行判断,以获取所述待同步数据库中的空闲目录;
    清空所述空闲目录中存储的数据信息,将与所述数据同步日志表对应的初始数据库所包含的数据信息同步存储至所述空闲目录,并记录同步起始时间。
  3. 根据权利要求1所述的数据同步方法,其中,所述若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果之前,还包括:
    判断所述待同步数据库中是否已记录与所述空闲目录对应的历史同步耗时;
    若所述待同步数据库中已记录与所述空闲目录对应的历史同步耗时,将所述历史同步耗时确定为所述预置时限;
    若所述待同步数据库中未记录与所述空闲目录对应的历史同步耗时,将预置的默认时限确定为所述预置时限。
  4. 根据权利要求1所述的数据同步方法,其中,所述根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果,包括:
    分别获取所述新增同步记录及所述空闲目录的数据量;
    对所述新增同步记录与所述空闲目录的数据量是否相等进行判断得到是否完成数据同步的第一判断结果,其中,若所述新增同步记录与所述空闲目录的数据量相等,所述第一判断结果为完成数据同步。
  5. 根据权利要求1所述的数据同步方法,其中,所述根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果之后,还包括:
    若所述第一判断结果为未完成数据同步,根据预置的同步判断规则及所述新增同步记录判断所述空闲目录是否完成数据同步以得到第二判断结果;
    若所述第二判断结果为完成数据同步,执行所述反馈完成数据同步的提示信息的步骤;
    若所述第二判断结果为未完成数据同步,反馈本次数据同步存在异常的提示信息。
  6. 根据权利要求1所述的数据同步方法,其中,所述同步判断规则包括循环周期、循环次数N及间隔数量阈值,所述根据预置的同步判断规则及所述新增同步记录判断所述空闲目录是否完成数据同步以得到第二判断结果,包括:
    与所述第一判断结果的获取时间每间隔一个所述循环周期,循环判断所述空闲目录的数据量是否增加;
    若最近N次循环判断中所述空闲目录的数据量均未增加,停止所述循环判断并判断所述新增同步记录与所述空闲目录之间的数据量差值是否小于所述间隔数量阈值,以得到是否完成数据同步的第二判断结果,其中,N为预置的大于零的整数,若所述新增同步记录与所述空闲目录之间的数据量差值小于所述间隔数量阈值,所述第二判断结果为完成数据同步。
  7. 根据权利要求3所述的数据同步方法,其中,还包括:
    根据所述第一判断结果的获取时间或所述第二判断结果的获取时间及所述同步起始时间对所述空闲目录的历史同步耗时进行更新。
  8. 一种数据同步装置,其中,包括:
    数据同步日志表判断单元,用于在到达预设同步时间点时,判断预置的数据同步日志表中是否包含新增同步记录;
    数据信息同步单元,用于若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间;
    同步判断单元,用于若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果;
    提示信息反馈单元,用于若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。
  9. 一种计算机设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现一种数据同步方法,应用于用户终端,包括:
    在到达预设同步时间点时,判断预置的数据同步日志表中是否包含新增同步记录;
    若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间;
    若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果;
    若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。
  10. 根据权利要求9所述的计算机设备,其中,所述将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间,该方法包括:
    对所述待同步数据库中每一目录的使用状态是否为空闲进行判断,以获取所述待同步数据库中的空闲目录;
    清空所述空闲目录中存储的数据信息,将与所述数据同步日志表对应的初始数据库所包含的数据信息同步存储至所述空闲目录,并记录同步起始时间。
  11. 根据权利要求9所述的计算机设备,其中,所述若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果之前,还包括:
    判断所述待同步数据库中是否已记录与所述空闲目录对应的历史同步耗时;
    若所述待同步数据库中已记录与所述空闲目录对应的历史同步耗时,将所述历史同步耗时确定为所述预置时限;
    若所述待同步数据库中未记录与所述空闲目录对应的历史同步耗时,将预置的默认时限确定为所述预置时限。
  12. 根据权利要求9所述的计算机设备,其中,所述根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果,包括:
    分别获取所述新增同步记录及所述空闲目录的数据量;
    对所述新增同步记录与所述空闲目录的数据量是否相等进行判断得到是否完成数据同步的第一判断结果,其中,若所述新增同步记录与所述空闲目录的数据量相等,所述第一判断结果为完成数据同步。
  13. 根据权利要求9所述的计算机设备,其中,所述根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果之后,还包括:
    若所述第一判断结果为未完成数据同步,根据预置的同步判断规则及所述新增同步记录判断所述空闲目录是否完成数据同步以得到第二判断结果;
    若所述第二判断结果为完成数据同步,执行所述反馈完成数据同步的提示信息的步骤;
    若所述第二判断结果为未完成数据同步,反馈本次数据同步存在异常的提示信息。
  14. 根据权利要求9所述的计算机设备,其中,所述同步判断规则包括循环周期、循环次数N及间隔数量阈值,所述根据预置的同步判断规则及所述新增同步记录判断所述空闲目录是否完成数据同步以得到第二判断结果,包括:
    与所述第一判断结果的获取时间每间隔一个所述循环周期,循环判断所述空闲目录的数据量是否增加;
    若最近N次循环判断中所述空闲目录的数据量均未增加,停止所述循环判断并判断所述新增同步记录与所述空闲目录之间的数据量差值是否小于所述间隔数量阈值,以得到是否完成数据同步的第二判断结果,其中,N为预置的大于零的整数,若所述新增同步记录与所述空闲目录之间的数据量差值小于所述间隔数量阈值,所述第二判断结果为完成数据同步。
  15. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序当被处理器执行时使所述处理器执行一种数据同步方法,应用于用户终端,包括:
    在到达预设同步时间点时,判断预置的数据同步日志表中是否包含新增同步记录;
    若所述数据同步日志表中包含新增同步记录,将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间;
    若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果;
    若所述第一判断结果为完成数据同步,反馈完成数据同步的提示信息。
  16. 根据权利要求15所述的计算机可读存储介质,其中,所述将与所述数据同步日志表对应的初始数据库中的数据信息同步存储至预置的待同步数据库的空闲目录中,并记录同步起始时间,该方法包括
    对所述待同步数据库中每一目录的使用状态是否为空闲进行判断,以获取所述待同步数据库中的空闲目录;
    清空所述空闲目录中存储的数据信息,将与所述数据同步日志表对应的初始数据库所包含的数据信息同步存储至所述空闲目录,并记录同步起始时间。
  17. 根据权利要求15所述的计算机可读存储介质,其中,所述若到达与所述同步起始时间间隔预置时限的时间,根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果之前,还包括:
    判断所述待同步数据库中是否已记录与所述空闲目录对应的历史同步耗时;
    若所述待同步数据库中已记录与所述空闲目录对应的历史同步耗时,将所述历史同步耗时确定为所述预置时限;
    若所述待同步数据库中未记录与所述空闲目录对应的历史同步耗时,将预置的默认时限确定为所述预置时限。
  18. 根据权利要求15所述的计算机可读存储介质,其中,所述根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果,包括:
    分别获取所述新增同步记录及所述空闲目录的数据量;
    对所述新增同步记录与所述空闲目录的数据量是否相等进行判断得到是否完成数据同步的第一判断结果,其中,若所述新增同步记录与所述空闲目录的数据量相等,所述第一判断结果为完成数据同步。
  19. 根据权利要求15所述的计算机可读存储介质,其中,所述根据所述新增同步记录判断所述空闲目录是否完成数据同步以得到第一判断结果之后,还包括:
    若所述第一判断结果为未完成数据同步,根据预置的同步判断规则及所述新增同步记录判断所述空闲目录是否完成数据同步以得到第二判断结果;
    若所述第二判断结果为完成数据同步,执行所述反馈完成数据同步的提示信息的步骤;
    若所述第二判断结果为未完成数据同步,反馈本次数据同步存在异常的提示信息。
  20. 根据权利要求15所述的计算机可读存储介质,其中,所述同步判断规则包括循环周期、循环次数N及间隔数量阈值,所述根据预置的同步判断规则及所述新增同步记录判断所述空闲目录是否完成数据同步以得到第二判断结果,包括:
    与所述第一判断结果的获取时间每间隔一个所述循环周期,循环判断所述空闲目录的数据量是否增加;
    若最近N次循环判断中所述空闲目录的数据量均未增加,停止所述循环判断并判断所述新增同步记录与所述空闲目录之间的数据量差值是否小于所述间隔数量阈值,以得到是否完成数据同步的第二判断结果,其中,N为预置的大于零的整数,若所述新增同步记录与所述空闲目录之间的数据量差值小于所述间隔数量阈值,所述第二判断结果为完成数据同步。
PCT/CN2020/087130 2020-01-20 2020-04-27 数据同步方法、装置、计算机设备及存储介质 WO2021147197A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010066094.8A CN111309742A (zh) 2020-01-20 2020-01-20 数据同步方法、装置、计算机设备及存储介质
CN202010066094.8 2020-01-20

Publications (1)

Publication Number Publication Date
WO2021147197A1 true WO2021147197A1 (zh) 2021-07-29

Family

ID=71144903

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/087130 WO2021147197A1 (zh) 2020-01-20 2020-04-27 数据同步方法、装置、计算机设备及存储介质

Country Status (2)

Country Link
CN (1) CN111309742A (zh)
WO (1) WO2021147197A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114020850B (zh) * 2022-01-05 2022-04-08 深圳市明源云科技有限公司 数据库数据同步方法、装置、设备及可读存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170220658A1 (en) * 2016-02-01 2017-08-03 Successfactors, Inc. Application Program Interface Managing Synchronized Data Replication
CN107798039A (zh) * 2017-05-19 2018-03-13 平安科技(深圳)有限公司 一种数据同步方法和装置
CN110347747A (zh) * 2019-06-14 2019-10-18 平安科技(深圳)有限公司 数据库间数据同步方法、系统、计算机设备及存储介质
CN110377664A (zh) * 2019-07-22 2019-10-25 腾讯科技(深圳)有限公司 数据同步方法、装置、服务器及存储介质
CN110417838A (zh) * 2018-04-28 2019-11-05 华为技术有限公司 一种数据同步方法及同步服务设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170220658A1 (en) * 2016-02-01 2017-08-03 Successfactors, Inc. Application Program Interface Managing Synchronized Data Replication
CN107798039A (zh) * 2017-05-19 2018-03-13 平安科技(深圳)有限公司 一种数据同步方法和装置
CN110417838A (zh) * 2018-04-28 2019-11-05 华为技术有限公司 一种数据同步方法及同步服务设备
CN110347747A (zh) * 2019-06-14 2019-10-18 平安科技(深圳)有限公司 数据库间数据同步方法、系统、计算机设备及存储介质
CN110377664A (zh) * 2019-07-22 2019-10-25 腾讯科技(深圳)有限公司 数据同步方法、装置、服务器及存储介质

Also Published As

Publication number Publication date
CN111309742A (zh) 2020-06-19

Similar Documents

Publication Publication Date Title
CN105550229B (zh) 分布式存储系统数据修复的方法和装置
US10455015B2 (en) System and method for automatic cloud-based full-data backup and restore on mobile devices
US7934071B2 (en) Method of managing storage capacity in a storage system, a storage device and a computer system
US10331625B2 (en) Managing sequential data store
JP5775973B2 (ja) 複数ソースからのプレイリストのマージ
WO2020151332A1 (zh) 数据删除方法、装置、计算机设备及存储介质
CN107148617B (zh) 日志协调存储组的自动配置
US20150213100A1 (en) Data synchronization method and system
US9940360B2 (en) Streaming optimized data processing
JP2015503168A (ja) アプリケーションデータを復元するためのシステム及び方法
CN105573859A (zh) 一种数据库的数据恢复方法和设备
US11728976B1 (en) Systems and methods for efficiently serving blockchain requests using an optimized cache
CN109445681B (zh) 数据的存储方法、装置和存储系统
CN110245145A (zh) 关系型数据库到Hadoop数据库的结构同步方法和装置
CN104216802B (zh) 一种内存数据库恢复方法和设备
CN103412929A (zh) 一种海量数据的存储方法
WO2021147197A1 (zh) 数据同步方法、装置、计算机设备及存储介质
WO2018000191A1 (zh) 一种数据处理的方法和装置
CN114218193A (zh) 数据迁移方法、装置、计算机设备和可读存储介质
CN111078418B (zh) 操作同步方法、装置、电子设备及计算机可读存储介质
WO2024036829A1 (zh) 一种数据融合方法、装置、设备及存储介质
CN107368505A (zh) 一种数据库实时增量复制软件中利用Apriori算法对并行入库进行智能分组优化的技术
CN115640280A (zh) 数据迁移方法及装置
US9747309B1 (en) Auto-determining backup level
CN115617800A (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: 20914944

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 1205A DATED 09.11.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20914944

Country of ref document: EP

Kind code of ref document: A1