Database cluster abnormality testing method and device

By automatically determining the operation log output level and cluster lock information of the database cluster, the test case library is generated, which solves the concurrency problem of distributed database in high concurrency scenarios, improves the accuracy and automation of abnormal tests, and ensures the distributed database Stability and user experience in abnormal situations.

CN118885406BActive Publication Date: 2025-01-17TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411390617.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-08
Publication Date
2025-01-17
Estimated Expiration
2044-10-08

AI Technical Summary

Technical Problem

The existing technology lacks the concurrency problem of distributed databases in high concurrency scenarios, and it is difficult to accurately estimate the abnormal triggering time point, the abnormal test accuracy is low, the coverage is small, manual triggering is difficult, and the degree of automated testing is low.

Method used

Through the test request sent by the test terminal, the operation log output level and cluster lock information of the database cluster are automatically determined, the test case library is generated, the degree of automation of abnormal tests is improved, concurrent requests and abnormal situations are simulated, and concurrency problems in high concurrency scenarios are overcome. Such as deadlocks and network partitions.

Benefits of technology

It improves the accuracy and automation of database exception testing, avoids the difficulties caused by manual triggering, ensures shared resource access to distributed database clusters under different exceptional conditions, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885406B_ABST
    Figure CN118885406B_ABST
Patent Text Reader

Abstract

The present invention provides a database cluster abnormality test method and device, and relates to the database technology and computer technology fields. The method includes: in response to receiving a test request sent by a test terminal, determining cluster configuration result information and abnormal test trigger point information corresponding to the test terminal based on the test request, wherein the test request includes identification information corresponding to the test terminal, the cluster configuration result information is associated with the operation log output level of the database cluster, and the abnormal test trigger point information represents the cluster lock information corresponding to the database cluster that meets the preset output level, and the cluster lock information includes lock stage information, lock identification information, lock type information and lock node information; based on the lock stage information, lock identification information, lock type information and lock node information, generating a test case library; and based on the lock identification information and the test cases in the test case library, sending a test instruction for performing an abnormal test to the test terminal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database technology and computer technology, and more specifically, to a database cluster anomaly testing method and device. Background Art

[0002] In a distributed database system, cluster locks can solve concurrent access problems that may occur when multiple nodes access shared resources at the same time. In a distributed database cluster, cluster locks can ensure data consistency and reliability. As the use of distributed databases becomes more and more common, abnormal testing of distributed databases is crucial. Traditional database testing methods include: increasing the database load (such as the number and frequency of read and write requests) to evaluate the system's performance and responsiveness when the load is too high; simulating various transaction processing scenarios (such as nested transactions, concurrent transactions) to evaluate the consistency and isolation of the system during transaction processing.

[0003] In the process of realizing the concept of the present invention, the inventors found that there are at least the following problems in the related art for distributed database anomaly testing: lack of consideration of possible concurrency problems of the database in high concurrency scenarios; it is difficult to accurately estimate the time point of the anomaly triggering, the anomaly test has low accuracy and small coverage; manual triggering is difficult and the degree of automated testing is low. Summary of the invention

[0004] In view of this, the present invention provides a database cluster anomaly testing method and device.

[0005] One aspect of the present invention provides a database cluster anomaly testing method, comprising:

[0006] In response to receiving a test request sent by a test terminal, cluster configuration result information and abnormal test trigger point information corresponding to the test terminal are determined based on the test request, wherein the test request includes identification information corresponding to the test terminal, the cluster configuration result information is associated with the operation log output level of the database cluster, and the abnormal test trigger point information represents cluster lock information corresponding to the database cluster that meets the preset output level, and the cluster lock information includes lock stage information, lock identification information, lock type information and lock node information; based on the lock stage information, the lock identification information, the lock type information and the lock node information, a test case library is generated; and based on the lock identification information and the test cases in the test case library, a test instruction for performing an abnormal test is sent to the test terminal.

[0007] According to an embodiment of the present invention, the above-mentioned cluster lock information and the above-mentioned test case enable the above-mentioned test terminal to determine the abnormal test script command according to the above-mentioned cluster lock information and the above-mentioned test case; and based on the prefabricated interface of the above-mentioned database cluster, send a test request including the above-mentioned abnormal test script command to the above-mentioned database cluster.

[0008] According to an embodiment of the present invention, the above-mentioned determination of the cluster configuration result information and abnormal test trigger point information corresponding to the above-mentioned test terminal based on the above-mentioned test request includes: updating the database cluster initial configuration information corresponding to the above-mentioned test request based on a preset update rule, and generating database cluster target configuration information, wherein the above-mentioned preset update rule is associated with the operation log output level of the above-mentioned database cluster; generating initialization database information based on the above-mentioned database cluster target configuration information, wherein the above-mentioned initialization database information includes list information corresponding to the above-mentioned initialization database; selecting a list tag corresponding to the above-mentioned test request from the above-mentioned list information, and generating a query statement; and executing the above-mentioned query statement to query the above-mentioned list information, and generating the cluster configuration result information corresponding to the above-mentioned test request, wherein the above-mentioned cluster configuration result information includes the test time information corresponding to the above-mentioned cluster configuration result information.

[0009] According to an embodiment of the present invention, the test configuration information corresponding to the test terminal is determined based on the test request, and further includes: screening the operation log of the database cluster to generate initial abnormal trigger condition information; and combining the initial abnormal trigger condition information to generate the abnormal test trigger point information.

[0010] According to an embodiment of the present invention, the above method also includes: in the event that the above test request is updated, updating the above abnormal test trigger point information based on the updated test request to generate abnormal update operation information; and updating the above test case library based on the above abnormal update operation information to generate an updated test case library.

[0011] According to an embodiment of the present invention, the above method also includes: in response to receiving the initial test result generated based on the above test request, verifying the above initial test result based on preset verification rules to generate a target test result, wherein the above preset verification rules include at least one of the following: operation duration verification rule, cluster lock verification rule, result set verification rule and list information verification rule.

[0012] According to an embodiment of the present invention, the above-mentioned initial test result is verified based on preset verification rules to generate a target test result, including: when the above-mentioned initial test result represents that the above-mentioned test request operation is abnormal, based on the above-mentioned operation duration verification rule, the duration information corresponding to the above-mentioned operation abnormality is compared with the preset duration threshold to generate a duration comparison result; and the target test result is determined based on the above-mentioned duration comparison result.

[0013] According to an embodiment of the present invention, the above-mentioned initial test result includes cluster lock quantity information corresponding to the above-mentioned database cluster; wherein, the above-mentioned initial test result is verified based on preset verification rules to generate a target test result, and also includes: based on the above-mentioned cluster lock verification rules, the above-mentioned cluster lock quantity information is compared with a preset quantity threshold to generate a quantity comparison result; and the above-mentioned target test result is determined based on the above-mentioned quantity comparison result.

[0014] According to an embodiment of the present invention, the above-mentioned test case includes a list detection script corresponding to the above-mentioned list information; wherein, the above-mentioned initial test result is verified based on the preset verification rules to generate the target test result, and also includes: detecting the above-mentioned list information based on the list detection script corresponding to the above-mentioned list tag to generate the list detection result; verifying the above-mentioned list detection result using the above-mentioned list information verification rules to generate the above-mentioned target test result.

[0015] Another aspect of the present invention provides a database cluster anomaly testing device, comprising:

[0016] An information determination module is used to determine, in response to a test request received from a test terminal, cluster configuration result information and abnormal test trigger point information corresponding to the test terminal based on the test request, wherein the test request includes identification information corresponding to the test terminal, the cluster configuration result information is associated with the operation log output level of the database cluster, and the abnormal test trigger point information represents cluster lock information corresponding to the database cluster that meets the preset output level, and the cluster lock information includes lock phase information, lock identification information, lock type information and lock node information; a test case library generation module is used to generate a test case library based on the lock phase information, the lock identification information, the lock type information and the lock node information; and a test instruction sending module is used to send a test instruction for performing an abnormal test to the test terminal based on the lock identification information and the test cases in the test case library.

[0017] Another aspect of the present invention provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned method.

[0018] Another aspect of the present invention provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.

[0019] Another aspect of the present invention provides a computer program product, the computer program product comprising computer executable instructions, and the instructions are used to implement the above method when executed.

[0020] According to an embodiment of the present invention, the present invention provides a database cluster abnormality testing method and device. Through a test request sent by a test terminal, cluster configuration result information corresponding to the operation log output level of the database cluster and an abnormality test trigger point (lock stage information, lock identification information, lock type information and lock node information) corresponding to the cluster lock can be automatically determined, so that a test case library can be automatically generated according to various cluster lock information, thereby improving the automation level of abnormality testing, and then implementing abnormality testing of the database according to different lock identification information and test cases. Since the abnormality test trigger point corresponding to the cluster lock is used to simulate concurrent requests and abnormal situations, the concurrency problems (for example, deadlock, node downtime and network partition, etc.) that may occur in a distributed database in a high-concurrency scenario are at least partially overcome, the problem of manual triggering is avoided, the accuracy of database abnormality testing is improved, and the distributed database cluster is further guaranteed to access shared resources under different abnormal situations, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The above and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:

[0022] Figure 1 An exemplary system architecture of a method and device for abnormality testing of a database cluster according to an embodiment of the present invention is shown;

[0023] Figure 2 A flowchart of a database cluster anomaly testing method according to an embodiment of the present invention is shown;

[0024] Figure 3 A system architecture diagram of a database cluster anomaly testing method according to an embodiment of the present invention is shown;

[0025] Figure 4 A schematic diagram of an abnormal test script execution process according to an embodiment of the present invention is shown;

[0026] Figure 5 It shows a structural block diagram of a database cluster anomaly testing device according to an embodiment of the present invention;

[0027] Figure 6 A block diagram of an electronic device suitable for implementing the method described above according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0028] Below, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of embodiments of the present invention. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of concepts of the present invention.

[0029] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0030] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0031] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0032] In the embodiments of the present invention, the collection, updating, analysis, processing, use, transmission, provision, disclosure, storage and other aspects of the data involved (for example, including but not limited to user personal information) are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. In particular, necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information and network security.

[0033] In the embodiment of the present invention, before obtaining or collecting the user's personal information, the user's authorization or consent is obtained.

[0034] In the process of conceiving the present invention, the inventor found that in the related art, the abnormal test of distributed database lacks consideration of possible concurrency problems of the database in high concurrency scenarios; it is difficult to accurately estimate the time point of abnormal triggering, the accuracy of abnormal test is low, and the coverage is small; manual triggering is difficult, and the degree of automated testing is low. In view of this, the present invention can automatically determine the cluster configuration result information corresponding to the operation log output level of the database cluster and the abnormal test trigger point (lock stage information, lock identification information, lock type information and lock node information) corresponding to the cluster lock through the test request sent by the test terminal, so that the test case library can be automatically generated according to various cluster lock information, the automation degree of abnormal test is improved, and then the abnormal test of the database can be realized according to different lock identification information and test cases. Since the abnormal test trigger point corresponding to the cluster lock is used to simulate concurrent requests and abnormal situations, the concurrency problems (for example, deadlock, node downtime and network partition, etc.) that may occur in the distributed database in high concurrency scenarios are at least partially overcome, the problem of manual triggering is avoided, the accuracy of database abnormal test is improved, and the distributed database cluster is further guaranteed to access shared resources under different abnormal situations.

[0035] An embodiment of the present invention provides a method and device for abnormal testing of a database cluster, the method comprising: in response to receiving a test request sent by a test terminal, determining cluster configuration result information and abnormal test trigger point information corresponding to the test terminal based on the test request, wherein the test request includes identification information corresponding to the test terminal, the cluster configuration result information is associated with the operation log output level of the database cluster, the abnormal test trigger point information represents the cluster lock information corresponding to the database cluster that meets the preset output level, the cluster lock information includes lock phase information, lock identification information, lock type information and lock node information; based on the lock phase information, lock identification information, lock type information and lock node information, generating a test case library; and based on the lock identification information and the test cases in the test case library, sending a test instruction for performing an abnormal test to the test terminal.

[0036] Figure 1 The exemplary system architecture of the method and device for database cluster anomaly testing according to an embodiment of the present invention is shown. It should be noted that: Figure 1 The examples shown are merely examples of system architectures to which the embodiments of the present invention may be applied, to help those skilled in the art understand the technical content of the present invention, but do not mean that the embodiments of the present invention may not be used in other devices, systems, environments or scenarios.

[0037] like Figure 1As shown, the system architecture according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, a server 105, and a test terminal 106. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, the server 105, and the test terminal 106. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.

[0038] The test terminal 106 is connected to the server 105 via the network 104 . The test terminal 106 includes but is not limited to physical devices such as smart phones, desktop computers, laptop computers, and smart wearable devices.

[0039] The user may use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software, etc. (only for example).

[0040] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0041] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.

[0042] It should be noted that the database cluster anomaly testing method provided in the embodiment of the present invention can generally be performed by the server 105. Accordingly, the database cluster anomaly testing system provided in the embodiment of the present invention can generally be set in the server 105. The database cluster anomaly testing method provided in the embodiment of the present invention can also be performed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Correspondingly, the database cluster anomaly testing device provided in the embodiment of the present invention can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Alternatively, the database cluster anomaly testing method provided in the embodiment of the present invention can also be performed by the first terminal device 101, the second terminal device 102, and the third terminal device 103, or can also be performed by other terminal devices different from the first terminal device 101, the second terminal device 102, and the third terminal device 103. Correspondingly, the database cluster anomaly testing device provided in the embodiment of the present invention can also be set in the first terminal device 101, the second terminal device 102, the third terminal device 103, or in other terminal devices different from the first terminal device 101, the second terminal device 102, the third terminal device 103.

[0043] It should be understood that Figure 1 The number of terminal devices, networks, test terminals and servers in the embodiment is only for illustration. Any number of terminal devices, test terminals, networks and servers may be provided according to implementation requirements.

[0044] Figure 2 A flowchart of a database cluster anomaly testing method according to an embodiment of the present invention is shown.

[0045] like Figure 2 As shown, the method includes operations S210 to S230.

[0046] In operation S210, in response to receiving a test request sent by the test terminal, cluster configuration result information and abnormal test trigger point information corresponding to the test terminal are determined based on the test request, wherein the test request includes identification information corresponding to the test terminal, the cluster configuration result information is associated with the operation log output level of the database cluster, and the abnormal test trigger point information represents the cluster lock information corresponding to the database cluster that meets the preset output level, and the cluster lock information includes lock stage information, lock identification information, lock type information and lock node information.

[0047] According to an embodiment of the present invention, the test terminal includes but is not limited to terminal devices such as desktop / tablet computers, smart phones, and intelligent digital assistants, and the database cluster to be tested may include a database interface. It should be noted that the operating system installed on the test terminal, the type of database to be tested, and the form of the database interface can be determined according to actual conditions and are not specifically limited here.

[0048] According to an embodiment of the present invention, the cluster configuration result information can represent the environmental configuration information of the database cluster to be tested. Further, the cluster configuration result information can represent the forward function execution result information of the database cluster to be tested. The cluster configuration result information can be determined by setting the output level of the operation log of the database cluster. Preferably, the output level of the database operation log is set to the highest level to achieve that the content of the output log contains relevant information about the cluster lock. The abnormal test trigger point information can represent the cluster lock information corresponding to the database cluster that meets the preset output level, including but not limited to lock stage information, lock identification information, lock type information and lock node information. Further, the key field information in the lock stage information, lock identification information, lock type information and lock node information can be extracted as the key field for abnormal trigger judgment.

[0049] In operation S220, a test case library is generated based on the lock phase information, the lock identification information, the lock type information, and the lock node information.

[0050] According to an embodiment of the present invention, the lock phase information may include an application phase, an upgrade phase, a downgrade phase, and a release phase. The lock identification information may represent the lock name or number information. The lock type information includes, but is not limited to, shared read locks and exclusive write lock types. The lock node information includes, but is not limited to, execution nodes, non-execution nodes, and data nodes. The test case library may generate test cases of various types based on different cluster lock information.

[0051] In operation S230, a test instruction for performing an abnormal test is sent to the test terminal based on the lock identification information and the test cases in the test case library.

[0052] According to an embodiment of the present invention, the test instruction may include cluster configuration result information and abnormal test trigger point information. Furthermore, the test instruction may also include information such as a test cycle and a test frequency corresponding to the database abnormal test.

[0053] According to an embodiment of the present invention, through the test request sent by the test terminal, the cluster configuration result information corresponding to the operation log output level of the database cluster and the abnormal test trigger point corresponding to the cluster lock (lock stage information, lock identification information, lock type information and lock node information) can be automatically determined, so that a test case library can be automatically generated according to various cluster lock information, thereby improving the degree of automation of abnormal testing, and then implementing abnormal testing of the database according to different lock identification information and test cases. Since the abnormal test trigger point corresponding to the cluster lock is used to simulate concurrent requests and abnormal situations, the concurrency problems (for example, deadlock, node downtime and network partition, etc.) that may occur in distributed databases in high concurrency scenarios are at least partially overcome, the problem of manual triggering is avoided, the accuracy of database abnormal testing is improved, and the distributed database cluster is further guaranteed to access shared resources under different abnormal situations, thereby improving the user experience.

[0054] According to an embodiment of the present invention, the test instructions include: cluster lock information and test cases, so that the test terminal determines the abnormal test script command according to the cluster lock information and the test case; and based on the prefabricated interface of the database cluster, sends a test request including the abnormal test script command to the database cluster.

[0055] In a feasible embodiment, the cluster lock information may include lock phase information, lock identification information, lock type information and lock node information; the test instruction may include lock identification information and a test case corresponding to the lock identification information. The test case may characterize an abnormal test case script, and the abnormal test case script may be automatically orthogonally generated according to the lock phase information, the lock node information and the lock type information. The lock type information may characterize the abnormal operation type information corresponding to the abnormal test, and the abnormal operation type includes but is not limited to service abnormalities (such as cluster layer service abnormalities, data layer service abnormalities), memory abnormalities, disk abnormalities and network abnormalities. The lock node information includes but is not limited to the number of lock nodes and the lock node IP address. The lock node information may include execution nodes, non-execution nodes and data nodes, etc., and may also be node information formed by any combination of execution nodes, non-execution nodes and data nodes.

[0056] In a feasible embodiment, the method of performing exception testing through an exception test script may include: executing database initialization statements; clearing operation logs; executing database operation statements to be tested, performing forward testing, retaining the operation start time, and retaining the execution result as an "abnormal test result"; the background concurrently judges the operation log content, and when an abnormal stage keyword is detected, constructs a specified abnormal test; and resumes the corresponding abnormal test.

[0057] According to an embodiment of the present invention, cluster configuration result information and abnormal test trigger point information corresponding to a test terminal are determined based on a test request, including: updating the database cluster initial configuration information corresponding to the test request based on a preset update rule, and generating database cluster target configuration information, wherein the preset update rule is associated with the operation log output level of the database cluster; generating initialization database information based on the database cluster target configuration information, wherein the initialization database information includes list information corresponding to the initialization database; selecting a list tag corresponding to the test request from the list information, and generating a query statement; and executing the query statement to query the list information, and generating cluster configuration result information corresponding to the test request, wherein the cluster configuration result information includes test time information corresponding to the cluster configuration result information.

[0058] According to an embodiment of the present invention, the database cluster initial configuration information may include the operation log output information of the database cluster. In order to reflect the information related to the cluster lock in the operation log output information, the database operation log output level may be set to the highest level to ensure that all detailed database operation information, including the content related to the cluster lock, is recorded to generate the target configuration information of the database cluster. It should be noted that considering that the use of the highest level of logging may cause a large amount of logs and system performance overhead, the operation log may be filtered after it is generated to meet the generation of the target configuration information while saving system overhead.

[0059] In a feasible embodiment, taking a certain analytical database as an example, the parameter gcluster_log_level can be set to 7 or above, and the log level can be above INFO, so that the printed content of the database operation log includes cluster lock related information.

[0060] According to an embodiment of the present invention, after the database cluster target configuration information is generated, the database initialization statement can be executed to complete the database construction work, for example, the database construction can be completed through the command line tool provided by the database management system; thereby, the required list structure can be created in the constructed database, and the constructed list can include information such as columns, constraints, indexes, etc. that define the list; and then the initial data is imported into the created data table.

[0061] In a feasible embodiment, taking a certain analytical database as an example, a database test and a data table t required for the statement to be tested are created, and two data records are inserted into table t, thereby completing the construction of the database and data table and the import of data.

[0062] According to an embodiment of the present invention, the list tag may include information such as the list name and the list number. A query statement may be generated according to the list name or the list number, that is, by extracting the table name in the operation statement to be tested, a query Structured Query Language (SQL) statement may be generated. For example, the test statement is: update t set a=1+1where b='cc'; extract the table name t, and generate the query statement select * from t.

[0063] In a feasible embodiment, after generating a query statement, the query statement can be executed to query the table data, and the query result can be retained as the "data before the forward test"; after clearing the operation log, the operation statement of the database to be tested can be executed to perform a forward test, and the execution result can be retained as the "forward test result", and the execution time can be extracted as the "forward test time"; further, the query statement can be executed again to query the table data, and the query result can be retained as the "data after the forward test".

[0064] In a feasible embodiment, the cluster configuration result information may be determined by collecting the forward function execution result, which may include operations S201 to S207.

[0065] In operation S201, the database configuration file is changed, and the output level of the database operation log can be set to the highest level (eg, INFO and above), with the log print content including cluster lock related information as a standard.

[0066] In operation S202, the database initialization statement is executed to complete the construction of the database, data table and data import.

[0067] In operation S203, the table names in the operation statement to be tested are selected and concatenated to generate a query SQL statement.

[0068] In operation S204, the SQL statement is executed to query the table data, and the query result is retained as "data before the forward test".

[0069] In operation S205, the operation log is cleared.

[0070] In operation S206, the database operation statement to be tested is executed to perform a forward test, the execution result is retained as a "forward test result", and the execution time is extracted as a "forward test time".

[0071] In operation S207, the same SQL statement in S204 is executed again to query the table data, and the query result is retained as "data after positive test".

[0072] According to an embodiment of the present invention, determining the test configuration information corresponding to the test terminal based on the test request also includes: screening the operation log of the database cluster to generate initial abnormal trigger condition information; and combining the initial abnormal trigger condition information to generate abnormal test trigger point information.

[0073] According to an embodiment of the present invention, the initial abnormal trigger condition information can represent a variety of initial key field information in the operation log that can be used as abnormal trigger judgment, and abnormal test trigger node information is generated by combining one or more of the initial key field information.

[0074] Taking "update t set a=1+1 where b='cc'" as an example, the lock keywords extracted after filtering the content of a certain operation log are as follows.

[0075] request READ lock: vc00001.hashmap_lock;

[0076] request READ lock: vc00001.test.db_lock;

[0077] …

[0078] release READ lock: vc00001.test.db_lock;

[0079] release READ lock: vc00001.hashmap_lock;

[0080] Among them, there are two lock stages: request lock and release lock, two lock types: READ lock (shared read lock) and WRITE lock (exclusive write lock), and the lock name is after the colon, such as: vc00001.hashmap_lock.

[0081] According to an embodiment of the present invention, automatically selecting relevant abnormal test trigger nodes helps to identify potential risks and problems, and is conducive to discovering situations that may cause deadlock or resource contention under concurrent access. At the same time, cluster lock-related abnormal trigger point tests can verify the stability and robustness of the system under concurrent conditions, ensuring that the system can correctly handle concurrent access and locking mechanisms.

[0082] According to an embodiment of the present invention, the method also includes: when a test request is updated, updating the abnormal test trigger point information based on the updated test request to generate abnormal update operation information; and updating the test case library based on the abnormal update operation information to generate an updated test case library.

[0083] According to an embodiment of the present invention, taking into account different test requirements and changes in test requirements, the abnormal test trigger point information can be updated according to the latest test request (when the test request is updated), and updated abnormal operation information (i.e., abnormal update operation information) can be generated. On this basis, the test cases in progress in the test case library can be supplemented and updated to generate an updated test case library.

[0084] According to an embodiment of the present invention, the test case library is updated in real time according to changes in test requirements, which can respond to product requirements and changes more quickly and ensure that the test case library contains the latest test scenarios and use cases; at the same time, by adding new test cases in a timely manner, it can ensure that new functions, new requirements or discovered defects are covered, thereby improving test coverage.

[0085] According to an embodiment of the present invention, the method also includes: in response to receiving an initial test result generated based on a test request, verifying the initial test result based on preset verification rules to generate a target test result, wherein the preset verification rules include at least one of the following: an operation duration verification rule, a cluster lock verification rule, a result set verification rule, and a list information verification rule.

[0086] According to an embodiment of the present invention, after the initial test result is generated, the initial test result can be verified based on a variety of verification rules (including operation duration verification rules, cluster lock verification rules, result set verification rules and list information verification rules) to determine the target test result. The operation duration verification rule can represent the rule for verifying the operation execution time when the initial test result is "abnormal test result does not exist". The cluster lock verification rule can represent the rule for using the cluster lock lock residual check script to check whether the number of residual cluster locks meets the preset residual condition. The result set verification rule can represent the rule for verifying the initial test result by calling the result set correctness check script. The list information verification rule can represent the rule for calling the list data atomicity check script and the list master-slave shard consistency check script to verify the list information; the list information verification rule may include the list data atomicity check rule and the list master-slave shard consistency check rule.

[0087] It can be understood that the verification scripts in the present invention, such as the lock residue check script, the result set correctness check script, the list data atomicity check script and the list master-slave shard consistency check script, can be generated in advance based on the specific test environment and stored in the system for specific script libraries for test result verification, or can be stored in a test case library.

[0088] According to an embodiment of the present invention, the initial test result is verified based on preset verification rules to generate a target test result, including: when the initial test result represents an abnormal test request operation, based on the operation duration verification rule, the duration information corresponding to the operation abnormality is compared with the preset duration threshold to generate a duration comparison result; and the target test result is determined based on the duration comparison result.

[0089] According to an embodiment of the present invention, taking into account the test anomalies (such as stuck and stopped) that may occur during the test process, after performing an abnormal test to obtain an initial test result, the operation duration verification rule can be used to check whether the operation ends normally. The method may include: when the "abnormal test result" (initial test result) already exists, the operation ends normally and subsequent tests continue; when the "abnormal test result" does not exist, the operation execution time is compared with the "forward test time"; when the comparison result is that the operation execution time does not exceed the threshold, wait until the next detection cycle is repeated; when the comparison result is that the operation execution time exceeds the specified threshold, the task times out and cannot end normally, the test fails, an error message is output, and the process jumps to environment cleanup.

[0090] According to an embodiment of the present invention, the initial test result includes cluster lock quantity information corresponding to the database cluster; wherein, the initial test result is verified based on preset verification rules to generate a target test result, and also includes: based on the cluster lock verification rule, the cluster lock quantity information is compared with a preset quantity threshold to generate a quantity comparison result; and the target test result is determined based on the quantity comparison result.

[0091] According to an embodiment of the present invention, the number of cluster locks can be checked and verified by calling the lock residual check script. When the number of residual cluster locks = 0, the test passes and subsequent tests can be continued; when the number of residual cluster locks > 0, the test fails and an error message is output. The test can jump to environment cleanup and release residual locks to avoid affecting subsequent tests.

[0092] According to an embodiment of the present invention, a test case includes a list detection script corresponding to the list information; wherein, the initial test result is verified based on a preset verification rule to generate a target test result, and further includes: detecting the list information based on the list detection script corresponding to the list tag to generate a list detection result; and verifying the list detection result using the list information verification rule to generate a target test result.

[0093] According to an embodiment of the present invention, the list data atomicity check script can be called and the list tag can be passed in as a parameter, including: executing a query statement (such as a SQL statement) on the list to query the table data, and retaining the table data query result as "abnormal test data".

[0094] If the "abnormal test result" indicates that the operation is successful, the "abnormal test data" is compared with the "positive test data" for environment cleanup. If the comparison results are consistent, the subsequent tests will continue. If the comparison results are inconsistent, the test will fail, an error message will be output, and the process will jump to environment cleanup.

[0095] When the "abnormal test result" is an operation failure, the "data after abnormal test" will be compared with the "data before positive test" and "data after positive test" for consistency; if the comparison result is that the "data after abnormal test" is consistent with any one, the subsequent test will continue; if the comparison result is that the "data after abnormal test" is inconsistent with both, the test fails, an error message is output, and the process jumps to environment cleanup.

[0096] In a feasible embodiment, the method of verifying the initial test result using the result set verification rule may include: verifying the initial test result by calling the result set correctness check script; when the "abnormal test result" (initial test result) is a successful operation, the "abnormal test result" and the "positive test result" can be compared for consistency; when the comparison result is consistent, the test passes and subsequent tests continue; when the comparison result is inconsistent, the test fails, an error message is output, and the process jumps to environment cleanup.

[0097] In a feasible embodiment, the method of verifying the initial test result by using the list information verification rule may also include: calling the list master-slave shard consistency check script, passing the list tag as a parameter, including: obtaining the table distribution attribute, and performing a consistency check on the data version number of the same shard of the table on each data node; if the check result is consistent, the test passes; if the check result is inconsistent, the test fails, an error message is output, and the environment is cleaned up

[0098] In a feasible embodiment, after the initial test results are verified using multiple verification rules, the abnormal test environment can be cleaned up, including: clearing the test environment after each abnormal test script is executed; deleting the database table; and restarting the service to clear the system cache.

[0099] In a feasible embodiment, after the abnormal test is finished and the test environment is cleaned up, the abnormal test results can be collected, counted, and printed into a table or file.

[0100] According to an embodiment of the present invention, by performing multi-faceted verification of the initial test results through a variety of verification rules, the behavior of the database under abnormal circumstances and the accuracy of the returned results can be ensured, which helps to discover potential problems or errors and ensure the reliability and correctness of the database; at the same time, by ensuring that the database can correctly process and return appropriate results under abnormal circumstances, the user experience can be improved, thereby enhancing the user's trust and satisfaction with the system.

[0101] Figure 3 A system architecture diagram of a database cluster anomaly testing method according to an embodiment of the present invention is shown.

[0102] like Figure 3 As shown, the database cluster abnormality testing method may include: collecting abnormality test positive function execution result information 310. By collecting the positive function execution result information 310, the behavior and performance of the system under normal conditions can be verified, which helps to ensure the stability and reliability of the system and provide a benchmark for subsequent tests under abnormal conditions; collecting abnormality triggering key fields 320, using the abnormality triggering key fields 320 to provide relevant data and parameters, which is helpful for error analysis and debugging. By collecting these fields, the conditions for the occurrence of abnormalities can be better understood, helping relevant personnel to quickly locate and fix problems; thereby generating an abnormality test case script library 330 based on the positive function execution result information 310 and the abnormality triggering key fields 320; and then executing the abnormality test case script 340 using the lock identification information corresponding to the test environment; and finally statistically outputting the abnormality test results 350.

[0103] Figure 4 A schematic diagram of an abnormal test script execution flow according to an embodiment of the present invention is shown.

[0104] like Figure 4 As shown, the abnormal test script execution process may include operations S410 to S480.

[0105] In operation S410, a data initialization statement is executed.

[0106] In operation S420, the operation log is cleared.

[0107] In operation S430, operations S431~S432 are included.

[0108] In operation S431, the front end executes the statements to be tested in the test case library.

[0109] In operation S432, the backend concurrently determines the operation log content, and when an abnormal extreme keyword (abnormal test trigger point information) is detected, a specified abnormality is constructed and the corresponding abnormality is recovered.

[0110] In operation S440, it is checked whether the operation ends normally.

[0111] In operation S450, the result set is checked for correctness.

[0112] In operation S460, the atomicity of the list data is checked.

[0113] In operation S470, a consistency check is performed on the primary and backup shards.

[0114] In operation S480, environmental cleaning is performed.

[0115] Figure 5 A structural block diagram of a database cluster anomaly testing device according to an embodiment of the present invention is shown.

[0116] like Figure 5 As shown, the database cluster anomaly testing device includes an information determination module 510 , a test case library generation module 520 , and a test instruction sending module 530 .

[0117] The information determination module 510 is used to determine the cluster configuration result information and abnormal test trigger point information corresponding to the test terminal based on the test request in response to receiving the test request sent by the test terminal, wherein the test request includes identification information corresponding to the test terminal, the cluster configuration result information is associated with the operation log output level of the database cluster, and the abnormal test trigger point information represents the cluster lock information corresponding to the database cluster that meets the preset output level, and the cluster lock information includes lock stage information, lock identification information, lock type information, and lock node information. In one embodiment, the information determination module 510 can be used to perform the operation S210 described above, which will not be repeated here.

[0118] The test case library generation module 520 is used to generate a test case library based on the lock phase information, the lock identification information, the lock type information and the lock node information. In one embodiment, the test case library generation module 520 can be used to perform the operation S220 described above, which will not be described in detail here.

[0119] The test instruction sending module 530 is used to send a test instruction for performing an abnormal test to the test terminal based on the lock identification information and the test cases in the test case library. In one embodiment, the test instruction sending module 530 can be used to perform the operation S230 described above, which will not be described in detail here.

[0120] According to an embodiment of the present invention, through the information determination module 510, the test case library generation module 520, and the test instruction sending module 530 in the database cluster abnormality test device, the cluster configuration result information corresponding to the operation log output level of the database cluster and the abnormal test trigger point (lock stage information, lock identification information, lock type information, and lock node information) corresponding to the cluster lock can be automatically determined through the test request sent by the test terminal, so that the test case library can be automatically generated according to various cluster lock information, thereby improving the automation level of abnormal testing, and then implementing abnormal testing of the database according to different lock identification information and test cases. Since the abnormal test trigger point corresponding to the cluster lock is used to simulate concurrent requests and abnormal situations, the concurrency problems (for example, deadlock, node downtime, and network partition, etc.) that may occur in the distributed database in a high-concurrency scenario are at least partially overcome, the problem of manual triggering is avoided, the accuracy of database abnormal testing is improved, and the distributed database cluster is further guaranteed to access shared resources under different abnormal situations.

[0121] According to an embodiment of the present invention, the test instructions include: cluster lock information and test cases, so that the test terminal determines the abnormal test script command according to the cluster lock information and the test case; and based on the prefabricated interface of the database cluster, sends a test request including the abnormal test script command to the database cluster.

[0122] According to an embodiment of the present invention, the information determination module includes: a database cluster target configuration information generation submodule, an initialization database information generation submodule, a query statement generation submodule and a cluster configuration result information generation submodule.

[0123] The database cluster target configuration information generation submodule is used to update the database cluster initial configuration information corresponding to the test request based on a preset update rule to generate the database cluster target configuration information, wherein the preset update rule is associated with the operation log output level of the database cluster.

[0124] The initialization database information generation submodule is used to generate initialization database information based on the database cluster target configuration information, wherein the initialization database information includes list information corresponding to the initialization database.

[0125] The query statement generation submodule is used to select a list tag corresponding to the test request from the list information and generate a query statement.

[0126] The cluster configuration result information generation submodule is used to execute a query statement to query the list information and generate cluster configuration result information corresponding to the test request, wherein the cluster configuration result information includes test time information corresponding to the cluster configuration result information.

[0127] According to an embodiment of the present invention, the information determination module further includes: an initial abnormal trigger condition information generation submodule and an abnormal test trigger point information generation submodule.

[0128] The initial exception trigger condition information generation submodule is used to screen the operation logs of the database cluster and generate initial exception trigger condition information.

[0129] The abnormal test trigger point information generation submodule is used to combine the initial abnormal trigger condition information to generate abnormal test trigger point information.

[0130] According to an embodiment of the present invention, the device further includes: an abnormal test trigger point information updating module and a test case library updating module.

[0131] The abnormal test trigger point information updating module is used to update the abnormal test trigger point information based on the updated test request when the test request is updated, and generate abnormal update operation information.

[0132] The test case library update module is used to update the test case library based on the abnormal update operation information and generate an updated test case library.

[0133] According to an embodiment of the present invention, the device also includes: a target test result generation module, which is used to verify the initial test result based on preset verification rules in response to receiving the initial test result generated based on the test request, and generate a target test result, wherein the preset verification rules include at least one of the following: an operation duration verification rule, a cluster lock verification rule, a result set verification rule and a list information verification rule.

[0134] According to an embodiment of the present invention, a target test result generation module includes: a duration comparison result generation submodule and a target test result determination submodule.

[0135] The duration comparison result generation submodule is used to compare the duration information corresponding to the operation abnormality with the preset duration threshold based on the operation duration verification rule to generate the duration comparison result when the initial test result indicates that the test request operation is abnormal.

[0136] The target test result determination submodule is used to determine the target test result based on the duration comparison result.

[0137] According to an embodiment of the present invention, the initial test result includes cluster lock quantity information corresponding to the database cluster; wherein the target test result generation module further includes: a quantity comparison result generation submodule and a target test result determination submodule.

[0138] The quantity comparison result generation submodule is used to compare the cluster lock quantity information with a preset quantity threshold based on the cluster lock verification rule to generate a quantity comparison result.

[0139] The target test result determination submodule is used to determine the target test result based on the quantity comparison result.

[0140] According to an embodiment of the present invention, the test case includes a list detection script corresponding to the list information; wherein the target test result generation module further includes: a list detection result generation submodule and a target test result generation submodule.

[0141] The list detection result generation submodule is used to detect the list information based on the list detection script corresponding to the list tag and generate a list detection result.

[0142] The target test result generation submodule is used to verify the list detection results using the list information verification rules to generate the target test results.

[0143] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging the circuit, or by any one of the three implementation methods of software, hardware, and firmware, or by a proper combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be executed.

[0144] For example, any multiple of the information determination module 510, the test case library generation module 520, and the test instruction sending module 530 can be combined in one module / unit / sub-unit for implementation, or any one of the modules / units / sub-units can be split into multiple modules / units / sub-units. Alternatively, at least part of the functions of one or more of these modules / units / sub-units can be combined with at least part of the functions of other modules / units / sub-units and implemented in one module / unit / sub-unit. According to an embodiment of the present invention, at least one of the information determination module 510, the test case library generation module 520, and the test instruction sending module 530 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in a suitable combination of any of them. Alternatively, at least one of the information determination module 510, the test case library generation module 520, and the test instruction sending module 530 may be at least partially implemented as a computer program module, and when the computer program module is executed, a corresponding function may be executed.

[0145] Figure 6 A block diagram of an electronic device suitable for implementing the method described above according to an embodiment of the present invention is shown. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0146] like Figure 6 As shown, the electronic device according to an embodiment of the present invention includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 to a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include an onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.

[0147] In RAM 603, various programs and data required for the operation of the electronic device are stored. The processor 601, ROM 602 and RAM 603 are connected to each other via a bus 604. The processor 601 performs various operations of the method flow according to the embodiment of the present invention by executing the programs in ROM 602 and / or RAM 603. It should be noted that the program can also be stored in one or more memories other than ROM 602 and RAM 603. The processor 601 can also perform various operations of the method flow according to the embodiment of the present invention by executing the programs stored in the one or more memories.

[0148] According to an embodiment of the present invention, the electronic device may further include an input / output (I / O) interface 605, which is also connected to the bus 604. The system may further include one or more of the following components connected to the input / output (I / O) interface 605: an input portion 606 including a keyboard, a mouse, etc.; an output portion 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 608 including a hard disk, etc.; and a communication portion 609 including a network interface card such as a LAN card, a modem, etc. The communication portion 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage portion 608 as needed.

[0149] According to an embodiment of the present invention, the method flow according to an embodiment of the present invention can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, the above-mentioned functions defined in the system of the embodiment of the present invention are executed. According to an embodiment of the present invention, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.

[0150] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiment; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present invention is implemented.

[0151] According to an embodiment of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device.

[0152] For example, according to an embodiment of the present invention, the computer-readable storage medium may include the ROM 602 and / or the RAM 603 described above and / or one or more memories other than the ROM 602 and the RAM 603 .

[0153] An embodiment of the present invention also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method provided by the embodiment of the present invention. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the method provided by the embodiment of the present invention.

[0154] When the computer program is executed by the processor 601, the above functions defined in the system / device of the embodiment of the present invention are executed. According to the embodiment of the present invention, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0155] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 609, and / or installed from a removable medium 611. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0156] According to an embodiment of the present invention, the program code for executing the computer program provided by the embodiment of the present invention can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).

[0157] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions. It can be understood by those skilled in the art that the features recorded in the various embodiments and / or claims of the present invention can be combined and / or combined in various ways, even if such a combination or combination is not explicitly recorded in the present invention. In particular, without departing from the spirit and teaching of the present invention, the features described in the various embodiments and / or claims of the present invention may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present invention.

[0158] The embodiments of the present invention are described above. However, these embodiments are only for the purpose of illustration, and are not intended to limit the scope of the present invention. Although each embodiment is described above, it does not mean that the measures in each embodiment cannot be used in combination. The scope of the present invention is defined by the attached claims and their equivalents. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.

Claims

1. A database cluster anomaly testing method, characterized in that: The method comprises: In response to receiving a test request sent by a test terminal, determining cluster configuration result information and abnormal test trigger point information corresponding to the test terminal based on the test request, wherein the test request includes identification information corresponding to the test terminal, the cluster configuration result information is associated with the operation log output level of the database cluster, and the abnormal test trigger point information represents cluster lock information corresponding to the database cluster that meets the preset output level, and the cluster lock information includes lock stage information, lock identification information, lock type information, and lock node information; Generate a test case library based on the lock phase information, the lock identification information, the lock type information and the lock node information; and Based on the lock identification information and the test cases in the test case library, a test instruction for performing an abnormal test is sent to the test terminal, wherein the test instruction includes: the cluster lock information and the test case, so that the test terminal determines an abnormal test script command according to the cluster lock information and the test case, and sends a test request including the abnormal test script command to the database cluster based on a prefabricated interface of the database cluster; The determining, based on the test request, cluster configuration result information and abnormal test trigger point information corresponding to the test terminal includes: Based on a preset update rule, the database cluster initial configuration information corresponding to the test request is updated to generate database cluster target configuration information, wherein the preset update rule is associated with the operation log output level of the database cluster; Based on the database cluster target configuration information, generating initialization database information, wherein the initialization database information includes list information corresponding to the initialization database; Selecting a list tag corresponding to the test request from the list information to generate a query statement; and Execute the query statement to query the list information, and generate cluster configuration result information corresponding to the test request, wherein the cluster configuration result information includes test time information corresponding to the cluster configuration result information; The method further comprises: Screening the operation log of the database cluster to generate initial abnormal trigger condition information; and The initial abnormal trigger condition information is combined to generate the abnormal test trigger point information.

2. The method according to claim 1, characterized in that The method further comprises: In the case where the test request is updated, updating the abnormal test trigger point information based on the updated test request to generate abnormal update operation information; and The test case library is updated based on the abnormal update operation information to generate an updated test case library.

3. The method according to claim 1, characterized in that The method further comprises: In response to receiving an initial test result generated based on the test request, the initial test result is verified based on preset verification rules to generate a target test result, wherein the preset verification rules include at least one of the following: an operation duration verification rule, a cluster lock verification rule, a result set verification rule, and a list information verification rule.

4. The method according to claim 3, characterized in that The verifying the initial test result based on the preset verification rule to generate the target test result includes: In the case where the initial test result indicates that the test request operation is abnormal, based on the operation duration verification rule, the duration information corresponding to the operation abnormality is compared with a preset duration threshold to generate a duration comparison result; and A target test result is determined based on the duration comparison result.

5. The method according to claim 3, characterized in that: The initial test result includes information on the number of cluster locks corresponding to the database cluster; The step of verifying the initial test result based on a preset verification rule to generate a target test result further includes: Based on the cluster lock verification rule, the cluster lock quantity information is compared with a preset quantity threshold to generate a quantity comparison result; and The target test result is determined based on the quantitative comparison result.

6. The method according to claim 3, characterized in that The test case includes a list detection script corresponding to the list information; The step of verifying the initial test result based on a preset verification rule to generate a target test result further includes: Detecting the list information based on a list detection script corresponding to the list tag to generate a list detection result; The list detection result is verified using the list information verification rule to generate the target test result.

7. A database cluster anomaly testing device, characterized in that: The device comprises: An information determination module, configured to determine, in response to receiving a test request sent by a test terminal, cluster configuration result information and abnormal test trigger point information corresponding to the test terminal based on the test request, wherein the test request includes identification information corresponding to the test terminal, the cluster configuration result information is associated with the operation log output level of the database cluster, the abnormal test trigger point information represents cluster lock information corresponding to the database cluster that meets the preset output level, and the cluster lock information includes lock stage information, lock identification information, lock type information and lock node information; a test case library generating module, configured to generate a test case library based on the lock phase information, the lock identification information, the lock type information and the lock node information; and A test instruction sending module, used for sending a test instruction for performing an abnormal test to the test terminal based on the lock identification information and the test case in the test case library, wherein the test instruction includes: the cluster lock information and the test case, so that the test terminal determines the abnormal test script command according to the cluster lock information and the test case, and sends a test request including the abnormal test script command to the database cluster based on the prefabricated interface of the database cluster; Wherein, the information determination module includes: A database cluster target configuration information generation submodule, used to update the database cluster initial configuration information corresponding to the test request based on a preset update rule to generate database cluster target configuration information, wherein the preset update rule is associated with the operation log output level of the database cluster; An initialization database information generation submodule, used to generate initialization database information based on the database cluster target configuration information, wherein the initialization database information includes list information corresponding to the initialization database; A query statement generating submodule, configured to select a list tag corresponding to the test request from the list information to generate a query statement; and A cluster configuration result information generating submodule, used for executing the query statement to query the list information, and generating cluster configuration result information corresponding to the test request, wherein the cluster configuration result information includes test time information corresponding to the cluster configuration result information; The information determination module also includes: an initial abnormal trigger condition information generating submodule, used to screen the operation log of the database cluster and generate initial abnormal trigger condition information; and The abnormal test trigger point information generation submodule is used to combine the initial abnormal trigger condition information to generate the abnormal test trigger point information.

Citation Information

Patent Citations

  • Distributed database cluster test method and device and storage medium

    CN110389900A

  • Redis cluster anomaly detection method and device, terminal and storage medium

    CN114553747A