Database stability test method and device, computer equipment and storage medium
By performing the deletion and query process in parallel in database stability testing, and dynamically adjusting the database operation based on the storage space ratio, the existing test method cannot simulate changes in dynamic data, and improves the accuracy of testing.
Patent Information
- Application Number
- CN202411641624.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-01-28
AI Technical Summary
Existing database stability testing methods cannot effectively simulate dynamic data changes in actual applications, resulting in low test accuracy.
By performing data creation and data query processes in parallel in the preset operation period, the database creation or deletion operation is dynamically executed according to the proportion of storage space in the storage node, and the corresponding log content is generated to monitor the task process to generate databases to generate databases to generate databases to generate databases Stability test results.
This method can more accurately simulate the stability of the database under the conditions of high concurrent scenarios and data volume dynamic changes, and improve the accuracy of database stability testing.
Smart Images

Figure CN119377123A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of database technology, and in particular to a method, apparatus, computer equipment, computer-readable storage medium and computer program product for testing database stability. Background Art
[0002] Existing databases, especially high-concurrency, real-time analytical databases, have extremely high requirements for data processing performance. When running under high load for a long time, performance degradation or stability problems may occur. Therefore, database stability testing has always been an important part of technology development and operation and maintenance management. Traditional database stability testing methods are usually based on pre-defined, fixed data sets for testing, which cannot simulate dynamic data changes in actual applications. Therefore, they cannot reflect the stability of the database under conditions of dynamic changes in data volume, resulting in low accuracy in database stability testing. Summary of the invention
[0003] Based on this, it is necessary to provide a database stability testing method, apparatus, computer equipment, computer-readable storage medium and computer program product that can improve the accuracy of database stability testing in order to address the above technical problems.
[0004] In a first aspect, the present application provides a method for testing database stability, comprising:
[0005] Execute at least one data creation and deletion process within a preset running time; the data creation and deletion process is used to execute a database creation operation or a database deletion operation in the storage node according to the used storage space of the storage node in the database system, and generate data creation and deletion log content;
[0006] Executing at least one data query process within the preset running time; the data query process is used to select a target database from the database of the storage node, and generate data query log content by executing a database query operation on the target database;
[0007] During the parallel execution of the data creation and deletion process and the data query process, a task monitoring process is executed; the task monitoring process is used to generate database stability test results based on the data creation and deletion log content and the data query log content.
[0008] In one embodiment, executing at least one data creation and deletion process within a preset running time includes:
[0009] Record the test start timestamp;
[0010] Determine the proportion of used storage space of the storage node; the proportion of used storage space is equal to the proportion of used storage space of the storage node to the total storage space;
[0011] Modify the value of the data manipulation direction identifier according to the used storage space ratio;
[0012] According to the value of the data manipulation direction identifier, a database creation operation or a database deletion operation is performed in the storage node, data creation and deletion log content is generated, the first process end timestamp is recorded, and the step of determining the percentage of used storage space of the storage node is returned to until the difference between the first process end timestamp and the test start timestamp is greater than the preset running time.
[0013] In one embodiment, modifying the value of the data manipulation direction identifier according to the used storage space ratio includes:
[0014] If the used storage space ratio is less than the minimum threshold, modifying the value of the data manipulation direction identifier to be the first value;
[0015] If the proportion of used storage space is greater than the maximum threshold, modifying the value of the data manipulation direction identifier to a second value;
[0016] If the percentage of used storage space is between the minimum threshold and the maximum threshold, the value of the data manipulation direction identifier is maintained.
[0017] In one embodiment, performing a database creation operation or a database deletion operation in the storage node according to the value of the data manipulation direction identifier includes:
[0018] If the value of the data manipulation direction identifier is the first value, executing a database creation operation in the storage node;
[0019] If the value of the data manipulation direction identifier is the second value, a database deletion operation is performed in the storage node.
[0020] In one of the embodiments, executing at least one data query process within the preset running time includes:
[0021] Record the test start timestamp;
[0022] When the number of databases of the storage node is greater than one, obtaining a database list of the storage node; the database list includes databases created by the at least one data creation and deletion process and arranged in a creation order;
[0023] Select the second to last database in the database list as the target database;
[0024] Perform a database query operation on the target database, generate data query log content, record the second process end timestamp, and return to the step of obtaining the database list of the storage node when the number of databases on the storage node is greater than one, until the difference between the second process end timestamp and the test start timestamp is greater than the preset running time.
[0025] In one embodiment, the execution task monitoring process includes:
[0026] Regularly obtain the process status of the data creation and deletion process and the data query process, the data creation and deletion log content, the data query log content and the node status of the storage node;
[0027] When at least one of the following conditions is met: the process status is abnormal, the data creation and deletion log content or the data query log content contains failure information, and the storage node is in an abnormal working state, it is determined that the database stability test result of the database system is that the database stability is abnormal.
[0028] In a second aspect, the present application also provides a database stability testing device, comprising:
[0029] A data creation and deletion module is used to execute at least one data creation and deletion process within a preset running time; the data creation and deletion process is used to execute a database creation operation or a database deletion operation in the storage node according to the used storage space of the storage node in the database system, and generate data creation and deletion log content;
[0030] A data query module, used to execute at least one data query process within the preset running time; the data query process is used to select a target database from the database of the storage node, and generate data query log content by executing a database query operation on the target database;
[0031] The task monitoring module is used to execute the task monitoring process when the data creation and deletion process and the data query process are executed in parallel; the task monitoring process is used to generate database stability test results based on the data creation and deletion log content and the data query log content.
[0032] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0033] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0034] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.
[0035] The above-mentioned database stability testing method, device, computer equipment, computer-readable storage medium and computer program product execute at least one data creation and deletion process within a preset running time, wherein the data creation and deletion process is used to execute database creation operations or database deletion operations in the storage node according to the used storage space of the storage node in the database system, and generate data creation and deletion log content; execute at least one data query process within the preset running time, wherein the data query process is used to select a target database from the database of the storage node, and generate data query log content by executing database query operations on the target database; in the process of parallel execution of the data creation and deletion process and the data query process, execute a task monitoring process, wherein the task monitoring process is used to generate database stability test results according to the data creation and deletion log content and the data query log content. By running the data creation and deletion processes and the data query processes in parallel within the preset running time, the high concurrency scenarios of actual applications can be simulated. While continuously querying the database, the database is constantly created and deleted, and the log contents generated by the data creation and deletion processes and the data query processes are checked regularly, so as to obtain effective and reliable database stability test results. In this way, the stability of the database can be tested under conditions of dynamic changes in data volume and high concurrency processes, thereby improving the accuracy of database stability testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0037] FIG1 is an application environment diagram of a method for testing database stability in one embodiment;
[0038] FIG2 is a schematic diagram of a flow chart of a method for testing database stability in one embodiment;
[0039] FIG3 is a logic diagram of a data creation and deletion process in one embodiment;
[0040] FIG4 is a logic diagram of a method for testing database stability in one embodiment;
[0041] FIG5 is a structural block diagram of a database stability testing device according to an embodiment;
[0042] FIG. 6 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0044] The database stability testing method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the execution machine 102 is a computer or server used to run tasks or perform automated operations. The execution machine 102 can be configured with an automated operation and maintenance tool, such as Ansible. The database system 104 can be an overall system including functions such as data storage, management, and query, including a database engine, query execution, and management interface, etc., which supports users to create, manage, and query multiple databases therein. Optionally, the database system 104 may include a high-performance, real-time analytical database based on a distributed computing architecture, such as the Doris database system. The Doris database system has the characteristics of high speed and ease of use. It only requires a sub-second response time to return query results under massive data. It can not only support high-concurrency query scenarios, but also support high-throughput complex analysis scenarios. However, the Doris database system currently does not have an effective means of verifying the stability of the version, and is prone to stability failures. The database system 104 includes a management node 1041 and a storage node 1042, wherein the management node 1041 can also be called a front-end node, and the storage node 1042 can also be called a back-end node. The management node 1041 is responsible for user request access, query parsing planning, metadata management, and node management related work; the storage node 1042 is responsible for data storage and query plan execution, and multiple databases can be created and stored in the storage node 1042. The execution machine 102 can package the scripts of the four modules, namely, the data generation module, the data creation and deletion module, the data query module, and the task monitoring module, into a test compressed package, and then upload the test compressed package to the management node 1041 of the database system 104 through the automated operation and maintenance tool, and the execution machine 102 remotely executes the scripts corresponding to each module through the automated operation and maintenance tool.
[0045] The execution machine 102 executes at least one data creation and deletion process within the preset running time; the data creation and deletion process is used to execute database creation operations or database deletion operations in the storage node 1042 according to the storage space of the storage node 1042 in the database system 104, and generate data creation and deletion log content; the execution machine 102 executes at least one data query process within the preset running time; the data query process is used to select a target database from the database of the storage node 1042, and generate data query log content by executing database query operations on the target database; the execution machine 102 executes a task monitoring process during the parallel execution of the data creation and deletion process and the data query process; the task monitoring process is used to generate database stability test results based on the data creation and deletion log content and the data query log content.
[0046] In an exemplary embodiment, as shown in FIG. 2 , a method for testing database stability is provided, which is described by taking the method applied to the execution machine 102 in FIG. 1 as an example, and includes:
[0047] Step S202, executing at least one data creation and deletion process within a preset running time.
[0048] The data creation and deletion process is used to execute a database creation operation or a database deletion operation in a storage node according to the used storage space of the storage node in the database system, and generate data creation and deletion log content.
[0049] In a specific implementation, the execution machine may first generate local persistent data through a benchmark tool. Persistent data refers to local data that can be stored for a long time. For example, the benchmark tool may be a TPC-H tool. The amount of persistent data generated by the execution machine may be generated based on the input script parameters. For example, if the script parameter is 1000, 1000 gigabytes (GB) of data is generated. Optionally, the amount of data generated may be between 1GB and 10,000GB. The generated persistent data may adopt a snowflake data model, which is a table structure design model for data warehouses and databases and may include several tables.
[0050] In a specific implementation, the data creation and deletion process may include concurrent steps such as calculation of the used storage space of the storage node, calculation of the accumulated running time, database creation, data import, and database deletion. The database creation operation may include creating a new database and importing the generated persistent data into the new database; the database deletion operation may include random deletion or sequential deletion of the database in the storage node; the used storage space is the storage space that has been occupied in the storage node.
[0051] A database is created in the storage node, and then the generated persistent data is imported into the newly created database through the programming interface of the management node; optionally, the created database can be named according to a special identifier and a creation timestamp, such as using tpch as a prefix and adding a creation timestamp as the name of the database, and the special identifier can be used to indicate that the database is created by a data creation and deletion process. At the same time, the execution machine can list all databases created by data creation and deletion processes in the storage node, and each database is sorted in the order of the creation timestamp, and each database can be deleted one by one from top to bottom through the database deletion operation. At the same time, the execution machine can determine the storage space range (including the storage space upper limit value and the storage space lower limit value) according to the input script parameters, and choose to execute the database creation operation or the database deletion operation in the storage node according to the relationship between the used storage space of the storage node and the storage space range. For example, if the used storage space is small, the database creation operation is executed; if the used storage space is large, the database deletion operation is executed. At the same time, the execution machine can calculate the cumulative running time of at least one data creation and deletion process, and determine whether the cumulative running time exceeds the preset running time. The preset running time can be a value set by the script parameters, such as 24 hours. If the accumulated running time of at least one data creation and deletion process exceeds the preset running time, the execution of the data creation and deletion process is terminated.
[0052] Among them, the data creation and deletion log content is the log content generated by executing the data creation and deletion process. For example, the data creation and deletion log content may include whether the database creation is successful, whether the database deletion is successful, the response time of database creation, the response time of database deletion, and other information that can be used to evaluate the stability of data creation, import, and deletion.
[0053] Step S204, executing at least one data query process within a preset running time.
[0054] The data query process is used to select a target database from the database of the storage node, and to generate data query log content by executing a database query operation on the target database.
[0055] Optionally, the target database is selected from the database of the storage node, and a database may be randomly designated as the target database, or a database with a data volume greater than a certain threshold may be selected as the target database, or a suitable target database may be selected according to the creation time of the database.
[0056] In the specific implementation, the execution machine performs database query operations on the target database, which can be polling and calling several query statements of Structured Query Language (SQL). These query statements can be used to test the response speed and performance of the target database in complex query operations. After querying the target database through these query statements, the response time corresponding to each query can be obtained. The response time is the time required from submitting the query to returning the result, and the information reflecting the response speed and performance, such as whether the query is successful and the response time, is written to the data query log content to generate the data query log content. For example, the TPC-H tool and other benchmark tools specifically used to test databases in analytical scenarios can be used to poll and call the target database for 22 SQL queries (Q1~Q22) in analytical scenarios.
[0057] The data query log content is the log content generated by executing the data query process. Exemplarily, the data query log content may include information such as whether the query is successful, the response time of the query, etc., which can be used to evaluate the stability of the data query.
[0058] Step S206, executing the task monitoring process while the data creation and deletion process and the data query process are executed in parallel.
[0059] The data creation and deletion processes and the data query processes are executed in parallel. Exemplarily, within the preset running time, the data creation and deletion processes are repeatedly executed. After each data creation and deletion process is executed, it is checked whether the preset running time has been reached. If not, the next data creation and deletion process is continued to be executed. In the process of executing several data creation and deletion processes in sequence, the data query process is executed in parallel. Similarly, the data query process can be repeatedly executed within the preset running time. After each data query process is executed, it is checked whether the preset running time has been reached. If not, the next data query process is continued to be executed. Optionally, the first data creation and deletion process executed among several data creation and deletion processes and the first data query process executed among several data query processes can be started synchronously.
[0060] Among them, the task monitoring process is used to generate database stability test results based on data creation and deletion log content and data query log content.
[0061] The database stability test results may include abnormal database stability and normal database stability. If the database stability is abnormal, the entire database stability test process can be interrupted and a failure notification can be sent to the relevant terminal; if the database stability is normal within the preset running time, a success notification can be sent to the relevant terminal.
[0062] Exemplarily, the task monitoring process may periodically obtain data creation and deletion log contents and data query log contents; if the data creation and deletion log contents reflect that error messages are generated during the database creation and deletion process, or that the creation and deletion response time is too slow, or if the data query log contents reflect that error messages are generated during the database query process, or that the query response time is too slow, then it may be determined that there is an abnormality in database stability.
[0063] In the above-mentioned database stability test method, at least one data creation and deletion process is executed within a preset running time, wherein the data creation and deletion process is used to perform a database creation operation or a database deletion operation in a storage node according to the used storage space of the storage node in the database system, and generate data creation and deletion log content; at least one data query process is executed within a preset running time, wherein the data query process is used to select a target database from the database of the storage node, and generate data query log content by performing a database query operation on the target database; in the process of parallel execution of the data creation and deletion process and the data query process, a task monitoring process is executed, wherein the task monitoring process is used to generate a database stability test result according to the data creation and deletion log content and the data query log content. By running the data creation and deletion process and the data query process in parallel within the preset running time, the high concurrency scenario of the actual application can be simulated, while continuously querying the database, the database is continuously created and deleted, and the log content generated by the data creation and deletion process and the data query process is regularly checked, so that an effective and reliable database stability test result can be obtained, so that the stability of the database can be tested under the conditions of dynamic changes in data volume and high concurrency process conditions can be simulated, and the accuracy of the test of database stability can be improved.
[0064] In another embodiment, at least one data creation and deletion process is executed within a preset running time, including: recording a test startup timestamp; determining the percentage of used storage space of a storage node; the percentage of used storage space is equal to the percentage of used storage space of the storage node and the total storage space; according to the percentage of used storage space, modifying the value of a data manipulation direction identifier; according to the value of the data manipulation direction identifier, executing a database creation operation or a database deletion operation in the storage node, generating data creation and deletion log content, recording the end timestamp of the first process, and returning to the step of determining the percentage of used storage space of the storage node, until the difference between the end timestamp of the first process and the test startup timestamp is greater than the preset running time.
[0065] The test start timestamp contains the time information of the start of the entire database test process. After the entire database test process is started, the data creation and deletion process and the data query process are executed in parallel.
[0066] The execution machine obtains the used storage space ratio by querying the used storage space and total storage space of the storage node and calculating the ratio between the two.
[0067] Among them, the data manipulation direction identifier can be an identifier used to indicate whether to perform a database creation operation or a database deletion operation. The value of the data manipulation direction identifier is determined based on the percentage of used storage space, and can indicate whether it is appropriate to perform a database creation operation or a database deletion operation under the current percentage of used storage space. For example, if the percentage of used storage space is high, the data manipulation direction identifier can indicate a database deletion operation; if the percentage of used storage space is low, the data manipulation direction identifier can indicate a database deletion operation. For example, the value of the data manipulation direction identifier can be True or False. If it is True, the database creation operation can be performed; if it is False, the database deletion operation can be performed.
[0068] Among them, the first process end timestamp contains the time information when any data creation and deletion process ends. That is, each time a data creation and deletion process is executed, the current timestamp is recorded as the first process end timestamp, and the time difference between the first process end timestamp and the test start timestamp is calculated. If the difference is less than the preset running time, the next data creation and deletion process is executed; if the difference is greater than the preset running time, the data creation and deletion process is terminated, and information such as "data creation and deletion process completed" used to reflect the completion of the data creation and deletion process is output to the data creation and deletion log content.
[0069] The technical solution of this embodiment dynamically determines the proportion of used storage space of the storage node, and executes database creation or deletion operations according to the changes in space, thereby simulating the scenario in which the amount of data in the database is constantly changing during actual operation. This can be closer to the real application environment and help test the stability of the database under conditions of changing data volume. By recording the test start timestamp and the first process end timestamp, and cyclically executing storage space judgment and database operations, the automated cyclic operation can continuously execute the test within a preset running time, thereby improving the test efficiency. By setting a data manipulation direction identifier, the operation direction (creating or deleting a database) is automatically adjusted according to the usage of the storage space, so that different database operation scenarios can be covered in a balanced manner.
[0070] In another embodiment, the value of the data manipulation direction identifier is modified according to the proportion of used storage space, including: if the proportion of used storage space is less than the minimum threshold, the value of the data manipulation direction identifier is modified to a first value; if the proportion of used storage space is greater than the maximum threshold, the value of the data manipulation direction identifier is modified to a second value; if the proportion of used storage space is between the minimum threshold and the maximum threshold, the value of the data manipulation direction identifier is maintained.
[0071] The minimum threshold may be the lowest percentage of used storage space set by the script parameters; the maximum threshold may be the highest percentage of used storage space set by the script parameters. When the value of the data manipulation direction identifier is a first value, it may indicate that the percentage of used storage space is less than the minimum threshold; when the value of the data manipulation direction identifier is a second value, it may indicate that the percentage of used storage space is greater than the maximum threshold.
[0072] The technical solution of this embodiment, by setting the minimum threshold and the maximum threshold, dynamically switches the operation direction according to the proportion of used storage space, can perform different operations (create or delete databases) for different scenarios of high load (storage is close to saturation) and low load (storage space is relatively empty) of the database, can truly verify the stability of the database, improve the accuracy of database stability, and keep the data manipulation direction unchanged when the proportion of used storage space is within the threshold range, avoid resource consumption caused by frequent switching of operation directions, and ensure the efficiency and stability of the test process.
[0073] In another embodiment, according to the value of the data manipulation direction identifier, a database creation operation or a database deletion operation is performed in the storage node, including: if the value of the data manipulation direction identifier is a first value, a database creation operation is performed in the storage node; if the value of the data manipulation direction identifier is a second value, a database deletion operation is performed in the storage node.
[0074] To facilitate the understanding of those skilled in the art, FIG3 exemplarily provides a logic diagram of a data creation and deletion process. It can be seen that the storage space and the running time can be judged in a two-way manner in the data creation and deletion process. Exemplarily, the first value is True, the second value is False, and the default value of the data manipulation direction identifier is set to True; the execution machine calculates the percentage of used storage space; if the percentage of used storage space is less than the minimum threshold, since the default value of the data manipulation direction identifier is True, the value of the data manipulation direction identifier is maintained as the default value, and the database creation operation is performed; if the percentage of used storage space is greater than the maximum threshold, the database deletion operation is performed, and the value of the data manipulation direction identifier is set to False; if the value of the data manipulation direction identifier is greater than the minimum threshold and less than the maximum threshold, the current value of the data manipulation direction identifier is determined. If the current value of the data manipulation direction identifier is True, the database creation operation is performed, otherwise the database deletion operation is performed.
[0075] In another embodiment, at least one data query process is executed within a preset running time, including: recording a test startup timestamp; when the number of databases of the storage node is greater than one, obtaining a database list of the storage node; the database list includes databases created by at least one data creation and deletion process and arranged in the order of creation; selecting the second to last database in the database list as the target database; performing a database query operation on the target database, generating data query log content, recording the end timestamp of the second process, and returning to the step of obtaining the database list of the storage node when the number of databases of the storage node is greater than one, until the difference between the end timestamp of the second process and the test startup timestamp is greater than the preset running time.
[0076] The data query process mainly includes the steps of specifying a target database from multiple databases in the storage node and querying the target database.
[0077] In the specific implementation, since the database queried in the data query process is created by the data creation and deletion process, the following three situations can be judged when executing the data query process: (1) When the number of databases in the storage node is 0, the data query operation is not executed; (2) When the number of databases in the storage node is 1, it means that the data creation and deletion process has just started to create the database and import data. The data in the database is incomplete. If the data query operation is executed, it is likely to fail. Therefore, when the number of databases in the storage node is 1, the data query operation is not executed; (3) When the number of databases in the storage node is greater than 1, all databases created by the data creation and deletion process in the storage node can be listed as a database list. These databases can be sorted according to the creation timestamp, that is, sorted in the order of creation. The execution machine can select the second to last database in the database list. The reason for this selection is: since it is unknown whether the data creation and deletion process is currently executing a database creation operation or a database deletion operation, if the database creation operation is being executed, except for the first to last database, the data of other databases are complete. If the database deletion operation is being executed, the first database in the order is deleted. Therefore, the second to last database is selected as the most stable database at present.
[0078] Among them, the second process end timestamp contains the time information when any data query process ends. That is, each time a data query process is executed, the current timestamp is recorded as the second process end timestamp, and the time difference between the second process end timestamp and the test start timestamp is calculated. If the difference is less than the preset running time, the next data query process is executed; if the difference is greater than the preset running time, the data query process is terminated, and information such as "data query process completed" used to reflect the completion of the data query process is output to the data query log content.
[0079] Exemplarily, after selecting the target database, the database variable in the configuration file can be modified to the name of the selected target database. The database variable is used to point to the database that currently needs to be queried. Within the preset running time, the database variable in the configuration file can be read to determine the target database, and then the database query operation can be executed. For example, 22 SQL query statements can be polled and called for query, and whether the query is successful is written into the data query log content.
[0080] The technical solution of this embodiment, by selecting the second to last database in the database list as the target database, avoids using the database that is being created or deleted, thereby ensuring the integrity and stability of the query data, reducing query failures caused by data changes, and improving the success rate and reliability of database testing.
[0081] In another embodiment, a task monitoring process is executed, including: regularly obtaining the process status of data creation and deletion processes and data query processes, data creation and deletion log contents, data query log contents, and node status of storage nodes; and determining that the result of the database stability test is that database stability is abnormal when at least one of the following conditions is met: the process status is abnormal, the data creation and deletion log contents or the data query log contents contain failure information, and the storage node is in an abnormal working state.
[0082] In the specific implementation, the process status of the data creation and deletion process and the data query process can be used to characterize whether the data creation and deletion process and the data query process exist, whether they are interrupted or crashed. If the process status characterizes that the process does not exist or is interrupted or crashed within the preset running time, the database stability test result is that the database stability is abnormal.
[0083] In the specific implementation, if there is operation failure or error information in the data creation and deletion log content and the data query log content, such as a database deletion operation or database query operation is not successfully executed, the database stability test result is that the database stability is abnormal.
[0084] In a specific implementation, it is possible to check whether the storage node is in an active (alive) state, that is, a normal operating state. If the storage node is in an abnormal working state, the database stability test result is that the database stability is abnormal. Optionally, it is also possible to check whether the management node is in an active (alive) state. If the management node is in an abnormal working state, the database stability test result is that the database stability is abnormal.
[0085] If at least one of the following conditions is met: the process status is abnormal, the data creation and deletion log content or the data query log content contains failure information, or the storage node is in an abnormal working state, the entire database stability test process can be interrupted and a failure notification is sent to the relevant terminal; if any of the above conditions is not met within the preset running time, a success notification is sent to the relevant terminal.
[0086] The technical solution of this embodiment can quickly identify abnormal database stability problems by periodically acquiring process status, log content and node status, and can comprehensively monitor the test process by combining multiple judgment conditions such as process status, log records and node status, effectively improving the coverage of database stability testing, and improving the accuracy and reliability of database stability testing.
[0087] To facilitate the understanding of those skilled in the art, FIG4 exemplarily provides a logic diagram of a method for testing database stability. Data is generated by a data generation module, and then a data creation and deletion module continuously creates, imports and deletes data according to the used storage space and within a preset running time. The data creation and deletion module can be executed independently and continuously to verify the stability of a large amount of data import and deletion. The data query module continuously polls SQL statements within a preset running time to perform data query operations to verify the stability of the query data. The task monitoring module can be used to start tasks and check status. According to test resources and demand conditions, multiple data creation and deletion modules and multiple data query modules can be imported respectively. In the process of multiple data creation and deletion processes and multiple data query processes running in parallel, the status of each process and the node status are regularly checked to verify the stability of the database as a whole.
[0088] The technical solution of this embodiment can verify the stability of importing and deleting data within the set storage space and running time. Through closed-loop process design, it simulates user usage scenarios and completes database import and deletion stability verification in an infinite loop and automatically under limited conditions. It can query data in parallel when the data volume changes. Since traditional test data queries are completed under the condition of unchanged data volume, the purpose is to verify the performance and efficiency of data queries. However, in the scenario where actual users use the database system, while continuously querying data, users will also continuously import and update data in other threads. In such a concurrent scenario, the system resource usage will reach a peak state. Therefore, the use of parallel execution of query, creation, import, and deletion data processes can effectively discover hidden performance and stability problems and improve the accuracy of database stability testing.
[0089] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0090] Based on the same inventive concept, the embodiment of the present application also provides a database stability testing device for implementing the database stability testing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of one or more database stability testing devices provided below can refer to the limitations of the database stability testing method above, and will not be repeated here.
[0091] In an exemplary embodiment, as shown in FIG5 , a database stability testing device is provided, including:
[0092] The data creation and deletion module 510 is used to execute at least one data creation and deletion process within a preset running time; the data creation and deletion process is used to execute a database creation operation or a database deletion operation in the storage node according to the used storage space of the storage node in the database system, and generate data creation and deletion log content.
[0093] The data query module 520 is used to execute at least one data query process within the preset running time; the data query process is used to select a target database from the database of the storage node, and generate data query log content by executing a database query operation on the target database.
[0094] The task monitoring module 530 is used to execute the task monitoring process when the data creation and deletion process and the data query process are executed in parallel; the task monitoring process is used to generate database stability test results based on the data creation and deletion log content and the data query log content.
[0095] In one embodiment, the data creation and deletion module 510 is specifically used to record the test startup timestamp; determine the percentage of used storage space of the storage node; the percentage of used storage space is equal to the percentage of used storage space of the storage node and the total storage space; modify the value of the data manipulation direction identifier according to the percentage of used storage space; according to the value of the data manipulation direction identifier, perform a database creation operation or a database deletion operation in the storage node, generate data creation and deletion log content, record the first process end timestamp, and return to the step of determining the percentage of used storage space of the storage node until the difference between the first process end timestamp and the test startup timestamp is greater than the preset running time.
[0096] In one embodiment, the data creation and deletion module 510 is specifically used to modify the value of the data manipulation direction identifier according to the proportion of used storage space, including: if the proportion of used storage space is less than the minimum threshold, then modify the value of the data manipulation direction identifier to the first value; if the proportion of used storage space is greater than the maximum threshold, then modify the value of the data manipulation direction identifier to the second value; if the proportion of used storage space is between the minimum threshold and the maximum threshold, then maintain the value of the data manipulation direction identifier.
[0097] In one embodiment, the data creation and deletion module 510 is specifically used to perform a database creation operation in the storage node if the value of the data manipulation direction identifier is the first value; and to perform a database deletion operation in the storage node if the value of the data manipulation direction identifier is the second value.
[0098] In one embodiment, the data query module 520 is specifically used to record the test startup timestamp; when the number of databases of the storage node is greater than one, obtain the database list of the storage node; the database list includes databases created by the at least one data creation and deletion process and arranged in the order of creation; select the second to last database in the database list as the target database; perform a database query operation on the target database, generate data query log content, record the second process end timestamp, and return to the step of obtaining the database list of the storage node when the number of databases of the storage node is greater than one, until the difference between the second process end timestamp and the test startup timestamp is greater than the preset running time.
[0099] In one embodiment, the task monitoring module 530 is specifically used to periodically obtain the process status of the data creation and deletion process and the data query process, the data creation and deletion log content, the data query log content and the node status of the storage node; when at least one of the following conditions is met: the process status is abnormal, the data creation and deletion log content or the data query log content contains failure information, and the storage node is in an abnormal working state, it is determined that the database stability test result is that the database stability is abnormal.
[0100] Each module in the above-mentioned database stability testing device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0101] In an exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG6. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a method for testing the stability of a database is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0102] Those skilled in the art will understand that the structure shown in FIG. 6 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0103] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0104] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0105] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0106] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0107] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0108] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0109] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for testing database stability, characterized in that: The method comprises: Execute at least one data creation and deletion process within a preset running time; the data creation and deletion process is used to execute a database creation operation or a database deletion operation in the storage node according to the used storage space of the storage node in the database system, and generate data creation and deletion log content; Executing at least one data query process within the preset running time; the data query process is used to select a target database from the database of the storage node, and generate data query log content by executing a database query operation on the target database; During the parallel execution of the data creation and deletion process and the data query process, a task monitoring process is executed; the task monitoring process is used to generate database stability test results based on the data creation and deletion log content and the data query log content.
2. The method according to claim 1, characterized in that The step of executing at least one data creation and deletion process within a preset running time includes: Record the test start timestamp; Determine the proportion of used storage space of the storage node; the proportion of used storage space is equal to the proportion of used storage space of the storage node to the total storage space; Modify the value of the data manipulation direction identifier according to the used storage space ratio; According to the value of the data manipulation direction identifier, a database creation operation or a database deletion operation is performed in the storage node, data creation and deletion log content is generated, the first process end timestamp is recorded, and the step of determining the percentage of used storage space of the storage node is returned to until the difference between the first process end timestamp and the test start timestamp is greater than the preset running time.
3. The method according to claim 2, characterized in that The modifying the value of the data manipulation direction identifier according to the used storage space ratio includes: If the used storage space ratio is less than the minimum threshold, modifying the value of the data manipulation direction identifier to be the first value; If the proportion of used storage space is greater than the maximum threshold, modifying the value of the data manipulation direction identifier to a second value; If the percentage of used storage space is between the minimum threshold and the maximum threshold, the value of the data manipulation direction identifier is maintained.
4. The method according to claim 3, characterized in that The performing a database creation operation or a database deletion operation in the storage node according to the value of the data manipulation direction identifier includes: If the value of the data manipulation direction identifier is the first value, executing a database creation operation in the storage node; If the value of the data manipulation direction identifier is the second value, a database deletion operation is performed in the storage node.
5. The method according to claim 1, characterized in that The executing at least one data query process within the preset running time includes: Record the test start timestamp; When the number of databases of the storage node is greater than one, obtaining a database list of the storage node; the database list includes databases created by the at least one data creation and deletion process and arranged in the order of creation; Select the second to last database in the database list as the target database; Perform a database query operation on the target database, generate data query log content, record the second process end timestamp, and return to the step of obtaining the database list of the storage node when the number of databases on the storage node is greater than one, until the difference between the second process end timestamp and the test start timestamp is greater than the preset running time.
6. The method according to claim 1, characterized in that The execution task monitoring process includes: Regularly obtain the process status of the data creation and deletion process and the data query process, the data creation and deletion log content, the data query log content and the node status of the storage node; When at least one of the following conditions is met: the process status is abnormal, the data creation and deletion log content or the data query log content contains failure information, and the storage node is in an abnormal working state, the database stability test result is determined to be that the database stability is abnormal.
7. A database stability testing device, characterized in that: The device comprises: A data creation and deletion module is used to execute at least one data creation and deletion process within a preset running time; the data creation and deletion process is used to execute a database creation operation or a database deletion operation in the storage node according to the used storage space of the storage node in the database system, and generate data creation and deletion log content; A data query module, used to execute at least one data query process within the preset running time; the data query process is used to select a target database from the database of the storage node, and generate data query log content by executing a database query operation on the target database; The task monitoring module is used to execute the task monitoring process when the data creation and deletion process and the data query process are executed in parallel; the task monitoring process is used to generate database stability test results based on the data creation and deletion log content and the data query log content.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
