CN114020813A - Data comparison method, device and equipment based on Hash algorithm and storage medium - Google Patents

Data comparison method, device and equipment based on Hash algorithm and storage medium Download PDF

Info

Publication number
CN114020813A
CN114020813A CN202111353239.3A CN202111353239A CN114020813A CN 114020813 A CN114020813 A CN 114020813A CN 202111353239 A CN202111353239 A CN 202111353239A CN 114020813 A CN114020813 A CN 114020813A
Authority
CN
China
Prior art keywords
comparison
preset
baseline
test
compared
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
CN202111353239.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 Bank Co Ltd
Original Assignee
Ping An Bank 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 Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202111353239.3A priority Critical patent/CN114020813A/en
Publication of CN114020813A publication Critical patent/CN114020813A/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/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • 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/24Querying
    • G06F16/248Presentation of query results

Abstract

The embodiment of the invention discloses a data comparison method, a data comparison device, data comparison equipment and a storage medium based on a hash algorithm. The invention relates to the technical field of artificial intelligence, which comprises the following steps: if a preset comparison instruction is received, acquiring environmental information and comparison rule information from a preset database according to the preset comparison instruction; traversing a pre-configured comparison database according to the environmental information and the comparison rule information, and acquiring a base line comparison table and a test comparison table from the pre-configured comparison database; carrying out hash value comparison on the baseline table to be compared and the test table to be compared by a preset hash comparison method to obtain differential data, and writing the differential data into a preset comparison result table; and storing the preset comparison result table into a preset database, and generating a comparison record according to the differential data and the comparison rule information. The embodiment of the invention not only can save time and labor, but also can improve the data comparison efficiency.

Description

Data comparison method, device and equipment based on Hash algorithm and storage medium
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to a data comparison method, a data comparison device, data comparison equipment and a storage medium based on a hash algorithm.
Background
At present, before testing and verifying a version to be put into production, in order to enable a testing environment to be consistent with a baseline environment, wherein the testing environment is an environment which is not put into production, and the baseline environment is an environment which is put into production, data in a testing table under the testing environment and data in a baseline table under the baseline environment are compared in a manual comparison mode to find out differential data, so that time and labor are wasted, and the comparison efficiency is low.
Disclosure of Invention
The embodiment of the invention provides a data comparison method, a data comparison device, data comparison equipment and a storage medium based on a hash algorithm, and aims to solve the problems that time and labor are wasted and the comparison efficiency is low in the conventional data comparison process.
In a first aspect, an embodiment of the present invention provides a data comparison method based on a hash algorithm, including:
if a preset comparison instruction is received, acquiring environment information and comparison rule information from a preset database according to the preset comparison instruction, wherein the environment information comprises a baseline environment, a baseline version, a test environment and a test version, and the comparison rule information comprises a table name to be compared, a white list and an index value;
traversing a pre-configured comparison database according to the environmental information and the comparison rule information, and acquiring a baseline table to be compared and a test table to be compared from the pre-configured comparison database;
performing hash value comparison on the baseline table to be compared and the test table to be compared by a preset hash comparison method to obtain differential data, and writing the differential data into a preset comparison result table;
and storing the preset comparison result table to the preset database, and generating a comparison record according to the differentiation data and the comparison rule information.
In a second aspect, an embodiment of the present invention further provides a data comparison device based on a hash algorithm, including:
the device comprises a first obtaining unit, a comparison unit and a comparison unit, wherein the first obtaining unit is used for obtaining environment information and comparison rule information from a preset database according to a preset comparison instruction if the preset comparison instruction is received, the environment information comprises a baseline environment, a baseline version, a test environment and a test version, and the comparison rule information comprises a table name to be compared, a white list and an index value;
the second obtaining unit is used for traversing a pre-configured comparison database according to the environment information and the comparison rule information, and obtaining a baseline comparison table and a test comparison table from the pre-configured comparison database;
the comparison unit is used for carrying out hash value comparison on the baseline comparison table and the test comparison table through a preset hash comparison method to obtain differential data and writing the differential data into a preset comparison result table;
and the generating unit is used for storing the preset comparison result table to the preset database and generating a comparison record according to the differentiation data and the comparison rule information.
In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the above method when executing the computer program.
In a fourth aspect, the present invention also provides a computer-readable storage medium, which stores a computer program, and the computer program can implement the above method when being executed by a processor.
The embodiment of the invention provides a data comparison method, a data comparison device, data comparison equipment and a storage medium based on a hash algorithm. Wherein the method comprises the following steps: if a preset comparison instruction is received, acquiring environment information and comparison rule information from a preset database according to the preset comparison instruction, wherein the environment information comprises a baseline environment, a baseline version, a test environment and a test version, and the comparison rule information comprises a table name to be compared, a white list and an index value; traversing a pre-configured comparison database according to the environmental information and the comparison rule information, and acquiring a baseline table to be compared and a test table to be compared from the pre-configured comparison database; performing hash value comparison on the baseline table to be compared and the test table to be compared by a preset hash comparison method to obtain differential data, and writing the differential data into a preset comparison result table; and storing the preset comparison result table to the preset database, and generating a comparison record according to the differentiation data and the comparison rule information. According to the technical scheme of the embodiment of the invention, the acquired baseline table to be compared and the acquired test table to be compared are subjected to hash value comparison by using the preset hash comparison method to obtain the differential data, manual comparison is not needed, time and labor are saved, and the data comparison efficiency can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, 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 invention, 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 of a data comparison method based on a hash algorithm according to an embodiment of the present invention;
fig. 2 is a sub-flow diagram of a data comparison method based on a hash algorithm according to an embodiment of the present invention;
fig. 3 is a sub-flow diagram of a data comparison method based on a hash algorithm according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of a data comparison method based on a hash algorithm according to another embodiment of the present invention;
fig. 5 is a schematic flowchart of a data comparison method based on a hash algorithm according to another embodiment of the present invention;
fig. 6 is a schematic block diagram of a data comparison apparatus based on a hash algorithm according to an embodiment of the present invention; and
fig. 7 is a schematic block diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention 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 be further 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.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to a determination" or "in response to a detection". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a data comparison method based on a hash algorithm according to an embodiment of the present invention. The data comparison method based on the hash algorithm can be applied to a test end, is realized by an application program installed on the test end, such as a comparison tool, and not only can time and labor be saved, but also the data comparison efficiency can be improved. As shown in fig. 1, the method includes the following steps S100-S130.
S100, if a preset comparison instruction is received, acquiring environment information and comparison rule information from a preset database according to the preset comparison instruction, wherein the environment information comprises a baseline environment, a baseline version, a test environment and a test version, and the comparison rule information comprises a table name to be compared, a white list and an index value.
In the embodiment of the invention, after configuring the environmental information and the comparison rule information in the comparison tool, a tester clicks a comparison button in the comparison tool, and then triggers sending of a preset comparison instruction, the comparison tool receives the preset comparison instruction and obtains the environmental information and the comparison rule information from a preset database according to the preset comparison instruction, wherein the environmental information comprises a baseline environment, a baseline version, a test environment and a test version, and the comparison rule information comprises a table name to be compared, a white list and an index value.
It should be noted that, in the embodiment of the present invention, the environment information further includes a configuration date and whether the configuration date is valid, where whether the configuration date is valid is used to identify whether the environment information is valid; the comparison rule information also comprises information such as a comparison identifier, a responsible person, a table Chinese name and the like, wherein the comparison identifier is used for indicating whether the comparison rule information is effective or not.
S110, traversing a pre-configured comparison database according to the environment information and the comparison rule information, and acquiring a baseline table to be compared and a test table to be compared from the pre-configured comparison database.
In the embodiment of the present invention, after obtaining the environmental information and the comparison rule information from a preset database according to the preset comparison instruction, traversing a preconfigured comparison database according to the environmental information and the comparison rule information, and obtaining a baseline to-be-compared table and a test to-be-compared table from the preconfigured comparison database, wherein all baseline environmental data and test environmental data are stored in the preconfigured comparison database. Understandably, the table names of the baseline table to be compared and the test table to be compared are consistent with the table name to be compared.
Referring to fig. 2, in an embodiment, for example, in the embodiment, the step S110 includes the following steps S111 to S113.
S111, traversing a pre-configured comparison database according to the baseline environment and the baseline version, the test environment and the test version, and respectively acquiring a baseline version to be compared and a test version to be compared from the pre-configured comparison database;
s112, respectively obtaining a baseline table and a test table from the baseline to-be-compared version and the test to-be-compared version according to the to-be-compared table name;
s113, respectively shielding corresponding fields in the baseline table and the test table according to the white list to obtain a baseline table to be compared and a test table to be compared.
In the embodiment of the present invention, a preconfigured comparison database is traversed according to the baseline environment and the baseline version, and the test environment and the test version, and a baseline version to be compared and a test version to be compared are obtained from the preconfigured comparison database, for example, assuming that the baseline environment, the baseline version, the test environment and the test version are fat004, 2018-12-1812:00:00, fat006 and 2018-12-2912:00:00, respectively, and the baseline version to be compared and the test version are 2018-12-1812:00:00 and 2018-12-2912:00:00, respectively; and then, respectively obtaining a baseline table to be compared and a test table to be compared from the baseline version to be compared and the test version to be compared according to the comparison rule information, specifically, respectively obtaining a baseline table and a test table from the baseline version to be compared and the test version to be compared according to the table name to be compared, for example, assuming that the table name of the table to be compared is table-fat, the table names of the baseline table and the test table are both table-fat. After the baseline table and the test table are obtained, corresponding fields in the baseline table and the test table are respectively shielded according to the white list to obtain a baseline comparison table and a test comparison table, for example, if a field value corresponding to the white list is act-no, the act-no in the baseline comparison table and the test comparison table is shielded. In practical application, the fields corresponding to the white list in the baseline table and the test table can be shielded by marking a preset mark.
It should be noted that, in the embodiment of the present invention, the preconfigured comparison database may be a database server, and may also be a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, a cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), a big data and an artificial intelligence platform, and only needs to provide data.
And S120, carrying out hash value comparison on the baseline table to be compared and the test table to be compared through a preset hash comparison method to obtain differential data, and writing the differential data into a preset comparison result table.
In the embodiment of the invention, after a baseline table to be compared and a test table to be compared are obtained from a preconfigured comparison database, a preset hash comparison method is used for comparing hash values of the baseline table to be compared and the test table to be compared to obtain differentiated data, wherein the preset hash comparison method is that the hash value of the data to be compared in the table to be compared is solved through a hash algorithm according to the index value, then differentiated data is obtained through comparing whether the hash values are consistent, and the differentiated data is written into a preset comparison result table, wherein the hash algorithm is also called as a hash algorithm, an input with any length is converted into an output with a fixed length through the hash algorithm, and the output is a hash value.
Referring to fig. 3, in an embodiment, for example, in the embodiment, the step S120 includes the following steps S121 to S126.
S121, sequentially acquiring baseline data to be compared from the baseline data to be compared according to the index value and lines, and performing hash calculation on the baseline data to be compared to obtain a baseline hash value;
s122, sequentially obtaining test data to be compared from the test data to be compared according to the index value and performing hash calculation on the test data to be compared to obtain a test hash value;
s123, respectively storing the baseline hash value and the test hash value to a preset baseline hash bucket and a preset test hash bucket;
s124, starting a comparison thread, and sequentially comparing whether the hash value in the preset baseline hash bucket is consistent with the hash value in the preset test hash bucket;
s125, if the hash values are inconsistent, acquiring the index value corresponding to the hash value according to the hash value;
and S126, acquiring differential data from the baseline table to be compared and the test table to be compared respectively according to the index values, and writing the differential data into a preset comparison result table.
In the embodiment of the invention, the baseline table to be compared and the test table to be compared are subjected to hash value comparison by a preset hash comparison method to obtain differential data. Specifically, baseline data to be compared are sequentially acquired from the baseline data to be compared table in rows according to the index values, hash calculation is performed on the baseline data to be compared to obtain a baseline hash value, and the baseline hash value is stored in a preset baseline hash bucket; and sequentially acquiring test data to be compared from the test data to be compared according to the index value, performing hash calculation on the test data to be compared to obtain a test hash value, and storing the test hash value to the preset test hash bucket. It is to be understood that the order of calculation and storage of the baseline hash value and the test hash value is not particularly limited. After the baseline hash value and the test hash value are respectively stored in the preset baseline hash bucket and the preset test hash bucket, starting a comparison thread, and sequentially comparing whether the hash value in the preset baseline hash bucket is consistent with the hash value in the preset test hash bucket or not; if the hash values are consistent, the difference data does not exist, and then the comparison is continued; and if the hash values are inconsistent and the differentiated data exists, acquiring the index value corresponding to the hash value according to the hash value. In practical applications, the index values are ORG, batch-date, acct-sys-id, etc., that is, the index values are fields in the baseline comparison table and the test comparison table, and the types of the index values can be divided into a service primary key and a non-service primary key, where the service primary key is unique from service-level reaction data, such as an order number, a commodity number, etc.; the non-service primary key is a mark which is irrelevant to service and really reflects data uniqueness. After the index value is obtained, differential data are respectively obtained from the baseline table to be compared and the test table to be compared according to the index value, and the differential data are written into a preset comparison result table, wherein the preset comparison result table records index types, index values and corresponding differential data.
It should be noted that, in the embodiment of the present invention, the comparison thread is started, and the preset baseline hash bucket and the preset test hash bucket are used to compare hash values, instead of comparing data itself, so that comparison time can be saved, and comparison efficiency can be improved.
S130, storing the preset comparison result table to the preset database, and generating a comparison record according to the differentiation data and the comparison rule information.
In the embodiment of the present invention, after the differentiated data is written into the preset comparison result table, the preset comparison result table is stored in a preset file path of the preset database, and a comparison record is generated according to the differentiated data and the comparison rule information. Specifically, the comparison record includes information such as the name of the table to be compared, the literal name in the table, the person in charge, the number of lines of the differentiated data, the total number of comparison lines, and the like, and the testing personnel can roughly know the comparison condition through the comparison record. Understandably, if the line number of the differentiated data is 0, it indicates that no differentiated data exists, otherwise, if the line number of the differentiated data is not 0, it indicates that there is differentiated data, the comparison record is clicked to check.
Fig. 4 is a schematic flowchart of a data comparison method based on a hash algorithm according to another embodiment of the present invention, where the method is executed at a testing end. As shown in fig. 4, in the present embodiment, the method includes steps S100-S150. That is, in the present embodiment, the method further includes steps S140 and S150 before step S100 of the above embodiment.
S140, if a preset determination instruction is received, respectively acquiring environment information and comparison rule information from an environment information configuration page and a contract template configuration page according to the preset determination instruction;
s150, storing the environment information and the comparison rule information into a preset database.
In the embodiment of the invention, before clicking a comparison button in a comparison tool, a tester needs to set environment information and comparison rule information, wherein when the comparison rule information is set, the name of a table to be compared is selected, information such as a white list, an index value and the like corresponding to the name of the table to be compared can be intelligently pulled according to the name of the table to be compared, after the setting of the environment information and the comparison rule information is completed, a determination button of an environment information configuration page and a contract template configuration page is clicked respectively, a preset determination instruction is triggered to be sent, the comparison tool receives the preset determination instruction, the environment information and the comparison rule information are obtained from the environment information configuration page and the contract template configuration page respectively according to the preset determination instruction, and after the environment information and the comparison rule information are obtained, and storing the environment information and the comparison rule information into a preset database so as to facilitate the use of data comparison.
Fig. 5 is a schematic flowchart of a data comparison method based on a hash algorithm according to another embodiment of the present invention, where the method is executed at a testing end. As shown in fig. 5, in the present embodiment, the method includes steps S100-S160. That is, in the present embodiment, the method further includes step S160 after step S130 of the above embodiment.
And S160, if a preset comparison query instruction is received, acquiring the differentiated data in the preset comparison result table according to the preset comparison query instruction, and displaying the differentiated data.
In the embodiment of the invention, after the comparison record is generated, if the number of rows of the differential data in the comparison record is not 0, it is indicated that the differential data exists, a tester selects the comparison record on the comparison tool query page, clicks the query button, triggers the sending of a preset comparison query instruction, the comparison tool receives the preset comparison query instruction, obtains the differential data in the preset comparison result table according to the preset comparison query instruction, and displays the differential data, so that the tester can conveniently check the differential data.
Fig. 6 is a schematic block diagram of a data alignment apparatus 200 based on a hash algorithm according to an embodiment of the present invention. As shown in fig. 6, the present invention further provides a data comparison apparatus 200 based on a hash algorithm, corresponding to the above data comparison method based on a hash algorithm. The hash-based data matching apparatus 200 includes a unit for performing the hash-based data matching method, and may be configured at a testing end. Specifically, referring to fig. 6, the hash-based data comparison apparatus 200 includes a first obtaining unit 201, a second obtaining unit 202, a comparing unit 203, and a generating unit 204.
The first obtaining unit 201 is configured to, if a preset comparison instruction is received, obtain environment information and comparison rule information from a preset database according to the preset comparison instruction, where the environment information includes a baseline environment, a baseline version, a test environment, and a test version, and the comparison rule information includes a table name to be compared, a white list, and an index value; the second obtaining unit 202 is configured to traverse a preconfigured comparison database according to the environment information and the comparison rule information, and obtain a baseline table to be compared and a test table to be compared from the preconfigured comparison database; the comparison unit 203 is configured to perform hash value comparison on the baseline table to be compared and the test table to be compared by using a preset hash comparison method to obtain differential data, and write the differential data into a preset comparison result table; the generating unit 204 is configured to store the preset comparison result table in the preset database, and generate a comparison record according to the differentiation data and the comparison rule information.
In some embodiments, for example, in this embodiment, the second obtaining unit 202 includes a first obtaining subunit 2021, a second obtaining subunit 2022, and a shielding unit 2023.
The first obtaining subunit 2021 is configured to traverse a preconfigured comparison database according to the baseline environment and the baseline version, and the test environment and the test version, and obtain a baseline version to be compared and a test version to be compared from the preconfigured comparison database, respectively; the second obtaining subunit 2022 is configured to obtain a baseline table and a test table from the baseline to-be-compared version and the test to-be-compared version according to the to-be-compared table name; the shielding unit 2023 is configured to respectively shield corresponding fields in the baseline table and the test table according to the white list, so as to obtain a baseline table to be compared and a test table to be compared.
In some embodiments, for example, in this embodiment, the comparing unit 203 includes a first calculating unit 2031, a second calculating unit 2032, a storing unit 2033, a comparing subunit 2034, a third acquiring subunit 2035, and a fourth acquiring subunit 2036.
The first calculating unit 2031 is configured to sequentially obtain baseline to-be-compared data from the baseline to-be-compared table in rows according to the index value, and perform hash calculation on the baseline to-be-compared data to obtain a baseline hash value; the second calculating unit 2032 is configured to sequentially obtain test data to be compared from the test data to be compared in rows according to the index value, and perform hash calculation on the test data to be compared to obtain a test hash value; the saving unit 2033 is configured to save the baseline hash value and the test hash value to a preset baseline hash bucket and a preset test hash bucket, respectively; the comparison subunit 2034 is configured to start a comparison thread, and sequentially compare whether the hash value in the preset baseline hash bucket is consistent with the hash value in the preset test hash bucket; the third obtaining sub-unit 2035 is configured to, if the hash values are inconsistent, obtain the index value corresponding to the hash value according to the hash value; the fourth obtaining subunit 2036 is configured to obtain differential data from the baseline to-be-compared table and the test to-be-compared table according to the index value, and write the differential data into a preset comparison result table.
In some embodiments, such as this embodiment, the apparatus 200 further includes a third obtaining unit 205 and a storing unit 206.
The third obtaining unit 205 is configured to, if a preset determination instruction is received, obtain the environmental information and the comparison rule information from the environmental information configuration page and the contract template configuration page according to the preset determination instruction; the storage unit 206 is configured to store the environment information and the comparison rule information in a preset database.
In some embodiments, such as this embodiment, the apparatus 200 further includes a fourth obtaining unit 207.
The fourth obtaining unit 207 is configured to, if a preset comparison query instruction is received, obtain the differentiated data in the preset comparison result table according to the preset comparison query instruction, and display the differentiated data.
The specific implementation manner of the data comparison device 200 based on the hash algorithm in the embodiment of the present invention corresponds to the data comparison method based on the hash algorithm, and is not described herein again.
The data comparison device based on the hash algorithm may be implemented in the form of a computer program, and the computer program may be run on a computer device as shown in fig. 7.
Referring to fig. 7, fig. 7 is a schematic block diagram of a computer device according to an embodiment of the present invention. The computer device 900 is a testing terminal, and the testing terminal is an intelligent terminal device such as a laptop, a notebook, a desktop, etc.
Referring to fig. 7, the computer device 900 includes a processor 902, memory, and a network interface 905 connected by a system bus 901, where the memory may include a storage medium 903 and an internal memory 904.
The storage medium 903 may store an operating system 9031 and a computer program 9032. The computer program 9032, when executed, causes the processor 902 to perform a data comparison method based on a hash algorithm.
The processor 902 is used to provide computing and control capabilities to support the operation of the overall computer device 900.
The internal memory 904 provides an environment for running a computer program 9032 in the storage medium 903, and when the computer program 9032 is executed by the processor 902, the processor 902 can execute a data comparison method based on a hash algorithm.
The network interface 905 is used for network communication with other devices. Those skilled in the art will appreciate that the configuration shown in fig. 7 is a block diagram of only a portion of the configuration associated with aspects of the present invention and is not intended to limit the computing device 900 to which aspects of the present invention may be applied, and that a particular computing device 900 may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
Wherein the processor 902 is configured to run a computer program 9032 stored in the memory to implement the following steps: if a preset comparison instruction is received, acquiring environment information and comparison rule information from a preset database according to the preset comparison instruction, wherein the environment information comprises a baseline environment, a baseline version, a test environment and a test version, and the comparison rule information comprises a table name to be compared, a white list and an index value; traversing a pre-configured comparison database according to the environmental information and the comparison rule information, and acquiring a baseline table to be compared and a test table to be compared from the pre-configured comparison database; performing hash value comparison on the baseline table to be compared and the test table to be compared by a preset hash comparison method to obtain differential data, and writing the differential data into a preset comparison result table; and storing the preset comparison result table to the preset database, and generating a comparison record according to the differentiation data and the comparison rule information.
In some embodiments, for example, in this embodiment, when the processor 902 implements the steps of traversing the preconfigured comparison database according to the environment information and the comparison rule information, and obtaining the baseline to-be-compared table and the test to-be-compared table from the preconfigured comparison database, the following steps are specifically implemented: traversing a pre-configured comparison database according to the baseline environment and the baseline version, the test environment and the test version, and respectively acquiring a baseline version to be compared and a test version to be compared from the pre-configured comparison database; respectively acquiring a baseline table and a test table from the baseline version to be compared and the test version to be compared according to the names of the tables to be compared; and respectively shielding corresponding fields in the baseline table and the test table according to the white list so as to obtain a baseline table to be compared and a test table to be compared.
In some embodiments, for example, in this embodiment, when the processor 902 implements the steps of comparing the hash values of the baseline to-be-compared table and the test to-be-compared table by using a preset hash comparison method to obtain differential data, and writing the differential data into a preset comparison result table, the following steps are specifically implemented: sequentially acquiring baseline data to be compared from the baseline data to be compared table according to the index value, and performing hash calculation on the baseline data to be compared to obtain a baseline hash value; sequentially acquiring test data to be compared from the test data to be compared according to the index value and performing hash calculation on the test data to be compared to obtain a test hash value; respectively storing the baseline hash value and the test hash value to a preset baseline hash bucket and a preset test hash bucket; starting a comparison thread, and sequentially comparing whether the hash value in the preset baseline hash bucket is consistent with the hash value in the preset test hash bucket or not; if the hash values are inconsistent, acquiring the index value corresponding to the hash value according to the hash value; and acquiring differential data from the baseline table to be compared and the test table to be compared respectively according to the index values, and writing the differential data into a preset comparison result table.
In some embodiments, for example, in this embodiment, before the step of obtaining the environment information and the comparison rule information from the preset database according to the preset comparison instruction if the preset comparison instruction is received, the processor 902 further includes the following steps: if a preset determination instruction is received, respectively acquiring environment information and comparison rule information from an environment information configuration page and a contract template configuration page according to the preset determination instruction; and storing the environment information and the comparison rule information into a preset database.
In some embodiments, for example, in this embodiment, after the step of storing the preset comparison result table in the preset database and generating the comparison record according to the differentiation data and the comparison rule information is implemented by the processor 902, the specific implementation further includes the following steps: and if a preset comparison query instruction is received, acquiring the differentiated data in the preset comparison result table according to the preset comparison query instruction, and displaying the differentiated data.
It should be understood that, in the embodiment of the present invention, the Processor 902 may be a Central Processing Unit (CPU), and the Processor 902 may also 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, and the like. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will be understood by those skilled in the art that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program instructing associated hardware. The computer program may be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program. The computer program, when executed by a processor, causes the processor to perform any of the embodiments of the hash algorithm based data alignment method described above.
The storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk, which can store various computer readable storage media.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, various elements or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be merged, divided and deleted according to actual needs. In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a terminal, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, while the invention has been described with respect to the above-described embodiments, it will be understood that the invention is not limited thereto but may be embodied with various modifications and changes.
While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A data comparison method based on a hash algorithm is characterized by comprising the following steps:
if a preset comparison instruction is received, acquiring environment information and comparison rule information from a preset database according to the preset comparison instruction, wherein the environment information comprises a baseline environment, a baseline version, a test environment and a test version, and the comparison rule information comprises a table name to be compared, a white list and an index value;
traversing a pre-configured comparison database according to the environmental information and the comparison rule information, and acquiring a baseline table to be compared and a test table to be compared from the pre-configured comparison database;
performing hash value comparison on the baseline table to be compared and the test table to be compared by a preset hash comparison method to obtain differential data, and writing the differential data into a preset comparison result table;
and storing the preset comparison result table to the preset database, and generating a comparison record according to the differentiation data and the comparison rule information.
2. The method of claim 1, wherein traversing a preconfigured alignment database according to the environmental information and the alignment rule information, and obtaining a baseline to-be-aligned table and a test to-be-aligned table from the preconfigured alignment database comprises:
traversing a pre-configured comparison database according to the baseline environment and the baseline version, the test environment and the test version, and respectively acquiring a baseline version to be compared and a test version to be compared from the pre-configured comparison database;
and respectively acquiring a baseline comparison table and a test comparison table from the baseline comparison version and the test comparison version according to the comparison rule information.
3. The method according to claim 2, wherein the obtaining a baseline to-be-compared table and a test to-be-compared table from the baseline to-be-compared version and the test to-be-compared version according to the comparison rule information comprises:
respectively acquiring a baseline table and a test table from the baseline version to be compared and the test version to be compared according to the names of the tables to be compared;
and respectively shielding corresponding fields in the baseline table and the test table according to the white list so as to obtain a baseline table to be compared and a test table to be compared.
4. The method of claim 1, wherein the comparing the hash value of the baseline table to be compared and the test table to be compared by a preset hash comparison method to obtain differential data, and writing the differential data into a preset comparison result table comprises:
sequentially acquiring baseline data to be compared from the baseline data to be compared table according to the index value, and performing hash calculation on the baseline data to be compared to obtain a baseline hash value;
sequentially acquiring test data to be compared from the test data to be compared according to the index value and performing hash calculation on the test data to be compared to obtain a test hash value;
and comparing the baseline hash value with the test hash value to obtain differential data, and writing the differential data into a preset comparison result table.
5. The method of claim 4, wherein comparing the baseline hash value and the test hash value to obtain differentiated data, and writing the differentiated data into a preset comparison result table comprises:
respectively storing the baseline hash value and the test hash value to a preset baseline hash bucket and a preset test hash bucket;
starting a comparison thread, and sequentially comparing whether the hash value in the preset baseline hash bucket is consistent with the hash value in the preset test hash bucket or not;
if the hash values are inconsistent, acquiring the index value corresponding to the hash value according to the hash value;
and acquiring differential data from the baseline table to be compared and the test table to be compared respectively according to the index values, and writing the differential data into a preset comparison result table.
6. The method of claim 1, wherein before the step of obtaining the environmental information and the comparison rule information from the predetermined database according to the predetermined comparison instruction if the predetermined comparison instruction is received, the method further comprises:
if a preset determination instruction is received, respectively acquiring environment information and comparison rule information from an environment information configuration page and a contract template configuration page according to the preset determination instruction;
and storing the environment information and the comparison rule information into a preset database.
7. The method of claim 1, wherein after storing the preset comparison result table in the preset database and generating a comparison record according to the differentiation data and the comparison rule information, the method further comprises:
and if a preset comparison query instruction is received, acquiring the differentiated data in the preset comparison result table according to the preset comparison query instruction, and displaying the differentiated data.
8. A data comparison device based on a hash algorithm is characterized by comprising:
the device comprises a first obtaining unit, a comparison unit and a comparison unit, wherein the first obtaining unit is used for obtaining environment information and comparison rule information from a preset database according to a preset comparison instruction if the preset comparison instruction is received, the environment information comprises a baseline environment, a baseline version, a test environment and a test version, and the comparison rule information comprises a table name to be compared, a white list and an index value;
the second obtaining unit is used for traversing a pre-configured comparison database according to the environment information and the comparison rule information, and obtaining a baseline comparison table and a test comparison table from the pre-configured comparison database;
the comparison unit is used for carrying out hash value comparison on the baseline comparison table and the test comparison table through a preset hash comparison method to obtain differential data and writing the differential data into a preset comparison result table;
and the generating unit is used for storing the preset comparison result table to the preset database and generating a comparison record according to the differentiation data and the comparison rule information.
9. A computer arrangement, characterized in that the computer arrangement comprises a memory having stored thereon a computer program and a processor implementing the method according to any of claims 1-7 when executing the computer program.
10. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method according to any one of claims 1-7.
CN202111353239.3A 2021-11-16 2021-11-16 Data comparison method, device and equipment based on Hash algorithm and storage medium Pending CN114020813A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111353239.3A CN114020813A (en) 2021-11-16 2021-11-16 Data comparison method, device and equipment based on Hash algorithm and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111353239.3A CN114020813A (en) 2021-11-16 2021-11-16 Data comparison method, device and equipment based on Hash algorithm and storage medium

Publications (1)

Publication Number Publication Date
CN114020813A true CN114020813A (en) 2022-02-08

Family

ID=80064572

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111353239.3A Pending CN114020813A (en) 2021-11-16 2021-11-16 Data comparison method, device and equipment based on Hash algorithm and storage medium

Country Status (1)

Country Link
CN (1) CN114020813A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115221245A (en) * 2022-07-14 2022-10-21 广州纳指数据智能科技有限公司 Intelligent data acquisition synchronization method, system and equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115221245A (en) * 2022-07-14 2022-10-21 广州纳指数据智能科技有限公司 Intelligent data acquisition synchronization method, system and equipment

Similar Documents

Publication Publication Date Title
US8868595B2 (en) Enhanced control to users to populate a cache in a database system
CN107729227B (en) Application program test range determining method, system, server and storage medium
CN109885786B (en) Data caching processing method and device, electronic equipment and readable storage medium
US20090006933A1 (en) Server Directory Schema Comparator
MX2013014800A (en) Recommending data enrichments.
US20070044085A1 (en) Integrated software for managing add-ons
CN111026775A (en) Method and device for determining correlation index, server and storage medium
WO2019161620A1 (en) Application dependency update method, terminal and device, and storage medium
CN111159227B (en) Data query method, device, equipment and storage medium
CN107368513B (en) Method and device for updating client database
WO2018188222A1 (en) A2l file merging method and device
CN114020813A (en) Data comparison method, device and equipment based on Hash algorithm and storage medium
US7610293B2 (en) Correlation of resource usage in a database tier to software instructions executing in other tiers of a multi tier application
CN108694172B (en) Information output method and device
CN112861182A (en) Database query method and system, computer equipment and storage medium
CN111737148A (en) Automatic regression testing method and device, computer equipment and storage medium
CN110097113B (en) Method, device and system for monitoring working state of display information delivery system
CN111221742A (en) Test case updating method and device, storage medium and server
CN116340318A (en) Method, device, equipment and storage medium for processing secondary index record
CN112100092A (en) Information caching method, device, equipment and medium
US20050120352A1 (en) Meta directory server providing users the ability to customize work-flows
WO2015068259A1 (en) Information provision method and device, and program
CN113704114A (en) Automatic testing method, device, equipment and medium for functional interface
CA3048699C (en) Join pattern agnostic aggregate computation in database query operations
TW201209744A (en) Method of recording information of merchandise visited by consumers, and searching method and server

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