Test method, device, electronic equipment and computer storage medium for data migration
By receiving database migration requests, obtaining basic information about the database to be migrated and the user's expected accuracy information, determining the minimum sampling sample data size, and using a random function to compare the data tables before and after migration, the problem of insufficient verification of migration results in existing technologies is solved, and the reliability and accuracy of the data migration process are confirmed.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AGRICULTURAL BANK OF CHINA
- Filing Date
- 2023-03-14
- Publication Date
- 2026-07-10
AI Technical Summary
During database migration, existing technologies cannot effectively verify the correctness of the migration results, especially in production environments where time windows are short. Testers cannot perform sufficient data comparisons, resulting in the migration error rate not being effectively controlled.
By receiving a database migration request, the system obtains the basic information of the database to be migrated and the user's expected accuracy information, determines the minimum sampling sample data size, and uses a random function to extract data from the data tables before and after the migration for comparison, generating prompt information to confirm the migration result.
It enables effective confirmation of data migration results within a limited time, ensures accurate prompts for successful or failed migration, and improves the reliability and accuracy of the migration process.
Smart Images

Figure CN116204437B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data migration testing method, apparatus, electronic device, and computer storage medium. Background Technology
[0002] During the process of informatization, enterprises will upgrade their technology systems, especially databases, due to factors such as security costs. For example, they may switch from databases such as Sybase Ace and Oracle to open-source and free databases such as MySQL.
[0003] During the data migration process, different vendors' databases implement data storage and encoding differently, which presents various technical challenges and risks of manual operation. At the same time, during the switchover of existing systems, for reasons of business continuity and data security, the data migration work must be completed within a limited time window in the production environment.
[0004] Existing data migration solutions often verify the correctness of the migration solution with a small amount of data in a test environment. During the formal migration process, due to the short time window, testers cannot perform effective verification work. They usually sample a small amount of data for comparison, but the correctness of the content cannot be effectively verified. Summary of the Invention
[0005] In view of this, this application provides a data migration testing method, apparatus, electronic device, and computer storage medium to effectively verify the results of data migration.
[0006] The first aspect of this application provides a data migration testing method, including:
[0007] Receive a database migration request; wherein the database migration request includes: basic information of the database to be migrated and the user's expected accuracy information for this database migration; the expected accuracy information includes at least: a baseline migration error rate, a target migration error rate, a first risk probability, and a second risk probability; the baseline migration error rate is the migration error rate that the user typically experiences; the target migration error rate is the migration error rate that the user can tolerate at most; the first risk probability is the probability that the sampling result will cause the tester to reject the null hypothesis; the second risk probability is the probability that the comparison result will cause the tester to incorrectly accept the alternative hypothesis;
[0008] Based on the basic information of the database to be migrated, obtain the data volume of each data table in the database to be migrated and the total data volume of all data tables in the database to be migrated.
[0009] The minimum sample size is determined based on the baseline migration error rate, the target migration error rate, the first risk probability, and the second risk probability.
[0010] For each data table, the number of data entries to be compared is determined based on the minimum sample size, the data size of the data table, and the total data size of all data tables in the database to be migrated.
[0011] After the data table is migrated, a preset random function is used to randomly select the required number of data entries from the data tables before and after the migration for comparison, and the comparison results are obtained.
[0012] Optionally, determining the minimum sample data size based on the baseline migration error rate, the target migration error rate, the first risk probability, and the second risk probability includes:
[0013] The first normal standard deviation is determined based on the first risk probability;
[0014] The second normal standard deviation is determined based on the second risk probability;
[0015] The target accuracy is determined based on the baseline migration error rate and the target migration error rate.
[0016] The minimum sample size is determined using the first normal standard deviation, the second normal standard deviation, the target precision, the baseline migration error rate, and the target migration error rate.
[0017] Optionally, after the data table migration is completed, the step of randomly selecting the required number of data entries for comparison from the data tables before and after the migration using a preset random function to obtain the comparison results further includes:
[0018] If the comparison results show that there is a mismatch between the data in the data table before and after the migration, a first prompt message is generated; wherein, the first prompt message indicates that the data migration in the data table was unsuccessful;
[0019] If the comparison results show that all data in the data tables before and after the migration are successfully matched, a second prompt message is generated; wherein, the second prompt message indicates that the data migration in the data tables is successful.
[0020] Optionally, the preset random function is nextInt().
[0021] A second aspect of this application provides a data migration testing apparatus, comprising:
[0022] A receiving unit is configured to receive a database migration request; wherein the database migration request includes: basic information of the database to be migrated and the user's expected accuracy information for this database migration; the expected accuracy information includes at least: a baseline migration error rate, a target migration error rate, a first risk probability, and a second risk probability; the baseline migration error rate is the migration error rate that is typically expected to occur, as input by the user; the target migration error rate is the migration error rate that the user can tolerate at most; the first risk probability is the probability that the sampling result will cause the tester to reject the null hypothesis; the second risk probability is the probability that the comparison result will cause the tester to incorrectly accept the alternative hypothesis;
[0023] The acquisition unit is used to acquire the data volume of each data table in the database to be migrated and the total data volume of all data tables in the database to be migrated, based on the basic information of the database to be migrated.
[0024] The first determining unit is configured to determine the minimum sample data size based on the baseline migration error rate, the target migration error rate, the first risk probability, and the second risk probability.
[0025] The second determining unit is used to determine the number of data entries to be compared for each data table based on the minimum sampling sample data size, the data size of the data table, and the total data size of all data tables in the database to be migrated.
[0026] The comparison unit is used to randomly extract the required number of data entries from the data tables before and after the data table migration is completed using a preset random function, and then compare them to obtain the comparison results.
[0027] Optionally, the first determining unit includes:
[0028] The first normal standard deviation determination unit is used to determine the first normal standard deviation based on the first risk probability;
[0029] The second normal standard deviation determination unit is used to determine the second normal standard deviation based on the second risk probability;
[0030] A target accuracy unit is used to determine the target accuracy based on the baseline migration error rate and the target migration error rate;
[0031] The first determining subunit is used to determine the minimum sample size using the first normal standard deviation, the second normal standard deviation, the target accuracy, the baseline migration error rate, and the target migration error rate.
[0032] Optionally, the data migration testing apparatus further includes:
[0033] The first prompting unit is used to generate a first prompting message if the comparison result shows that there is a mismatch between a piece of data in the data table before and after the migration; wherein, the first prompting message indicates that the data migration in the data table was unsuccessful;
[0034] The second prompt unit is used to generate a second prompt message if the comparison result shows that all data in the data tables before and after the migration is successfully matched; wherein, the second prompt message indicates that the data migration in the data tables is successful.
[0035] Optionally, the preset random function is nextInt().
[0036] A third aspect of this application provides an electronic device, comprising:
[0037] One or more processors;
[0038] A storage device on which one or more programs are stored;
[0039] When the one or more programs are executed by the one or more processors, the one or more processors implement the data migration test method as described in any one of the first aspects.
[0040] The fourth aspect of this application provides a computer storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements a data migration test method as described in any one of the first aspects.
[0041] As can be seen from the above solutions, this application provides a data migration testing method, apparatus, electronic device, and computer storage medium. The data migration testing method includes: receiving a database migration request; wherein, the database migration request includes: basic information of the database to be migrated and the user's expected accuracy information for this database migration; the expected accuracy information includes at least: a baseline migration error rate, a target migration error rate, a first risk probability, and a second risk probability; the baseline migration error rate is the migration error rate that the user typically inputs; the target migration error rate is the migration error rate that the user can tolerate at most; the first risk probability is the probability that the sampling result will cause the tester to reject the null hypothesis; the second risk probability is the probability that the comparison result will cause the tester to incorrectly accept the null hypothesis. The process involves several steps: First, determining the probability of choosing a hypothesis; then, based on the basic information of the database to be migrated, obtaining the data volume of each table in the database and the total data volume of all tables in the database; next, determining the minimum sampling sample size based on the baseline migration error rate, the target migration error rate, the first risk probability, and the second risk probability; then, for each table, determining the number of data entries to be compared based on the minimum sampling sample size, the data volume of the table, and the total data volume of all tables in the database to be migrated; finally, after the data tables are migrated, randomly selecting the required number of data entries from both the pre- and post-migration tables using a preset random function for comparison, and obtaining the comparison results. This effectively confirms the results of the data migration. Attached Figure Description
[0042] 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 or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0043] Figure 1 A detailed flowchart of a data migration testing method provided in an embodiment of this application;
[0044] Figure 2 A flowchart illustrating a data migration testing method provided in another embodiment of this application;
[0045] Figure 3 A schematic diagram of a data migration testing apparatus provided for another embodiment of this application;
[0046] Figure 4 A schematic diagram of an electronic device for implementing a test method for data migration, provided in another embodiment of this application. Detailed Implementation
[0047] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. 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.
[0048] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0049] It should be noted that the concepts of "first" and "second" mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0050] It should be noted that the terms "a" and "a plurality of" used in this application are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0051] This application provides a data migration testing method, such as... Figure 1 As shown, the specific steps include:
[0052] S101, Receive database migration request.
[0053] The database migration request includes: basic information about the database to be migrated and the user's expected accuracy information for this database migration; the expected accuracy information includes at least: baseline migration error rate, target migration error rate, first risk probability, and second risk probability; the baseline migration error rate is the migration error rate that the user typically inputs; the target migration error rate is the migration error rate that the user can tolerate the most; the first risk probability is the probability that the sampling results will cause the tester to reject the null hypothesis; the second risk probability is the probability that the comparison results will cause the tester to incorrectly accept the alternative hypothesis.
[0054] It's important to note that sampling comparison tests can lead to two types of errors. Type I error refers to the probability that the sampling results will cause the tester to reject the null hypothesis, i.e., the first risk. Type II error refers to the probability that the comparison results will cause the tester to incorrectly accept the alternative hypothesis, also known as the second risk. In reality, it's often desirable to control both the first and second risk probabilities. Generally, an upper limit is set for the first risk probability, usually 5% (this is just an example, not a specific limit here), meaning the first risk occurrence does not exceed 5%. If the sample comparison shows a difference before and after the migration, consistent with expectations, the probability of this correct judgment is called power. The situation where the sample shows a difference before and after the migration but there is actually no difference is the second risk probability, which is 1 - power. The second risk probability represents the probability of correctly rejecting the null hypothesis under the alternative hypothesis. The second risk probability is usually 0.1 or 0.2 (this is just an example, not a specific limit here).
[0055] S102. Based on the basic information of the database to be migrated, obtain the data volume of each data table in the database to be migrated and the total data volume of all data tables in the database to be migrated.
[0056] S103. Determine the minimum sample size based on the baseline migration error rate, the target migration error rate, the first risk probability, and the second risk probability.
[0057] Optionally, in another embodiment of this application, one implementation of step S103 is as follows: Figure 2 As shown, it includes:
[0058] S201. Determine the first normal standard deviation based on the first risk probability.
[0059] Specifically, the normal standard deviation with a confidence level of α / 2 is taken as the first normal standard deviation, α is the first risk probability, and z... α / 2 This represents the first normal standard deviation.
[0060] S202. Determine the second normal standard deviation based on the second risk probability.
[0061] Specifically, the normal standard deviation at a confidence level of β is taken as the second normal standard deviation, where β is the second hazard probability, and z... β It represents the second normal standard deviation.
[0062] S203. Determine the target accuracy based on the baseline migration error rate and the target migration error rate.
[0063] Specifically, let Δ represent the target accuracy, Δ = |p1 - p2|. Where p1 represents the baseline transfer error rate and p2 represents the target transfer error rate.
[0064] S204. Using the first normal standard deviation, the second normal standard deviation, the target precision, the baseline transfer error rate, and the target transfer error rate, determine the minimum sample size.
[0065] Continuing with the above examples, the minimum sample size n can be calculated using the following formula in the practical application of this application:
[0066]
[0067] S104. For each data table, determine the number of data records to be compared based on the minimum sample size, the data size of the data table, and the total data size of all data tables in the database to be migrated.
[0068] S105. After the data table migration is completed, a preset random function is used to randomly select the number of data entries to be compared from the data tables before and after the migration, and the comparison results are obtained.
[0069] It should be noted that the preset random function is set and modified in advance by technical personnel or relevant authorized staff. There are no restrictions here. The random function can be, but is not limited to, nextInt(), etc.
[0070] In the specific implementation of this application, the database migration results can also be generated based on the comparison results of all data tables.
[0071] Optionally, in another embodiment of this application, one implementation method after obtaining the comparison results further includes:
[0072] If the comparison results show that there is a mismatch between the data in the data tables before and after the migration, the first prompt message will be generated.
[0073] The first message indicates that the data migration in the data table was unsuccessful.
[0074] If the comparison results show that all data in the data tables before and after the migration are successfully matched, a second prompt message will be generated.
[0075] The second message indicates that the data migration in the data table was successful.
[0076] As can be seen from the above scheme, this application provides a data migration testing method, including: receiving a database migration request; wherein, the database migration request includes: basic information of the database to be migrated and the user's expected accuracy information for this database migration; the expected accuracy information includes at least: a baseline migration error rate, a target migration error rate, a first risk probability, and a second risk probability; the baseline migration error rate is the migration error rate that the user typically inputs; the target migration error rate is the migration error rate that the user can tolerate at most; the first risk probability is the probability that the sampling result will cause the tester to reject the null hypothesis; the second risk probability is the probability that the comparison result will cause the tester to incorrectly accept the alternative hypothesis. The process involves several steps: first, determining the probability of a data migration; second, based on the basic information of the database to be migrated, obtaining the data volume of each table and the total data volume of all tables in the database; third, determining the minimum sample size based on the baseline migration error rate, the target migration error rate, the first risk probability, and the second risk probability; fourth, for each table, determining the number of data entries to be compared based on the minimum sample size, the table's data volume, and the total data volume of all tables in the database to be migrated; and finally, after the data tables are migrated, randomly selecting the required number of data entries from both the pre- and post-migration tables using a pre-defined random function for comparison, thus obtaining the comparison results. This effectively confirms the results of the data migration.
[0077] Another embodiment of this application provides a data migration testing apparatus, such as... Figure 3 As shown, it specifically includes:
[0078] The receiving unit 301 is used to receive database migration requests.
[0079] The database migration request includes: basic information about the database to be migrated and the user's expected accuracy information for this database migration; the expected accuracy information includes at least: baseline migration error rate, target migration error rate, first risk probability, and second risk probability; the baseline migration error rate is the migration error rate that the user typically inputs; the target migration error rate is the migration error rate that the user can tolerate the most; the first risk probability is the probability that the sampling results will cause the tester to reject the null hypothesis; the second risk probability is the probability that the comparison results will cause the tester to incorrectly accept the alternative hypothesis.
[0080] The acquisition unit 302 is used to acquire the data volume of each data table in the database to be migrated and the total data volume of all data tables in the database to be migrated, based on the basic information of the database to be migrated.
[0081] The first determining unit 303 is used to determine the minimum sample data size based on the baseline migration error rate, the target migration error rate, the first risk probability, and the second risk probability.
[0082] Optionally, in another embodiment of this application, one implementation of the first determining unit 303 includes:
[0083] The first normal standard deviation determination unit is used to determine the first normal standard deviation based on the first risk probability.
[0084] The second normal standard deviation determination unit is used to determine the second normal standard deviation based on the second risk probability.
[0085] The target accuracy unit is used to determine the target accuracy based on the baseline migration error rate and the target migration error rate.
[0086] The first determining subunit is used to determine the minimum sample size using the first normal standard deviation, the second normal standard deviation, the target accuracy, the baseline transfer error rate, and the target transfer error rate.
[0087] For details on the specific working process of the units disclosed in the above embodiments of this application, please refer to the corresponding method embodiments, such as... Figure 2 As shown, it will not be elaborated further here.
[0088] The second determining unit 304 is used to determine the number of data records to be compared for each data table based on the minimum sample size, the data size of the data table, and the total data size of all data tables in the database to be migrated.
[0089] The comparison unit 305 is used to randomly select the number of data entries to be compared from the data tables before and after the data table migration is completed using a preset random function, and obtain the comparison results.
[0090] It should be noted that the preset random function is set and modified in advance by technical personnel or relevant authorized staff. There are no restrictions here. The random function can be, but is not limited to, nextInt(), etc.
[0091] For details on the specific working process of the units disclosed in the above embodiments of this application, please refer to the corresponding method embodiments, such as... Figure 1 As shown, it will not be elaborated further here.
[0092] Optionally, in another embodiment of this application, one implementation of the data migration testing apparatus further includes:
[0093] The first prompt unit is used to generate a first prompt message if the comparison results show that there is a mismatch between a data record in the data table before and after the migration.
[0094] The first message indicates that the data migration in the data table was unsuccessful.
[0095] The second prompt unit is used to generate a second prompt message if the comparison results show that all data in the data tables before and after the migration are successfully matched.
[0096] The second message indicates that the data migration in the data table was successful.
[0097] For details on the specific working process of the units disclosed in the above embodiments of this application, please refer to the corresponding method embodiments, which will not be repeated here.
[0098] As can be seen from the above scheme, this application provides a data migration testing device, including: a receiving unit 301 receiving a database migration request; wherein, the database migration request includes: basic information of the database to be migrated and the user's expected accuracy information for this database migration; the expected accuracy information includes at least: a baseline migration error rate, a target migration error rate, a first risk probability, and a second risk probability; the baseline migration error rate is the migration error rate that usually occurs as input by the user; the target migration error rate is the migration error rate that the user can tolerate the most; the first risk probability is the probability that the sampling result makes the tester reject the null hypothesis; the second risk probability is the probability that the comparison result makes the tester incorrectly accept the alternative hypothesis; then, the single... Unit 302, based on the basic information of the database to be migrated, obtains the data volume of each data table in the database to be migrated, as well as the total data volume of all data tables in the database to be migrated. Then, the first determining unit 303 determines the minimum sampling sample data volume based on the baseline migration error rate, the target migration error rate, the first risk probability, and the second risk probability. The second determining unit 304, for each data table, determines the number of data entries to be compared based on the minimum sampling sample data volume, the data volume of the data table, and the total data volume of all data tables in the database to be migrated. Finally, after the data tables are migrated, the comparison unit 305 uses a preset random function to randomly select the required number of data entries from the data tables before and after the migration for comparison, obtaining the comparison results. This effectively confirms the results of the data migration.
[0099] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0100] Another embodiment of this application provides an electronic device, such as... Figure 4 As shown, it includes:
[0101] One or more processors 401.
[0102] Storage device 402, on which one or more programs are stored.
[0103] When the one or more programs are executed by the one or more processors 401, the one or more processors 401 implement the data migration test method as described in any of the above embodiments.
[0104] Another embodiment of this application provides a computer storage medium storing a computer program thereon, wherein the computer program, when executed by a processor, implements a data migration test method as described in any of the above embodiments.
[0105] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0106] It should be noted that the computer-readable medium described above in this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0107] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0108] Another embodiment of this application provides a computer program product, which, when executed, is used to perform a test method for data migration as described above.
[0109] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, it performs the functions defined in the methods of the embodiments of this application.
[0110] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
[0111] While several specific implementation details are included in the foregoing discussion, these should not be construed as limiting the scope of this application. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0112] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described application concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions claimed in this application.
Claims
1. A data migration testing method, characterized in that, include: Receive a database migration request; wherein the database migration request includes: basic information of the database to be migrated and the user's expected accuracy information for this database migration; the expected accuracy information includes at least: a baseline migration error rate, a target migration error rate, a first risk probability, and a second risk probability; the baseline migration error rate is the migration error rate that the user typically inputs; the target migration error rate is the migration error rate that the user can tolerate at most; the first risk probability is the probability that the sampling result will cause the tester to reject the null hypothesis; the second risk probability is the probability that the comparison result will cause the tester to incorrectly accept the alternative hypothesis; Based on the basic information of the database to be migrated, obtain the data volume of each data table in the database to be migrated and the total data volume of all data tables in the database to be migrated. The minimum sample size is determined based on the baseline migration error rate, the target migration error rate, the first risk probability, and the second risk probability. For each data table, the number of data entries to be compared is determined based on the minimum sample size, the data size of the data table, and the total data size of all data tables in the database to be migrated. After the data table is migrated, a preset random function is used to randomly extract the number of data entries to be compared from the data tables before and after the migration, and the comparison results are obtained. The step of determining the minimum sample data size based on the baseline migration error rate, the target migration error rate, the first risk probability, and the second risk probability includes: The first normal standard deviation is determined based on the first risk probability. The second normal standard deviation is determined based on the second risk probability. The target accuracy is determined based on the baseline migration error rate and the target migration error rate. The minimum sample size is determined using the first normal standard deviation, the second normal standard deviation, the target precision, the baseline migration error rate, and the target migration error rate.
2. The test method according to claim 1, characterized in that, After the data table migration is completed, the step of randomly selecting the required number of data entries for comparison from the data tables before and after the migration using a preset random function to obtain the comparison results also includes: If the comparison results show that there is a mismatch between the data in the data table before and after the migration, a first prompt message is generated; wherein, the first prompt message indicates that the data migration in the data table was unsuccessful; If the comparison results show that all data in the data tables before and after the migration are successfully matched, a second prompt message is generated; wherein, the second prompt message indicates that the data migration in the data tables is successful.
3. The test method according to claim 1, characterized in that, The preset random function is nextInt().
4. A data migration testing apparatus, characterized in that, include: A receiving unit is configured to receive a database migration request; wherein the database migration request includes: basic information of the database to be migrated and the user's expected accuracy information for this database migration; the expected accuracy information includes at least: a baseline migration error rate, a target migration error rate, a first risk probability, and a second risk probability; the baseline migration error rate is the migration error rate that the user typically experiences; the target migration error rate is the migration error rate that the user can tolerate at most; the first risk probability is the probability that the sampling result will cause the tester to reject the null hypothesis; the second risk probability is the probability that the comparison result will cause the tester to incorrectly accept the alternative hypothesis; The acquisition unit is used to acquire the data volume of each data table in the database to be migrated and the total data volume of all data tables in the database to be migrated, based on the basic information of the database to be migrated. The first determining unit is configured to determine the minimum sample data size based on the baseline migration error rate, the target migration error rate, the first risk probability, and the second risk probability. The second determining unit is used to determine the number of data entries to be compared for each data table based on the minimum sampling sample data size, the data size of the data table, and the total data size of all data tables in the database to be migrated. The comparison unit is used to randomly extract the number of data entries to be compared from the data tables before and after the data table migration is completed using a preset random function, and obtain the comparison results. The first determining unit includes: The first normal standard deviation determination unit is used to determine the first normal standard deviation based on the first risk probability. The second normal standard deviation determination unit is used to determine the second normal standard deviation based on the second risk probability. A target accuracy unit is used to determine the target accuracy based on the baseline migration error rate and the target migration error rate; The first determining subunit is used to determine the minimum sample size using the first normal standard deviation, the second normal standard deviation, the target accuracy, the baseline migration error rate, and the target migration error rate.
5. The testing apparatus according to claim 4, characterized in that, Also includes: The first prompting unit is used to generate a first prompt message if the comparison result shows that there is a mismatch between a piece of data in the data table before and after the migration; wherein, the first prompt message indicates that the data migration in the data table was unsuccessful; The second prompt unit is used to generate a second prompt message if the comparison result shows that all data in the data tables before and after the migration is successfully matched; wherein, the second prompt message indicates that the data migration in the data tables is successful.
6. The testing apparatus according to claim 4, characterized in that, The preset random function is nextInt().
7. An electronic device, characterized in that, include: One or more processors; A storage device on which one or more programs are stored; When the one or more programs are executed by the one or more processors, the one or more processors implement the data migration test method as described in any one of claims 1 to 3.
8. A computer storage medium, characterized in that, It stores a computer program, wherein the computer program, when executed by a processor, implements the test method for data migration as described in any one of claims 1 to 3.