A data migration verification method, device and equipment and a storage medium
By performing hash calculations on each character before and after the migration, forming a new string, and then performing BKDR hash calculations, the consistency verification problem before and after the migration of rich text format data is solved, and the effectiveness of data consistency verification is realized.
Patent Information
- Application Number
- CN202311177326.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-13
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2043-09-13
AI Technical Summary
Existing technologies cannot effectively verify the consistency of rich text format data containing Chinese characters before and after migration, and the BKDR hash algorithm is not applicable to such data.
For each character before and after the migration, a hash calculation is performed to obtain the hash value of the character. After forming a new string, a BKDR hash calculation is performed to determine data consistency.
It achieves effective consistency verification of rich text format data, solves the problem that the BKDR hash algorithm cannot be applied, and ensures the consistency verification of migrated data.
Smart Images

Figure CN117290332B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data migration technology, and in particular to a data migration verification method, apparatus, device and storage medium. Background Technology
[0002] After data is migrated from the source system database to the target system database, it is necessary to verify whether the data before and after the migration is consistent to confirm whether the data migration was successful. In verifying data consistency, relevant technologies propose using the BKDR hash algorithm to calculate the hash values of the data before and after the migration, and comparing the two hash values to determine if the data is consistent. During the BKDR hash calculation process, the hash value of the previous character is applied to the hash calculation of the next character, ultimately resulting in a unique BKDR hash value for the string. A change in any character within the string will also lead to a different final output BKDR hash value, thus making it suitable for scenarios involving verifying the consistency of data before and after migration.
[0003] In BKDR hash calculation, the American Standard Code for Information Interchange (ASCII) of each character is used as the value for calculation. However, since ASCII encoding cannot encode Chinese characters, there is an urgent need for a verification method for rich text format data containing Chinese characters. Summary of the Invention
[0004] The exemplary embodiments of this application provide a data migration verification method, apparatus, device, and storage medium for implementing migration verification of rich text format data.
[0005] Firstly, this application proposes a data migration verification method, including:
[0006] A hash calculation is performed on at least one character included in the source data before migration to obtain a first hash value of the at least one character included in the source data, and a hash calculation is performed on at least one character included in the target data after migration to obtain a first hash value of the at least one character included in the target data.
[0007] Using the first hash value of the at least one character as the value of the at least one character, perform BKDR hash calculation on the source data and the target data respectively to determine the second hash value of the source data and the second hash value of the target data;
[0008] Based on the comparison between the second hash value of the source data and the second hash value of the target data, it is determined whether the source data and the target data are consistent.
[0009] Based on the above scheme, this application proposes that when performing data migration verification, firstly, a hash calculation is performed on each character of the data to be verified to determine the hash value of each character. Then, a new string composed of the hash values of each character is used to perform a BKDR hash calculation to determine a hash value that uniquely represents the data to be verified, and this is used to verify the consistency of the data before and after migration. The scheme proposed in this application solves the problem that rich text format strings cannot be used for consistency verification using the BKDR hash algorithm.
[0010] In one or more embodiments, the source data includes at least one character that is all the characters of the source data; the target data includes at least one character that is all the characters of the target data.
[0011] In one or more embodiments, the step of performing a hash calculation on each character of the source data before migration to obtain a first hash value corresponding to each character of the source data includes:
[0012] Obtain the hexadecimal value of each character included in the source data;
[0013] Calculate the hash value of each sign bit based on the value of each sign bit in the hexadecimal value of the first character; wherein, the first character is any one of the multiple characters included in the source data;
[0014] Use the hash value of the last sign bit obtained from the calculation as the first hash value of the first character.
[0015] In one or more embodiments, the hash value of the first sign bit in the hexadecimal value of the first character is the value of the first sign bit; the hash values of the sign bits other than the first sign bit in the hexadecimal value of the first character are calculated using the following formula:
[0016] H i =H i-1 *16+A i
[0017] Among them, H i H is the hash value of the i-th sign bit. i-1 Let A be the hash value of the -1st sign bit. i Let be the value of the i-th sign bit.
[0018] In one or more embodiments, the source data is data stored in the source system database before migration, and the target data is data stored in the target system database after migration; before obtaining the first hash value corresponding to each character, the method further includes:
[0019] Obtain the target encoding format used by the target system;
[0020] Each character in the source data is converted into a character in the target encoding format.
[0021] Secondly, this application proposes a data migration verification device, the device comprising:
[0022] The hash calculation module is used to perform hash calculation on at least one character included in the source data before migration to obtain a first hash value of at least one character included in the source data, and to perform hash calculation on at least one character included in the target data after migration to obtain a first hash value of at least one character included in the target data.
[0023] The hash calculation module is further configured to perform BKDR hash calculations on the source data and the target data respectively, using the first hash value of the at least one character as the value of the at least one character, to determine the second hash value of the source data and the second hash value of the target data;
[0024] The migration verification module is used to determine whether the source data and the target data are consistent based on the comparison result between the second hash value of the source data and the second hash value of the target data.
[0025] In one or more embodiments, the source data includes at least one character that is all the characters of the source data; the target data includes at least one character that is all the characters of the target data.
[0026] In one or more embodiments, the hash calculation module is specifically used for:
[0027] Obtain the hexadecimal value of each character included in the source data;
[0028] Calculate the hash value of each sign bit based on the value of each sign bit in the hexadecimal value of the first character; wherein, the first character is any one of the multiple characters included in the source data;
[0029] Use the hash value of the last sign bit obtained from the calculation as the first hash value of the first character.
[0030] In one or more embodiments, the hash value of the first sign bit in the hexadecimal value of the first character is the value of the first sign bit; the hash calculation module is used to calculate the hash value of the sign bits other than the first sign bit in the hexadecimal value of the first character using the following formula:
[0031] H i =H i-1 *16+Ai
[0032] Among them, H i H is the hash value of the i-th sign bit. i-1 Let A be the hash value of the -1st sign bit. i Let be the value of the i-th sign bit.
[0033] In one or more embodiments, the source data is data stored in the source system database before migration, and the target data is data stored in the target system database after migration; the apparatus further includes a format conversion module, used for:
[0034] Obtain the target encoding format used by the target system;
[0035] Each character in the source data is converted into a character in the target encoding format.
[0036] Thirdly, this application provides an electronic device, comprising:
[0037] Memory, used to store program instructions;
[0038] A processor is configured to invoke program instructions stored in the memory and execute the steps of the method described in any one of the first aspects according to the obtained program instructions.
[0039] Fourthly, this application provides a computer-readable storage medium storing a computer program, the computer program including program instructions, which, when executed by a computer, cause the computer to perform the method described in any one of the first aspects.
[0040] Fifthly, this application provides a computer program product comprising: computer program code, which, when run on a computer, causes the computer to perform the method described in any one of the first aspects. Attached Figure Description
[0041] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application.
[0042] Figure 1 A schematic diagram of an architecture for a data migration verification scenario provided in an embodiment of this application;
[0043] Figure 2 This is a schematic diagram illustrating the process of performing BKDR hash calculation on a string of arbitrary length.
[0044] Figure 3This is a schematic flowchart of a data migration verification method provided in an embodiment of this application;
[0045] Figure 4 This application provides a schematic diagram illustrating a process for performing hash calculations on source data.
[0046] Figure 5 This is a schematic diagram of the structure of a data migration verification device provided in an embodiment of this application;
[0047] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. Unless otherwise specified, the embodiments and features in the embodiments of this application can be arbitrarily combined with each other. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0049] The terms "first" and "second" in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. The term "multiple" in this application can mean at least two, for example, two, three, or more, and the embodiments of this application do not impose limitations.
[0050] The data collection, dissemination, and use in this application all comply with relevant national laws and regulations.
[0051] To facilitate understanding of the proposed solution, the application scenarios involved in this application are first introduced. See [link to relevant documentation]. Figure 1 This is a schematic diagram illustrating an architecture for a data migration verification scenario provided in an embodiment of this application. Specifically, it includes a source system, a target system, and a verification module. The data migration process refers to migrating data stored in the source system's database to the target system's database. During the data migration process, it is necessary to verify whether the data before and after the migration is consistent. Figure 1The verification module shown is used to verify the consistency of data before and after the migration. For example, Figure 1 The source system shown can be implemented by one or more computer hardware devices, such as a server or server cluster, including processors, hard disks, memory, system buses, etc. The source system is used to maintain the data stored in the database of the source system, such as performing user-initiated operations such as adding, deleting, querying, and modifying data. Figure 1 The target system shown is used to maintain the data stored in the target system's database. Figure 1 The verification module shown is used to verify the consistency of data before and after migration during the process of migrating data from the source system's database to the target system's database.
[0052] For example, Figure 1 The source system shown can be a platform system based on foreign commercial technology, while the target system can be a platform system based on domestic technology. The data migration process can be a process of data localization. Currently, there are many methods for data migration, such as using the commercial data migration tool DSG to achieve efficient data migration without downtime. Regarding consistency verification before and after data migration, the verification methods proposed in related technologies mainly include: data volume verification, used to verify whether the amount of data recorded in the database tables is consistent before and after migration; numeric field verification, used to verify whether the cumulative sum of numeric fields is consistent before and after migration; and character field verification, using a hash method to obtain hash values for character fields, comparing the hash values obtained before and after migration to determine whether the character fields are consistent.
[0053] For character field validation, a common algorithm is the Black-Scholes hash algorithm. The Black-Scholes hash algorithm can map a string of any length to a unique non-negative integer that represents that string. The specific process is as follows: Take a fixed value P, and treat the string to be calculated as a base P number. P is generally a small prime number, such as 131 or 13331. Take another fixed value M, and calculate the remainder of the string divided by M, which is used as the hash value of the string. Here, M can be set to 2. 64 To avoid arithmetic overflow, the following describes the process of calculating the hash value of a string using the BKDR hash algorithm, with specific examples. For a string of length n [S1S2S3……S…] n The BKDR hash calculation process is as follows:
[0054] BKDR_Hash[0] = 0;
[0055] BKDR_Hash[S1]=MOD(ASCII(S1),M);
[0056] BKDR_Hash[S1S2] = MOD(ASCII(S1) × P + ASCII(S2), M) = MOD
[0057] (BKDR_Hash[S1] × P + ASCII(S2), M);
[0058] BKDR_Hash[S1S2S3] = MOD(ASCII(S1) × P 2 + ASCII(S2) × P + ASCII(S3),
[0059] M) = MOD(BKDR_Hash[S1S2] × P + ASCII(S3), M);
[0060] ……
[0061] BKDR_Hash[S1S2S3……S n = MOD(ASCII(S1) × P n-1 + ASCII(S2) × P n-2 +…+ ASCII(S n-1 ) × P + ASCII(S n ),M) = MOD((ASCII(S1) × P n-2 + ASCII(S2) × P n-3 +…+ ASCII(S n-1 )) × P + ASCII(S n )) × P,M) = MOD(BKDR_Hash[S1S2S3……S n-1 × P + ASCII(S n ),M);
[0062] After organizing the above calculation process, we get:
[0063] BKDR_Hash[0] = 0;
[0064] BKDR_Hash[S1] = MOD(ASCII(S1), M);
[0065] BKDR_Hash[S1S2] = MOD(BKDR_Hash[S1] × P + ASCII(S2), M);
[0066] BKDR_Hash[S1S2S3] = MOD(BKDR_Hash[S1S2] × P + ASCII(S3), M);
[0067] ……
[0068] BKDR_Hash[S1S2S3……S n ]=MOD(BKDR_Hash[S1S2S3……S n-1 ]×P+ASCII(S n M); that is, strings S1S2S3……S n The hash value is: MOD(BKDR_Hash[S1S2S3……S n-1 ]×P+ASCII(S n ), M);
[0069] Where MOD(a, b) represents the remainder when a and b are calculated, and ASCII(S i ) represents the i-th character S in the string. i The American Standard Code for Information Interchange (ASCII) value. As an example, Figure 1 The verification module shown above performs the process of calculating the BKDR hash value. (See also: [link to relevant documentation]) Figure 2 , Figure 2 This paper introduces the process of performing BKDR hash calculations on strings of arbitrary length.
[0070] As can be seen from the above process, to implement BKDR hash calculation, it is necessary to extract the ASCII code value of each character in the string and then perform the calculation. However, in actual data migration, the data to be migrated may include fields containing rich text formatting, such as Chinese characters, which cannot be encoded using ASCII. Therefore, the BKDR algorithm cannot satisfy the verification of this type of data migration. In view of this, this application proposes a data migration verification method. It proposes to first perform hash calculation on each character in the string to obtain a unique hash value representing each character. Then, the hash value of each character is used as the character's value, resulting in a new string containing only non-negative integers. Next, BKDR hash calculation is performed on the new string to determine the string's hash value, thereby verifying whether the hash values before and after migration are consistent. This application proposes to perform two hash calculations on the data to be verified, which can be applied to verification scenarios of strings containing rich text formatting, such as Chinese characters, solving the problem that the BKDR hash algorithm cannot be used for migration verification of rich text formatting strings in the prior art.
[0071] See Figure 3 This is a schematic flowchart of a data migration verification method provided in an embodiment of this application. Optionally, Figure 3 The method flow shown can be derived from Figure 1The verification module included in the scenario shown can be used for execution, or it can be executed by specific components included in the verification module; this application does not limit this. Figure 3 The method flow shown specifically includes:
[0072] 301. Perform a hash calculation on at least one character included in the source data before migration to obtain a first hash value for at least one character included in the source data.
[0073] Among them, the source data is Figure 1 The data stored in the database of the source system in the scenario architecture shown.
[0074] Optionally, the verification module can perform hash calculations for each character included in the source data. For example, when calculating the first hash value of character A included in the source data, the calculation can be performed based on the value of each sign bit of character A.
[0075] 302. Perform a hash calculation on at least one character included in the migrated target data to obtain a first hash value for at least one character included in the target data.
[0076] Among them, the target data is Figure 1 The data stored in the target system's database in the scenario architecture shown is data migrated from the source system's database.
[0077] For example, when the verification module calculates the hash value of each character in the target data, it can do so based on the value of the sign bit included in each character.
[0078] 303. Using the first hash value of each character as the value of each character, perform BKDR hash calculation on the source data and the target data respectively to determine the second hash value of the source data and the target data.
[0079] For example, when calculating the second hash value of the source data, the verification module can assemble the first hash values of each character in the source data into a new string, which contains only non-negative integers. Therefore, a BKDR hash calculation can be performed on this new string to obtain a second hash value that uniquely represents the source data. Correspondingly, when calculating the second hash value of the target data, a BKDR hash calculation can be performed on a new string composed of the first hash values of each character in the target data to obtain the second hash value of the target data.
[0080] 304. Based on the comparison of the second hash values of the source data and the target data, determine whether the source data and the target data are consistent.
[0081] For example, if the second hash value of the source data is the same as the second hash value of the target data, it means that the source data and the target data are consistent and the migration verification is successful; otherwise, if the second hash value of the source data is different from the second hash value of the target data, it means that the source data and the target data are inconsistent and the migration verification fails.
[0082] Based on the above scheme, this application proposes that when performing data migration verification, firstly, a hash calculation is performed on each character of the data to be verified to determine the hash value of each character. Then, a new string composed of the hash values of each character is used to perform a BKDR hash calculation to determine a hash value that uniquely represents the data to be verified, and this is used to verify the consistency of the data before and after migration. The scheme proposed in this application solves the problem that rich text format strings cannot be used for consistency verification using the BKDR hash algorithm.
[0083] As an alternative approach, the encoding formats of the source and target data can be unified before hashing the source or target data. Since different data systems use different encoding formats, the hash values calculated for the same data can differ, leading to lower accuracy in migration verification. To address this issue, this application proposes obtaining the target encoding format used by the target system before performing consistency verification, and converting each character in the source data to the target encoding format. For example, if the target system uses UTF-8 encoding, the source data can be converted to the UTF-8 character set before consistency verification, ensuring that the encoding formats of the source and target data are unified.
[0084] In some embodiments, when performing hash calculations on each character in the source data before migration or the target data after migration to obtain the first hash value of each character, the calculation can be based on the value of the sign bit included in each character. The following description uses the calculation of the first hash value of each character in the source data as an example. It should be noted that the process of calculating the first hash value of each character in the target data is the same as the process of calculating the first hash value of each character in the source data.
[0085] For example, when calculating the first hash value of the first character included in the source data, the raw hexadecimal value of the first character can be obtained. The first hash value of the first character is determined based on the value of each symbol in the raw hexadecimal value of the first character, where the first character is any one of the multiple characters included in the source data. Optionally, the step of performing hash calculation on each character of the source data can be called performing inner BKDR hash calculation on the source data. The inner BKDR hash calculation is performed on the raw hexadecimal value of the character. Therefore, the value of P in the BKDR algorithm is 16. Since the character is a hexadecimal value, there will be no algorithm overflow problem. This application sets that no modulo calculation is performed when performing inner BKDR hash calculation to improve computational efficiency. The following describes the inner BKDR hash calculation on the first character as an example. The first character is defined to include m symbol bits, and the expression is: [H1H2H3…H m The inner BKDR hash calculation process is as follows:
[0086] BKDR_Hash_I[0] = 0;
[0087] BKDR_Hash_I[H1] = H1;
[0088] BKDR_Hash_I[H1H2]=H1×16+H2=BKDR_Hash_I[H1]×16+H2;
[0089] BKDR_Hash_I[H1H2H3]=H1×16 2 +H2×16+H3=(H1×16+H2)×16+H3
[0090] =BKDR_Hash_I[H1H2]×16+H3; ...
[0092] BKDR_Hash_I[H1H2H3…H m ] = H1 × 16 m-1 +H2×16 m-2 +…+H m-1 ×16+
[0093] H m = (H1×16) m-2 +H2×16 m-3 +…+H m-1 )×16+H m =BKDR_Hash_I[H1H2
[0094] H3…H m-1 ]×16+H m ;
[0095] After simplifying the above calculation process, we get:
[0096] BKDR_Hash_I[0] = 0;
[0097] BKDR_Hash_I[H1] = H1;
[0098] BKDR_Hash_I[H1H2]=BKDR_Hash_I[H1]×16+H2;
[0099] BKDR_Hash_I[H1H2H3]=BKDR_Hash_I[H1H2]×16+H3; ...
[0101] BKDR_Hash_I[H1H2H3…H m ]=BKDR_Hash_I[H1H2 H3…H m-1 ]×16+H m ;
[0102] That is, the first hash value of the first character is: BKDR_Hash_I[H1H2 H3…H m-1 ]×16+H m .
[0103] Furthermore, after completing the inner BKDR hash calculation for each character, a new string composed of the first hash values corresponding to each character can be used to represent the source data for BKDR hash calculation. This BKDR hash calculation performed on the new string composed of the first hash values can be called the outer hash calculation. The following describes the outer BKDR hash calculation process using the calculation of the second hash value of the source data as an example. In this example, the source data is defined as a string of length n [S1S2S3……S… n ], where S1-S n Given n characters in the source data, represent the first hash value of the k-th character as H. i (S k ), thus the new string obtained after the inner hash calculation is [H i (S1), H i (S2), H i (S3)...H i (S n The outer BKDR hash calculation process is as follows:
[0104] BKDR_Hash_O[0] = 0;
[0105] BKDR_Hash_O[S1]=MOD(H i (S1),M);
[0106] BKDR_Hash_O[S1S2]=MOD(H i (S1)×P+H i (S2),M)=MOD(BKDR_Hash_O[S1]
[0107] ×P+H i (S2),M);
[0108] BKDR_Hash_O[S1S2S3]=MOD(H i (S1)×P 2 +H i (S2)×P+H i (S3),M)=
[0109] MOD((H i (S1)×P+H i (S2))×P+H i (S3),M)=MOD(BKDR_Hash_O[S1S2]×P+
[0110] H i (S3),M); ...
[0112] BKDR_Hash_O[S1S2S3…S n ] = MOD(H i (S1)×P n-1 +H i (S2)×P n-2 +…+
[0113] H i (S n-1 )×P+H i (S n ),M)=MOD((H i (S1)×P n-2 +H i (S2)×P n-3 +…+H i (S n-1 ))×P+
[0114] H i (S n ),M)=MOD(BKDR_Hash_O[S1S2 S3…S n-1 ]×P+H i (S n ),M);
[0115] After simplifying the above calculation process, we get:
[0116] BKDR_Hash_O[0] = 0;
[0117] BKDR_Hash_O[S1]=MOD(H i (S1),M);
[0118] BKDR_Hash_O[S1S2]=MOD(BKDR_Hash_O[S1]×P+H i (S n ),M);
[0119] BKDR_Hash_O[S1S2S3]=MOD(BKDR_Hash_O[S1S2]×P+H i (S3),M); ...
[0121] BKDR_Hash_O[S1S2S3…S n ]=MOD(BKDR_Hash_O[S1S2S3…S n-1 ]×P+
[0122] H i (S n ),M); that is, the second hash value of the source data is MOD(BKDR_Hash_O[S1S2S3…S n-1 ]×P+H i (S n ),M).
[0123] As an example, the process of performing inner and outer hash calculations on the source data as proposed in this application can also be found in [reference needed]. Figure 4 As shown. It should be noted that, Figure 4 The illustrated process can also be applied to both the inner and outer hash calculations of the target data. After the calculation is complete, the consistency between the source and target data can be determined by comparing the second hash values of the source and target data, thereby confirming whether the data migration verification was successful.
[0124] Based on the same concept as the method described above, see [link to relevant documentation]. Figure 5 This application provides a data migration verification device 500. The device 500 is used to implement the steps in the above method embodiments. To avoid repetition, it will not be described again here. The device 500 includes: a hash calculation module 501, a migration verification module 502 and a format conversion module 503.
[0125] The hash calculation module 501 is used to perform hash calculation on at least one character included in the source data before migration to obtain a first hash value of at least one character included in the source data, and to perform hash calculation on at least one character included in the target data after migration to obtain a first hash value of at least one character included in the target data.
[0126] The hash calculation module 501 is further configured to perform BKDR hash calculations on the source data and the target data respectively, using the first hash value of the at least one character as the value of the at least one character, to determine the second hash value of the source data and the second hash value of the target data;
[0127] The migration verification module 502 is used to determine whether the source data and the target data are consistent based on the comparison result between the second hash value of the source data and the second hash value of the target data.
[0128] In one or more embodiments, the source data includes at least one character that is all the characters of the source data; the target data includes at least one character that is all the characters of the target data.
[0129] In one or more embodiments, the hash calculation module 501 is specifically used for:
[0130] Obtain the hexadecimal value of each character included in the source data;
[0131] Calculate the hash value of each sign bit based on the value of each sign bit in the hexadecimal value of the first character; wherein, the first character is any one of the multiple characters included in the source data;
[0132] Use the hash value of the last sign bit obtained from the calculation as the first hash value of the first character.
[0133] In one or more embodiments, the hash value of the first sign bit in the hexadecimal value of the first character is the value of the first sign bit; the hash calculation module 501 is used to calculate the hash value of the sign bits other than the first sign bit in the hexadecimal value of the first character using the following formula:
[0134] H i =H i-1 *16+A i
[0135] Among them, H i H is the hash value of the i-th sign bit. i-1 Let A be the hash value of the -1st sign bit. i Let be the value of the i-th sign bit.
[0136] In one or more embodiments, the source data is data stored in the source system database before migration, and the target data is data stored in the target system database after migration; the apparatus further includes a format conversion module 503, used for:
[0137] Obtain the target encoding format used by the target system;
[0138] Each character in the source data is converted into a character in the target encoding format.
[0139] Figure 6 A schematic diagram of the structure of an electronic device 600 provided in an embodiment of this application is shown. The electronic device 600 in this embodiment may further include a communication interface 603, such as a network port, through which the electronic device can transmit data.
[0140] In this embodiment of the application, the memory 602 stores instructions that can be executed by at least one processor 601. By executing the instructions stored in the memory 602, the at least one processor 601 can perform the various steps in the above method.
[0141] The processor 601 is the control center of the electronic device, capable of connecting various parts of the device via various interfaces and lines. It executes instructions stored in the memory 602 and retrieves data stored in the memory 602. Optionally, the processor 601 may include one or more processing units. The processor 601 may integrate an application controller and a modem controller. The application controller primarily handles the operating system and applications, while the modem controller primarily handles wireless communication. It is understood that the modem controller may not be integrated into the processor 601. In some embodiments, the processor 601 and the memory 602 may be implemented on the same chip; in other embodiments, they may be implemented on separate chips.
[0142] The processor 601 can be a general-purpose controller, such as a central processing unit (CPU), digital signal controller, application-specific integrated circuit, field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose controller can be a microcontroller or any conventional controller. The steps disclosed in the embodiments of this application can be directly executed by the hardware controller, or executed by a combination of hardware and software modules within the controller.
[0143] Memory 602, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 602 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 602 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 602 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0144] By designing and programming the processor 601, for example, the code corresponding to the methods described in the foregoing embodiments can be embedded into the chip, so that the chip can execute the aforementioned method steps when running. How to design and program the processor 601 is a well-known technique to those skilled in the art, and will not be described in detail here.
[0145] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0146] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a controller of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions, which execute via the controller of the computer or other programmable data processing device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0147] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0148] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0149] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0150] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A data migration verification method, characterized in that, The method includes: A hash calculation is performed on at least one character included in the source data before migration to obtain a first hash value for the at least one character included in the source data, and a hash calculation is performed on at least one character included in the target data after migration to obtain a first hash value for the at least one character included in the target data; wherein, the first hash value of the at least one character included in the source data is obtained by: obtaining the hexadecimal value of each character included in the source data; and calculating the hash value of each sign bit based on the value of each sign bit in the hexadecimal value of the first character. The process of obtaining the first hash value of at least one character included in the source data and the process of obtaining the first hash value of at least one character included in the target data do not involve modulo calculation; the source data includes strings containing rich text format; the first character is any one of the multiple characters included in the source data; the hash value of the last sign bit obtained by calculation is used as the first hash value of the first character; Using the first hash value of the at least one character as the value of the at least one character, perform BKDR hash calculation on the source data and the target data respectively to determine the second hash value of the source data and the second hash value of the target data; Based on the comparison between the second hash value of the source data and the second hash value of the target data, it is determined whether the source data and the target data are consistent.
2. The method according to claim 1, characterized in that, The source data includes at least one character that is all the characters in the source data; the target data includes at least one character that is all the characters in the target data.
3. The method according to claim 1, characterized in that, The hash value of the first sign bit in the hexadecimal value of the first character is the value of the first sign bit; the hash values of the sign bits other than the first sign bit in the hexadecimal value of the first character are calculated using the following formula: H i =H i-1 *16+A i Among them, H i H is the hash value of the i-th sign bit. i-1 Let A be the hash value of the (i-1)th sign bit. i Let be the value of the i-th sign bit.
4. The method according to claim 1 or 2, characterized in that, The source data is the data stored in the source system database before migration, and the target data is the data stored in the target system database after migration. Before obtaining the first hash value corresponding to each character, the method further includes: Obtain the target encoding format used by the target system; Each character in the source data is converted into a character in the target encoding format.
5. A data migration verification device, characterized in that, The device includes: The hash calculation module is used to perform hash calculation on at least one character included in the source data before migration to obtain a first hash value of at least one character included in the source data, and to perform hash calculation on at least one character included in the target data after migration to obtain a first hash value of at least one character included in the target data. The hash calculation module is specifically used to obtain the first hash value of at least one character included in the source data in the following manner: obtaining the hexadecimal value of each character included in the source data; calculating the hash value of each sign bit according to the value of each sign bit in the hexadecimal value of the first character; wherein, the process of obtaining the first hash value of at least one character included in the source data and the process of obtaining the first hash value of at least one character included in the target data do not perform modulo calculation; the source data includes a string containing rich text format; the first character is any one of the multiple characters included in the source data; the hash value of the last sign bit calculated is used as the first hash value of the first character; The hash calculation module is further configured to perform BKDR hash calculations on the source data and the target data respectively, using the first hash value of the at least one character as the value of the at least one character, to determine the second hash value of the source data and the second hash value of the target data; The migration verification module is used to determine whether the source data and the target data are consistent based on the comparison result between the second hash value of the source data and the second hash value of the target data.
6. The apparatus according to claim 5, characterized in that, The source data includes at least one character that is all the characters in the source data; the target data includes at least one character that is all the characters in the target data.
7. The apparatus according to claim 5, characterized in that, The hash value of the first sign bit in the hexadecimal value of the first character is the value of the first sign bit; the hash calculation module is used to calculate the hash values of the sign bits other than the first sign bit in the hexadecimal value of the first character using the following formula: H i =H i-1 *16+A i Among them, H i H is the hash value of the i-th sign bit. i-1 Let A be the hash value of the (i-1)th sign bit. i Let be the value of the i-th sign bit.
8. The apparatus according to claim 5 or 6, characterized in that, The source data is data stored in the source system database before migration, and the target data is data stored in the target system database after migration; the device further includes a format conversion module, used for: Obtain the target encoding format used by the target system; Each character in the source data is converted into a character in the target encoding format.
9. An electronic device, characterized in that, include: Memory, used to store program instructions; A processor is configured to invoke program instructions stored in the memory and execute the steps of the method according to any one of claims 1-4.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a computer, cause the computer to perform the method as described in any one of claims 1-4.
11. A computer program product, characterized in that, The computer program product includes: computer program code, which, when run on a computer, causes the computer to perform the method described in any one of claims 1-4.
Citation Information
Patent Citations
Data checking method and device, computer equipment and storage medium
CN112433988A