CN112231403A - Consistency checking method, device, equipment and storage medium for data synchronization - Google Patents

Consistency checking method, device, equipment and storage medium for data synchronization Download PDF

Info

Publication number
CN112231403A
CN112231403A CN202011103505.2A CN202011103505A CN112231403A CN 112231403 A CN112231403 A CN 112231403A CN 202011103505 A CN202011103505 A CN 202011103505A CN 112231403 A CN112231403 A CN 112231403A
Authority
CN
China
Prior art keywords
task
state
check
verification
checking
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011103505.2A
Other languages
Chinese (zh)
Other versions
CN112231403B (en
Inventor
王凯龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingbase Information Technologies Co Ltd
Original Assignee
Beijing Kingbase Information Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingbase Information Technologies Co Ltd filed Critical Beijing Kingbase Information Technologies Co Ltd
Priority to CN202011103505.2A priority Critical patent/CN112231403B/en
Publication of CN112231403A publication Critical patent/CN112231403A/en
Application granted granted Critical
Publication of CN112231403B publication Critical patent/CN112231403B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • G06F16/273Asynchronous replication or reconciliation

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Retry When Errors Occur (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the disclosure discloses a method, a device, equipment and a storage medium for consistency check of data synchronization. The method comprises the following steps: acquiring data information of each table to be verified, generating a plurality of verification tasks based on the data information of each table, and recording the task state of each verification task as an unexecuted state; for any check task, if the task state of the check task is an unexecuted state, modifying the task state of the check task to be an executing state, processing the check task, and modifying the task state of the check task to be an executing completed state under the condition that the check task is normally checked; and if the check is abnormal, continuously checking each unchecked check task based on the task state of each check task. The consistency checking process is divided into the plurality of checking tasks, the task state of each checking task is dynamically modified, so that checking is continued based on each task state after fault recovery, repeated checking of table data is avoided, checking time is saved, and checking efficiency is improved.

Description

Consistency checking method, device, equipment and storage medium for data synchronization
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for consistency check of data synchronization.
Background
The process of utilizing the data synchronization tool to perform real-time data synchronization of the database comprises three stages: the first stage is to carry out initialization loading of stock data to obtain a basic point of data synchronization; in the second stage, incremental data synchronization is carried out by taking a synchronization base point established by initializing data loading as a reference; and the third stage is used for regularly comparing and checking the source data and the target data which are synchronized. In the third stage, all synchronous table data of the source end and the target end need to be pulled simultaneously for verification, so as to judge whether the data of the source end and the target end are consistent.
In the consistency check process, faults such as network instability, abnormal database restart, abnormal operating system and the like can be encountered, so that the consistency check is interrupted. At present, the processing mode for such a situation is mainly to perform consistency check on all table data again after fault recovery.
However, since there are many tables that need to be subjected to data verification in one data verification process and the data size of the tables is large, the time required to perform one full-data consistency verification is long. Then, according to the above consistency check scheme, after the check is aborted and resumed, the completed data table needs to be checked repeatedly, which not only occupies more resources, but also consumes a lot of time, and affects the database synchronization efficiency.
Disclosure of Invention
To solve the technical problem or at least partially solve the technical problem, the present disclosure provides a consistency check method, apparatus, device and storage medium for data synchronization.
In a first aspect, the present disclosure provides a method for checking consistency of data synchronization, including:
acquiring data information of each table to be verified, generating a plurality of verification tasks based on the data information of each table, and recording the task state of each verification task as an unexecuted state;
for any one of the verification tasks, if the task state of the verification task is the unexecuted state, modifying the task state of the verification task to be an executing state, processing the verification task, and modifying the task state of the verification task to be an executing completed state under the condition that the verification task is normally verified;
and if the check is abnormal, continuously checking each check task which is not checked based on the task state of each check task.
In some embodiments, one of said check tasks includes one of said table data messages.
In some embodiments, if a checking exception is detected, the continuing to check each of the checking tasks that are not executed based on the task state of each of the checking tasks includes:
for any one of the verification tasks, if the task state of the verification task is modified to be the executing state, and the verification task is not normally verified, modifying the task state of the verification task from the executing state to the non-executing state;
and returning to execute the check task, if the task state of the check task is the unexecuted state, modifying the task state of the check task to be an executing state, processing the check task, and modifying the task state of the check task to be an executing finished state under the condition that the check task is normally checked.
In some embodiments, if a checking exception is detected, the continuing to check each of the checking tasks that are not executed based on the task state of each of the checking tasks includes:
if a restart signal after the verification interruption is detected, searching the task state as the verification task in the executing state, and modifying the task state of the searched verification task from the executing state to the non-executing state;
and returning to execute the check task, if the task state of the check task is the unexecuted state, modifying the task state of the check task to be an executing state, processing the check task, and modifying the task state of the check task to be an executing finished state under the condition that the check task is normally checked.
In some embodiments, after modifying the task state of the verification task to be an executing state if the task state of the verification task is the unexecuted state, the method further includes:
removing the verification task from a task pool;
accordingly, after modifying the task state of the verification task from the executing state to the non-executing state, the method further comprises:
and adding the checking task into the task pool again.
In some embodiments, after said detecting a check anomaly, the method further comprises:
recording abnormal information of the check abnormality; and/or the presence of a gas in the gas,
and clearing the checking intermediate result corresponding to the checking task.
In some embodiments, the method further comprises:
after the table data information to be verified is obtained, determining the table data information as a verification total task, and recording the task state of the verification total task as the unexecuted state; the checking total task and each checking task have an association relation;
modifying the task state of the total checking task from the unexecuted state to the executing state before modifying the task state of the checking task to the executing state if the task state of the checking task is the unexecuted state aiming at any checking task;
and when the task state of each checking task is the execution completion state, modifying the task state of the checking total task from the execution state to the execution completion state.
In a second aspect, the present disclosure provides a device for checking consistency of data synchronization, the device comprising:
the verification task generating module is used for acquiring data information of each table to be verified, generating a plurality of verification tasks based on the data information of each table, and recording the task state of each verification task as an unexecuted state;
a task state modification module, configured to modify, for any one of the verification tasks, if the task state of the verification task is the unexecuted state, the task state of the verification task to be an executing state, and process the verification task, and modify, under a condition that the verification task is normally verified, the task state of the verification task to be an execution completion state;
and the check exception processing module is used for continuously checking each check task which is not checked based on the task state of each check task if the check exception is detected.
In some embodiments, one of said check tasks includes one of said table data messages.
In some embodiments, the check exception handling module is specifically configured to:
for any one of the verification tasks, if the task state of the verification task is modified to be the executing state, and the verification task is not normally verified, modifying the task state of the verification task from the executing state to the non-executing state;
and returning to execute the check task, if the task state of the check task is the unexecuted state, modifying the task state of the check task to be an executing state, processing the check task, and modifying the task state of the check task to be an executing finished state under the condition that the check task is normally checked.
In some embodiments, the check exception handling module is specifically configured to:
if a restart signal after the verification interruption is detected, searching the task state as the verification task in the executing state, and modifying the task state of the searched verification task from the executing state to the non-executing state;
and returning to execute the check task, if the task state of the check task is the unexecuted state, modifying the task state of the check task to be an executing state, processing the check task, and modifying the task state of the check task to be an executing finished state under the condition that the check task is normally checked.
In some embodiments, the apparatus further comprises a task management module to:
if the task state of the verification task is the unexecuted state, modifying the task state of the verification task to be an executing state, and then removing the verification task from a task pool;
and after the task state of the checking task is changed from the executing state to the non-executing state, the checking task is added into the task pool again.
In some embodiments, the check exception handling module is further to:
after the check anomaly is detected, recording anomaly information of the check anomaly; and/or the presence of a gas in the gas,
and clearing the checking intermediate result corresponding to the checking task after the checking abnormity is detected.
In some embodiments, the apparatus further comprises a check total task processing module configured to:
after the table data information to be verified is obtained, determining the table data information as a verification total task, and recording the task state of the verification total task as the unexecuted state; the checking total task and each checking task have an association relation;
modifying the task state of the total checking task from the unexecuted state to the executing state before modifying the task state of the checking task to the executing state if the task state of the checking task is the unexecuted state aiming at any checking task;
and when the task state of each checking task is the execution completion state, modifying the task state of the checking total task from the execution state to the execution completion state.
In a third aspect, the present disclosure provides an electronic device, including:
a processor and a storage device;
the processor is configured to perform the steps of the method of any embodiment of the present disclosure by calling a program or instructions stored in the storage device.
In a fourth aspect, the present disclosure provides a computer-readable storage medium storing a program or instructions for causing a computer to perform the steps of the method described in any embodiment of the present disclosure.
According to the technical scheme provided by the embodiment of the disclosure, a plurality of verification tasks are generated by acquiring data information of each table to be verified, and the task state of each verification task is recorded as an unexecuted state; for any check task, if the task state of the check task is an unexecuted state, modifying the task state of the check task to be an executing state, processing the check task, and modifying the task state of the check task to be an executing completed state under the condition that the check task is normally checked; and if the check is abnormal, continuously checking each unchecked check task based on the task state of each check task. The method and the device have the advantages that the one-time data consistency verification process is divided into the multiple verification tasks with smaller execution granularity, the task state of each verification task is dynamically modified in the execution process of each verification task, so that the verification of the un-verified table data can be continuously executed based on the task state of each verification task after the verification process is interrupted and recovered, the problem that all table data are required to be verified again when the data consistency verification is interrupted is solved, repeated verification processes of some table data are reduced, operation resources required by the consistency verification are reduced, time consumed by verification is saved, and the efficiency of the data consistency verification is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present disclosure, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a flowchart of a consistency checking method for data synchronization according to an embodiment of the present disclosure;
FIG. 2 is a flowchart of another method for checking consistency of data synchronization according to an embodiment of the present disclosure;
FIG. 3 is a flowchart of a method for checking consistency of data synchronization according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a consistency check apparatus for data synchronization according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure.
Detailed Description
In order that the above objects, features and advantages of the present disclosure may be more clearly understood, aspects of the present disclosure will be described in further detail below. It should be noted that the embodiments and features of the embodiments of the present disclosure may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure, but the present disclosure may be practiced in other ways than those described herein; it is to be understood that the embodiments disclosed in the specification are only a few embodiments of the present disclosure, and not all embodiments.
The consistency checking method for data synchronization provided by the embodiment of the disclosure is mainly applicable to a scene of checking consistency between data at two ends when data synchronization is performed between different devices, for example, a data consistency checking process in a database synchronization scene. The consistency checking method for data synchronization provided by the embodiment of the present disclosure may be executed by a consistency checking apparatus for data synchronization, where the apparatus may be implemented in a software and/or hardware manner, and the apparatus may be integrated in an electronic device with a table data operation function, such as a tablet computer, a notebook computer, a desktop computer, or a server. In some embodiments, the electronic device may be a device corresponding to a source of production data, a device corresponding to a target of synchronization data, or a third-party device different from the source-corresponding device and the target-corresponding device.
Fig. 1 is a flowchart of a consistency checking method for data synchronization according to an embodiment of the present disclosure. Referring to fig. 1, the method specifically includes:
s110, obtaining data information of each table to be verified, generating a plurality of verification tasks based on the data information of each table, and recording the task state of each verification task as an unexecuted state.
The table data information is information for representing data to be checked, and may be table data pulled from the source end and the target end, or descriptive information of the table data, and is used to request the source end and the target end for the corresponding table data. The checking task is an execution unit of data consistency checking, and each checking operation corresponds to executing one checking task. The checking task includes the table data information, but the number of the checking tasks is less than the total number of the table data information. In some embodiments, a check task includes a table data message. Although one verification task may include a plurality of table data information, in order to further improve the efficiency of data consistency verification, in this embodiment, one table data information is determined as one verification task. The task state is used for representing the execution progress of one task, and may be, for example, an unexecuted state in which the "unexecuted", "not started", "to be executed", and the like represent that the task is not executed, an executing state in which the "executing", "checking", and the like represent that the task is being executed, or an execution completion state in which the "execution completion", "checking completion", and the like represent that the task has been completed by normal execution.
In view of the fact that all table data need to be re-checked after each fault recovery in the related art, in the embodiment of the present disclosure, a process of checking data consistency once is divided into a plurality of checking tasks with smaller execution granularity, and a task state is dynamically set for each checking task according to the execution progress of the checking task. Therefore, when the verification process is interrupted due to a fault, the interrupted verification task is the verification task which is being verified, and after the subsequent fault is recovered, the verification tasks which are not verified can be screened according to the task states of the verification tasks to continue verification without repeatedly verifying the verified table data.
Based on the above concept, in specific implementation, all table data information required to be subjected to consistency check is acquired first. Then, according to a preset task amount (such as a table data information) corresponding to one checking task, all the table data information is split, and a plurality of checking tasks are generated. And, an initial task state, i.e., an unexecuted state, is set for each check task. In some embodiments, the check total tasks corresponding to all the table data information and the generated task information (such as task descriptive information, task status, and the like) of each check task may be persisted for subsequent query and modification with greater convenience.
And S120, aiming at any check task, if the task state of the check task is the non-execution state, modifying the task state of the check task to be the execution state, processing the check task, and modifying the task state of the check task to be the execution completion state under the condition that the check task is normally checked.
For one of the check tasks, if the task state is an unexecuted state, the check task can be processed. Firstly, modifying the task state of the checking task from an unexecuted state to an executing state; then, executing the check task, for example, comparing whether the table data respectively corresponding to the source end and the target end in the check task are consistent; whether the comparison result is that the two are consistent or not, the verification task is normally verified and completed. At this time, the task state of the verification task is modified from the executing state to the executing completion state, which indicates that the verification task is verified. According to the process, each check task is traversed. Note that each check task may be executed in serial or parallel in a loop manner.
And S130, if the checking abnormality is detected, continuously checking each unchecked checking task based on the task state of each checking task.
If in the process of processing each check task, check abnormality is detected, for example, the check task cannot be continuously executed due to network abnormality, database connection failure, or restart after interruption of the consistency check program for data synchronization caused by operating system failure, hardware failure, program memory overflow, or the like, after the failure is recovered, the check tasks in the executing state and the non-executing state are continuously processed based on the task state of each check task until all the check tasks are completely processed.
According to the technical scheme of the embodiment of the disclosure, the data information of each table to be verified is obtained, a plurality of verification tasks are generated based on the data information of each table, and the task state of each verification task is recorded as the unexecuted state; for any check task, if the task state of the check task is an unexecuted state, modifying the task state of the check task to be an executing state, processing the check task, and modifying the task state of the check task to be an executing completed state under the condition that the check task is normally checked; and if the check is abnormal, continuously checking each unchecked check task based on the task state of each check task. The method and the device have the advantages that the one-time data consistency verification process is divided into the multiple verification tasks with smaller execution granularity, the task state of each verification task is dynamically modified in the execution process of each verification task, so that the verification of the un-verified table data can be continuously executed based on the task state of each verification task after the verification process is interrupted and recovered, the problem that all table data are required to be verified again when the data consistency verification is interrupted is solved, repeated verification processes of some table data are reduced, operation resources required by the consistency verification are reduced, time consumed by verification is saved, and the efficiency of the data consistency verification is improved.
In some embodiments, after detecting the check anomaly, the method further comprises: recording abnormal information of the check abnormality; and/or clearing the check intermediate result corresponding to the check task. In this embodiment, if a check anomaly is detected, the anomaly information of the check anomaly needs to be recorded in a log. In addition, when the check is detected to be abnormal, the check task currently being processed cannot complete normal check, and the check task needs to be re-checked after the failure is recovered, so that various check intermediate results generated by the check task need to be cleared.
In some embodiments, the method for checking consistency of data synchronization further comprises: after data information of each table to be verified is obtained, determining the data information of each table as a verification total task, and recording the task state of the verification total task as an unexecuted state; wherein, the checking total task has an incidence relation with each checking task; for any check task, if the task state of the check task is an unexecuted state, before the task state of the check task is modified to be an executing state, modifying the task state of the check task from the unexecuted state to the executing state; and when the task states of all the checking tasks are the execution completion states, modifying the task state of the checking total task from the execution state to the execution completion state. The present embodiment is directed to a scenario in which multiple data consistency check processes exist simultaneously. In this scenario, in order to ensure smooth execution of each verification process, all table data information included in each data consistency verification process is abstracted into a verification total task, and then the verification total task has an association relationship with each generated verification task. Before the check is performed, the overall task is set to an initial task state, i.e., an unexecuted state. When traversing each checking task is started, the task state of the checking task needs to be modified from the non-execution state to the execution state, which indicates that the checking task is being processed. After all the checking tasks are completely processed, the task state of the checking task needs to be modified from the executing state to the executing completion state, which indicates that all the checking tasks are completely processed. Therefore, by dynamically modifying the task state of the verification total task and the task state of each related verification task, the verification total task and the verification tasks which need to be continuously processed can be accurately positioned after the verification process is interrupted and recovered, and the efficiency of data consistency verification is further improved.
Fig. 2 is a flowchart of another consistency checking method for data synchronization according to an embodiment of the present disclosure. The method carries out further optimization on the condition that if the check abnormality is detected, each check task which is not executed is continuously checked based on the task state of each check task. On the basis, related steps of checking task management in the task pool can be added. The consistency checking method for data synchronization aims at consistency checking interruption scenes caused by network abnormity, database abnormity and other faults which do not relate to a data consistency checking program. Wherein explanations of the same or corresponding terms as those of the above embodiments are omitted. Referring to fig. 2, the method includes:
s210, obtaining data information of each table to be verified, determining the data information of each table as a verification total task, and recording the task state of the verification total task as an unexecuted state.
S220, generating a plurality of checking tasks based on the data information of each table, and recording the task state of each checking task as an unexecuted state.
S210 and S220 complete the initialization process of the total verification task and each verification task corresponding to the data consistency verification process, and obtain task identifiers, task type identifiers, and task states of the total verification task and each verification task as shown in table 1. The check total task (ID 1) includes three check tasks (ID 2, ID 3, and ID 4, respectively), and all of them are in an unexecuted state.
TABLE 1 task information Table (initial state)
Task Identification (ID) Task type identification (PID) Task STATUS (STATUS)
1 0 (check task) Is not executing
2 1 (check task) Is not executing
3 1 Is not executing
4 1 Is not executing
And S230, modifying the task state of the checking total task from an unexecuted state to an executing state.
Firstly, determining a total verification task (PID is 0) according to the task type identifier, and modifying the task state of the total verification task into an executing state.
S240, aiming at any check task, if the task state of the check task is the non-execution state, the task state of the check task is modified to be the execution state, the check task is removed from the task pool, the check task is processed, and under the condition that the check task is normally checked, the task state of the check task is modified to be the execution completion state.
For a certain check task, for example, a check task with an ID of 2, the task state is modified to be an executing state. Since the check task has begun processing, the check task is removed from the task pool. Unprocessed check tasks are stored in the task pool. Then, the check task is processed, and the task state of the check task with ID 2 in table 1 is modified to the execution completion state after the processing is completed.
And S250, aiming at any check task, if the check task is not normally checked after the task state of the check task is modified to be the executing state, modifying the task state of the check task from the executing state to the non-executing state.
For a certain checking task, for example, the checking task with the ID of 2, after modifying the task state to the executing state, if it is detected that the checking task is not normally checked, the task state is modified to the non-executing state again.
And S260, recording abnormal information of abnormal verification, clearing a verification intermediate result corresponding to the verification task, and adding the verification task into the task pool again.
The checking task with abnormal checking needs to be checked again after the fault is recovered, so that the task needs to be added into the task pool again after the task state is modified into the unexecuted state.
S270, returning to the step of executing S240.
And executing S240-S270 in a circulating mode to ensure that all the verification tasks are processed as long as the verification tasks exist in the task pool.
According to the technical scheme of the embodiment of the disclosure, through the removal and addition of the verification tasks in the task pool, each verification task can be efficiently managed, and the integrity of data consistency verification is further ensured. And if the task state of the verification task is not in the execution state, modifying the task state of the verification task to be in the execution state, processing the verification task, and modifying the task state of the verification task to be in the execution state under the condition that the verification task is normally verified. When the data consistency check program can normally run but the data consistency check is interrupted, the task state of the check task which is checked abnormally is automatically changed into the unexecuted state, so that the check task can be continuously checked without repeatedly checking the finished check task, and the fault tolerance and the check efficiency of the data consistency check are improved.
Fig. 3 is a flowchart of a further method for checking consistency of data synchronization according to an embodiment of the present disclosure. The method carries out further optimization on the condition that if the check abnormality is detected, each check task which is not executed is continuously checked based on the task state of each check task. On the basis, related steps of checking task management in the task pool can be added. The consistency checking method for data synchronization aims at consistency checking interruption scenes caused by faults that a data consistency checking program cannot run due to operating system faults, hardware faults, program memory overflow and the like. Wherein explanations of the same or corresponding terms as those of the above embodiments are omitted. Referring to fig. 3, the method includes:
s310, obtaining data information of each table to be verified, determining the data information of each table as a verification total task, and recording the task state of the verification total task as an unexecuted state.
And S320, generating a plurality of checking tasks based on the data information of each table, and recording the task state of each checking task as an unexecuted state.
S330, modifying the task state of the checking total task from the non-execution state to the execution state.
S340, aiming at any check task, if the task state of the check task is the non-execution state, modifying the task state of the check task to be the execution state, removing the check task from the task pool, processing the check task, and modifying the task state of the check task to be the execution completion state under the condition that the check task is normally checked.
And S350, if a restart signal after the verification interruption is detected, searching the verification task with the task state being the executing state, and modifying the task state of the searched verification task from the executing state to the non-executing state.
If the data consistency check program is restarted due to a failure during a process of checking the total task, the task information in the intermediate state shown in, for example, table 2 can be obtained through the above-described processes of S310 to S340. As can be seen from table 2, the task status of the check task is the executing status, and the check task is not processed completely, including the check task in the executing status (ID is 3), which indicates that the check task is being processed before restart, and includes the check task in the non-executing status (ID is 4).
TABLE 2 task information Table (intermediate State)
Task Identification (ID) Task type identification (PID) Task STATUS (STATUS)
1 0 (check task) In execution
2 1 (check task) Complete the process
3 1 In execution
4 1 Is not executing
In specific implementation, after a restart signal is detected, a check total task (ID is 1) of an executing state is searched from the task information table. Then, the check task (ID 3) associated with the check task and having the task status as the executing status is searched. And then, modifying the task state of the searched checking task from the executing state to the non-executing state.
And S360, recording abnormal information of abnormal verification, clearing the middle verification result corresponding to the found verification task, and adding the verification task into the task pool again.
S370, return to the step of S340.
According to the technical scheme of the embodiment of the disclosure, if the restart signal after the verification interruption is detected, the verification task with the task state being the executing state is searched, and the task state of the searched verification task is changed from the executing state to the non-executing state; and returning to execute any check task, if the task state of the check task is an unexecuted state, modifying the task state of the check task into an executing state, processing the check task, and modifying the task state of the check task into an executing finished state under the condition that the check task is normally checked. The method and the device realize that the check task in the executing state is automatically searched and the task state of the check task is modified after the program is restarted under the condition of data consistency check interruption caused by the fact that the data consistency check program cannot normally run due to faults, and the check task in the non-executing state is automatically searched and processed, so that the check task which is not checked can be accurately and comprehensively obtained, the data consistency check is continuously carried out, the finished check task does not need to be checked repeatedly, and the efficiency of the data consistency check is further improved.
Fig. 4 is a schematic structural diagram of a consistency check apparatus for data synchronization according to an embodiment of the present disclosure. Referring to fig. 4, the apparatus specifically includes:
the verification task generating module 410 is configured to obtain data information of each table to be verified, generate a plurality of verification tasks based on the data information of each table, and record a task state of each verification task as an unexecuted state;
the task state modification module 420 is configured to, for any check task, modify the task state of the check task to be an executing state if the task state of the check task is an unexecuted state, process the check task, and modify the task state of the check task to be an executing completed state if the check task is normally checked;
and a checking exception processing module 430, configured to, if a checking exception is detected, continue to check each checking task that is not checked based on a task state of each checking task.
In some embodiments, a check task includes a table data message.
In some embodiments, the check exception handling module 430 is specifically configured to:
for any check task, if the task state of the check task is modified to be the executing state, and the check task is detected not to be normally checked, the task state of the check task is modified from the executing state to the non-executing state;
and returning to execute any check task, if the task state of the check task is an unexecuted state, modifying the task state of the check task into an executing state, processing the check task, and modifying the task state of the check task into an executing finished state under the condition that the check task is normally checked.
In some embodiments, the check exception handling module 430 is specifically configured to:
if a restart signal after the verification interruption is detected, searching a verification task with the task state being an executing state, and modifying the task state of the searched verification task from the executing state to an unexecuted state;
and returning to execute any check task, if the task state of the check task is an unexecuted state, modifying the task state of the check task into an executing state, processing the check task, and modifying the task state of the check task into an executing finished state under the condition that the check task is normally checked.
In some embodiments, the apparatus further comprises a task management module to:
if the task state of the verification task is the non-execution state, modifying the task state of the verification task to be the execution state, and then removing the verification task from the task pool;
and after the task state of the checking task is modified from the executing state to the non-executing state, the checking task is added into the task pool again.
In some embodiments, check exception handling module 430 is further operable to:
after the check anomaly is detected, recording anomaly information of the check anomaly; and/or the presence of a gas in the gas,
and after the verification abnormity is detected, clearing the verification intermediate result corresponding to the verification task.
In some embodiments, the apparatus further comprises a check total task processing module configured to:
after data information of each table to be verified is obtained, determining the data information of each table as a verification total task, and recording the task state of the verification total task as an unexecuted state; wherein, the checking total task has an incidence relation with each checking task;
for any check task, if the task state of the check task is an unexecuted state, before the task state of the check task is modified to be an executing state, modifying the task state of the check task from the unexecuted state to the executing state;
and when the task states of all the checking tasks are the execution completion states, modifying the task state of the checking total task from the execution state to the execution completion state.
Through the consistency checking device for data synchronization provided by the embodiment of the disclosure, a data consistency checking process is divided into a plurality of checking tasks with smaller execution granularity, and the task state of each checking task is dynamically modified in the execution process, so that the checking process can be continuously executed based on the task state of each checking task after being interrupted and recovered, the problem that all table data are required to be checked again when the data consistency checking is interrupted is solved, repeated checking processes of some table data are reduced, operation resources required by consistency checking are reduced, checking time is saved, and the efficiency of data consistency checking is improved.
The consistency verification device for data synchronization provided by the embodiment of the disclosure can execute the consistency verification method for data synchronization provided by any embodiment of the disclosure, and has corresponding functional modules and beneficial effects of the execution method.
It should be noted that, in the embodiment of the consistency check apparatus for data synchronization, each included module is only divided according to functional logic, but is not limited to the above division, as long as the corresponding function can be implemented; in addition, specific names of the functional modules are only used for distinguishing one functional module from another, and are not used for limiting the protection scope of the present disclosure.
Fig. 5 is a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure. Referring to fig. 5, an electronic device 500 provided by an embodiment of the present disclosure includes: processor 520 and memory 510; the processor 520 is used to execute the steps of the consistency check method for data synchronization provided by the embodiment of the present disclosure by calling the program or instruction stored in the memory 510:
acquiring data information of each table to be verified, generating a plurality of verification tasks based on the data information of each table, and recording the task state of each verification task as an unexecuted state;
for any check task, if the task state of the check task is an unexecuted state, modifying the task state of the check task to be an executing state, processing the check task, and modifying the task state of the check task to be an executing completed state under the condition that the check task is normally checked;
and if the check is abnormal, continuously checking each unchecked check task based on the task state of each check task.
Of course, those skilled in the art can understand that the processor 520 may also implement the technical solution of the consistency check method for data synchronization provided in any embodiment of the present disclosure.
The electronic device 500 shown in fig. 5 is only an example and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 5, the electronic device 500 is embodied in the form of a general purpose computing device. The components of the electronic device 500 may include, but are not limited to: one or more processors 520, a memory 510, and a bus 550 that couples the various system components (including the memory 510 and the processors 520).
Bus 550 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 500 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by electronic device 500 and includes both volatile and nonvolatile media, removable and non-removable media.
Memory 510 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)511 and/or cache memory 512. The electronic device 500 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 513 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, commonly referred to as a "hard drive"). Although not shown in FIG. 5, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 550 by one or more data media interfaces. Memory 510 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the disclosure.
A program/utility 514 having a set (at least one) of program modules 515 may be stored, for instance, in memory 510, such program modules 515 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 515 generally perform the functions and/or methods of any of the embodiments described in this disclosure.
The electronic device 500 may also communicate with one or more external devices 560 (e.g., keyboard, pointing device, display 570, etc.), with one or more devices that enable a user to interact with the electronic device 500, and/or with any devices (e.g., network card, modem, etc.) that enable the electronic device 500 to communicate with one or more other computing devices. Such communication may be through input/output interfaces (I/O interfaces) 530. Also, the electronic device 500 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) through the network adapter 540. As shown in FIG. 5, the network adapter 540 communicates with the other modules of the electronic device 500 over a bus 550. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The embodiment of the present disclosure further provides a computer-readable storage medium, where the computer-readable storage medium stores a program or an instruction, and the program or the instruction causes a computer to execute the steps of the consistency check method for data synchronization provided by the embodiment of the present disclosure:
acquiring data information of each table to be verified, generating a plurality of verification tasks based on the data information of each table, and recording the task state of each verification task as an unexecuted state;
for any check task, if the task state of the check task is an unexecuted state, modifying the task state of the check task to be an executing state, processing the check task, and modifying the task state of the check task to be an executing completed state under the condition that the check task is normally checked;
and if the check is abnormal, continuously checking each unchecked check task based on the task state of each check task.
Of course, the stored program or instruction of the computer-readable storage medium provided by the embodiments of the present disclosure is not limited to the above method operations, and may also perform related operations in the consistency check method for data synchronization provided by any embodiment of the present disclosure.
The computer storage media of the disclosed embodiments may take any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be understood that the terminology used in the disclosure is for the purpose of describing particular embodiments only, and is not intended to limit the scope of the present application. As used in the specification and claims of this disclosure, the terms "a," "an," "the," and/or "the" are not intended to be inclusive in the singular, but rather are inclusive in the plural, unless the context clearly dictates otherwise. The term "and/or" includes any and all combinations of one or more of the associated listed items. The terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present disclosure, which enable those skilled in the art to understand or practice the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A consistency check method for data synchronization is characterized by comprising the following steps:
acquiring data information of each table to be verified, generating a plurality of verification tasks based on the data information of each table, and recording the task state of each verification task as an unexecuted state;
for any one of the verification tasks, if the task state of the verification task is the unexecuted state, modifying the task state of the verification task to be an executing state, processing the verification task, and modifying the task state of the verification task to be an executing completed state under the condition that the verification task is normally verified;
and if the check is abnormal, continuously checking each check task which is not checked based on the task state of each check task.
2. The method of claim 1, wherein one of said check tasks includes one of said table data messages.
3. The method of claim 1, wherein if a checking anomaly is detected, continuing to check each of the checking tasks that are not executed based on the task status of each of the checking tasks comprises:
for any one of the verification tasks, if the task state of the verification task is modified to be the executing state, and the verification task is not normally verified, modifying the task state of the verification task from the executing state to the non-executing state;
and returning to execute the check task, if the task state of the check task is the unexecuted state, modifying the task state of the check task to be an executing state, processing the check task, and modifying the task state of the check task to be an executing finished state under the condition that the check task is normally checked.
4. The method of claim 1, wherein if a checking anomaly is detected, continuing to check each of the checking tasks that are not executed based on the task status of each of the checking tasks comprises:
if a restart signal after the verification interruption is detected, searching the task state as the verification task in the executing state, and modifying the task state of the searched verification task from the executing state to the non-executing state;
and returning to execute the check task, if the task state of the check task is the unexecuted state, modifying the task state of the check task to be an executing state, processing the check task, and modifying the task state of the check task to be an executing finished state under the condition that the check task is normally checked.
5. The method according to claim 3 or 4, wherein after the modifying the task state of the verification task to the executing state if the task state of the verification task is the unexecuted state, the method further comprises:
removing the verification task from a task pool;
after modifying the task state of the verification task from the executing state to the non-executing state, the method further comprises:
and adding the checking task into the task pool again.
6. The method of claim 1, wherein after said detecting a verification anomaly, said method further comprises:
recording abnormal information of the check abnormality; and/or the presence of a gas in the gas,
and clearing the checking intermediate result corresponding to the checking task.
7. The method of claim 1, further comprising:
after the table data information to be verified is obtained, determining the table data information as a verification total task, and recording the task state of the verification total task as the unexecuted state; the checking total task and each checking task have an association relation;
modifying the task state of the total checking task from the unexecuted state to the executing state before modifying the task state of the checking task to the executing state if the task state of the checking task is the unexecuted state aiming at any checking task;
and when the task state of each checking task is the execution completion state, modifying the task state of the checking total task from the execution state to the execution completion state.
8. A consistency check device for data synchronization is characterized by comprising:
the verification task generating module is used for acquiring data information of each table to be verified, generating a plurality of verification tasks based on the data information of each table, and recording the task state of each verification task as an unexecuted state;
a task state modification module, configured to modify, for any one of the verification tasks, if the task state of the verification task is the unexecuted state, the task state of the verification task to be an executing state, and process the verification task, and modify, under a condition that the verification task is normally verified, the task state of the verification task to be an execution completion state;
and the check exception processing module is used for continuously checking each check task which is not checked based on the task state of each check task if the check exception is detected.
9. An electronic device, characterized in that the electronic device comprises:
a processor and a memory;
the processor is adapted to perform the steps of the method of any one of claims 1 to 7 by calling a program or instructions stored in the memory.
10. A computer-readable storage medium, characterized in that it stores a program or instructions for causing a computer to carry out the steps of the method according to any one of claims 1 to 7.
CN202011103505.2A 2020-10-15 2020-10-15 Consistency verification method, device, equipment and storage medium for data synchronization Active CN112231403B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011103505.2A CN112231403B (en) 2020-10-15 2020-10-15 Consistency verification method, device, equipment and storage medium for data synchronization

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011103505.2A CN112231403B (en) 2020-10-15 2020-10-15 Consistency verification method, device, equipment and storage medium for data synchronization

Publications (2)

Publication Number Publication Date
CN112231403A true CN112231403A (en) 2021-01-15
CN112231403B CN112231403B (en) 2024-01-30

Family

ID=74117342

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011103505.2A Active CN112231403B (en) 2020-10-15 2020-10-15 Consistency verification method, device, equipment and storage medium for data synchronization

Country Status (1)

Country Link
CN (1) CN112231403B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112910086A (en) * 2021-01-18 2021-06-04 国网山东省电力公司青岛供电公司 Intelligent substation data verification method and system
CN113485809A (en) * 2021-07-14 2021-10-08 上海通联金融服务有限公司 Method for solving problem of high time consumption of business process
CN113672167A (en) * 2021-07-09 2021-11-19 济南浪潮数据技术有限公司 Data consistency verification method, device and equipment of distributed storage system

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6049851A (en) * 1994-02-14 2000-04-11 Hewlett-Packard Company Method and apparatus for checking cache coherency in a computer architecture
US6332181B1 (en) * 1998-05-04 2001-12-18 International Business Machines Corporation Recovery mechanism for L1 data cache parity errors
US20100094802A1 (en) * 2008-10-10 2010-04-15 Abb Technology Ag Method and a system for replicating databases
CN102354292A (en) * 2011-09-21 2012-02-15 国家计算机网络与信息安全管理中心 Method and system for checking consistency of records in master and backup databases
CN107798007A (en) * 2016-08-31 2018-03-13 南京中兴新软件有限责任公司 A kind of method, apparatus and relevant apparatus of distributed data base data check
CN110019214A (en) * 2017-12-04 2019-07-16 北京京东尚科信息技术有限公司 The method and apparatus that data split result is verified
CN110443695A (en) * 2019-07-31 2019-11-12 中国工商银行股份有限公司 Data processing method and its device, electronic equipment and medium
CN110532247A (en) * 2019-08-28 2019-12-03 北京皮尔布莱尼软件有限公司 Data migration method and data mover system
US20190370368A1 (en) * 2018-05-31 2019-12-05 Warevalley Co., Ltd. Data consistency verification method and system minimizing load of original database
CN110727539A (en) * 2019-12-19 2020-01-24 北京江融信科技有限公司 Method and system for processing exception in batch processing task and electronic equipment
CN110928863A (en) * 2019-11-20 2020-03-27 无锡识凌科技有限公司 Method for task breakpoint resume applied to data cleaning tool
CN111581028A (en) * 2020-05-12 2020-08-25 上海英方软件股份有限公司 Data block-based method and system for rapid data backup and consistency verification

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6049851A (en) * 1994-02-14 2000-04-11 Hewlett-Packard Company Method and apparatus for checking cache coherency in a computer architecture
US6332181B1 (en) * 1998-05-04 2001-12-18 International Business Machines Corporation Recovery mechanism for L1 data cache parity errors
US20100094802A1 (en) * 2008-10-10 2010-04-15 Abb Technology Ag Method and a system for replicating databases
CN102354292A (en) * 2011-09-21 2012-02-15 国家计算机网络与信息安全管理中心 Method and system for checking consistency of records in master and backup databases
CN107798007A (en) * 2016-08-31 2018-03-13 南京中兴新软件有限责任公司 A kind of method, apparatus and relevant apparatus of distributed data base data check
CN110019214A (en) * 2017-12-04 2019-07-16 北京京东尚科信息技术有限公司 The method and apparatus that data split result is verified
US20190370368A1 (en) * 2018-05-31 2019-12-05 Warevalley Co., Ltd. Data consistency verification method and system minimizing load of original database
CN110443695A (en) * 2019-07-31 2019-11-12 中国工商银行股份有限公司 Data processing method and its device, electronic equipment and medium
CN110532247A (en) * 2019-08-28 2019-12-03 北京皮尔布莱尼软件有限公司 Data migration method and data mover system
CN110928863A (en) * 2019-11-20 2020-03-27 无锡识凌科技有限公司 Method for task breakpoint resume applied to data cleaning tool
CN110727539A (en) * 2019-12-19 2020-01-24 北京江融信科技有限公司 Method and system for processing exception in batch processing task and electronic equipment
CN111581028A (en) * 2020-05-12 2020-08-25 上海英方软件股份有限公司 Data block-based method and system for rapid data backup and consistency verification

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112910086A (en) * 2021-01-18 2021-06-04 国网山东省电力公司青岛供电公司 Intelligent substation data verification method and system
CN112910086B (en) * 2021-01-18 2024-05-31 国网山东省电力公司青岛供电公司 Intelligent substation data verification method and system
CN113672167A (en) * 2021-07-09 2021-11-19 济南浪潮数据技术有限公司 Data consistency verification method, device and equipment of distributed storage system
CN113672167B (en) * 2021-07-09 2023-12-22 济南浪潮数据技术有限公司 Data consistency verification method, device and equipment for distributed storage system
CN113485809A (en) * 2021-07-14 2021-10-08 上海通联金融服务有限公司 Method for solving problem of high time consumption of business process

Also Published As

Publication number Publication date
CN112231403B (en) 2024-01-30

Similar Documents

Publication Publication Date Title
US11137911B2 (en) Fast restart of applications using shared memory
CN112231403B (en) Consistency verification method, device, equipment and storage medium for data synchronization
CN110442560B (en) Log replay method, device, server and storage medium
US20160140164A1 (en) Complex event processing apparatus and complex event processing method
US20080172421A1 (en) Automated client recovery and service ticketing
WO2020232951A1 (en) Task execution method and device
US9870314B1 (en) Update testing by build introspection
CN112559140B (en) Transaction control method, system, equipment and storage medium for data consistency
US20100037094A1 (en) Application Failure Recovery
US8489938B2 (en) Diagnostic data capture in a computing environment
CN107729541A (en) A kind of data processing method, device and computer-readable recording medium
CN112765126B (en) Database transaction management method, device, computer equipment and storage medium
US20110202903A1 (en) Apparatus and method for debugging a shared library
CN117112522A (en) Concurrent process log management method, device, equipment and storage medium
CN109254880B (en) Method and device for processing database downtime
CN115757099A (en) Automatic test method and device for platform firmware protection recovery function
WO2023009062A1 (en) Device and method for re-executing of test cases in software application
CN111324668B (en) Database data synchronous processing method, device and storage medium
CN113254506A (en) Data processing method and device, computer equipment and storage medium
CN112328423A (en) Processing method, device and storage medium for search service loophole
CN109213569B (en) Auditing method and device based on virtual machine, server and storage medium
US10083086B2 (en) Systems and methods for automatically resuming commissioning of a partition image after a halt in the commissioning process
JP4989496B2 (en) Command net execution device, command net execution program, and computer-readable recording medium on which command net execution program is recorded
US20140282401A1 (en) Composite program history
CN104239182A (en) Cluster file system split-brain processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant