Distributed relational database testing method and device, equipment and medium

By using a pre-trained fault generation model to generate and inject fault test data, combined with consistency detection algorithm to monitor and repair the data consistency problem of distributed relational databases, the inefficiency problem of manual injection of fault data testing in the prior art is solved. , realizes efficient automated testing and repair.

CN119473684APending Publication Date: 2025-02-18CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411666790.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

Distributed relational databases may have data consistency problems in extreme scenarios. The existing technology requires manual injection of faulty data for testing, which consumes a lot of time and manpower.

Method used

The pre-trained target test fault generation model is used to generate fault test data according to the database architecture and data flow direction, inject it into the database and use a consistency detection algorithm to monitor data consistency problems, generate fault test reports and perform data repairs.

Benefits of technology

It improves the testing efficiency of data consistency problems of distributed relational databases, reduces testing time and manpower consumption, and realizes automated data repair.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473684A_ABST
    Figure CN119473684A_ABST
Patent Text Reader

Abstract

The invention relates to a distributed relational database testing method and device, equipment and a medium. The method comprises the following steps: generating a plurality of pieces of fault test data according to the architecture and data flow direction of a distributed relational database; for each piece of fault test data, injecting the fault test data into the distributed relational database, and carrying out data consistency problem monitoring on the distributed relational database based on a consistency detection algorithm; when the distributed relational database has the data consistency problem, stopping injection of the multiple pieces of fault test data, and stopping data consistency problem monitoring on the distributed relational database; according to the data consistency problem occurring in the distributed relational database, a fault test report is generated, and data with the data consistency problem in the distributed relational database is repaired. At least the data consistency problem of the distributed relational database can be tested more efficiently, and the data with the data consistency problem can be repaired.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of hydropower station operation control, and in particular to a testing method, device, equipment and medium for a distributed relational database. Background Art

[0002] Distributed relational databases can support high-concurrency access and large-scale data storage, and have been widely used in many Internet industries. Compared with traditional centralized databases, the architecture of distributed relational databases is more complex, and it is more difficult to ensure data consistency.

[0003] In order to ensure the reliability of distributed relational databases, it is necessary to test the distributed relational databases. However, data consistency problems often only occur in certain extreme scenarios. It is necessary to use fault injection tools to inject fault data and then perform data consistency analysis on the distributed relational database. In addition, data with data consistency problems must be manually repaired, which requires a lot of manpower, material resources and testing time. Summary of the invention

[0004] Based on this, it is necessary to provide a distributed relational database testing method, device, equipment and medium to address the above technical problems, which can at least more efficiently test the data consistency problems of the distributed relational database and repair the data with data consistency problems, thereby reducing the testing time and the consumption of manpower and material resources.

[0005] In a first aspect, the present application provides a testing method for a distributed relational database, comprising: based on a pre-trained target test fault generation model, generating multiple fault test data according to the architecture and data flow of the distributed relational database; for each fault test data, injecting the fault test data into the distributed relational database, and monitoring the distributed relational database for data consistency problems based on a consistency detection algorithm; when the distributed relational database has data consistency problems, stopping the injection of multiple fault test data and stopping monitoring the distributed relational database for data consistency problems; generating a fault test report based on the data consistency problems that occur in the distributed relational database, and repairing the data in the distributed relational database that has data consistency problems.

[0006] In one of the embodiments, the test fault generation model is trained by the following steps: historical fault data is obtained, the historical fault data includes multiple fault data; for each fault data, multiple data features related to data consistency issues in the fault data are determined; for each fault data, the data consistency issue of the fault data and multiple database features related to the data consistency issue are input into the test fault generation model to generate training fault data; for each training fault data, the fault type of the training fault data and the application scenario corresponding to the training fault data are determined, the application scenario includes the architecture and data flow of a distributed relational database; based on the multiple training fault data, the initial test fault generation model is trained until the fault data generated by the test fault generation model can cause data consistency issues in multiple application scenarios corresponding to the multiple fault data.

[0007] In one of the embodiments, data consistency problems of a distributed relational database are monitored by the following steps: obtaining multiple transaction logs of the distributed relational database, and determining whether the start state and the end state of the transaction in each transaction log are consistent; generating a database snapshot at a preset time interval, and determining whether there is a data consistency problem between multiple database snapshots; determining whether there is a data consistency problem between data of multiple nodes based on multiple nodes in multiple execution paths of multiple distributed transactions; determining whether multiple consistency protocols of the distributed relational database are correct; if the start state and the end state of the transaction in each transaction log are inconsistent; and / or; there is a data consistency problem between multiple database snapshots; and / or; there is a data consistency problem between data of multiple nodes; and / or; multiple consistency protocols of the distributed relational database are incorrect, it is determined that the distributed relational database has a data consistency problem.

[0008] In one of the embodiments, data consistency problems of a distributed relational database are monitored by the following steps: load data of the distributed relational database is obtained; a detection time interval for monitoring data consistency problems of the distributed relational database is determined based on the load data of the distributed relational database; data consistency problem detection is performed on the distributed relational database at every detection time interval, and the data consistency problem detection includes single-node consistency detection, multi-node consistency detection and global consistency detection.

[0009] In one of the embodiments, the distributed relational database data having data consistency problems is repaired by the following steps: determining the problem level of the data consistency problem occurring in the distributed relational database data; and repairing the data consistency problem in the distributed relational database data according to a fault recovery mechanism corresponding to the problem level.

[0010] In one of the embodiments, the method also includes: when a distributed relational database has a data consistency problem, obtaining fault test data and a fault test report; generating at least one fault data based on the fault test data and the fault test report; and training a target test fault generation model based on the at least one fault data to update the target test fault generation model.

[0011] In the second aspect, the present application also provides a testing device for a distributed relational database, including a fault test data generation module, a data consistency problem monitoring module, a fault test stop module and a data repair module. The fault test data generation module is used to generate multiple fault test data based on a pre-trained target test fault generation model according to the architecture and data flow of the distributed relational database; the data consistency problem monitoring module is used to inject each fault test data into the distributed relational database, and monitor the distributed relational database for data consistency problems based on a consistency detection algorithm; the fault test stop module is used to stop the injection of multiple fault test data when there is a data consistency problem in the distributed relational database, and stop monitoring the distributed relational database for data consistency problems; the data repair module is used to generate a fault test report based on the data consistency problem that occurs in the distributed relational database, and repair the data in the distributed relational database that has data consistency problems.

[0012] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0013] Based on the pre-trained target test fault generation model, multiple fault test data are generated according to the architecture and data flow of the distributed relational database;

[0014] For each fault test data, inject the fault test data into the distributed relational database, and monitor the data consistency problem of the distributed relational database based on the consistency detection algorithm;

[0015] When a distributed relational database has data consistency problems, stop injecting multiple fault test data and stop monitoring the distributed relational database for data consistency problems;

[0016] According to the data consistency problems in the distributed relational database, a fault test report is generated, and the data with data consistency problems in the distributed relational database is repaired.

[0017] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:

[0018] Based on the pre-trained target test fault generation model, multiple fault test data are generated according to the architecture and data flow of the distributed relational database;

[0019] For each fault test data, inject the fault test data into the distributed relational database, and monitor the data consistency problem of the distributed relational database based on the consistency detection algorithm;

[0020] When a distributed relational database has data consistency problems, stop injecting multiple fault test data and stop monitoring the distributed relational database for data consistency problems;

[0021] According to the data consistency problems in the distributed relational database, a fault test report is generated, and the data with data consistency problems in the distributed relational database is repaired.

[0022] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0023] Based on the pre-trained target test fault generation model, multiple fault test data are generated according to the architecture and data flow of the distributed relational database;

[0024] For each fault test data, inject the fault test data into the distributed relational database, and monitor the data consistency problem of the distributed relational database based on the consistency detection algorithm;

[0025] When a distributed relational database has data consistency problems, stop injecting multiple fault test data and stop monitoring the distributed relational database for data consistency problems;

[0026] According to the data consistency problems in the distributed relational database, a fault test report is generated, and the data with data consistency problems in the distributed relational database is repaired.

[0027] The above-mentioned distributed relational database testing method, device, equipment and medium automatically generate fault data through a pre-trained target test fault generation model; based on a consistency detection algorithm, the distributed relational database is monitored for data consistency problems; when data consistency problems occur, a fault test report can be automatically generated, and the data with data consistency problems can be repaired, which can not only more efficiently test the data consistency problems of the distributed relational database and repair the data with data consistency problems, but also reduce the testing time and the consumption of manpower and material resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application 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 creative work.

[0029] FIG1 is a schematic diagram of a flow chart of a method for testing a distributed relational database in one embodiment;

[0030] FIG2 is a schematic diagram of a flow chart of a testing method for a distributed relational database in another embodiment;

[0031] FIG3 is a structural block diagram of a testing device for a distributed relational database in one embodiment;

[0032] FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment.

[0033] Reference numerals and descriptions:

[0034] 10. Fault test data generation module; 20. Data consistency problem monitoring module; 30. Fault test stop module; 40. Data repair module. DETAILED DESCRIPTION

[0035] 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.

[0036] The distributed relational database testing method provided in the embodiment of the present application can be applied to various personal computers, laptops, smart phones, tablet computers, IoT devices and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc.

[0037] Please refer to FIG1 , in an exemplary embodiment, a distributed relational database testing method is provided, including the following steps S101 to S104. In which:

[0038] Step 101 , based on a pre-trained target test fault generation model, a plurality of fault test data are generated according to the architecture and data flow of the distributed relational database.

[0039] Specifically, the test fault generation model can be trained through the following steps: obtaining historical fault data, wherein the historical fault data includes multiple fault data; for each fault data, determining multiple data features related to the data consistency problem in the fault data; for each fault data, inputting the data consistency problem of the fault data and multiple database features related to the data consistency problem into the test fault generation model to generate training fault data; for each training fault data, determining the fault type of the training fault data and the application scenario corresponding to the training fault data, wherein the application scenario includes the architecture and data flow of the distributed relational database; based on multiple training fault data, training the initial test fault generation model until the fault data generated by the test fault generation model can cause data consistency problems in multiple application scenarios corresponding to the multiple fault data.

[0040] Here, the test fault generation model mentioned in the present application can be an intelligent fault injection generation model based on machine learning, which can automatically learn and identify the fault types and scenarios that are most likely to cause data consistency problems, so as to improve the pertinence and effectiveness of fault injection.

[0041] The multiple fault data may include the fault type, the condition under which the fault occurs, the type of data consistency problem, etc.

[0042] Among them, multiple data features may include system load, number of concurrent transactions, network delay, etc.

[0043] For example, a machine learning algorithm (such as random forest, support vector machine, etc.) can be used to train the extracted data features to generate a fault prediction model. Test fault generation can predict the type of fault that is most likely to cause data consistency problems under specific conditions.

[0044] Step S102: for each fault test data, inject the fault test data into the distributed relational database, and monitor the data consistency problem of the distributed relational database based on a consistency detection algorithm.

[0045] Specifically, the distributed relational database can be monitored for data consistency problems through the following steps: obtaining multiple transaction logs of the distributed relational database, and determining whether the start state and the end state of the transaction in each transaction log are consistent; generating a database snapshot at a preset time interval, and determining whether there is a data consistency problem between multiple database snapshots; based on multiple nodes in multiple execution paths of multiple distributed transactions, determining whether there is a data consistency problem between data of multiple nodes; determining whether multiple consistency protocols of the distributed relational database are correct; if the start state and the end state of the transaction in each transaction log are inconsistent; and / or; there is a data consistency problem between multiple database snapshots; and / or; there is a data consistency problem between data of multiple nodes; and / or; the multiple consistency protocols of the distributed relational database are incorrect, it is determined that the distributed relational database has a data consistency problem.

[0046] Here, this application develops and adopts an optimized consistency detection algorithm, which can detect and locate data consistency problems in the shortest time. By comparing transaction logs, ensure that the start and end states of each transaction are consistent; during the transaction execution process, regularly generate database snapshots and compare the data consistency between snapshots; by tracking the execution path of distributed transactions, detect the consistency of data between nodes; during the consistency detection process, verify the correctness of the consistency protocol (such as Paxos, Raft, etc.) used by the distributed database to ensure that the protocol can be correctly executed in various failure scenarios.

[0047] Among them, the consistency detection algorithm adopted in this application can be a Merkle tree, a version vector, etc., to improve the accuracy and efficiency of data consistency detection.

[0048] Specifically, the distributed relational database may also be monitored for data consistency issues through the following steps: obtaining the load data of the distributed relational database; determining a detection time interval for monitoring the data consistency issues of the distributed relational database based on the load data of the distributed relational database; performing data consistency issue detection on the distributed relational database at every detection time interval, wherein the data consistency issue detection includes single-node consistency detection, multi-node consistency detection and global consistency detection.

[0049] Here, the present application designs a hierarchical consistency detection mechanism including single-node consistency detection, multi-node consistency detection and global consistency detection, and performs detection in layers according to the severity and scope of the data consistency problem.

[0050] At the same time, when monitoring data consistency issues in a distributed relational database, the frequency of data consistency detection can be dynamically adjusted to balance the load and detection accuracy.

[0051] Exemplarily, the detection frequency is increased when the load is low, and vice versa, the detection frequency is reduced to ensure that the performance of the distributed relational database is not significantly affected.

[0052] Step S103: when the distributed relational database has a data consistency problem, stop injecting the plurality of fault test data, and stop monitoring the data consistency problem of the distributed relational database.

[0053] Here, when there is a data consistency problem in the distributed relational database, the injection of faults and the detection of data consistency problems are stopped immediately, ensuring that after the problem is detected, the operation of the distributed relational database is greatly affected.

[0054] Among them, the present application also designs a multi-level fault recovery mechanism, which can perform corresponding recovery operations according to the severity of the fault to ensure that the system can quickly resume normal operation.

[0055] Step S104: generating a fault test report according to the data consistency problem occurring in the distributed relational database, and repairing the data occurring in the data consistency problem in the distributed relational database.

[0056] Here, the fault test report is a detailed and intuitive visual test report, which includes the system status, data flow, data consistency test results, etc. when the fault occurs, so that users can quickly understand the cause of the fault and the scope of impact.

[0057] Specifically, the distributed relational database data with data consistency problems can be repaired through the following steps: determining the problem level of the data consistency problem of the distributed relational database data; and repairing the data consistency problem of the distributed relational database data according to a fault recovery mechanism corresponding to the problem level.

[0058] For example, after a data consistency problem is detected, automatic or semi-automatic repair suggestions can be provided to help operation and maintenance personnel quickly resolve the consistency problem.

[0059] Optionally, when automatically repairing a data consistency problem, the repair result and the repair process need to be recorded in a fault test report.

[0060] Please refer to FIG. 2 , in one embodiment, the distributed relational database testing method further includes:

[0061] Step S201, when the distributed relational database has a data consistency problem, obtaining fault test data and the fault test report.

[0062] Step S202: Generate at least one fault data according to the fault test data and the fault test report.

[0063] Step S203: training the target test fault generation model based on the at least one fault data to update the target test fault generation model.

[0064] Here, by regularly updating the fault prediction model and continuously learning new fault data and test results, the accuracy and effectiveness of the model can be improved.

[0065] The distributed relational database testing method proposed in this application can not only automatically inject faults into the distributed database, but also perform real-time data read and write monitoring in combination with data consistency detection tools during the fault injection process. It can detect and evaluate the data consistency of the distributed relational database in real time under fault scenarios. It can not only quickly discover data consistency problems when a fault occurs, but also ensure the consistency and integrity of the data during the fault recovery process, reducing the test time and the consumption of manpower and material resources, and significantly improving the reliability and stability of the system.

[0066] In addition, the system also adopts an intelligent fault injection strategy, using machine learning and big data analysis technology to automatically identify and simulate the fault types and scenarios that are most likely to cause data consistency problems, and designs a comprehensive monitoring and alarm mechanism that can respond immediately when data consistency anomalies occur, provide detailed fault reports, and help users quickly locate problems and take corresponding measures.

[0067] 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.

[0068] Based on the same inventive concept, the embodiment of the present application also provides a distributed relational database testing device for implementing the distributed relational database 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 the testing device for one or more distributed relational databases provided below can refer to the limitations of the distributed relational database testing method above, and will not be repeated here.

[0069] Please refer to Figure 3. In an exemplary embodiment, a testing device for a distributed relational database is provided, including: a fault test data generation module 10, a data consistency problem monitoring module 20, a fault test stop module 30 and a data repair module 40. The fault test data generation module 10 is used to generate multiple fault test data based on a pre-trained target test fault generation model according to the architecture and data flow of the distributed relational database; the data consistency problem monitoring module 20 is used to inject each fault test data into the distributed relational database, and monitor the distributed relational database for data consistency problems based on a consistency detection algorithm; the fault test stop module 30 is used to stop the injection of the multiple fault test data and stop monitoring the distributed relational database for data consistency problems when the distributed relational database has data consistency problems; the data repair module 40 is used to generate a fault test report according to the data consistency problems that occur in the distributed relational database, and repair the data with data consistency problems in the distributed relational database.

[0070] Each module in the above-mentioned distributed relational database test device can be implemented in whole or in part by software, hardware and 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.

[0071] In an exemplary embodiment, a computer device is provided, which may be a terminal. 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 can 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 controlling the drainage of a water turbine top cover 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.

[0072] Those skilled in the art will understand that the structure shown in FIG. 4 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.

[0073] 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 when the processor executes the computer program, the following steps are implemented:

[0074] Based on the pre-trained target test fault generation model, multiple fault test data are generated according to the architecture and data flow of the distributed relational database;

[0075] For each fault test data, inject the fault test data into the distributed relational database, and monitor the data consistency problem of the distributed relational database based on the consistency detection algorithm;

[0076] When the distributed relational database has a data consistency problem, stop injecting the multiple fault test data, and stop monitoring the distributed relational database for data consistency problems;

[0077] According to the data consistency problem occurring in the distributed relational database, a fault test report is generated, and the data occurring in the distributed relational database with the data consistency problem is repaired.

[0078] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0079] Based on the pre-trained target test fault generation model, multiple fault test data are generated according to the architecture and data flow of the distributed relational database;

[0080] For each fault test data, inject the fault test data into the distributed relational database, and monitor the data consistency problem of the distributed relational database based on the consistency detection algorithm;

[0081] When the distributed relational database has a data consistency problem, stop injecting the multiple fault test data, and stop monitoring the distributed relational database for data consistency problems;

[0082] According to the data consistency problem occurring in the distributed relational database, a fault test report is generated, and the data occurring in the distributed relational database with the data consistency problem is repaired.

[0083] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0084] Based on the pre-trained target test fault generation model, multiple fault test data are generated according to the architecture and data flow of the distributed relational database;

[0085] For each fault test data, inject the fault test data into the distributed relational database, and monitor the data consistency problem of the distributed relational database based on the consistency detection algorithm;

[0086] When the distributed relational database has a data consistency problem, stop injecting the multiple fault test data, and stop monitoring the distributed relational database for data consistency problems;

[0087] According to the data consistency problem occurring in the distributed relational database, a fault test report is generated, and the data occurring in the distributed relational database with the data consistency problem is repaired.

[0088] 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.

[0089] 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.

[0090] 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 distributed relational database testing method, characterized in that: include: Based on the pre-trained target test fault generation model, multiple fault test data are generated according to the architecture and data flow of the distributed relational database; For each fault test data, inject the fault test data into the distributed relational database, and monitor the data consistency problem of the distributed relational database based on the consistency detection algorithm; When the distributed relational database has a data consistency problem, stop injecting the multiple fault test data, and stop monitoring the distributed relational database for data consistency problems; According to the data consistency problem occurring in the distributed relational database, a fault test report is generated, and the data occurring in the distributed relational database with the data consistency problem is repaired.

2. The distributed relational database testing method according to claim 1, characterized in that: Train the test fault generation model by following these steps: Acquire historical fault data, where the historical fault data includes a plurality of fault data; For each fault data, determining a plurality of data features in the fault data that are related to the data consistency problem; For each fault data, inputting the data consistency problem of the fault data and a plurality of database features related to the data consistency problem into the test fault generation model to generate training fault data; For each training fault data, determine the fault type of the training fault data and the application scenario corresponding to the training fault data, wherein the application scenario includes the architecture and data flow of the distributed relational database; An initial test fault generation model is trained according to a plurality of training fault data until the fault data generated by the test fault generation model can cause data consistency problems in a plurality of application scenarios corresponding to the plurality of fault data.

3. The distributed relational database testing method according to claim 1, characterized in that: The distributed relational database is monitored for data consistency issues by following the steps below: Obtaining multiple transaction logs of the distributed relational database, and determining whether the start state and the end state of the transaction in each transaction log are consistent; Generate a database snapshot at a preset time interval and determine whether there is a data consistency problem between multiple database snapshots; Based on multiple nodes in multiple execution paths of multiple distributed transactions, determine whether there is a data consistency problem between the data of multiple nodes; Determining whether multiple consistency protocols of the distributed relational database are correct; If the start state and end state of the transaction in each transaction log are inconsistent; and / or; there are data consistency issues between multiple database snapshots; and / or; there are data consistency issues between multiple nodes; and / or; multiple consistency protocols of the distributed relational database are incorrect, it is determined that the distributed relational database has data consistency issues.

4. The distributed relational database testing method according to claim 1, characterized in that: The distributed relational database is monitored for data consistency issues by following the steps below: Obtaining load data of the distributed relational database; Determining, according to the load data of the distributed relational database, a detection time interval for monitoring data consistency problems of the distributed relational database; At every detection time interval, the distributed relational database is subjected to data consistency problem detection, wherein the data consistency problem detection includes single-node consistency detection, multi-node consistency detection and global consistency detection.

5. The distributed relational database testing method according to claim 1, characterized in that: Use the following steps to repair the distributed relational database data with data consistency issues: Determine the problem level of the data consistency problem occurring in the distributed relational database data; The data consistency problem of the distributed relational database data is repaired according to a fault recovery mechanism corresponding to the problem level.

6. The distributed relational database testing method according to claim 1, characterized in that: The method further comprises: When the distributed relational database has a data consistency problem, obtaining fault test data and the fault test report; generating at least one fault data according to the fault test data and the fault test report; The target test fault generation model is trained based on the at least one fault data to update the target test fault generation model.

7. A distributed relational database testing device, characterized in that: The device comprises: A fault test data generation module, used to generate multiple fault test data based on a pre-trained target test fault generation model and according to the architecture and data flow of the distributed relational database; A data consistency problem monitoring module, for each fault test data, injecting the fault test data into the distributed relational database, and performing data consistency problem monitoring on the distributed relational database based on a consistency detection algorithm; A fault test stopping module is used to stop the injection of the plurality of fault test data and stop monitoring the data consistency problem of the distributed relational database when there is a data consistency problem in the distributed relational database; The data repair module is used to generate a fault test report according to the data consistency problem occurring in the distributed relational database, and repair the data occurring in the distributed relational database with the data consistency problem.

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.

Citation Information

Cited By

  • Database testing method and device and medium

    CN122220241A