Data comparison method, device and storage medium
By using the difference rate to directly compare strong hash values in data comparison in the financial technology field, the inefficiency problem of traditional methods when most of the data is the same is solved, and efficient data comparison is achieved.
Patent Information
- Application Number
- CN202011273307.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-13
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2040-11-13
AI Technical Summary
In the data comparison process in the financial technology field, traditional methods are inefficient when most of the data are the same, resulting in a lot of time consumption and unable to meet the demand for efficient comparison.
By calculating the difference rate between the compared data block and the standard data block, if the difference rate is less than the preset value, the strong hash value will be directly calculated and compared instead of the weak hash value, reducing the number of hash value calculations and comparisons. Improve comparison efficiency.
It effectively improves the efficiency of data comparison, especially when most of the data is the same, it significantly reduces the calculation time and improves the comparison speed.
Smart Images

Figure CN112380203B
Abstract
Description
Technical Field
[0001] The present invention relates to data processing technology, and in particular to a data comparison method, device and storage medium. Background Art
[0002] With the development of computer technology, more and more technologies (big data, distributed, artificial intelligence, etc.) are being applied in the financial field. The traditional financial industry is gradually transforming to financial technology (Fintech). However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on service request technology. At present, in the field of financial technology, in order to ensure the accuracy of data, it is usually necessary to test the data, that is, to compare the actual data with the standard data to test whether the data has changed.
[0003] At present, when performing data comparison, the data to be compared and the standard data are usually divided into multiple data blocks in the same way, and the weak hash value of each data block and the weak hash value of each standard data block are calculated respectively. For a data block to be compared, if the weak hash value of the data block is different from the weak hash value of the corresponding standard data block, the strong hash value of the two data blocks is calculated again, and by comparing the strong hash values, it is determined whether the data in the two data blocks are the same.
[0004] However, when comparing data in a database, if most of the data to be compared are the same as the standard data, using the above method to compare the data will take a long time and result in low efficiency of data comparison. Summary of the invention
[0005] In order to solve the problems existing in the prior art, the present invention provides a data comparison method, device and storage medium, which can improve the efficiency of data comparison.
[0006] In a first aspect, an embodiment of the present application provides a data comparison method, comprising:
[0007] Obtaining a difference rate of at least one comparison data block relative to a standard data block, wherein the number of rows of data contained in each comparison data block is the same as the number of rows of data contained in each standard data block, and the at least one comparison data block includes all data blocks to be compared or data blocks before a first comparison data block to be compared;
[0008] If the difference rate is less than a preset value, determining a first strong hash value of the first comparison data block and a second strong hash value of a first standard data block corresponding to the first comparison data block;
[0009] If the first strong hash value is different from the second strong hash value, it is determined that the comparison between the first comparison data block and the first standard data block fails.
[0010] Optionally, if the at least one comparison data block includes a data block before the first comparison data block currently to be compared;
[0011] The obtaining of a difference rate of at least one comparison data block relative to a standard data block comprises:
[0012] Obtaining a first number of data blocks before the first comparison data block to be compared;
[0013] Determine a second number of data blocks that fail to be compared in the data blocks preceding the first comparison data block to be compared currently;
[0014] The difference rate is determined according to a ratio of the second number to the first number.
[0015] Optionally, if the at least one comparison data block includes all the data blocks to be compared;
[0016] The obtaining of a difference rate of at least one comparison data block relative to a standard data block comprises:
[0017] Obtaining the first number of rows of all data included in all the data blocks to be compared and the second number of rows of all data included in a plurality of standard data blocks;
[0018] The difference rate is determined according to a difference between the first number of lines and the second number of lines.
[0019] Optionally, the first comparison data block is other data blocks among all the comparison data blocks except the last comparison data block;
[0020] After determining that the comparison between the first comparison data block and the first standard data block fails, the method further includes:
[0021] Determine whether the last row of data in the first comparison data block is the same as the last row of data in the first standard data block;
[0022] If the last row of data in the first comparison data block is the same as the last row of data in the first standard data block, then the next comparison data block of the first comparison data block is compared with the next standard data block of the first standard data block.
[0023] Optionally, the method further includes:
[0024] If the last row of data in the first comparison data block is different from the last row of data in the first standard data block, re-determine the second comparison data block according to a preset number of rows starting from the Mth row of data in the first comparison data block;
[0025] Compare the second comparison data block with other standard data blocks after the first standard data block respectively;
[0026] If the second comparison data block fails to compare with the other standard data blocks, M+1 is added and the above steps are repeated until the data in all comparison data blocks are compared. M is a positive integer and the starting value of M is 2.
[0027] Optionally, the method further includes:
[0028] If there is a second standard data block in other standard data blocks that is successfully compared with the second comparison data block, the data after the second comparison data block is re-blocked according to a preset number of rows, and the first data block after the re-blocking is compared with the first standard data block after the second standard data block.
[0029] Optionally, the method further includes:
[0030] If the difference rate is not less than the preset value, respectively determining a first weak hash value of the first comparison data block and a second weak hash value of the first standard data block;
[0031] If the first weak hash value is the same as the second weak hash value, determining whether the first strong hash value is the same as the second strong hash value;
[0032] If the first strong hash value is different from the second strong hash value, it is determined that the comparison between the first comparison data block and the first standard data block fails.
[0033] In a second aspect, an embodiment of the present application provides a data comparison device, comprising:
[0034] An acquisition module, used for acquiring a difference rate of at least one comparison data block relative to a standard data block, wherein the number of rows of data contained in each comparison data block is the same as the number of rows of data contained in each standard data block, and the at least one comparison data block includes all data blocks to be compared or data blocks before a first comparison data block to be compared;
[0035] a determination module, configured to determine, when the difference rate is less than a preset value, a first strong hash value of the first comparison data block and a second strong hash value of a first standard data block corresponding to the first comparison data block;
[0036] The determining module is further configured to determine that the comparison between the first comparison data block and the first standard data block fails when the first strong hash value is different from the second strong hash value.
[0037] Optionally, if the at least one comparison data block includes a data block before the first comparison data block currently to be compared;
[0038] The acquisition module is specifically used for:
[0039] Obtaining a first number of data blocks before the first comparison data block to be compared;
[0040] Determine a second number of data blocks that fail to be compared in the data blocks preceding the first comparison data block to be compared currently;
[0041] The difference rate is determined according to a ratio of the second number to the first number.
[0042] Optionally, if the at least one comparison data block includes all the data blocks to be compared;
[0043] The acquisition module is specifically used for:
[0044] Obtaining the first number of rows of all data included in all the data blocks to be compared and the second number of rows of all data included in a plurality of standard data blocks;
[0045] The difference rate is determined according to a difference between the first number of lines and the second number of lines.
[0046] Optionally, the first comparison data block is other data blocks among all the comparison data blocks except the last comparison data block;
[0047] The device also includes: a judgment module and a comparison module;
[0048] The judging module is used to judge whether the last row of data in the first comparison data block is the same as the last row of data in the first standard data block;
[0049] The comparison module is used to compare the next comparison data block of the first comparison data block with the next standard data block of the first standard data block when the judgment module determines that the last row of data in the first comparison data block is the same as the last row of data in the first standard data block.
[0050] Optionally, the determination module is further configured to, if the last row of data in the first comparison data block is different from the last row of data in the first standard data block, re-determine the second comparison data block based on a preset number of rows starting from the Mth row of data in the first comparison data block;
[0051] The comparison module is also used to compare the second comparison data block with other standard data blocks after the first standard data block; if the comparison between the second comparison data block and the other standard data blocks fails, M+1 is added and the above steps are repeated until the data in all comparison data blocks are compared, where M is a positive integer and the starting value of M is 2.
[0052] Optionally, the comparison module is also used to: if there is a second standard data block in other standard data blocks and the comparison with the second comparison data block is successful, then the data after the second comparison data block is re-blocked according to a preset number of rows, and the first data block after the re-blocking is compared with the first standard data block after the second standard data block.
[0053] Optionally, the determination module is further configured to respectively determine a first weak hash value of the first comparison data block and a second weak hash value of the first standard data block if the difference rate is not less than the preset value;
[0054] The judging module is further configured to judge whether the first strong hash value is the same as the second strong hash value if the first weak hash value is the same as the second weak hash value;
[0055] The determining module is further configured to determine that the comparison between the first comparison data block and the first standard data block fails when the judging module determines that the first strong hash value is different from the second strong hash value.
[0056] In a third aspect, an embodiment of the present application provides a server, including:
[0057] Transceiver;
[0058] processor;
[0059] Memory; and
[0060] Computer programs;
[0061] The computer program is stored in the memory and is configured to be executed by the processor, wherein the computer program includes instructions for executing the method as described in the first aspect.
[0062] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program enables a server to execute the method described in the first aspect.
[0063] The data comparison method, device and storage medium provided by the present application obtain the difference rate of at least one comparison data block relative to the standard data block. When the difference rate is less than a preset value, the first strong hash value of the first comparison data block and the second strong hash value of the first standard data block corresponding to the first comparison data block are determined, so that the first comparison data block and the first standard data block are compared by comparing the first strong hash value and the second strong hash value. When the first strong hash value and the second strong hash value are different, it can be determined that the comparison between the first comparison data block and the first standard data block fails. Compared with the prior art, in the embodiment of the present application, when it is determined that the difference value is less than the preset value, the weak hash value of the first comparison data block and the weak hash value of the first standard data block will not be compared, but the strong hash values of the two will be directly compared. Since the time used to determine the difference rate of at least one comparison data block relative to the standard data block is much less than the time spent on calculating the weak hash value of the comparison data block, when the difference value is less than the preset value, the calculation of the weak hash value is omitted and the number of comparisons of the weak hash value is reduced, thereby improving the efficiency of data comparison. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0065] Figure 1 A system architecture diagram of a data comparison method provided in an embodiment of the present application;
[0066] Figure 2 A schematic diagram of a data comparison method provided in an embodiment of the present application;
[0067] Figure 3 A schematic diagram of data comparison;
[0068] Figure 4 Another schematic diagram for data comparison;
[0069] Figure 5 Another schematic diagram of a data comparison method provided in an embodiment of the present application;
[0070] Figure 6 This is another schematic diagram for data comparison;
[0071] Figure 7 Another schematic diagram for data comparison;
[0072] Figure 8 A schematic diagram of a data comparison device provided in an embodiment of the present application;
[0073] Fig. 9 Another schematic diagram of a data comparison device provided in an embodiment of the present application;
[0074] Fig.10 A schematic diagram of the structure of a server embodiment provided in an embodiment of the present application. DETAILED DESCRIPTION
[0075] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0076] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0077] In order to help those skilled in the art better understand the technical solution of the present application, the relevant contents involved in the technical solution of the present application are introduced below.
[0078] (1) Hive: An offline SQL data warehouse.
[0079] (2) Data comparison: Compare the data generated by the program twice in the same table to find out the different data rows. During testing, a copy of the expected number is usually saved and then compared with the actual data generated each time.
[0080] (3) Hash algorithm refers to mapping a binary value of arbitrary length to a shorter binary value of fixed length. This shorter binary value is called a hash value. Hash algorithms include strong hash algorithms and weak hash algorithms. The collision probability of the hash value obtained by the strong hash algorithm can be small enough to be ignored. As long as the collision probability of the hash value is small enough to be ignored, the hash algorithm can be called a strong hash algorithm. For the sake of simplicity, the hash value obtained by the strong hash algorithm can be called a strong hash value. Typical strong hash algorithms include Secure Hash Algorithm (SHA) 1, SHA256 and Message Digest Algorithm (MD) 5. Since the collision probability of the strong hash value obtained by the strong hash algorithm is negligible, different strong hash values correspond to different data, and the same strong hash value corresponds to the same data.
[0081] The hash value obtained by using a weak hash algorithm has a high probability of collision. For the sake of simplicity, the hash value obtained by using a weak hash algorithm can be called a weak hash value. Typical weak hash algorithms include: Cyclic Redundancy Check (CRC), XX Hash, Mumur Hash, etc. Since the weak hash value obtained by the weak hash algorithm has a high probability of collision, the data corresponding to the same weak hash value may be the same or different. However, the data corresponding to different weak hash values is different.
[0082] The data comparison method provided in the embodiment of the present application can be applied to the scenario of comparing data in a database system. For example, when testing a system, the data obtained after the system is running can be compared with the pre-stored standard data, thereby completing the test of the system. For another example, as the amount of data stored in the database increases, different types of data may be stored in different data blocks, and data information may be imported between each database. After the data information of the data block is imported, it is also involved to confirm whether the imported data information is correct. At this time, it is necessary to compare the imported data information with the previously stored data information.
[0083] In the prior art, when comparing data, the data to be compared written into the database and the pre-stored standard data can be compared line by line, or the data to be compared and the pre-stored standard data can be exported to text or Excel for comparison. However, the comparison efficiency is low by comparing line by line, and the comparison in text or Excel not only has low comparison efficiency, but also causes large system memory consumption.
[0084] In response to the above problems, the data to be compared and the standard data can be divided into blocks in the same way, that is, multiple lines of data are divided into one data block, thereby obtaining multiple data blocks to be compared and standard data blocks. Compared with the strong hash algorithm, the weak hash algorithm has a fast calculation speed, but the weak hash value obtained by the weak hash algorithm has a higher probability of conflict. Therefore, when performing data comparison, the weak hash value of each data block to be compared and the weak hash value of the standard data block are usually calculated first. If the weak hash value of the data block to be compared is different from the weak hash value of the corresponding standard data block, it means that the data in the data block to be compared is different from the data in the corresponding standard data block, and there is no need to perform strong hashing at this time. If the weak hash value of the data block to be compared is the same as the weak hash value of the corresponding standard data block, the data in the data block to be compared may be the same as or different from the data in the standard data block. Therefore, the strong hash value of the data block to be compared and the strong hash value of the corresponding standard data block will continue to be compared. If the strong hash value of the data block to be compared and the strong hash value of the corresponding standard data block are the same, it means that the data in the data block to be compared and the data in the corresponding standard data block are the same. If the strong hash value of the data block to be compared and the strong hash value of the corresponding standard data block are different, it means that the data in the data block to be compared and the data in the corresponding standard data block are different.
[0085] When performing system testing or verifying data correctness, usually most of the data to be compared and the standard data are the same. When performing data comparison in the above manner, it will be the case that the weak hash values of most of the data blocks to be compared are the same as the weak hash values of the corresponding standard data blocks. In this case, it will be necessary to continue comparing the strong hash values, which will take a long time and result in low data comparison efficiency.
[0086] In the embodiment of the present application, the above-mentioned problems are taken into consideration, and a data comparison method is proposed. In this method, if it is determined that the comparison data block to be compared is identical to most of the data in the standard data block, if the weak hash value of the comparison data block is compared with the weak hash value of the standard data block at this time, it is very likely that the weak hash values of the two are the same. Based on the above considerations, when doing data comparison, the step of comparing weak hash values can be omitted, and the strong hash value of the comparison data block and the strong hash value of the standard data block can be directly compared to compare the data. Since it takes a long time to calculate the weak hash value of the comparison data block, the above method can reduce the calculation of the weak hash value and the number of comparisons of the weak hash value, so as to reduce the time spent on calculating the weak hash value, thereby improving the comparison efficiency of the data.
[0087] Before describing the scheme of the data comparison method of the present application, Figure 1 Let's understand the system architecture of this application.
[0088] Figure 1This is a system architecture diagram of the data comparison method provided in the embodiment of the present application. Figure 1 As shown, the database system includes: a terminal device 102, a database 103 and a server 104. Among them, the user 101 can access the database 103 through the terminal device 102. The server 104 can be, for example, a hive database, or some servers in an enterprise, such as a server of an enterprise resource planning (Enterprise Resource Planning, ERP) or a warehouse management system (Warehouse Management System, WMS) system, and the data generated by the server 104 can be written into the database 103. It should be noted that the server 104 can be a single server or a server cluster consisting of multiple servers.
[0089] Taking the scenario of testing the system as an example, when the user 101 tests the system through the terminal device 102, the server 104 will write the generated data into the database 103. Since the database 103 stores standard data, the server can compare the data written into the database 103 with the pre-stored standard data. If the data comparison is consistent, it means that the system test has passed. If the data comparison is inconsistent, or the data difference rate is greater than the preset value, it means that the system test has failed.
[0090] In addition, the user 101 may also send a data comparison request to the server 104 through the terminal device 102 according to other needs, such as verifying the correctness of the data.
[0091] It should be understood that Figure 1 In the system architecture shown, the number of users 101, terminal devices 102, databases 103 and servers 104 is only exemplary, and more or less numbers belong to the protection scope of this application. In addition, in the above example operation scenario, the user 101 can use various devices to access the network, such as personal computers, servers, tablets, mobile phones, PDAs, notebooks or any other computing devices with networking functions. The database 103 can be implemented using a server or server group with more powerful processing capabilities and higher security. Figure 1The networks shown in the figure may include various types of wired and wireless networks, such as but not limited to: the Internet, local area networks, Wireless Fidelity (WIFI), Wireless Local Area Networks (WLAN), cellular communication networks (General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), 2G / 3G / 4G / 5G cellular networks), satellite communication networks, etc.
[0092] After understanding the system architecture of this application, combined with Figure 2 The scheme of the data comparison method of the present application is described in detail.
[0093] Figure 2 The present invention provides a data comparison method according to an embodiment of the present invention. The present invention provides a data comparison method, which can be executed by any device for executing the data comparison method, and the device can be implemented by software and / or hardware. In this embodiment, the device can be integrated in Figure 1 As shown in the server. Figure 2 As shown, the data comparison method provided in the embodiment of the present application includes the following steps:
[0094] Step 201: Obtain a difference rate between at least one comparison data block and a standard data block.
[0095] The number of data rows contained in each comparison data block is the same as the number of data rows contained in each standard data block, and at least one comparison data block includes all data blocks to be compared or data blocks before the first comparison data block to be compared.
[0096] In this step, the comparison data block is a data block obtained by dividing the actually generated data according to a preset number of rows, and the standard data block is a data block obtained by dividing the reference data or expected data according to a preset number of rows. In addition, the difference rate can also be understood as the difference, and the difference rate of at least one comparison data block relative to the standard data block can be used to indicate the proportion of different data in at least one comparison data block and the standard data block.
[0097] Exemplarily, since the database stores standard data, the server can sort the data table in the database according to the primary key and then export the text, so as to obtain the standard data and the total number of rows of the standard data L. Among them, since the primary key can be used to uniquely identify the data or the record, after sorting the data in the data table according to the primary key, since each data will be uniquely marked, the accuracy of data comparison can be improved when the standard data is subsequently compared in blocks.
[0098] After obtaining the standard data and the total number of rows of the standard data L, the standard data may be divided into data blocks according to the preset number of rows R, thereby obtaining N standard data blocks, where N=L MOD R. The server may save the obtained N standard data blocks.
[0099] Furthermore, when generating actual data, that is, comparison data that needs to be compared, these comparison data can be sorted according to the primary key and then exported as text to obtain S rows of comparison data, and the comparison data can be divided into blocks in the same way as the standard data to obtain multiple comparison data blocks. It should be noted that the number of rows of data contained in each comparison data block is the same as the number of rows of data contained in each standard data block, that is, each comparison data block contains R rows of data.
[0100] After the comparison data blocks are determined, the comparison data blocks and the standard data blocks may be compared in sequence starting from the first comparison data block and the first standard data block. The comparison method between the data blocks will be described in detail in the subsequent embodiments.
[0101] In order to improve data comparison efficiency, after determining the comparison data, the difference rate of at least one comparison data block relative to the standard data block can be determined, wherein the at least one comparison data block includes all data blocks to be compared or data blocks before the first comparison data block to be compared.
[0102] In one possible implementation, if at least one comparison data block includes all the data blocks to be compared, then when obtaining the difference rate of at least one comparison data block relative to the standard data block, the difference rate can be determined by obtaining the first number of rows of all data included in all the data blocks to be compared and the second number of rows of all data included in multiple standard data blocks, and based on the difference between the first number of rows and the second number of rows.
[0103] Specifically, when the data comparison is started for the first comparison data block, the first number of rows S of all comparison data, that is, the number of rows S of the generated actual data, and the second number of rows L of the pre-stored standard data are first obtained. The difference between the first number of rows S and the second number of rows L is calculated, and the difference rate of at least one comparison data block relative to the standard data block is determined according to the difference and a preset algorithm. For example, the ratio of the difference to the first number of rows S can be determined as the above-mentioned difference rate.
[0104] In this embodiment, when the data blocks are compared, the difference rate of at least one compared data block relative to the standard data block can be determined based on the number of rows of the compared data and the number of rows of the standard data, which can make the determination of the difference rate simpler.
[0105] In another possible implementation, if at least one comparison data block includes a data block before the first comparison data block to be compared, then when obtaining the difference rate of at least one comparison data block relative to the standard data block, the first number of data blocks before the first comparison data block to be compared can be obtained, and the second number of data blocks that failed to be compared in the data blocks before the first comparison data block to be compared can be determined, so that the difference rate can be determined based on the ratio of the second number to the first number.
[0106] Specifically, if the first comparison data block to be compared is not the first comparison data block, or it can also be understood that among the multiple comparison data blocks obtained, there is a data block that has been compared, the difference rate can be determined based on the data blocks that have been compared. It can be understood that, since the comparison is performed in sequence according to the sequence number or order of the data blocks, the data block before the first comparison data block to be compared is the data block that has been compared.
[0107] If there are data blocks that have been matched, the first number of data blocks before the first compared data block, that is, the first number Sa of data blocks that have been matched, and the second number Se of data blocks that failed to be matched among the data blocks that have been matched can be determined, so that the difference rate Ce of at least one compared data block relative to the standard data block can be determined according to the formula Ce=Se / Sa.
[0108] The failure of data block comparison may be understood as the inconsistency between the data in the comparison data block and the data included in the corresponding standard data block.
[0109] It should be noted that after each comparison of a comparison data block, the difference rate can be calculated in the above manner, so that the comparison method of the next comparison data block to be compared can be determined according to the currently calculated difference rate.
[0110] In this embodiment, when at least one comparison data block includes a data block before the first comparison data block to be compared, the difference rate can be determined based on a first number of data blocks before the first comparison data block and a second number of data blocks that failed the comparison. This not only makes the determination result of the difference rate more accurate, but also allows the difference rate to be determined in real time based on the data blocks that have been compared, thereby adjusting the comparison method of the data blocks, thereby improving the efficiency of data comparison.
[0111] Step 202: If the difference rate is less than a preset value, determine a first strong hash value of the first comparison data block and a second strong hash value of the first standard data block corresponding to the first comparison data block.
[0112] In this step, if the determined difference rate is less than the preset value, it means that the data in the comparison data block to be compared may be mostly the same as the data in the standard data block. At this time, the first strong hash value of the first comparison data block and the second strong hash value of the first standard data block that need to be compared can be directly determined. The first standard data block is a data block corresponding to the first comparison data block.
[0113] The preset value may be set according to actual conditions or experience, for example, 1%, or 2%, etc. The specific value of the preset value is not limited in the embodiment of the present application.
[0114] Exemplarily, after acquiring N standard data blocks, the server may use a weak hash algorithm to perform a weak hash check, such as using an rsync algorithm, to obtain a weak hash value for each standard data block, and use a strong hash algorithm to perform a strong hash check, such as using an MD5 or SHA1 algorithm, to obtain a strong hash value for each standard data block, thereby obtaining a hash check table as a basis for data comparison. The hash check table may be, for example, as shown in Table 1:
[0115] Table 1
[0116]
[0117]
[0118] In order to improve the efficiency of data comparison, the server can store the contents in Table 1 after calculating the weak hash value and strong hash value of each standard data block. In this way, when performing data comparison later, the server can directly obtain the weak hash value or strong hash value of the standard data block based on the pre-stored content.
[0119] Exemplarily, if the first comparison data block to be compared is the first data block among multiple comparison data blocks, if the server determines that the difference rate is less than a preset value, a strong hash algorithm can be used to perform a strong hash check on the first comparison data block, thereby obtaining a first strong hash value of the first comparison data block. In addition, since the first standard data block corresponding to the first comparison data block is S_1, the server can directly obtain the second strong hash value of the first standard data block S_1 according to Table 1.
[0120] Exemplarily, if the first comparison data block to be compared is not the first data block, assuming that the first comparison data block is the second data block, if the server determines that the difference rate is less than the preset value, a strong hash algorithm can be used to perform a strong hash check on the first comparison data block, thereby obtaining a first strong hash value of the first comparison data block. In addition, since the first standard data block corresponding to the first comparison data block is S_2, the server can directly obtain the second strong hash value of the first standard data block S_2 according to Table 1.
[0121] Furthermore, the server may determine whether the first strong hash value and the second strong hash value obtained above are the same.
[0122] Step 203: If the first strong hash value is different from the second strong hash value, it is determined that the comparison between the first comparison data block and the first standard data block fails.
[0123] In this step, if it is determined that the first strong hash value is different from the second strong hash value, it can be determined that the comparison between the first comparison data block and the first standard data block fails, that is, the data included in the first comparison data block and the data included in the first standard data block are completely or partially different.
[0124] The data comparison method provided in the embodiment of the present application obtains the difference rate of at least one comparison data block relative to the standard data block. When the difference rate is less than a preset value, the first strong hash value of the first comparison data block and the second strong hash value of the first standard data block corresponding to the first comparison data block are determined, so that the first comparison data block and the first standard data block are compared by comparing the first strong hash value and the second strong hash value. When the first strong hash value and the second strong hash value are different, it can be determined that the comparison between the first comparison data block and the first standard data block fails. Compared with the prior art, in the embodiment of the present application, when it is determined that the difference value is less than the preset value, the weak hash value of the first comparison data block and the weak hash value of the first standard data block will not be compared, but the strong hash values of the two will be directly compared. Since the time used to determine the difference rate of at least one comparison data block relative to the standard data block is much less than the time spent on calculating the weak hash value of the comparison data block, when the difference value is less than the preset value, the calculation of the weak hash value is omitted and the number of comparisons of the weak hash value is reduced, thereby improving the efficiency of data comparison.
[0125] Exemplarily, in order to further improve the efficiency of data comparison, when the first comparison data block is a data block other than the last comparison data block among all comparison data blocks, after it is determined that the comparison between the first comparison data block and the first standard data block fails, the server will determine whether the last row of data in the first comparison data block is the same as the last row of data in the first standard data block; if the last row of data in the first comparison data block is the same as the last row of data in the first standard data block, the next comparison data block of the first comparison data block is compared with the next standard data block of the first standard data block.
[0126] Specifically, if the first comparison data block fails to be compared with the first standard data block, it means that the data contained in the first comparison data block and the data contained in the first standard data block are completely different or partially different. It is not difficult to understand that if new data is inserted, deleted or modified in the first comparison data block, the comparison between the first comparison data block and the first standard data block will fail.
[0127] In the prior art, whenever the first comparison data block fails to be compared with the first standard data block, the first comparison data block is slid according to the offset value to obtain a new data block, and then the new data block is compared with other standard data blocks. The offset value is 1. In order to avoid missing data, only one row of data can be slid each time, but this method will result in low efficiency of data comparison.
[0128] In contrast, in the embodiment of the present application, if the first comparison data block is not the last data block, that is, if there are data blocks that need to be compared after the first comparison data, it can be determined whether the last row of data in the first comparison data block is the same as the last row of data in the first standard data block. If they are the same, it means that the first comparison data does not involve deletion or insertion of data, but only the data in the first comparison data is modified. Therefore, it is not necessary to slide the data in the first comparison data block one row at a time to form a new data block and then compare it with other standard data blocks as in the prior art, but directly scroll to the next comparison data block of the first comparison data block and the next standard data block of the first standard data block to compare the data blocks.
[0129] The last row of data in the first comparison data block can also be understood as the boundary data of the first comparison data block, and the last row of data in the first standard data block can also be understood as the boundary data of the first standard data block.
[0130] The method of comparing the next comparison data block of the first comparison data block with the next standard data block of the first standard data block is similar to the method of comparing the first comparison data block with the first standard data block, and will not be described in detail here.
[0131] For example, Figure 3 A schematic diagram of data comparison is shown in Figure 3 As shown, the standard data blocks include S_1, S_2, S_3, ... and S_N, and the comparison data blocks to be compared include A_1, A_2, ..., wherein each standard data block and each comparison data block contain R lines of data. It can be understood that each data block to be compared can also be understood as a comparison window. Assuming that the first comparison data block A_1 fails to be compared with the first standard data block S_1, and the boundary data Bs1 of S_1 is the same as the boundary data Ba1 of A_1, the data blocks will be scrolled, that is, A_2 and S_2 will be compared.
[0132] In this embodiment, when the last row of data in the first comparison data block is the same as the last row of data in the first standard data block, the next comparison data block of the first comparison data block can be directly compared with the next standard data block of the first standard data block, thereby improving the efficiency of data comparison.
[0133] Furthermore, if the last row of data in the first comparison data block is different from the last row of data in the first standard data block, then starting from the Mth row of data in the first comparison data block, the second comparison data block is re-determined according to the preset number of rows, and the second comparison data block is compared with other standard data blocks after the first standard data block. If the comparison between the second comparison data block and other standard data blocks fails, M+1 is added and the above steps are repeated until the data in all comparison data blocks are compared, where M is a positive integer and the starting value of M is 2.
[0134] Specifically, if the last row of data in the first comparison data block is different from the last row of data in the first standard data block, it means that the data in the first comparison data block may have newly inserted data or some data has been deleted. Therefore, the server will set an offset value and slide according to the offset value to re-divide the data block to compare the re-divided data block with the standard data block. Specifically, starting from the second row of data of the first comparison data block, the data to be compared can be re-blocked according to the preset number of rows R, so that the first comparison data block after re-blocking is determined as the second comparison data block, and the second comparison data block is sequentially compared with each other standard data block after the first standard data block in the N standard data blocks. If the second comparison data block fails to be compared with other standard data blocks, the data to be compared can be re-blocked according to the preset number of rows R starting from the row of data after the second row of data of the first comparison data block, and the first comparison data block after re-blocking is determined as the new second comparison data block, and the above process is repeated until the data in all comparison data blocks are compared.
[0135] It can be understood that the row of data after the second row of data in the first comparison data block may be data in the first comparison data block, or data in a comparison data block after the first comparison data block.
[0136] For example, Figure 4 Another schematic diagram of data comparison is shown in Figure 4As shown, the standard data blocks include S_1, S_2, S_3, ... and S_N, and the comparison data blocks that need to be compared include A_1, A_2, ..., wherein each standard data block and each comparison data block contain R lines of data. It can be understood that each data block to be compared can also be understood as a comparison window. Assume that the first comparison data block is A_1, if there is newly added difference data in A_1. When the comparison between S_1 and A_1 fails, and it is determined that the last line of data in S_1 is not the same as the last line of data in A_1, it will slide according to the data rows to re-block the comparison data according to R, such as taking the R lines of data starting from the second line of data of A_1 as the second comparison data block A_1', and comparing the second comparison data block A_1' with S_2, S_3, ... and S_N respectively. If the second comparison data block A_1' fails to compare with S_2, S_3, ... and S_N, If the comparison between the new second comparison data block A_1” and S_2, S_3, ... and S_N fails, the next R rows of data starting from the 3rd row of data of A_1 are used as the new second comparison data block A_1", and the new second comparison data block A_1" is compared with S_2, S_3, ... and S_N respectively. If the comparison between the new second comparison data block A_1" and S_2, S_3, ... and S_N fails, the next R rows of data starting from the 4th row of data of A_1 are used as the new second comparison data block, and the above process is repeated until the data in all the comparison data blocks are compared.
[0137] In this embodiment, if the last row of data in the first comparison data block is different from the last row of data in the first standard data block, the data blocks can be re-divided by sliding according to the data rows to complete the comparison of the data blocks. In this way, the accuracy of the data block comparison can also be guaranteed for the cases where newly inserted data and deleted data are present.
[0138] Exemplarily, if there is a second standard data block in other standard data blocks that successfully compares with the second comparison data block, the data after the second comparison data block is re-blocked according to a preset number of rows, and the first data block after the re-blocking is compared with the first standard data block after the second standard data block.
[0139] Specifically, if during the comparison process, there is a second standard data block and a newly divided second comparison data block in the standard data block and the comparison is successful, that is, the strong hash value of the second standard data block is the same as that of the second comparison data block, then the data after the second comparison data block can be re-divided into blocks according to a preset number of rows, and the first data block obtained after the division can be compared with the first standard data block after the second standard data block.
[0140] Following the above example, Figure 4As shown, if the re-divided second comparison data A_1"' is successfully compared with the second standard data block S_2, the data to be compared after A_1"' can be re-divided according to the preset number of rows R, and the first comparison data block B_1 obtained after the re-division can be compared with the first standard data block S_3 after the second standard data block S_2.
[0141] In this embodiment, if there is a second standard data block in other standard data blocks and the comparison with the second comparison data block is successful, the data after the second comparison data block can be re-blocked according to a preset number of rows, and the first data block after the re-blocking can be compared with the first standard data block after the second standard data block. Such a comparison method can not only ensure that there will be no omissions in the comparison data, but also improve the efficiency of data comparison.
[0142] Figure 5 Another schematic diagram of a data comparison method provided in an embodiment of the present application is shown in FIG. Figure 5 The embodiment shown in Figure 2 On the basis of the embodiment shown, the process of comparing the comparison data block with the standard data block when the difference rate is not less than the preset value is further described in detail. Figure 5 As shown, the data comparison method provided in the embodiment of the present application includes the following steps:
[0143] Step 501: Obtain a difference rate between at least one comparison data block and a standard data block.
[0144] The number of data rows contained in each comparison data block is the same as the number of data rows contained in each standard data block, and at least one comparison data block includes all data blocks to be compared or data blocks before the first comparison data block to be compared.
[0145] The implementation process and principle of step 501 are similar to those of step 201 and will not be repeated here.
[0146] Step 502: If the difference rate is not less than a preset value, a first weak hash value of the first comparison data block and a second weak hash value of the first standard data block are determined respectively.
[0147] In this step, if it is determined that the difference rate of at least one comparison data block relative to the standard data block is not less than a preset value, it means that there is a greater than preset amount of data in the comparison data block to be compared and the standard data block that is different. Compared with the strong hash algorithm, the weak hash value is determined faster and more efficiently by the weak hash algorithm. Therefore, the server can determine the first weak hash value of the first comparison data block and the second weak hash value of the first standard data block respectively.
[0148] For example, Figure 2As described in the illustrated embodiment, the weak hash value corresponding to each standard data block is pre-stored in the server (as shown in Table 1), so the server can directly obtain the second weak hash value of the first standard data block according to Table 1. In addition, the server can calculate the first weak hash value of the first comparison data block by a weak hash algorithm.
[0149] Step 503: If the first weak hash value is the same as the second weak hash value, determine whether the first strong hash value is the same as the second strong hash value.
[0150] If the first weak hash value is different from the second weak hash value, it means that the first comparison data block and the first standard data block fail to match, that is, different data exists in the first comparison data block and the first standard data block.
[0151] If the first weak hash value is the same as the second weak hash value, the data included in the first comparison data block and the first standard data block may be the same or different. In this case, a strong hash value with a lower probability of conflict is needed to compare the data. Specifically, the server can obtain the first strong hash value of the first comparison data block and the second strong hash value of the first standard data block, and compare the first strong hash value with the second strong hash value.
[0152] Step 504: If the first strong hash value is different from the second strong hash value, it is determined that the comparison between the first comparison data block and the first standard data block fails.
[0153] For example, Figure 6 Another schematic diagram of data comparison is shown in Figure 2. Figure 6 As shown, the standard data blocks include S_1, S_2, S_3, ... and S_N, and the comparison data blocks that need to be compared include A_1, A_2, ..., wherein each standard data block and each comparison data block contain R lines of data. It can be understood that each data block to be compared can also be understood as a comparison window. Assume that the first comparison data block is A_1, the first weak hash value of A_1 is A_Checksum_1, and the second weak hash value of S_1 is S_Checksum_1. If A_Checksum_1 and S_Checksum_1 are equal, then calculate the first strong hash value A_MD5string_1 of A_1, and obtain the second strong hash value of S_1 as S_MD5string_1. If A_MD5string_1 and S_MD5string_1 are consistent, then the data included in A_1 and S_1 are consistent.
[0154] If A_Checksum_1 and S_Checksum_1 are not equal, or A_MD5string_1 and S_MD5string_1 are not equal, it means that the comparison between A_1 and S_1 fails, that is, the data included in A_1 and S_1 are different.
[0155] Figure 7 Another schematic diagram of data comparison is shown in FIG. Figure 7 As shown, if the data of A_1 and S_1 are consistent, the data block will be scrolled, that is, S_2 and A_2 will be compared. The comparison method is similar to the comparison method of S_1 and A_1, which will not be repeated here.
[0156] It is worth noting that the data that slipped through in the actual data to be compared, that is, the data that failed to be compared, can be grouped with the standard data block that failed to be compared and recorded in the difference table. After all the data blocks are compared, the final difference table will be obtained, as shown in Table 2. Next, the data recorded in the difference table can be taken out and compared one by one to obtain data that is different from the standard data.
[0157] Table 2
[0158] serial number Standard data blocks Actual data block 1 S_1 Line number 0—aa 2 S_2—S4 Line number bb—cc 3 Sx Line number dd—ee 4 Sx1—Sx2 Line number ff—gg …… …… ……
[0159] The data comparison method provided by the embodiment of the present application can first compare the first weak hash value of the first comparison data block and the second weak hash value of the first standard data block when the difference rate is not less than a preset value. Compared with the calculation of the strong hash value, the calculation speed of the weak hash value is faster, so the data comparison efficiency can be improved. When the first weak hash value is the same as the second weak hash value, the data block is compared according to the first strong hash value and the second strong hash value, thereby improving the accuracy of the data comparison.
[0160] Figure 8 A schematic diagram of a data comparison device provided in an embodiment of the present application, such as Figure 8 As shown, the data comparison device 80 includes:
[0161] An acquisition module 801 is used to acquire a difference rate of at least one comparison data block relative to a standard data block, wherein the number of rows of data contained in each comparison data block is the same as the number of rows of data contained in each standard data block, and the at least one comparison data block includes all data blocks to be compared or data blocks before the first comparison data block to be compared;
[0162] A determination module 802, configured to determine, when the difference rate is less than a preset value, a first strong hash value of the first comparison data block and a second strong hash value of a first standard data block corresponding to the first comparison data block;
[0163] The determining module 802 is further configured to determine that the comparison between the first comparison data block and the first standard data block fails when the first strong hash value is different from the second strong hash value.
[0164] Optionally, if the at least one comparison data block includes a data block before the first comparison data block currently to be compared;
[0165] The acquisition module 801 is specifically used for:
[0166] Obtaining a first number of data blocks before the first comparison data block to be compared;
[0167] Determine a second number of data blocks that fail to be compared in the data blocks preceding the first comparison data block to be compared currently;
[0168] The difference rate is determined according to a ratio of the second number to the first number.
[0169] Optionally, if the at least one comparison data block includes all the data blocks to be compared;
[0170] The acquisition module 801 is specifically used for:
[0171] Obtaining the first number of rows of all data included in all the data blocks to be compared and the second number of rows of all data included in a plurality of standard data blocks;
[0172] The difference rate is determined according to a difference between the first number of lines and the second number of lines.
[0173] Fig. 9 Another schematic diagram of the data comparison device provided in the embodiment of the present application is as follows: Fig. 9 As shown, the data comparison device 80 further includes: a judgment module 803 and a comparison module 804;
[0174] Optionally, the first comparison data block is other data blocks among all the comparison data blocks except the last comparison data block;
[0175] The judging module 803 is used to judge whether the last row of data in the first comparison data block is the same as the last row of data in the first standard data block;
[0176] The comparison module 804 is used to compare the next comparison data block of the first comparison data block with the next standard data block of the first standard data block when the judgment module determines that the last row of data in the first comparison data block is the same as the last row of data in the first standard data block.
[0177] Optionally, the determination module 802 is further configured to, if the last row of data in the first comparison data block is different from the last row of data in the first standard data block, re-determine the second comparison data block according to a preset number of rows starting from the Mth row of data in the first comparison data block;
[0178] The comparison module 804 is also used to compare the second comparison data block with other standard data blocks after the first standard data block; if the comparison between the second comparison data block and the other standard data blocks fails, M+1 is added and the above steps are repeated until the data in all comparison data blocks are compared, where M is a positive integer and the starting value of M is 2.
[0179] Optionally, the comparison module 804 is also used for: if there is a second standard data block in other standard data blocks and the comparison with the second comparison data block is successful, then the data after the second comparison data block is re-blocked according to a preset number of rows, and the first data block after the re-blocking is compared with the first standard data block after the second standard data block.
[0180] Optionally, the determination module 802 is further configured to respectively determine a first weak hash value of the first comparison data block and a second weak hash value of the first standard data block if the difference rate is not less than the preset value;
[0181] The judging module 803 is further configured to judge whether the first strong hash value is the same as the second strong hash value if the first weak hash value is the same as the second weak hash value;
[0182] The determining module 802 is further configured to determine that the comparison between the first comparison data block and the first standard data block fails when the judging module determines that the first strong hash value is different from the second strong hash value.
[0183] The data comparison device 80 provided in the embodiment of the present application can execute the technical solution of the data comparison method in any of the above-mentioned embodiments. Its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the data comparison method. Please refer to the implementation principle and beneficial effects of the data comparison method, and no further details will be given here.
[0184] It should be noted that it should be understood that the division of the various modules of the above devices is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the determination module can be a separately established processing element, or it can be integrated in a chip of the above-mentioned device for implementation. In addition, it can also be stored in the memory of the above-mentioned device in the form of program code, and called and executed by a processing element of the above-mentioned device. The implementation of other modules is similar. In addition, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.
[0185] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more microprocessors (digital signal processors, DSP), or one or more field programmable gate arrays (FPGA), etc. For another example, when a module above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0186] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.
[0187] Fig.10 A schematic diagram of the structure of a server embodiment provided in the present application embodiment. Fig.10 As shown, the server may include: a processor 1001, a memory 1002, a communication interface 1003 and a system bus 1004, wherein the memory 1002 and the communication interface 1003 are connected to the processor 1001 via the system bus 1004 and communicate with each other, the memory 1002 is used to store computer execution instructions, the communication interface 1003 is used to communicate with other devices, and the processor 1001 implements the technical solution of the data comparison method shown in the above embodiment when executing the computer program.
[0188] In this Fig.10 In the embodiment, the processor 1001 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, or discrete hardware components.
[0189] The memory 1002 may include a random access memory (RAM), may include a read-only memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0190] The communication interface 1003 is used to implement the communication between the database access device and other devices (such as a client, a read-write library, and a read-only library).
[0191] The system bus 1004 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0192] Optionally, an embodiment of the present application further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the technical solution of the data comparison method shown in the above embodiment.
[0193] Optionally, an embodiment of the present application further provides a chip for running instructions, wherein the chip is used to execute the technical solution of the data comparison method shown in the above embodiment.
[0194] An embodiment of the present application also provides a program product, which includes a computer program, which is stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium, and when the at least one processor executes the computer program, it can implement the technical solution of the data comparison method shown in the above embodiment.
[0195] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the application disclosed herein. This application is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0196] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A data comparison method, characterized in that: include: Obtaining a difference rate of at least one comparison data block relative to a standard data block, wherein the number of rows of data contained in each comparison data block is the same as the number of rows of data contained in each standard data block, and the at least one comparison data block includes all data blocks to be compared or data blocks before a first comparison data block to be compared; If the at least one comparison data block includes a data block before the first comparison data block to be compared, the obtaining of the difference rate of the at least one comparison data block relative to the standard data block includes: obtaining a first number of data blocks before the first comparison data block to be compared; determining a second number of data blocks that fail to be compared among the data blocks before the first comparison data block to be compared; and determining the difference rate according to a ratio of the second number to the first number. If the at least one comparison data block includes all the data blocks to be compared, obtaining the difference rate of the at least one comparison data block relative to the standard data block includes: obtaining a first number of rows of all data included in all the data blocks to be compared and a second number of rows of all data included in a plurality of standard data blocks; determining the difference rate according to a difference between the first number of rows and the second number of rows; If the difference rate is less than a preset value, determining a first strong hash value of the first comparison data block and a second strong hash value of a first standard data block corresponding to the first comparison data block; If the first strong hash value is different from the second strong hash value, it is determined that the comparison between the first comparison data block and the first standard data block fails.
2. The method according to any one of claim 1, characterized in that: The first comparison data block is other data blocks among all the comparison data blocks except the last comparison data block; After determining that the comparison between the first comparison data block and the first standard data block fails, the method further includes: Determine whether the last row of data in the first comparison data block is the same as the last row of data in the first standard data block; If the last row of data in the first comparison data block is the same as the last row of data in the first standard data block, then the next comparison data block of the first comparison data block is compared with the next standard data block of the first standard data block.
3. The method according to claim 2, characterized in that The method further comprises: If the last row of data in the first comparison data block is different from the last row of data in the first standard data block, re-determine the second comparison data block according to a preset number of rows starting from the Mth row of data in the first comparison data block; Compare the second comparison data block with other standard data blocks after the first standard data block respectively; If the second comparison data block fails to compare with the other standard data blocks, M+1 is added and the above steps are repeated until the data in all comparison data blocks are compared. M is a positive integer and the starting value of M is 2.
4. The method according to claim 3, characterized in that The method further comprises: If there is a second standard data block in other standard data blocks that is successfully compared with the second comparison data block, the data after the second comparison data block is re-blocked according to a preset number of rows, and the first data block after the re-blocking is compared with the first standard data block after the second standard data block.
5. The method according to any one of claim 1, characterized in that: The method further comprises: If the difference rate is not less than the preset value, respectively determining a first weak hash value of the first comparison data block and a second weak hash value of the first standard data block; If the first weak hash value is the same as the second weak hash value, determining whether the first strong hash value is the same as the second strong hash value; If the first strong hash value is different from the second strong hash value, it is determined that the comparison between the first comparison data block and the first standard data block fails.
6. A data comparison device, characterized in that: include: An acquisition module, used for acquiring a difference rate of at least one comparison data block relative to a standard data block, wherein the number of rows of data contained in each comparison data block is the same as the number of rows of data contained in each standard data block, and the at least one comparison data block includes all data blocks to be compared or data blocks before a first comparison data block to be compared; If the at least one comparison data block includes a data block before the first comparison data block to be compared, the obtaining of the difference rate of the at least one comparison data block relative to the standard data block includes: obtaining a first number of data blocks before the first comparison data block to be compared; determining a second number of data blocks that fail to be compared among the data blocks before the first comparison data block to be compared; and determining the difference rate according to a ratio of the second number to the first number; If the at least one comparison data block includes all the data blocks to be compared, the obtaining of the difference rate of the at least one comparison data block relative to the standard data block includes: obtaining a first number of rows of all data included in all the data blocks to be compared and a second number of rows of all data included in a plurality of standard data blocks; and determining the difference rate according to a difference between the first number of rows and the second number of rows; a determination module, configured to determine, when the difference rate is less than a preset value, a first strong hash value of the first comparison data block and a second strong hash value of a first standard data block corresponding to the first comparison data block; The determination module is further configured to determine that the comparison between the first comparison data block and the first standard data block fails when the first strong hash value is different from the second strong hash value.
7. A server, characterized in that: include: Transceiver; processor; Memory; as well as Computer programs; The computer program is stored in the memory and is configured to be executed by the processor, wherein the computer program includes instructions for executing the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program enables the server to execute the method according to any one of claims 1 to 5.
