CN116089285A - Database testing method and device, electronic equipment and readable medium - Google Patents

Database testing method and device, electronic equipment and readable medium Download PDF

Info

Publication number
CN116089285A
CN116089285A CN202310019542.2A CN202310019542A CN116089285A CN 116089285 A CN116089285 A CN 116089285A CN 202310019542 A CN202310019542 A CN 202310019542A CN 116089285 A CN116089285 A CN 116089285A
Authority
CN
China
Prior art keywords
database
data
target database
target
business
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310019542.2A
Other languages
Chinese (zh)
Inventor
段红润
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202310019542.2A priority Critical patent/CN116089285A/en
Publication of CN116089285A publication Critical patent/CN116089285A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/214Database migration support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Computer Hardware Design (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Debugging And Monitoring (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a database testing method, a database testing device, electronic equipment and a readable medium, wherein the method comprises the following steps: the service system checks configuration information and compatibility of the first database and the second database and connectivity of the first database and the second database with the synchronization tool respectively to obtain a first check result, and when the first check result is determined to be qualified, the service system calls the synchronization tool to synchronize data of the first database to the second database to obtain a target database, checks the data of the target database to obtain a second check result, and the second check result feeds back whether the target database can be normally applied. The first test is carried out on the two databases before migration, a foundation is laid for successful migration of the data in the first database, and the second test is carried out on the data of the target database, so that the target database is tested, and whether the new database can be normally applied is verified.

Description

Database testing method and device, electronic equipment and readable medium
Technical Field
The present invention relates to the field of database technologies, and in particular, to a database testing method, a database testing apparatus, an electronic device, and a computer readable medium.
Background
Database migration refers to migration of data from an A database to a B database, and may be divided into migration of the same type of database and data migration between different types of databases. Migration of the same type of database is simple, and data migration between different types of databases has some problems: if the table structure changes, there is a difference in syntax, etc.
Because of the existence of the differences between the databases of different types, the databases often generate a lot of errors or errors after data migration, so that the correctness and usability of the data cannot be guaranteed, the core business process may be affected when the data is transferred to a new database, the new database may not bear the load of the original core business, and the use of users is affected.
Disclosure of Invention
In view of the above, embodiments of the present invention have been made to provide a database test method, a database test apparatus, an electronic device, and a computer-readable medium that overcome or at least partially solve the above problems.
The embodiment of the invention discloses a database testing method which is applied to a service system, wherein the service system comprises a first database and a second database, and comprises the following steps:
the service system calls a distributed resource scheduling program, checks configuration information and compatibility of the first database and the second database, and connectivity of the first database and the second database with a synchronization tool respectively, and generates a first check result;
under the condition that the first inspection result is qualified, the service system calls the synchronization tool to synchronize the data of the first database to the second database to obtain a target database;
the business system checks the data of the target database to generate a second check result; and the second checking result feeds back whether the target database can be normally applied.
Optionally, under the condition that the first test result is qualified, the service system calls the synchronization tool to synchronize the data of the first database to the second database, so as to obtain a target database, including:
in the process of normal operation of the service system, the synchronization tool synchronizes the total amount of data stored in the first database before starting migration to the second database;
And synchronizing the incremental data in the first database to the second database by taking the time of starting full synchronization as the starting time, so as to obtain the target database.
Optionally, the service system checks the data of the target database to generate a second check result, including:
the business system adopts the target database to run a business core flow, and judges whether the target database is available in the business core flow;
if abnormal error reporting occurs, determining that the target database is not available; the exception reporting errors comprise null pointer exceptions and/or deadlock exceptions;
and if no abnormal error report occurs, determining that the target database is normally available.
Optionally, the method further comprises:
recording a first time used by the business system to operate the business core flow by adopting the target database;
comparing the first time with a second time used by the business system to operate the business core flow by adopting the first database, and judging whether the operation efficiency of the target database is qualified or not;
if the first time is less than or equal to the second time, determining that the target database operation efficiency is qualified;
And if the first time is longer than the second time, determining that the target database operation efficiency is not qualified.
Optionally, the service system checks the data of the target database to generate a second check result, and further includes:
the business system invokes a data checking tool to detect data consistency of the first database and the target database.
Optionally, the service system call data checking tool detects data consistency of the first database and the target database, including:
the data inspection tool extracting first data from the first database;
the data checking tool searches second data corresponding to the first data from the target database;
the data checking tool compares the first data with the second data and judges whether the data transferred to the target database has errors or not;
if the first data are the same as the second data, determining that the data transferred to the target database have no errors;
and if the first data is different from the second data, determining that the data transferred to the target database has errors.
Optionally, the service system checks the data of the target database to generate a second check result, and further includes:
Constructing at least one type of third data on pages of the target database by adopting the data of the target database; the type comprises at least one of the longest field, different formats, full filling of the field and default value of the field; the different formats comprise at least one of character strings, integers and floating point numbers;
and comparing the third data with fourth data of a corresponding type in the page of the first database, and judging whether the target database can normally display data in the page.
The embodiment of the invention also discloses a database testing device which is applied to a service system, wherein the service system comprises a first database and a second database, and comprises:
the first checking module is used for the service system to call a distributed resource scheduling program, checking configuration information and compatibility of the first database and the second database, and connectivity of the first database and the second database with a synchronization tool respectively, and generating a first checking result;
the synchronization module is used for calling the synchronization tool by the service system to synchronize the data of the first database to the second database under the condition that the first test result is qualified, so as to obtain a target database;
The second checking module is used for checking the data of the target database by the service system and generating a second checking result; and the second checking result feeds back whether the target database can be normally applied.
Optionally, the synchronization module includes:
a full synchronization sub-module, configured to synchronize, during normal operation of the service system, the full amount of data stored in the first database before the start of migration to the second database by the synchronization tool;
and the increment synchronization sub-module is used for synchronizing the increment data in the first database to the second database by taking the time of starting full-quantity synchronization as the starting time to obtain the target database.
Optionally, the second inspection module includes:
the first judging sub-module is used for the business system to adopt the target database to run a business core flow and judging whether the target database is available in the business core flow;
the first determining submodule is used for determining that the target database is unavailable if abnormal error reporting occurs; the exception reporting errors comprise null pointer exceptions and/or deadlock exceptions;
and the second determining submodule is used for determining that the target database is normally available if no abnormal error report occurs.
Optionally, the second inspection module further comprises:
the recording sub-module is used for recording the first time used by the business system for running the business core flow by adopting the target database;
the second judging sub-module is used for comparing the first time with a second time used by the business system for operating the business core flow by adopting the first database and judging whether the operation efficiency of the target database is qualified or not;
a third determining submodule, configured to determine that the target database operating efficiency is qualified if the first time is less than or equal to the second time;
and the fourth determining submodule is used for determining that the target database operation efficiency is unqualified if the first time is longer than the second time.
Optionally, the second inspection module further comprises:
and the detection sub-module is used for the service system to call a data checking tool to detect the data consistency of the first database and the target database.
Optionally, the detection sub-module includes:
an extraction unit for the data inspection tool to extract first data from the first database;
the searching unit is used for searching second data corresponding to the first data from the target database by the data checking tool;
A judging unit configured to judge whether or not an error occurs in the data transferred to the target database by comparing the first data with the second data by the data checking tool;
a first determining unit configured to determine that no error has occurred in the data transferred to the target database if the first data is identical to the second data;
and the second determining unit is used for determining that the data transferred to the target database has errors if the first data are different from the second data.
Optionally, the second inspection module further comprises:
a construction sub-module for constructing at least one type of third data on a page of the target database by adopting the data of the target database; the type comprises at least one of the longest field, different formats, full filling of the field and default value of the field; the different formats comprise at least one of character strings, integers and floating point numbers;
and the third judging sub-module is used for comparing the third data with fourth data of a corresponding type in the page of the first database and judging whether the target database can normally display the data on the page.
The embodiment of the invention also discloses electronic equipment, which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
The memory is used for storing a computer program;
the processor is used for realizing the database testing method according to the embodiment of the invention when executing the program stored in the memory.
Embodiments of the present invention also disclose one or more computer readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform a database testing method according to embodiments of the present invention.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, the service system checks the configuration information and compatibility of the first database and the second database and the connectivity of the first database and the second database with the synchronization tool respectively to obtain a first check result, and the service system calls the synchronization tool to synchronize the data of the first database to the second database to obtain a target database and checks the data of the target database to obtain a second check result, wherein the second check result feeds back whether the target database can be normally applied or not under the condition that the first check result is determined to be qualified. The first test is carried out on the two databases before migration, so that the configuration information of the two databases is consistent, the first database and the second database can be interacted, the first database and the second database can be communicated with a synchronous tool, a foundation is laid for successful migration of data in the first database, after the data of the first database is migrated to the second database to obtain a target database, the second test is carried out on the data of the target database, and therefore testing is carried out on the databases after new data are migrated, and whether the target database can be normally applied is verified.
Drawings
FIG. 1 is a flow chart of steps of a database testing method provided in an embodiment of the present invention;
FIG. 2 is a flow chart of steps of another database testing method provided in an embodiment of the present invention;
FIG. 3 is a flow chart of a data consistency test provided in an embodiment of the present invention;
FIG. 4 is a schematic flow chart of a test database provided in an embodiment of the present invention;
FIG. 5 is a block diagram of a database testing apparatus according to an embodiment of the present invention;
FIG. 6 is a block diagram of an electronic device provided in an embodiment of the invention;
fig. 7 is a schematic diagram of a computer readable medium provided in an embodiment of the invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
The different databases have differences, so that the problem of influencing migration can be encountered in the process of data migration of the different databases, and the use problem can also exist after the data migration, so that the use of users is influenced, and therefore, the configuration information and compatibility of the two databases and the connectivity of the two databases and a synchronization tool can be checked before the data migration, so that the successful migration of the data is ensured. After the data migration is completed, the correctness and the availability of the data can be checked to ensure that the data obtained by each service are accurate; the core flow of the business is checked to ensure that the core business flow is not affected when the business is transferred to a new database, and the new database can bear the load of the original core business.
Referring to fig. 1, a flowchart illustrating steps of a database testing method provided in an embodiment of the present invention may specifically include the following steps:
step 101, the service system calls a distributed resource scheduling program, checks configuration information and compatibility of the first database and the second database, and connectivity of the first database, the second database and a synchronization tool respectively, and generates a first check result;
in the embodiment of the invention, a service system can be set, the service system is used for processing services, and a database can be set in the service system and used for storing service data. When business upgrading or greatly increasing the business volume of an enterprise makes a source database in a business system incapable of meeting business operation and business data storage requirements, the enterprise can create a database with stronger functions and huge capacity to meet business requirements. Of course, after the database is newly built, the problem of data migration is necessarily faced.
The migration of the databases of the same type is simpler, and the databases of different types have differences, so that the migration is influenced in the process of data migration of the databases of different types, and the use problem is also caused after the data migration.
Specifically, the service system may include a first database and a second database, where the first database is a source database to be migrated, and the second database is a target database to be migrated. Before data migration, the first database and the second database can be checked, alarms are given to some conditions which possibly affect the success of migration, and the influence factors are pre-processed to prevent migration failure caused in the migration process.
Specifically, the service system may invoke the distributed resource scheduler to check configuration information and compatibility of the first database and the second database, and connectivity of the first database, the second database and the synchronization tool respectively, and generate a first check result, where the first check result feeds back whether the first database and the second database meet a condition for performing data migration.
The configuration information is basic parameter information of a database; compatibility indicates whether new and old databases can interact; connectivity means whether the new and old databases can be communicated with the synchronization tool;
checking configuration information of the first database and the second database to compare the configuration information of the first database and the configuration information of the second database, judging whether the configuration information of the first database and the configuration information of the second database are the same, if so, indicating that the first database and the second database use the same SQL specification, and in the migration process, SQL problems cannot occur, and migration conditions are met; if not, the configuration information of the second database may be modified to enable the data of the first database to be successfully migrated to the second database.
The method comprises the steps that the compatibility of a first database and a second database is checked to check whether the first database and the second database can interact, and if the first database and the second database can interact, migration conditions are met; if the first database and the second database cannot interact, the second database can be replaced by a database which can interact with the first database, so that the data of the first database can be successfully migrated to the second database.
The connectivity test of the first database and the second database and the synchronous tool is to detect whether the synchronous tool can be communicated with the first database and the second database respectively, and if the first database and the second database can be communicated with the synchronous tool, the migration condition is met; if one or both databases cannot communicate with the synchronization tool, multiple connections may be made until successful communication, so that the data of the first database can be successfully migrated to the second database.
Preferably, the distributed resource scheduler may also test the load virtualization of the second database in advance to determine whether the second database can bear the load of the service.
102, under the condition that the first test result is qualified, the service system calls the synchronization tool to synchronize the data of the first database to the second database, so as to obtain a target database;
After the first test is performed, if the first test result is qualified, that is, if the configuration information, the compatibility and the connectivity test result are all qualified, data migration can be performed. Specifically, the business system may invoke a synchronization tool that is employed to synchronize data of the first database to the second database, thereby obtaining the target database.
The first database may be the same type of database or different types of databases, and before migration, it may be determined whether the same type of database is migrated or the different types of databases are migrated, and whether the content and scope of data migration are the basic data migration of a part of modules or the migration of the whole database.
For data migration, the migration can be performed under the condition that a service system stops operating, and the migration method only needs to migrate the historical data in the first database to the second database, so that the migration method is convenient, but the service is needed to be suspended by adopting the migration method, so that the use of a user is influenced; the migration can also be performed under the condition that the service system operates normally, the migration mode is complex, not only is the total migration of the historical data required, but also incremental data is required to be synchronized to the second database, and the workload of data migration is increased.
Preferably, the distributed resource scheduler may set a breakpoint mechanism in the synchronization tool so that no data is lost during synchronization of data, whether it is a normal start-stop or an abnormal restart.
Step 103, the business system checks the data of the target database to generate a second check result; and the second checking result feeds back whether the target database can be normally applied.
After the data of the first database is successfully migrated to the second database to obtain the target database, the service system can check the data of the target database so as to determine whether the target database can be normally applied.
In particular, the verification of the data in the target database may include verifying the correctness of the data and verifying the availability of the data. Verifying the correctness of the data may be to verify whether the data migrated in the target database is in error. The checking of the availability of the data may be to check whether the data migrated in the target database can be normally applied in the core flow of the business or to check whether the data migrated in the target database can be normally displayed in the target database page.
By the database testing method, the service system checks configuration information and compatibility of the first database and the second database and connectivity of the first database and the second database with the synchronization tool respectively through calling the distributed resource scheduling program to obtain a first check result, and under the condition that the first check result is qualified, the service system calls the synchronization tool to synchronize data of the first database to the second database to obtain a target database, checks the data of the target database to obtain a second check result, and the second check result feeds back whether the target database can be normally applied. The first test is carried out on the two databases before migration, so that the configuration information of the two databases is consistent, the first database and the second database can be interacted, the first database and the second database can be communicated with a synchronous tool, a foundation is laid for successful migration of data in the first database, after the data of the first database is migrated to the second database to obtain a target database, the second test is carried out on the data of the target database, and therefore testing is carried out on the databases after new data are migrated, and whether the target database can be normally applied is verified.
Referring to fig. 2, a flowchart illustrating steps of another database testing method provided in an embodiment of the present invention may specifically include the following steps:
step 201, the service system calls a distributed resource scheduler, checks configuration information and compatibility of the first database and the second database, and connectivity of the first database, the second database and a synchronization tool respectively, and generates a first check result;
in the embodiment of the invention, a service system can be set, the service system is used for processing services, and a database can be set in the service system and used for storing service data. When business upgrading or greatly increasing the business volume of an enterprise makes a source database in a business system incapable of meeting business operation and business data storage requirements, the enterprise can create a database with stronger functions and huge capacity to meet business requirements. Of course, after the database is newly built, the problem of data migration is necessarily faced.
The migration of the databases of the same type is simpler, and the databases of different types have differences, so that the migration is influenced in the process of data migration of the databases of different types, and the use problem is also caused after the data migration.
Specifically, the service system may include a first database and a second database, where the first database is a source database to be migrated, and the second database is a target database to be migrated. Before data migration, the first database and the second database can be checked, alarms are given to some conditions which possibly affect the success of migration, and the influence factors are pre-processed to prevent migration failure caused in the migration process.
Specifically, the service system may invoke the distributed resource scheduler to check configuration information and compatibility of the first database and the second database, and connectivity of the first database, the second database and the synchronization tool respectively, and generate a first check result, where the first check result feeds back whether the first database and the second database meet a condition for performing data migration.
The configuration information is basic parameter information of a database; compatibility indicates whether new and old databases can interact; connectivity means whether the new and old databases can be communicated with the synchronization tool;
checking configuration information of the first database and the second database to compare the configuration information of the first database and the configuration information of the second database, judging whether the configuration information of the first database and the configuration information of the second database are the same, if so, indicating that the first database and the second database use the same SQL specification, and in the migration process, SQL problems cannot occur, and migration conditions are met; if not, the configuration information of the second database may be modified to enable the data of the first database to be successfully migrated to the second database.
The method comprises the steps that the compatibility of a first database and a second database is checked to check whether the first database and the second database can interact, and if the first database and the second database can interact, migration conditions are met; if the first database and the second database cannot interact, the second database can be replaced by a database which can interact with the first database, so that the data of the first database can be successfully migrated to the second database.
The connectivity test of the first database and the second database and the synchronous tool is to detect whether the synchronous tool can be communicated with the first database and the second database respectively, and if the first database and the second database can be communicated with the synchronous tool, the migration condition is met; if one or both databases cannot communicate with the synchronization tool, multiple connections may be made until successful communication, so that the data of the first database can be successfully migrated to the second database.
Step 202, in the process of normal operation of the service system, the synchronization tool synchronizes the total data stored in the first database before starting migration to the second database;
And under the condition that the first test result is qualified, data migration can be performed. For data migration, the migration can be performed under the condition that a service system operates normally, and the migration mode is complex, so that not only is the whole amount of historical data required to be migrated, but also incremental data is required to be synchronized to a second database.
Specifically, during normal operation of the service system, the synchronization tool may first synchronize the full amount of data already stored in the first database before the start of migration to the second database, such that the historical data of the first database is all migrated to the second database.
Step 203, synchronizing the incremental data in the first database to the second database by taking the time of starting full synchronization as the starting time, so as to obtain the target database;
when the data volume synchronization is performed, the service system is in normal operation, so that the first database further stores incremental data, and after all the historical data of the first database are migrated to the second database, the incremental data also need to be synchronized to the second database.
Specifically, the time of starting full synchronization can be used as the starting time, and incremental data in the first database can be synchronized to the second database to obtain the target database. In practical application, the target database and the first database cannot be completely consistent due to the time difference, so that the system can be stopped for a short period of time, and the service system can be continuously operated after the incremental data are synchronized.
Step 204, the business system checks the data of the target database to generate a second check result; and the second checking result feeds back whether the target database can be normally applied.
After the data of the first database is successfully migrated to the second database to obtain the target database, the service system can check the data of the target database so as to determine whether the target database can be normally applied.
In particular, the verification of the data in the target database may include verifying the correctness of the data and verifying the availability of the data. Verifying the correctness of the data may be to verify whether the data migrated in the target database is in error. The checking of the availability of the data may be to check whether the data migrated in the target database can be normally applied in the core flow of the business or to check whether the data migrated in the target database can be normally displayed in the target database page.
In one embodiment of the present invention, the service system checks the data of the target database to generate a second check result, including:
s11, the business system adopts the target database to run a business core flow, and judges whether the target database is available in the business core flow;
The data migrated to the new database may be able to be applied normally or may have errors resulting in the failure to be applied normally, so the business system may verify the data of the target database after the data migration is completed. The checking of the data in the target database by the service system may include checking the availability of the data, in particular, the service system may use the data in the target database to run a service core flow, and determine whether the data migrated to the target database is normally available in the service core flow.
S12, if abnormal error reporting occurs, determining that the target database is not available; the exception reporting errors comprise null pointer exceptions and/or deadlock exceptions;
in the process that the business system adopts the data of the target database to run the business core flow, if abnormal error reporting occurs, the data of the target database can be indicated not to be suitable for the business core flow, so the target database cannot be normally applied to the business.
Specifically, in the process that the service system adopts the data of the target database to operate the service core flow, possible abnormal error reporting is null pointer abnormality, deadlock abnormality and other abnormal error reporting. Where a null pointer exception refers to an exception class in java that is thrown when an application attempts to use null where an object is needed. Deadlock exceptions are a kind of dead office caused by competing for resources in the running process of multiple processes, and if no external force is used, they cannot continue to advance until the program crashes.
And S13, if no abnormal error report occurs, determining that the target database is normally available.
In the process that the business system adopts the data of the target database to run the business core flow, if no abnormal error reporting occurs, the data of the target database can be normally applied in the business core flow, so the target database can be used in the business system.
In one embodiment of the invention, the method further comprises:
s21, recording the first time used by the business system for running the business core flow by adopting the target database;
and the efficiency of operating the business core flow by the target database can be checked by comparing the efficiency of operating the business core flow by the first database with the efficiency of operating the business core flow by the target database so as to determine whether the operation efficiency of the target database is qualified.
In the embodiment of the invention, the efficiency of running the business core flow can be compared by comparing the time required for running the business core flow. Specifically, in the process that the service system adopts the data of the target database to operate the service core flow, the first time used by the service system to operate the service core flow by adopting the target database may be recorded first.
S22, comparing the first time with a second time used by the business system to operate the business core flow by adopting the first database, and judging whether the operation efficiency of the target database is qualified or not;
after the first time used by the business system for operating the business core flow by adopting the target database is recorded, the business core flow can also be operated by adopting the data of the first database in the business system, and the second time used by the business system for operating the business core flow by adopting the first database is recorded, so that the first time and the second time can be compared, and whether the operation efficiency of the target database is qualified or not is judged according to the comparison result. Specifically, if the first time is shorter than the second time, the time used for operating the service core flow by using the target database is less than the time used for operating the service core flow by using the first database, and the efficiency is higher, the operation efficiency of the target database can be determined to be qualified; if the first time is longer than the second time, which means that the time used for operating the business core flow by using the target database is more than the time used for operating the business core flow by using the first database, the efficiency is lower, and the operation efficiency of the target database can be determined to be unqualified.
S23, if the first time is smaller than or equal to the second time, determining that the target database operation efficiency is qualified;
if the comparison result is that the first time is smaller than or equal to the second time, that is, the first time is shorter than the second time, the time used for operating the business core flow by adopting the target database is smaller than the time used for operating the business core flow by adopting the first database, the efficiency is higher, and the operation efficiency of the target database can be determined to be qualified.
And S24, if the first time is longer than the second time, determining that the operation efficiency of the target database is unqualified.
If the comparison result is that the first time is longer than the second time, that is, the first time is longer than the second time, the time used for operating the business core flow by adopting the target database is more than the time used for operating the business core flow by adopting the first database, the efficiency is lower, and the operation efficiency of the target database can be determined to be unqualified.
In one embodiment of the present invention, the service system checks the data of the target database to generate a second check result, and further includes:
s31, the business system calls a data checking tool to detect the data consistency of the first database and the target database.
The data transferred to the new database may be completely consistent with the first database, or errors may occur to cause the data to be inconsistent with the data of the first database, so that the service system may verify the data of the target database after the data transfer is completed. The verification of the data in the target database by the business system may comprise verification of the correctness of the data, in particular the business system may invoke a data checking tool to detect the consistency of the data of the first database and the target database.
In one embodiment of the present invention, the service system call data checking tool detects data consistency of the first database and the target database, including:
s41, the data checking tool extracts first data from the first database;
the data inspection tool may comprise an extraction tool for extracting data from the first database. In particular, the extraction tool may extract the first data from the first database for comparison with the data of the target database.
S42, the data checking tool searches second data corresponding to the first data from the target database;
the data inspection tool may also include an application tool for extracting data from the target database. In particular, the application tool may look up the second data corresponding to the first data from the target database for comparison with the first data of the first database.
S43, the data checking tool compares the first data with the second data to judge whether the data transferred to the target database has errors or not;
the data inspection tool may compare the first data of the first database with the second data of the target database to determine if the data transferred to the target database is erroneous.
S44, if the first data are the same as the second data, determining that the data transferred to the target database have no errors;
by contrast, if it is determined that the first data is identical to the second data, it is determined that the data transferred to the target database has no error, which indicates that the data of the target database is identical to the data of the first data.
S45, if the first data are different from the second data, determining that the data transferred to the target database have errors.
By contrast, if it is determined that the first data is different from the second data, it is indicated that the data of the target database is inconsistent with the data of the first data, and it may be determined that an error occurs in the data transferred to the target database.
Referring to FIG. 3, a flow chart of a data consistency test provided in an embodiment of the present invention is shown.
The specific flow is as follows:
1. extracting the first data from the first database using an extraction tool;
2. extracting second data from the target database using the application tool;
3. the data checking tool compares the first data with the second data and judges that the first data is identical with the second data;
4. if the first data is the same as the second data, the data transfer is error-free;
5. if the first data is different from the second data, the data transfer is indicated to have errors.
In one embodiment of the present invention, the service system checks the data of the target database to generate a second check result, and further includes:
s51, constructing at least one type of third data on a page of the target database by adopting the data of the target database; the type comprises at least one of data with the longest field, different formats and full filling of the field and a default value of the field; the different formats comprise at least one of character strings, integers and floating point numbers;
and the data availability is checked, whether the data of the target database can be normally displayed in the page can be checked, and the data displayed in the page in the target database can be compared with the data displayed in the page in the first database so as to determine whether the data of the target database can be normally displayed in the page.
In particular, at least one type of data may be constructed on a page of the target database, and these types of data may be compared with corresponding types of data in the first data page. Wherein the at least one type of data comprises data with the longest field, data with different formats, data with full filling of the field and data with the default value of the field; the data in different formats comprises character strings, integers and floating point numbers.
S52, comparing the third data with fourth data of a corresponding type in the page of the first database, and judging whether the target database can normally display data on the page.
And comparing the at least one type of data in the page of the target database with the corresponding type of data in the page of the first database to judge whether the target database can normally display the data in the page.
Specifically, if the at least one type of data in the page of the target database is completely consistent with the corresponding type of data in the page of the first database, it can be stated that the target database can normally display the data on the page; if any one of the at least one type of data in the page of the target database corresponds to the type of data in the page of the first database, it can be stated that the target database cannot normally display the data on the page.
Referring to fig. 4, a schematic flow chart of a test database according to an embodiment of the present invention is shown.
The specific flow is as follows:
1. determining data migration content and range;
2. the DRS checks configuration information and compatibility of the first database and the second database, and connectivity of the first database and the second database with a synchronization tool respectively;
3. migrating the data of the first database to a second database to obtain a target database;
4. the testing of the data of the target database can comprise testing of business core flows, testing of data consistency and testing of data page display.
By the database testing method, the service system checks configuration information and compatibility of the first database and the second database and connectivity of the first database and the second database with the synchronization tool respectively through calling the distributed resource scheduling program to obtain a first check result, and under the condition that the first check result is qualified, the service system calls the synchronization tool to synchronize data of the first database to the second database to obtain a target database, checks the data of the target database to obtain a second check result, and the second check result feeds back whether the target database can be normally applied. The first test is carried out on the two databases before migration, so that the configuration information of the two databases is consistent, the first database and the second database can be interacted, the first database and the second database can be communicated with a synchronous tool, a foundation is laid for successful migration of data in the first database, after the data of the first database is migrated to the second database to obtain a target database, the second test is carried out on the data of the target database, and therefore testing is carried out on the databases after new data are migrated, and whether the target database can be normally applied is verified.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to fig. 5, a block diagram of a database testing apparatus provided in an embodiment of the present invention is shown, which may specifically include the following modules:
a first checking module 501, configured to invoke a distributed resource scheduler by the service system, check configuration information and compatibility of the first database and the second database, and connectivity of the first database and the second database with a synchronization tool, respectively, and generate a first checking result;
the synchronization module 502 is configured to, when the first test result is qualified, invoke the synchronization tool by the service system, and synchronize data of the first database to the second database to obtain a target database;
A second checking module 503, configured to check the data of the target database by using the service system, and generate a second checking result; and the second checking result feeds back whether the target database can be normally applied.
Optionally, the synchronization module includes:
a full synchronization sub-module, configured to synchronize, during normal operation of the service system, the full amount of data stored in the first database before the start of migration to the second database by the synchronization tool;
and the increment synchronization sub-module is used for synchronizing the increment data in the first database to the second database by taking the time of starting full-quantity synchronization as the starting time to obtain the target database.
Optionally, the second inspection module includes:
the first judging sub-module is used for the business system to adopt the target database to run a business core flow and judging whether the target database is available in the business core flow;
the first determining submodule is used for determining that the target database is unavailable if abnormal error reporting occurs; the exception reporting errors comprise null pointer exceptions and/or deadlock exceptions;
and the second determining submodule is used for determining that the target database is normally available if no abnormal error report occurs.
Optionally, the second inspection module further comprises:
the recording sub-module is used for recording the first time used by the business system for running the business core flow by adopting the target database;
the second judging sub-module is used for comparing the first time with a second time used by the business system for operating the business core flow by adopting the first database and judging whether the operation efficiency of the target database is qualified or not;
a third determining submodule, configured to determine that the target database operating efficiency is qualified if the first time is less than or equal to the second time;
and the fourth determining submodule is used for determining that the target database operation efficiency is unqualified if the first time is longer than the second time.
Optionally, the second inspection module further comprises:
and the detection sub-module is used for the service system to call a data checking tool to detect the data consistency of the first database and the target database.
Optionally, the detection sub-module includes:
an extraction unit for the data inspection tool to extract first data from the first database;
the searching unit is used for searching second data corresponding to the first data from the target database by the data checking tool;
A judging unit configured to judge whether or not an error occurs in the data transferred to the target database by comparing the first data with the second data by the data checking tool;
a first determining unit configured to determine that no error has occurred in the data transferred to the target database if the first data is identical to the second data;
and the second determining unit is used for determining that the data transferred to the target database has errors if the first data are different from the second data.
Optionally, the second inspection module further comprises:
a construction sub-module for constructing at least one type of third data on a page of the target database by adopting the data of the target database; the type comprises at least one of the longest field, different formats, full filling of the field and default value of the field; the different formats comprise at least one of character strings, integers and floating point numbers;
and the third judging sub-module is used for comparing the third data with fourth data of a corresponding type in the page of the first database and judging whether the target database can normally display the data on the page.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
In addition, the embodiment of the invention also provides an electronic device, as shown in fig. 6, which comprises a processor 601, a communication interface 602, a memory 603 and a communication bus 604, wherein the processor 601, the communication interface 602 and the memory 603 complete communication with each other through the communication bus 604,
a memory 603 for storing a computer program;
the processor 601 is configured to execute the program stored in the memory 603, and implement the following steps:
the service system calls a distributed resource scheduling program, checks configuration information and compatibility of the first database and the second database, and connectivity of the first database and the second database with a synchronization tool respectively, and generates a first check result;
under the condition that the first inspection result is qualified, the service system calls the synchronization tool, and 5 synchronizes the data of the first database to the second database to obtain a target database;
the business system checks the data of the target database to generate a second check result;
and the second checking result feeds back whether the target database can be normally applied.
Optionally, in the case that the first inspection result is qualified, the business system invokes the same
Step means for synchronizing the data of the first database to the second database to obtain a target database, 0 comprising:
in the process of normal operation of the service system, the synchronization tool synchronizes the total amount of data stored in the first database before starting migration to the second database;
and synchronizing the incremental data in the first database to the second database by taking the time of starting full synchronization as the starting time, so as to obtain the target database.
5 optionally, the service system checks the data of the target database to generate a second check result, including:
the business system adopts the target database to run a business core flow, and judges whether the target database is available in the business core flow;
if abnormal error reporting occurs, determining that the target database is not available; the exception reporting errors comprise null 0 pointer exceptions and/or deadlock exceptions;
and if no abnormal error report occurs, determining that the target database is normally available.
Optionally, the method further comprises:
recording the use of the business system to run the business core process by adopting the target database
Is a first time of (a);
5, using the first database to run the service core with the service system at the first time
Comparing the second time used by the heart flow, and judging whether the operation efficiency of the target database is qualified or not;
if the first time is less than or equal to the second time, determining that the target database operation efficiency is qualified;
and if the first time is longer than the second time, determining that the target database operation efficiency is not qualified.
Optionally, the service system checks the data of the target database to generate a second check result, and further includes:
the business system invokes a data checking tool to detect data consistency of the first database and the target database.
Optionally, the service system call data checking tool detects data consistency of the first database and the target database, including:
the data inspection tool extracting first data from the first database;
the data checking tool searches second data corresponding to the first data from the target database;
the data checking tool compares the first data with the second data and judges whether the data transferred to the target database has errors or not;
If the first data are the same as the second data, determining that the data transferred to the target database have no errors;
and if the first data is different from the second data, determining that the data transferred to the target database has errors.
Optionally, the service system checks the data of the target database to generate a second check result, and further includes:
constructing at least one type of third data on pages of the target database by adopting the data of the target database; the type comprises at least one of the longest field, different formats, full filling of the field and default value of the field; the different formats comprise at least one of character strings, integers and floating point numbers;
and comparing the third data with fourth data of a corresponding type in the page of the first database, and judging whether the target database can normally display data in the page.
The communication bus mentioned by the above terminal may be a peripheral component interconnect standard (Peripheral Component Interconnect, abbreviated as PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, abbreviated as EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the terminal and other devices.
The memory may include random access memory (Random Access Memory, RAM) or non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but also digital signal processors (Digital Signal Processing, DSP for short), application specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), field-programmable gate arrays (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In yet another embodiment of the present invention, as shown in fig. 7, there is further provided a computer readable storage medium 701 having instructions stored therein, which when run on a computer, cause the computer to perform the database test method described in the above embodiment.
In yet another embodiment of the present invention, a computer program product containing instructions that, when run on a computer, cause the computer to perform the database test method described in the above embodiment is also provided.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may 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 loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present invention, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), etc.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order
There is any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus
Other elements listed or include 0 element inherent to such a process, method, article or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In the present specification, each embodiment is described in a related manner, and the same similar parts between the embodiments are mutually referred to, and each embodiment is mainly described in a different manner from the other embodiments
Where it is. In particular, for system embodiments, since they are substantially similar to method embodiments, description 5 is relatively simple, with reference to the description of method embodiments in part.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims (10)

1. A database testing method, applied to a business system, the business system comprising a first database and a second database, comprising:
the service system calls a distributed resource scheduling program, checks configuration information and compatibility of the first database and the second database, and connectivity of the first database and the second database with a synchronization tool respectively, and generates a first check result;
under the condition that the first inspection result is qualified, the service system calls the synchronization tool to synchronize the data of the first database to the second database to obtain a target database;
the business system checks the data of the target database to generate a second check result; and the second checking result feeds back whether the target database can be normally applied.
2. The method of claim 1, wherein, in the case that the first test result is acceptable, the service system invokes the synchronization tool to synchronize the data of the first database to the second database to obtain a target database, comprising:
In the process of normal operation of the service system, the synchronization tool synchronizes the total amount of data stored in the first database before starting migration to the second database;
and synchronizing the incremental data in the first database to the second database by taking the time of starting full synchronization as the starting time, so as to obtain the target database.
3. The method of claim 1, wherein the business system verifies the data of the target database to generate a second verification result, comprising:
the business system adopts the target database to run a business core flow, and judges whether the target database is available in the business core flow;
if abnormal error reporting occurs, determining that the target database is not available; the exception reporting errors comprise null pointer exceptions and/or deadlock exceptions;
and if no abnormal error report occurs, determining that the target database is normally available.
4. A method according to claim 3, characterized in that the method further comprises:
recording a first time used by the business system to operate the business core flow by adopting the target database;
Comparing the first time with a second time used by the business system to operate the business core flow by adopting the first database, and judging whether the operation efficiency of the target database is qualified or not;
if the first time is less than or equal to the second time, determining that the target database operation efficiency is qualified;
and if the first time is longer than the second time, determining that the target database operation efficiency is not qualified.
5. The method of claim 1, wherein the business system verifies the data of the target database to generate a second verification result, further comprising:
the business system invokes a data checking tool to detect data consistency of the first database and the target database.
6. The method of claim 1, wherein the business system call data checking tool detects data consistency of the first database and the target database, comprising:
the data inspection tool extracting first data from the first database;
the data checking tool searches second data corresponding to the first data from the target database;
The data checking tool compares the first data with the second data and judges whether the data transferred to the target database has errors or not;
if the first data are the same as the second data, determining that the data transferred to the target database have no errors;
and if the first data is different from the second data, determining that the data transferred to the target database has errors.
7. The method of claim 1, wherein the business system verifies the data of the target database to generate a second verification result, further comprising:
constructing at least one type of third data on pages of the target database by adopting the data of the target database; the type comprises at least one of the longest field, different formats, full filling of the field and default value of the field; the different formats comprise at least one of character strings, integers and floating point numbers;
and comparing the third data with fourth data of a corresponding type in the page of the first database, and judging whether the target database can normally display data in the page.
8. A database testing apparatus, characterized by being applied to a business system including a first database and a second database, comprising:
The first checking module is used for the service system to call a distributed resource scheduling program, checking configuration information and compatibility of the first database and the second database, and connectivity of the first database and the second database with a synchronization tool respectively, and generating a first checking result;
the synchronization module is used for calling the synchronization tool by the service system to synchronize the data of the first database to the second database under the condition that the first test result is qualified, so as to obtain a target database;
the second checking module is used for checking the data of the target database by the service system and generating a second checking result; and the second checking result feeds back whether the target database can be normally applied.
9. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the method according to any one of claims 1-7 when executing a program stored on a memory.
10. One or more computer-readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method of any of claims 1-7.
CN202310019542.2A 2023-01-06 2023-01-06 Database testing method and device, electronic equipment and readable medium Pending CN116089285A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310019542.2A CN116089285A (en) 2023-01-06 2023-01-06 Database testing method and device, electronic equipment and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310019542.2A CN116089285A (en) 2023-01-06 2023-01-06 Database testing method and device, electronic equipment and readable medium

Publications (1)

Publication Number Publication Date
CN116089285A true CN116089285A (en) 2023-05-09

Family

ID=86203934

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310019542.2A Pending CN116089285A (en) 2023-01-06 2023-01-06 Database testing method and device, electronic equipment and readable medium

Country Status (1)

Country Link
CN (1) CN116089285A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116991691A (en) * 2023-09-26 2023-11-03 中国铁塔股份有限公司 Database testing method and device, electronic equipment and readable storage medium
CN117194390A (en) * 2023-11-08 2023-12-08 建信金融科技有限责任公司 Database migration method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116991691A (en) * 2023-09-26 2023-11-03 中国铁塔股份有限公司 Database testing method and device, electronic equipment and readable storage medium
CN116991691B (en) * 2023-09-26 2024-01-30 中国铁塔股份有限公司 Database testing method and device, electronic equipment and readable storage medium
CN117194390A (en) * 2023-11-08 2023-12-08 建信金融科技有限责任公司 Database migration method and device
CN117194390B (en) * 2023-11-08 2024-02-09 建信金融科技有限责任公司 Database migration method and device

Similar Documents

Publication Publication Date Title
US11263111B2 (en) Validating software functionality
CN116089285A (en) Database testing method and device, electronic equipment and readable medium
US10169203B2 (en) Test simulation for software defined networking environments
US9880897B2 (en) Failure mode identification and reporting
CN108038039B (en) Method for recording log and micro-service system
CN111190551B (en) Redis data migration system, migration method, migration device and terminal
CN112241370B (en) API interface class checking method, system and device
CN111767340A (en) Data processing method, device, electronic equipment and medium
CN111767226A (en) Method, system and equipment for testing cloud computing platform resources
CN110063042A (en) A kind of response method and its terminal of database failure
CN111352997A (en) Test environment verification method and system
US11347533B2 (en) Enhanced virtual machine image management system
CN111597020A (en) Application Programming Interface (API) debugging method and debugging terminal
CN112286786A (en) Database testing method and device and server
CN115599683A (en) Automatic testing method, device, equipment and storage medium
CN115080449A (en) Test method, device, equipment, medium and program product
CN108845932B (en) Unit testing method and device of network library, storage medium and terminal
CN110618943B (en) Security service test method and device, electronic equipment and readable storage medium
CN112256554B (en) Method and equipment for testing based on scene test cases
JP2009181494A (en) Job processing system and job information acquisition method
CN114900531B (en) Data synchronization method, device and system
CN115640236B (en) Script quality detection method and computing device
US20170235771A1 (en) Systems and methods for electronic mail communication based data management
CN114253846B (en) Automatic test abnormality positioning method, device, equipment and readable storage medium
CN116974928A (en) Dynamic test method, device, terminal equipment and medium based on data migration

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination