CN114416874A - Synchronous verification method, device, equipment and storage medium of database - Google Patents

Synchronous verification method, device, equipment and storage medium of database Download PDF

Info

Publication number
CN114416874A
CN114416874A CN202210044768.3A CN202210044768A CN114416874A CN 114416874 A CN114416874 A CN 114416874A CN 202210044768 A CN202210044768 A CN 202210044768A CN 114416874 A CN114416874 A CN 114416874A
Authority
CN
China
Prior art keywords
data
database
field name
synchronization
synchronized
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.)
Pending
Application number
CN202210044768.3A
Other languages
Chinese (zh)
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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202210044768.3A priority Critical patent/CN114416874A/en
Publication of CN114416874A publication Critical patent/CN114416874A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/254Extract, transform and load [ETL] procedures, e.g. ETL data flows in data warehouses

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a synchronous verification method, a synchronous verification device, synchronous verification equipment and a computer-readable storage medium of a database, wherein the method comprises the following steps: acquiring first data in a first database and second data in a second database; generating third data according to the first data and/or the second data based on a preset data generation rule, wherein the data format of the third data is the same as that of the first data, and the data value of the third data is different from that of the first data and the second data; synchronizing the third data into the first database so that the second database synchronizes the third data from the first database; and if the synchronized second database has third data, outputting indication information for indicating that the synchronization is successful. The method and the device can avoid the judgment error caused by different data structures between the databases, and can also improve the efficiency of verifying whether the databases are synchronous or not. The application also relates to a blockchain technique, indicating information can be stored in the blockchain.

Description

Synchronous verification method, device, equipment and storage medium of database
Technical Field
The present application relates to the field of data synchronization processing technologies, and in particular, to a method, an apparatus, a device, and a computer-readable storage medium for database synchronization verification.
Background
When the connectivity of a data link is tested, the structures of a table located at the upstream of the data link and a table located at the downstream of the data link need to be compared, data modification processing is performed on the table at the upstream, whether the modification processing can be synchronized to the table at the downstream is judged, whether the data link is communicated or not is determined, however, the table structures between databases across the system may be inconsistent, whether synchronization is successful or not can be determined through manual comparison when the data amount is small, data are easily omitted and a large amount of labor cost is consumed through manual comparison when the data amount is too large, data in the table at the upstream are different from data in the table at the downstream when the data are not modified, misjudgment is easily generated when whether synchronization is successful or not determined after the data modification processing, and therefore the accuracy of a test result is not high.
Disclosure of Invention
The application provides a database synchronization verification method, a database synchronization verification device, database synchronization equipment and a computer readable storage medium, and aims to improve the efficiency and accuracy of verifying whether databases are synchronized.
In a first aspect, the present application provides a method for synchronously verifying a database, where the method for synchronously verifying a database includes the following steps:
acquiring first data in a first database and second data in a second database, wherein the second database is used for synchronizing data from the first database;
generating third data according to the first data and/or the second data based on a preset data generation rule, wherein the data format of the third data is the same as that of the first data, and the data value of the third data is different from that of the first data and the data value of the second data;
synchronizing the third data into the first database so that the second database synchronizes the third data from the first database;
and if the third data exists in the synchronized second database, outputting indication information for indicating that the synchronization of the first database and the second database is successful.
In a second aspect, the present application further provides a database synchronization verification apparatus, including:
the data acquisition module is used for acquiring first data in a first database and second data in a second database, and the second database is used for synchronizing data from the first database;
the data generating module is used for generating third data according to the first data and/or the second data based on a preset data generating rule, wherein the data format of the third data is the same as that of the first data, and the data value of the third data is different from that of the first data and the second data;
the data synchronization module is used for synchronizing the third data to the first database so that the second database synchronizes the third data from the first database;
and the information output module is used for outputting indication information for indicating that the first database and the second database are successfully synchronized if the synchronized second database has the third data.
In a third aspect, the present application further provides a computer device, which includes a processor, a memory, and a computer program stored on the memory and executable by the processor, wherein the computer program, when executed by the processor, implements the steps of the synchronization verification method for a database as described above.
In a fourth aspect, the present application further provides a computer-readable storage medium, having a computer program stored thereon, where the computer program, when executed by a processor, implements the steps of the synchronization verification method for a database as described above.
The application provides a synchronous verification method, a synchronous verification device, synchronous verification equipment and a computer-readable storage medium of a database, wherein the method comprises the steps of obtaining first data in a first database and second data in a second database, wherein the second database is used for synchronizing the data from the first database; generating third data according to the first data and/or the second data based on a preset data generation rule, wherein the data format of the third data is the same as that of the first data, and the data value of the third data is different from that of the first data and the data value of the second data; synchronizing the third data into the first database so that the second database synchronizes the third data from the first database; and if the third data exists in the synchronized second database, outputting indication information for indicating that the synchronization of the first database and the second database is successful. The generated third data is synchronized to the first database, the second database is enabled to synchronize the third data from the first database, and then whether the second database has the third data or not is determined to judge whether the second database is synchronized with the first database or not, so that whether data links where the first database and the second database are located are communicated or not is determined, judgment errors caused by different data structures between the databases can be avoided, and the efficiency of verifying whether the databases are synchronized or not can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart illustrating a method for verifying synchronization of databases according to an embodiment of the present application;
fig. 2 is a scene diagram of a method for verifying synchronization of databases according to an embodiment of the present application;
fig. 3 is a schematic block diagram of a synchronization verification apparatus for a database according to an embodiment of the present application;
fig. 4 is a block diagram illustrating a structure of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The flow diagrams depicted in the figures are merely illustrative and do not necessarily include all of the elements and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
The embodiment of the application provides a synchronous verification method and device of a database, computer equipment and a computer readable storage medium. The synchronous verification method of the database can be applied to terminal equipment, and the terminal equipment can be electronic equipment such as a tablet computer, a notebook computer and a desktop computer. The method can also be applied to a server, which can be an independent server, or a cloud server providing basic cloud computing services such as cloud service, a cloud database, cloud computing, a cloud function, cloud storage, Network service, cloud communication, middleware service, domain name service, security service, Content Delivery Network (CDN), big data and artificial intelligence platform, and the like.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Referring to fig. 1 and fig. 2, fig. 1 is a schematic flowchart illustrating a database synchronization verification method according to an embodiment of the present disclosure. Fig. 2 is a schematic diagram of a synchronization verification method for databases according to an embodiment of the present disclosure, where a first database and a second database are located in a same data link, the first database is located upstream of the second database, a data processing system can process data in the first database and/or the second database through a preset function statement, so that the data can be synchronized into the first database, and the second database can synchronize the data from the first database.
As shown in fig. 1, the database synchronization verification method includes steps S101 to S104.
Step S101, acquiring first data in a first database and second data in a second database, wherein the second database is used for synchronizing data from the first database.
For example, in a data link, there may be multiple databases, such as data warehouses, where in one data link, a first database upstream of the data link is used to store data and can transmit the data stored in the first database to a second database downstream of the same data link through the data link, where the second database can also store data through the database. It can be understood that, the first database at the upstream and the second database at the downstream may be different types of databases, so that the data types and lengths of the data in the upstream and downstream databases are inconsistent, and thus, when testing whether the databases in the data link are connected, a large amount of operations are required to be performed to compare whether the data are synchronized, the speed is slow, and the data types and lengths of the data at the upstream and downstream are inconsistent, which increases the load of data comparison and is prone to errors, thereby reducing the accuracy of the data link connectivity judgment.
Illustratively, the first database located upstream of the data link has a corresponding first data processing system to perform data processing on the first database located upstream of the data link, specifically, the data processing may be any one of data insertion, data update and data deletion, and it is understood that the data insertion or update or deletion processing may be performed on the first database by running a preset functional statement in the first data processing system. Likewise, a second database downstream of the data link also has a corresponding second data processing system to perform data synchronization processing of the second database.
In other embodiments, the data link may correspond to a data processing system, for example, the data processing system corresponding to the first database and the data processing system corresponding to the second database are the same, so as to perform the data processing of the first database and the data synchronization processing of the second database. The following embodiments are described with the first database and the second database corresponding to the same data processing system, and the number and the manner of the data processing systems corresponding to the databases in the data link are not limited.
Illustratively, a first database and a second database located in the same data link are obtained, third data generated by first data in the first database and second data in the second database are synchronized into the first database, corresponding function statements are run in a data processing system corresponding to the data link, so that the second database synchronizes the first database, whether the synchronization of the first database and the second database is successful can be determined by determining whether corresponding data occurs in the synchronized second database, so as to test the connectivity of the data link, thereby reducing the load during data comparison, and improving the speed of testing the connectivity of the data link and the accuracy of judging whether the data link is communicated.
It is understood that, if the data link is connected, the second database can synchronize the data in the first database, for example, the first database is located upstream of the data link, the second database is located downstream of the data link, and when the data link is connected and the data processing system corresponding to the data link executes the preset synchronization function, the second database located downstream can synchronize the data in the first database located upstream, specifically, by determining that the data in the first database is changed, for example, inserting data, updating data, and deleting data, determining whether the second database is changed correspondingly, it can be determined whether the synchronization between the first database and the second database is successful, thereby determining whether the data link where the first database and the second database are located is connected.
For example, at least two databases may be determined to be in a preset table among a plurality of databases in a data link, and the method is performed to obtain the preset table and determine a first database and a second database in the preset table, so as to determine whether the data link where the first database and the second database are located is connected through the first database and the second database.
Illustratively, after the first database and the second database are determined, the first data in the first database and the second data in the second database are acquired, so as to perform the step of generating the third data and determine whether the data link is connected.
Step S102, based on a preset data generation rule, generating third data according to first data and/or second data, wherein the data format of the third data is the same as that of the first data, and the data value of the third data is different from that of the first data and the data value of the second data.
For example, the third data is generated through the first data and/or the second data, so that the generated third data can be synchronized into the second database, and an error condition in the synchronization process is avoided.
The data format of the generated third data is the same as the data format of the first data, for example, the first and third data are both key-value pair data formats. The same data format can avoid the situation that the control system cannot synchronize due to the incompatibility of the first database and the third data, so that the judgment of the synchronization result is wrong.
The generated data value of the third data is different from the data value of the first data and the data value of the second data, so that the third data is prevented from being influenced by the first data or the second data when being searched in a database after subsequent synchronization. It is understood that the data value of the data may be a value corresponding to a field name in the data, and the sum of the number of characters included in the field name and the number of characters included in the value corresponding to the field name may characterize the data length.
In some embodiments, generating the third data from the first data comprises: acquiring a first field name in first data; taking the first field name as a third field name of the third data, inserting a random character to complete a value corresponding to the third field name to obtain third data; and/or obtaining a first data length of the first data; and determining a third data length of the third data to be smaller than or equal to the first data length, inserting a random character to complete a third field name of the third data and a value corresponding to the third field name to obtain third data.
For example, the third data may be generated according to the first data, specifically, the preset data generation rule may be that the third field is determined according to the first field name, and the third data is generated according to the first field name of the acquired first data, and it can be understood that the third field name corresponding to the generated third data is the same as the first field name of the first data.
For example, the first data is "name: "abcdefg … …'", where a first field name of the first data is "name", a third field name of the generated third data is also "name", a value corresponding to the third field name may be determined by inserting a random character, and specifically, the generated third data may be "name: 'engsendse … …'.
For example, the preset data generation rule may further determine a third data length according to the first data length, and generate third data according to the first data length of the acquired first data, where the third data length of the third data is less than or equal to the first data length, and specifically, a sum of a number of characters included in a third field name and a number of characters included in a value corresponding to the third field name is less than or equal to a sum of a number of characters included in the first field name and a number of characters included in a value corresponding to the first field name.
For example, the first data length of the first data is 50 bytes, and the third data length of the generated third data is also 50 bytes, or may be smaller than 50 bytes.
For example, the third field name of the third data may be the same as the first field name of the first data, and the third data length of the third data is less than or equal to the first data length of the first data.
For example, the first data is "name: 'abcdfg … …' ″, where the first data length of the first data is 80 bytes, and the generated third data is "name: the third data length of the 'efjeiwong … …' ″ third data is also 80 bytes.
It should be noted that, the first field name and the first data length are illustrated by way of example, and the first field name and the first data length in this application are not limited, and other situations may also occur between the first field name and the first data length.
It is understood that, in the first data, there may be a plurality of first field names, and in the generated third data, there may also be a plurality of third field names, and each third field name is the same as the plurality of first field names.
Illustratively, the third data with the same field name or the same length is generated through the first data, so that the situation that the first database and/or the second database are incompatible with the third data to cause the failure of synchronization or the wrong judgment of the synchronization result is avoided.
It is to be understood that, in other embodiments, the second field name of the second data and/or the second data length of the second data are obtained, and the third data is generated according to the second field name of the second data and/or the second data length of the second data. The generation process may be the step of generating data according to the first data as described above, and will not be described here.
In some embodiments, generating third data from the first data and the second data comprises: acquiring a first data length of first data and a second data length of second data; and if the first data length is larger than the second data length, determining a third data length of the third data to be smaller than or equal to the second data length, and inserting a random character to complete a third field name of the third data and a value corresponding to the third field name to obtain third data.
For example, when third data is generated from the first data and the second data, a first data length of the first data may be obtained, a second data length of the second data may be obtained, and the size of the first data length and the size of the second data length may be compared to determine data with a shorter data length, for example, the first data length is greater than the second data length, and the third data length of the generated third data is smaller than or equal to the second data length.
For example, the generated third field name of the third data may be the same as the first field name of the first data or the second field name of the second data, or may be different from both the first field name and the second field name, and the random character is inserted to complement the third field name.
It can be understood that the third data length of the generated third data is smaller than or equal to the smaller one of the data lengths corresponding to the data of the two databases, which can avoid the situation that the third data cannot be matched due to incompatibility when the third data is synchronized into the first database and/or the second database, and can reduce the load of the databases, thereby speeding up the data link synchronization rate.
In some embodiments, prior to step S102, the method further comprises: acquiring a first field name in the first data and a second field name in the second data; judging whether the second field name is matched with the first field name or not; and if the second field name is judged to be matched with the first field name, generating third data according to the first data and/or the second data.
Illustratively, a first field name of first data is acquired, a second field name of second data is acquired, whether the second field name is matched with the first field name is judged, so as to avoid that when the second field name is not synchronized, the second field name in the second data in the second database is different from the first field name of the first data in the first database, and after the synchronization, the error judgment of the non-synchronization condition is caused by the fact that the field name in the second data is different from the first field name in the first database.
Illustratively, whether the second field name is the same as the first field name is predetermined, so as to improve the accuracy of the judgment.
It is understood that if a second field name exists in the second data, but the second field name does not have the same first field name in the first data, an error message, such as "the first database is not consistent with the second database structure", needs to be output.
It can be understood that, if all the second field names included in the second data in the second database are the corresponding field names found in the first field names included in the first data in the first database, after the third data is synchronized, whether the first database and the second database are synchronized successfully can be determined through the third field names corresponding to the third data, and the influence of the field names in the first database and the second database when the synchronization is not synchronized is eliminated, so that the probability of misjudgment is reduced, and the accuracy of judging whether the synchronization is successful is improved.
In some embodiments, determining whether the second field name matches the first field name comprises: comparing the second field name with the first field name; if the field name identical to the second field name can be inquired in the first data, the second field name is judged to be matched with the first field name.
For example, the first data may be all data in the first database, or may be partial data, and likewise, the second data may be all data or partial data in the second database.
Illustratively, the field names in the first data are traversed to obtain a plurality of first field names in the first data, similarly, the field names in the second data are traversed to obtain a plurality of second field names in the second data, the first field name is compared with the obtained first field name, and if the first field name with the same field name can be queried for each second field name, it is determined that the second field name matches the first field name.
If the field name identical to the second field name is not searched in the first data, the second field name is judged not to be matched with the first field name.
It can be understood that if at least one second field name fails to query the first field name with the same field name, it is determined that the second field name does not match the first field name.
For example, the first field name includes "name, id, source, address", and if the second field name includes "name, id, source", the first field name may be considered to match the second field name; if the second field name includes "name, channel, address", it can be considered that the first field name does not match the second field name.
For example, by determining whether the first field name matches the second field name, it may be avoided that the synchronization is erroneously determined to be incorrect when unmatched field names are found in the second database and the first database after the synchronization process.
And step S103, synchronizing the third data into the first database so that the second database synchronizes the third data from the first database.
Illustratively, the third data is synchronized to the first database, and it is understood that the synchronization may be the insertion of the third data into the first database.
After the third data is synchronized to the first database, the data processing system corresponding to the data link runs a preset functional statement, and executes a preset synchronization function corresponding to the preset functional statement, so that the second database synchronizes the third data from the first database. The function statement is used to describe a preset synchronization function, and the function statement may be, for example, an sql statement, such as an insert statement (insert function statement) and an update statement (update function statement), and by presetting the function statement, the data processing system corresponding to the data link executes a corresponding synchronization function to determine whether the data link is connected.
It can be understood that, if the data link is connected and/or the first database and the second database are synchronized successfully, after the data change occurs in the first database and the data processing system corresponding to the data link runs the function statement, the second database is enabled to perform the same data change operation as the first database, so that the changed data can be synchronized into the second database. It will be appreciated that whether the same data change operation occurred in the second database as the first database may be determined by whether third data exists in the second database.
For example, the third data may be inserted and/or updated into the first database to complete the synchronization of the third data into the first database.
Illustratively, updating the third data into the first database includes: determining fourth data corresponding to a third field name corresponding to the third data in the first database; the fourth data is updated to the third data.
It can be understood that the updating is to overwrite some data in the first database when not updated to obtain the updated first database, so that after determining whether the data link is connected or whether the synchronization between the first database and the second database is successful, the first database and/or the second database is restored to restore the overwritten data to the data when not updated.
And step S104, if the synchronized second database has third data, outputting indication information for indicating that the synchronization of the first database and the second database is successful.
For example, if it is determined that the third data exists in the second database, the synchronization between the first database and the second database may be considered to be successful and/or the data link where the first database and the second database are located may be connected.
For example, the output indication information may be "success" to indicate that the synchronization of the first database with the second database is successful.
It is understood that the indication information may be stored in the block chain, so that when other terminal devices need to determine whether the data link is connected, the indication information can be obtained by broadcasting to the block chain, so as to determine whether the data link is connected through the indication information. The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Illustratively, after the data processing system corresponding to the data link runs the synchronization function, whether third data exists is searched in the synchronized second database, it can be understood that, if the synchronization between the first database and the second database is successful, after the third data is inserted into the first database and when the data processing system corresponding to the data link runs the synchronization function, the second database also performs the insertion processing of the third data, so that after the data processing system corresponding to the data link runs the synchronization function, the third data can be searched in the synchronized second database.
It should be noted that, if the third field name corresponding to the third data has the corresponding first field name in the first database, and the third data is obtained by updating the corresponding first data in the first database, but the second database does not have the corresponding second field name, the third data may be inserted into the second database, so that the third data can be found in the second database when the first database and the second database are synchronized.
In some embodiments, the method further comprises: after the data link executes the preset synchronization function, comparing the field name contained in the synchronized second database with the third field name of the third data; and if the field name identical to the third field name exists in the current second database, determining that third data exists in the second database.
For example, after a preset time length or after the data processing system corresponding to the data link outputs information indicating that the synchronization function is completed, the field name included in the synchronized second database may be compared with the third field name of the third data, and if the third field name of the third data can be queried in the synchronized second database, it is determined that the third data exists in the synchronized second database.
And if the field name which is the same as the third field name of the third data is not inquired in the synchronized second database, determining that the synchronization between the second database and the first database is not successful and/or the data link is in an unconnected state.
In some embodiments, the method further comprises: and if the third data does not exist in the synchronized second database after the second database is synchronized with the first database, determining error information for indicating that the synchronization is unsuccessful, and outputting the error information.
For example, if it is determined that third data does not exist in the synchronized second database, it may be considered that the synchronization between the first database and the second database is not successful, or the data link where the first database and the second database are located is in an unconnected state, and error information used for indicating that the synchronization is unsuccessful is determined.
For example, the error information may be determined from a synchronization function statement executed by the data processing system to which the data link corresponds.
For example, if the data processing system corresponding to the data link runs the insert synchronization function statement, after the second database completes synchronization with the first database, the third data is not found in the synchronized second database, and the output error information may be "the second database fails to query the inserted third data".
If the data processing system corresponding to the data link runs the update synchronization function statement, after the second database completes synchronization with the first database, the third data is not found in the synchronized second database, and the output error information may be that the second database fails to inquire the updated third data.
Illustratively, by outputting error information corresponding to a synchronous function statement operated by the data processing system, a detection technician can know whether an error occurs when the third data is inserted or an error occurs when the third data is updated, the synchronous function statement can be replaced and the processing of the steps can be performed on the first database and the second database again, and repeated description is omitted here.
It can be understood that if the running of the replaced synchronization function statement still fails to find the third data in the second database, it may be considered that the synchronization of the first database and the second database is not successful.
In some embodiments, the method further comprises: when detecting that an operation of deleting target third data exists in the first database, synchronously deleting third data which are the same as the target third data in the second database; and if third data which are the same as the target third data do not exist in the second database, outputting indication information for indicating that the synchronization of the deleting functions of the first database and the second database is successful.
For example, after the synchronization of the insertion function and/or the update function of the third data is completed, it may be verified whether the synchronization of the deletion function of the first database and the second database is successful.
Illustratively, the target third data is deleted from the first database, a preset deletion function statement is obtained, and the deletion function statement is executed by the data processing system corresponding to the data link, so that the second database synchronously deletes the target third data, and if third data identical to the target third data does not exist in the second database, it can be determined that the deletion function is successfully synchronized.
In some embodiments, when the insert function and/or the update function of the first database and the second database are synchronized successfully and the delete function is also synchronized successfully, it is determined that the first database and the second database are synchronized successfully and/or that the data links where the first database and the second database are located are connected. It is understood that if the deletion function of the first database and the second database is not synchronized successfully, the first database and the second database are considered to be not synchronized successfully.
For example, the third data is synchronized into the first database through insertion processing and/or update processing, the data processing system runs a corresponding preset function statement to enable the second database to synchronize the third data from the first database, then the first database and the second database are synchronously verified, and if the verification result is that the data synchronization is successful, the synchronous deletion function is verified; and if the verification result is that the data synchronization is unsuccessful, determining error information and outputting the error information.
For example, when the insertion function and/or the update function of the second database and the deletion function can be synchronized with the first database, the indication information for indicating that the synchronization is successful is output; when the insertion function and/or the update function are not completed, and the deletion function is also not completed, the output error information may be "whether the insertion function and/or the update function are not synchronized, and whether the deletion function is synchronized or not cannot be confirmed"; when the synchronization of the inserting function and/or the updating function is determined to be successful, the third data can still be found in the second database after the synchronization deleting function is operated, and the output error information can be indication information of that the third data can still be found in the second database and the synchronization of the deleting function is not successful, so that a detector can know which link is in problem and obtain information of whether the synchronization of the first database and the second database is successful or whether the data links are communicated.
In the synchronous verification method for the databases provided in the above embodiments, the third data is generated according to the first data and the second data, so that the generated third data can conform to the table structure of the data in the first database and/or the second database, the load of the data processing system during the operation of the functional statement is reduced, the verification efficiency is improved, and the judgment error of whether the data links are connected or not due to the fact that the synchronization cannot be successfully performed due to the difference of the data structures between the databases is avoided during the synchronization. And the verification accuracy of the data link connectivity can be improved through the verification of various preset functions.
Referring to fig. 3, fig. 3 is a schematic diagram of a database synchronization verification apparatus according to an embodiment of the present application, where the database synchronization verification apparatus may be configured in a server or a terminal for executing the aforementioned database synchronization verification method.
As shown in fig. 3, the synchronization verification apparatus for a database includes: the data acquisition module 110, the data generation module 120, the data synchronization module 130, and the information output module 140.
The data obtaining module 110 is configured to obtain first data in a first database and second data in a second database, where the second database is used to synchronize data from the first database.
A data generating module 120, configured to generate third data according to the first data and/or the second data based on a preset data generating rule, where a data format of the third data is the same as a data format of the first data, and a data value of the third data is different from a data value of the first data and a data value of the second data.
A data synchronization module 130, configured to synchronize the third data to the first database, so that the second database synchronizes the third data from the first database.
The information output module 140 is configured to output indication information for indicating that the synchronization between the first database and the second database is successful if the synchronized second database has the third data.
Illustratively, the synchronous verification device of the database further comprises a data deleting module.
And the data deleting module is used for synchronously deleting third data which is the same as the target third data in the second database when detecting that the operation of deleting the target third data exists in the first database.
The information output module 140 is further configured to output indication information for indicating that the synchronization of the deletion functions of the first database and the second database is successful if third data that is the same as the target third data does not exist in the second database.
Illustratively, the information output module 150 is further configured to determine error information indicating that synchronization is unsuccessful if the third data does not exist in the synchronized second database after the synchronization of the second database with the first database is completed, and output the error information.
Illustratively, the data generating module 120 further includes a field name obtaining sub-module, a data length obtaining sub-module, and a data completing sub-module.
And the field name acquisition submodule is used for acquiring the first field name in the first data.
And the data length obtaining submodule is used for obtaining the first data length in the first data.
The data completion submodule is used for taking the first field name as a third field name of the third data, inserting random characters into the first field name and completing a value corresponding to the third field name to obtain third data; and/or determining a third data length of the third data to be smaller than or equal to the first data length, and inserting a random character to complete a third field name of the third data and a value corresponding to the third field name to obtain third data.
Illustratively, the data length obtaining sub-module is further configured to obtain a first data length of the first data and a second data length of the second data;
and the data completion submodule is further configured to determine that a third data length of the third data is smaller than or equal to the second data length if it is determined that the first data length is larger than the second data length, and complete a third field name of the third data and a value corresponding to the third field name by inserting a random character, so as to obtain third data.
Illustratively, the synchronous verification device of the database further comprises a field name comparison sub-module and a data determination sub-module.
And the field name comparison submodule is used for comparing the field name contained in the synchronized second database with the third field name of the third data.
And the data determining submodule is used for determining that the third data exists in the second database if the name which is the same as the name of the third field exists in the synchronized second database.
Illustratively, the synchronous verification device of the database further comprises a field name acquisition sub-module and a field name matching sub-module.
And the field name acquisition submodule is used for acquiring a first field name in the first data and a second field name in the second data.
And the field name matching submodule is used for judging whether the second field name is matched with the first field name or not.
The data generating module 120 is further configured to generate third data according to the first data and/or the second data if it is determined that the second field name is matched with the first field name.
It should be noted that, as will be clear to those skilled in the art, for convenience and brevity of description, the specific working processes of the apparatus, the modules and the units described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The methods of the present application are operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The above-described methods and apparatuses may be implemented, for example, in the form of a computer program that can be run on a computer device as shown in fig. 4.
Referring to fig. 4, fig. 4 is a schematic block diagram of a computer device according to an embodiment of the present disclosure. The computer device may be a server or a terminal.
As shown in fig. 4, the computer device includes a processor, a memory, and a network interface connected by a system bus, wherein the memory may include a storage medium and an internal memory.
The storage medium may store an operating system and a computer program. The computer program includes program instructions that, when executed, cause a processor to perform any one of the methods for synchronization verification of a database.
The processor is used for providing calculation and control capability and supporting the operation of the whole computer equipment.
The internal memory provides an environment for running a computer program in the storage medium, which when executed by the processor causes the processor to perform any one of the methods for synchronization verification of databases.
The network interface is used for network communication, such as sending assigned tasks and the like. Those skilled in the art will appreciate that the architecture shown in fig. 4 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
It should be understood that the Processor may be a Central Processing Unit (CPU), and the Processor may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Wherein, in one embodiment, the processor is configured to execute a computer program stored in the memory to implement the steps of:
acquiring first data in a first database and second data in a second database, wherein the second database is used for synchronizing data from the first database;
generating third data according to the first data and/or the second data based on a preset data generation rule, wherein the data format of the third data is the same as that of the first data, and the data value of the third data is different from that of the first data and the data value of the second data;
synchronizing the third data into the first database so that the second database synchronizes the third data from the first database;
and if the third data exists in the synchronized second database, outputting indication information for indicating that the synchronization of the first database and the second database is successful.
In one embodiment, the processor, when implementing the synchronization verification method for the database, is configured to implement:
when detecting that an operation of deleting target third data exists in the first database, synchronously deleting third data which are the same as the target third data in the second database;
and if third data which are the same as the target third data do not exist in the second database, outputting indication information for indicating that the synchronization of the deleting functions of the first database and the second database is successful.
In one embodiment, the processor, when implementing the synchronization verification method for the database, is configured to implement:
and if the third data does not exist in the synchronized second database after the second database is synchronized with the first database, determining error information for indicating that the synchronization is unsuccessful, and outputting the error information.
In one embodiment, the processor, when effecting generation of third data from the first data, is operable to effect:
acquiring a first field name in the first data;
taking the first field name as a third field name of the third data, and inserting a random character to complement a value corresponding to the third field name to obtain third data; and/or
Acquiring a first data length of the first data;
and determining a third data length of the third data to be smaller than or equal to the first data length, and inserting a random character to complete a third field name of the third data and a value corresponding to the third field name to obtain third data.
In one embodiment, the processor, in enabling generation of third data from the first data and the second data, is configured to enable:
acquiring a first data length of the first data and a second data length of the second data;
and if the first data length is larger than the second data length, determining a third data length of the third data to be smaller than or equal to the second data length, and inserting a random character to complete a third field name of the third data and a value corresponding to the third field name to obtain third data.
In one embodiment, the processor, when implementing the synchronization verification method for the database, is configured to implement:
comparing the field name contained in the synchronized second database with the third field name of the third data;
and if the name identical to the name of the third field exists in the synchronized second database, determining that the third data exists in the second database.
In one embodiment, the processor, when implementing the synchronization verification method for the database, is configured to implement:
acquiring a first field name in the first data and a second field name in the second data;
judging whether the second field name is matched with the first field name or not;
and if the second field name is judged to be matched with the first field name, generating third data according to the first data and/or the second data.
It should be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of describing the synchronous verification of the database may refer to the corresponding process in the embodiment of the synchronous verification control method of the database, and is not described herein again.
Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, where the computer program includes program instructions, and when the program instructions are executed, a method implemented by the computer program instructions may refer to various embodiments of a synchronization verification method for a database of the present application.
The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device.
It is to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items. It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system 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, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments. While the invention has been described with reference to specific embodiments, the scope of the invention is not limited thereto, and those skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A synchronous verification method for a database is characterized by comprising the following steps:
acquiring first data in a first database and second data in a second database, wherein the second database is used for synchronizing data from the first database;
generating third data according to the first data and/or the second data based on a preset data generation rule, wherein the data format of the third data is the same as that of the first data, and the data value of the third data is different from that of the first data and the data value of the second data;
synchronizing the third data into the first database so that the second database synchronizes the third data from the first database;
and if the third data exists in the synchronized second database, outputting indication information for indicating that the synchronization of the first database and the second database is successful.
2. The method for synchronous validation of databases as recited in claim 1, the method further comprising:
when detecting that an operation of deleting target third data exists in the first database, synchronously deleting third data which are the same as the target third data in the second database;
and if third data which are the same as the target third data do not exist in the second database, outputting indication information for indicating that the synchronization of the deleting functions of the first database and the second database is successful.
3. The method for synchronous validation of databases as recited in claim 1, the method further comprising:
and if the third data does not exist in the synchronized second database after the second database is synchronized with the first database, determining error information for indicating that the synchronization is unsuccessful, and outputting the error information.
4. The database synchronization verification method according to any one of claims 1 to 3, wherein the generating third data according to the first data based on a preset data generation rule comprises:
acquiring a first field name in the first data;
taking the first field name as a third field name of the third data, and inserting a random character to complement a value corresponding to the third field name to obtain third data; and/or
Acquiring a first data length of the first data;
and determining a third data length of the third data to be smaller than or equal to the first data length, and inserting a random character to complete a third field name of the third data and a value corresponding to the third field name to obtain third data.
5. The database synchronization verification method according to any one of claims 1 to 3, wherein the generating third data according to the first data and the second data based on a preset data generation rule comprises:
acquiring a first data length of the first data and a second data length of the second data;
and if the first data length is larger than the second data length, determining a third data length of the third data to be smaller than or equal to the second data length, and inserting a random character to complete a third field name of the third data and a value corresponding to the third field name to obtain third data.
6. A method for synchronous validation of databases as claimed in any of claims 1 to 3, the method further comprising:
comparing the field name contained in the synchronized second database with the third field name of the third data;
and if the name identical to the name of the third field exists in the synchronized second database, determining that the third data exists in the second database.
7. A method for synchronous validation of databases as claimed in any of claims 1 to 3, the method further comprising:
acquiring a first field name in the first data and a second field name in the second data;
judging whether the second field name is matched with the first field name or not;
and if the second field name is judged to be matched with the first field name, generating third data according to the first data and/or the second data.
8. A database synchronization verification apparatus, comprising:
the data acquisition module is used for acquiring first data in a first database and second data in a second database, and the second database is used for synchronizing data from the first database;
the data generating module is used for generating third data according to the first data and/or the second data based on a preset data generating rule, wherein the data format of the third data is the same as that of the first data, and the data value of the third data is different from that of the first data and the second data;
the data synchronization module is used for synchronizing the third data to the first database so that the second database synchronizes the third data from the first database;
and the information output module is used for outputting indication information for indicating that the first database and the second database are successfully synchronized if the synchronized second database has the third data.
9. A computer arrangement, characterized in that the computer arrangement comprises a processor, a memory, and a computer program stored on the memory and executable by the processor, wherein the computer program, when executed by the processor, carries out the steps of the method for synchronous verification of a database according to any of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon a computer program, wherein the computer program, when being executed by a processor, carries out the steps of the method for synchronization verification of a database according to any one of claims 1 to 7.
CN202210044768.3A 2022-01-14 2022-01-14 Synchronous verification method, device, equipment and storage medium of database Pending CN114416874A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210044768.3A CN114416874A (en) 2022-01-14 2022-01-14 Synchronous verification method, device, equipment and storage medium of database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210044768.3A CN114416874A (en) 2022-01-14 2022-01-14 Synchronous verification method, device, equipment and storage medium of database

Publications (1)

Publication Number Publication Date
CN114416874A true CN114416874A (en) 2022-04-29

Family

ID=81272565

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210044768.3A Pending CN114416874A (en) 2022-01-14 2022-01-14 Synchronous verification method, device, equipment and storage medium of database

Country Status (1)

Country Link
CN (1) CN114416874A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116436836A (en) * 2023-06-13 2023-07-14 阿里巴巴(中国)有限公司 Domain name data synchronous detection method, device and equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116436836A (en) * 2023-06-13 2023-07-14 阿里巴巴(中国)有限公司 Domain name data synchronous detection method, device and equipment
CN116436836B (en) * 2023-06-13 2023-09-01 阿里巴巴(中国)有限公司 Domain name data synchronous detection method, device and equipment

Similar Documents

Publication Publication Date Title
US8849750B2 (en) Synchronization for initialization of a remote mirror storage facility
CN108153784B (en) Synchronous data processing method and device
CN110704428A (en) Data indexing method and device for block chain, computer equipment and storage medium
CN111209343B (en) Node data synchronization method, device, equipment and storage medium
CN110737719B (en) Data synchronization method, device, equipment and computer readable storage medium
WO2024007481A1 (en) Fault detection method and apparatus for security chip, electronic device, and medium
CN111666087A (en) Operation rule updating method and device, computer system and readable storage medium
CN114461262A (en) Data processing method, system, device, equipment and computer storage medium
CN114416874A (en) Synchronous verification method, device, equipment and storage medium of database
CN113590181A (en) Configuration file checking method, device, equipment and storage medium
CN114625751A (en) Data tracing query method and device based on block chain
CN112765124B (en) Verification method for automatically verifying data and server
CN114840429A (en) Method, apparatus, device, medium and program product for identifying version conflicts
CN114564336A (en) Data consistency checking method, device, equipment and storage medium
CN112650569A (en) Timed task relation network graph generation method based on Oracle code and related equipment
CN112559546A (en) Database synchronization method and device, computer equipment and readable storage medium
CN105765908A (en) Method, client and system for multi-site automatic update
CN111400328A (en) Data updating method and device and node server
CN117971297B (en) Method, apparatus, computer device and storage medium for packet dependent synchronization
CN115080311B (en) Informatization remote control method and device for big data
CN117057974B (en) GPU big data platform, electronic equipment and storage medium
CN114710333B (en) Method, system, computer device and storage medium for data transmission and verification
CN113190575A (en) Data checking method and device, computer equipment and storage medium
CN113992334B (en) Storage method and verification method and device of equipment side data and electronic equipment
CN116702073B (en) Fault event prompting method and device, electronic equipment and storage medium

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