Abnormality analysis method and device, computer equipment and readable storage medium

By analyzing the target SQL statements and synchronizing the target data of the online environment to the corresponding data table of the test environment, the data synchronization failure caused by the structure of the online environment and the test environment table are solved, and efficient and automated data synchronization and abnormal simulation analysis are achieved.

CN120196465APending Publication Date: 2025-06-24北京新氧万维科技咨询有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311695587.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-11
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

When business abnormalities occur in production environments, the data of the online environment needs to be synchronized to the test environment or local development environment for abnormal troubleshooting and troubleshooting. However, the existing technology needs to rely on additional database management software, synchronization takes time, is inefficient, costly, and is prone to synchronization failure.

Method used

In the case of abnormal online functions, the target SQL statement is obtained, the target SQL statement is parsed, the first business data table associated with the exception function is found from the online environment database, and the second business data table corresponding to the first business data table from the test environment database is found, the table structure difference between the two is determined, and the target data is synchronized into the second business data table according to the differences and preset rules for exception simulation analysis.

Benefits of technology

It realizes automatic compatibility between the table structure differences between the online environment and the test environment, improves the success rate of data synchronization, reduces the cost of manual intervention, and improves the efficiency of abnormal simulation and analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120196465A_ABST
    Figure CN120196465A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an exception analysis method, which comprises the following steps of: acquiring a target SQL (Structured Query Language) statement under the condition of online function exception; according to the target SQL statement, searching a first business data table associated with an abnormal function from an online environment database, and searching a second business data table corresponding to the first business data table from a test environment database; obtaining target data according to the target SQL statement and the first business data table; determining a table structure difference between the first service data table and the second service data table; and synchronizing the target data to the second business data table according to the table structure difference and a preset rule. According to the technical scheme provided by the embodiment of the invention, when the table structures of the online environment and the test environment are different, the target data can be automatically compatible and added into the test environment database, so that the problem of synchronization failure can be relieved, and business exception can be conveniently simulated in the test environment and analyzed and processed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of data processing, and in particular, to an exception analysis method, apparatus, computer device, and computer-readable storage medium. Background Art

[0002] In software development of any scale, it is inevitable that business exceptions occur in the production environment. In this case, it is crucial to promptly troubleshoot the online functional code. In the face of such business exceptions, necessary measures need to be taken to solve the problems to minimize the negative impact on the user experience and business processes. For example, it is necessary to collect exception information and analyze the exception information, so as to perform exception troubleshooting and fault repair on the online functional code.

[0003] When a business exception occurs in the production environment (online environment), the business exception can be reproduced in the test environment or the local development environment to repair the relevant function. The ever-changing complexity of the business causes business exceptions to be associated with specific scenario data. After repairing the exception in the test environment or the local development environment, it is also necessary to use the latest specific scenario data in the online environment to verify the function repair situation.

[0004] However, synchronizing the data in the online environment to the test environment or the local development environment requires additional database management software, which is time-consuming, inefficient, costly, and prone to synchronization failures.

[0005] It should be noted that the above content is not necessarily prior art and is not used to limit the patent protection scope of the present application. Summary of the Invention

[0006] The embodiments of the present application provide an exception analysis method, apparatus, computer device, and computer-readable storage medium to solve or alleviate one or more of the above technical problems.

[0007] One aspect of the embodiments of the present application provides an exception analysis method, the method comprising:

[0008] When an online function is abnormal, obtain a target SQL statement;

[0009] According to the target SQL statement, find a first business data table associated with the abnormal function from the online environment database, and find a second business data table corresponding to the first business data table from the test environment database;

[0010] Obtain target data according to the target SQL statement and the first business data table;

[0011] Determine the table structure difference between the first business data table and the second business data table;

[0012] Synchronize the target data to the second service data table according to the table structure difference and preset rules for abnormal simulation analysis.

[0013] Optionally, the step of finding the first service data table associated with the abnormal function from the online environment database and the second service data table corresponding to the first service data table from the test environment database according to the target SQL statement includes:

[0014] Perform syntax and lexical analysis on the target SQL statement to obtain the target database name and the target data table name;

[0015] Find the first service data table from the online environment database according to the target database name and the target data table name;

[0016] Find the second service data table from the test environment database according to the target database name and the target data table name.

[0017] Optionally, the abnormal analysis method further includes:

[0018] Match the target database name and the target data table name with the pre-configured database name and data table name;

[0019] In the case of successful matching, find the first service data table and the second service data table according to the target database name and the target data table name, and obtain the table structures of the first service data table and the second service data table respectively.

[0020] Optionally, the step of obtaining the target data according to the target SQL statement and the first service data table includes:

[0021] Obtain the primary key of the first service data table according to the target SQL statement;

[0022] Obtain the target data from the online environment database according to the primary key of the first service data table.

[0023] Optionally, the table structure difference includes field difference; the step of synchronizing the target data to the second service data table according to the table structure difference and preset rules includes:

[0024] Determine a first data synchronization statement and a second data synchronization statement according to the table structure difference and the target data;

[0025] Synchronize the target data to the second service data table according to the first data synchronization statement and the second data synchronization statement;

[0026] Among them, the first data synchronization statement is used to: delete the corresponding fields in the target data according to the table structure difference; the second data synchronization statement is used to: add corresponding fields to the target data according to the table structure difference, and set the values of the newly added fields to preset values.

[0027] Optionally, the first business data table includes: one or more data tables in the online environment database associated with the abnormal function;

[0028] The second business data table includes: one or more data tables in the test environment database corresponding to the first business data table.

[0029] Optionally, the abnormal analysis method further includes:

[0030] In the case of synchronizing the target data to the second business data table, perform abnormal simulation analysis through the test environment database.

[0031] Another aspect of the embodiments of the present application provides an abnormal analysis device, and the device includes:

[0032] A first acquisition module, configured to acquire a target SQL statement in the case of an abnormal online function;

[0033] A search module, configured to search for a first business data table associated with the abnormal function from the online environment database according to the target SQL statement, and search for a second business data table corresponding to the first business data table from the test environment database;

[0034] A second acquisition module, configured to acquire target data according to the target SQL statement and the first business data table;

[0035] A determination module, configured to determine the table structure difference between the first business data table and the second business data table;

[0036] A synchronization module, configured to synchronize the target data into the second business data table according to the table structure difference and a preset rule for abnormal simulation analysis.

[0037] Another aspect of the embodiments of the present application provides a computer device, including:

[0038] At least one processor; and

[0039] A memory communicatively connected to the at least one processor;

[0040] Wherein: the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.

[0041] Another aspect of the embodiments of the present application provides a computer-readable storage medium, in which computer instructions are stored, and when the computer instructions are executed by a processor, the method described above is implemented.

[0042] The embodiments of the present application adopting the above technical solutions may include the following advantages:

[0043] When a business function in the online environment is abnormal, the target SQL statement can be obtained first. By parsing the target SQL statement, the first business data table associated with the abnormal function is found from the online environment database, and the second business data table corresponding to the first business data table is found from the test environment database, and the table structure differences between the first business data table and the second business data table are determined. According to the target SQL statement and the first business data table, the target data is obtained. Based on the table structure differences and preset rules, the target data is synchronized to the second business data table for abnormal simulation analysis in the test environment. It can be seen that when there are differences in the table structures between the online environment and the test environment, the embodiments of the present application can automatically be compatible with the target data and add it to the test environment database, which helps to alleviate the problem of synchronization failure, and the business exception can be simulated and analyzed in the test environment. This synchronization process does not require manual intervention, which can reduce costs and improve efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The drawings exemplarily show the embodiments and form a part of the specification, and are used together with the written description of the specification to explain the exemplary embodiments. The shown embodiments are only for illustrative purposes and do not limit the scope of the claims. In all the drawings, the same reference numerals refer to similar but not necessarily the same elements.

[0045] Figure 1 Schematically shows the flowchart of the exception analysis method according to Embodiment 1 of the present application;

[0046] Figure 2 Schematically shows Figure 1 the sub-steps of step S102 in;

[0047] Figure 3 Schematically shows Figure 1 the sub-steps of step S108 in;

[0048] Figure 4 is an application example diagram of the exception analysis method according to Embodiment 1 of the present application;

[0049] Figure 5 Schematically shows the block diagram of the exception analysis device according to Embodiment 2 of the present application; and

[0050] Figure 6 Schematically shows the hardware architecture diagram of the computer device according to Embodiment 3 of the present application. Detailed implementation manners

[0051] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to 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. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts belong to the scope of protection of the present application.

[0052] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between various embodiments can be combined with each other, but it must be based on the fact that those of ordinary skill in the art can implement them. When the combination of technical solutions appears to be contradictory or unable to be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present application.

[0053] In the description of the present application, it should be understood that the numerical labels before the steps do not identify the sequence of execution of the steps, but are only used to facilitate the description of the present application and distinguish each step, and thus cannot be understood as a limitation to the present application.

[0054] First, provide the term explanations involved in the present application:

[0055] Online environment: Also known as the production environment, it is the environment where software, applications or systems actually run and provide services, facing real users.

[0056] Local (development) environment: It is the environment used by developers to write, debug and run code, and can be configured according to the needs of developers.

[0057] Test environment: An environment used to test new functions, fix exceptions or evaluate system performance. The test environment can be a local environment, a pre-release environment or a pre-production environment, etc.

[0058] SQL (Structured Query Language): The standard language for managing relational databases. SQL statements can be used to interact with databases to perform operations such as querying, inserting, updating, deleting, etc.

[0059] Assertion: It is used to mark and verify the assumed conditions of the code in a program, which helps in debugging and detecting errors or unexpected situations in the code.

[0060] Dotting: Using the dot operator to access or call specific properties or methods in an object or data structure, which can be used for fault analysis or troubleshooting.

[0061] Secondly, to facilitate the understanding of the technical solutions provided by the embodiments of the present application by those skilled in the art, the related technologies are described below:

[0062] When a business exception occurs in the production environment (online environment), in order to repair the related functions, the business exception can be reproduced in the test environment or the local development environment. The complexity of continuous business iteration results in the business exception being related to specific scenario data. After repairing the business exception in the local development environment or the test environment, it is necessary to use the latest specific business scenario data in the online environment to verify whether the function repair is successful. In both of the above cases, it is necessary to synchronize the data in the online environment to the test environment or the local development environment.

[0063] However, the applicant has learned that: Synchronizing the data in the online environment to the test environment or the local development environment in the related technologies requires relying on additional database management software, and there are the following defects:

[0064] (1) Synchronizing all the data in the online environment to the test environment, or synchronizing the data tables associated with the specified scenario to the local environment through database management software takes a long time, and each synchronization requires a large amount of time, resulting in low efficiency.

[0065] (2) When synchronizing the data tables associated with the specified scenario through database management software, it is necessary to first synchronize the data to the local environment and then to the test environment, and the synchronization process has a high cost and low efficiency.

[0066] (3) Business data grows at the level of TB (Terabyte, one trillion bytes) and PB (Petabyte) per day. If all the business data is to be synchronized to the test environment, it will cause waste of disk space.

[0067] (4) There may be differences in the table structures of the online environment database and the test environment database. For example: in the test environment, developers perform operations such as adding fields, changing fields, or taking offline fields in the data table, and these operations will cause differences between the online data table and the offline data table, resulting in synchronization failure. It is necessary for R & D personnel to intervene to filter the different fields, which will increase the labor cost of data synchronization.

[0068] To this end, the embodiments of the present application provide a technical solution for exception analysis. In this technical solution: (1) According to the business exception function points, relevant business data tables are matched to obtain a structured query language SQL (cross-database join queries can be performed when multiple tables are involved). Configuring the SQL to the background of the data synchronization (online environment - test environment) engine can achieve data synchronization. Subsequently, exception simulation, analysis, and repair can be carried out in the test environment through assertions, logging, etc. (2) Lexical and syntactic analysis is performed on the SQL statement to specify data for synchronization. One SQL statement can synchronize multiple data tables and is automatically compatible with the case where there are differences in table structures between the test environment and the online environment. (3) The data in the online environment is quickly and efficiently synchronized to the test environment database, improving the efficiency of business reproduction; saving disk storage space by only synchronizing specified data and alleviating the waste of storage resources caused by full-volume data synchronization. See the following for details.

[0069] The technical solution of the present application will be introduced below through multiple embodiments. It should be noted that these embodiments can be implemented in various different forms and should not be construed as being limited only to the embodiments described herein.

[0070] Embodiment 1

[0071] Figure 1 A flowchart of the exception analysis method according to Embodiment 1 of the present application is schematically shown.

[0072] As Figure 1 shown, the exception analysis method may include steps S100 to S108, where:

[0073] Step S100, in the case of an online function exception, obtain the target SQL statement.

[0074] Step S102, according to the target SQL statement, find the first business data table associated with the exception function from the online environment database, and find the second business data table corresponding to the first business data table from the test environment database.

[0075] Step S104, according to the target SQL statement and the first business data table, obtain the target data.

[0076] Step S106, determine the table structure difference between the first business data table and the second business data table.

[0077] Step S108, according to the table structure difference and the preset rules, synchronize the target data to the second business data table for exception simulation analysis.

[0078] The exception analysis method provided in this embodiment can obtain the target SQL statement first when an exception occurs in the business function in the online environment. By parsing the target SQL statement, find the first business data table associated with the abnormal function from the online environment database and find the second business data table corresponding to the first business data table from the test environment database, and determine the table structure differences between the first business data table and the second business data table. According to the target SQL statement and the first business data table, obtain the target data. Based on the table structure differences and preset rules, synchronize the target data to the second business data table for abnormal simulation analysis in the test environment. It can be seen that when there are differences in the table structures between the online environment and the test environment in the embodiment of the present application, it can automatically be compatible with the target data and add it to the test environment database, which helps to alleviate the problem of synchronization failure, and can simulate business exceptions and perform analysis and processing in the test environment. This synchronization process does not require manual intervention, which can reduce costs and improve efficiency.

[0079] The following will elaborate in detail on each step in steps S100 to S108 and optional other steps in combination with Figure 1 this.

[0080] Step S100 In the case of an abnormal online function, obtain the target SQL statement.

[0081] When a business exception occurs in the online environment (production environment), it is necessary to promptly identify and solve the problem to restore the normal operation state of the business. On the one hand, directly repairing in the online environment is likely to cause new problems or errors, such as service interruption, data loss, etc. To minimize the impact on users and the business, the data in the online environment can be synchronized to the test environment or the local development environment, and then business repair can be carried out in the test environment or the local development environment. On the other hand, business exceptions may involve multiple business scenarios or data interactions. That is, business exceptions are not only related to the data of the current business scenario but may also be affected by the data of other related business scenarios. Therefore, the business data table associated with the business exception function point can be queried through the target SQL statement, that is, obtain the business data related to the business exception. Taking the e-commerce scenario as an example, the business scenarios involved can include: users, products, product marketing activities, product rush purchase activities, new user prices, merchant discounts, discount calculations, order creation, etc. If there is an error in product price calculation, multiple related business data tables can be queried through cross-database table joining using the target SQL statement, such as: the table storing user information (such as: tb_user table), the table storing product information (such as: tb_product table), the table storing product-related activities, the table storing new user information, etc., so that the business data related to the product price calculation error can be obtained more comprehensively.

[0082] In this embodiment, when an abnormality occurs in the online function, the target SQL statement can be used to retrieve the business data tables associated with the abnormal function points for subsequent abnormal simulation analysis.

[0083] Step S102 , according to the target SQL statement, find the first business data table associated with the abnormal function from the online environment database, and find the second business data table corresponding to the first business data table from the test environment database.

[0084] The online environment may include multiple specific databases, such as: product database, user database, activity database, and new user database, etc. Each database may include one or more data tables for storing specific categories of business data. For example, the product database tb_product may include: data table tb_product_1 and data table tb_product_2. To better simulate the real business situation of the online environment, the test environment may be provided with databases and data tables corresponding to the online environment.

[0085] In an alternative embodiment, the first business data table may be one or more data tables associated with the abnormal function in the online environment database. Continuing with the example of incorrect calculation of product prices, the first business data table may be data table tb_product_1 and data table tb_product_2 located in the product database tb_product, or data table tb_user_1 located in the user database tb_user, etc. Correspondingly, the second business data table may be one or more data tables corresponding to the first business data table in the test environment database.

[0086] In this embodiment, through the target SQL statement, the first business data table associated with the abnormal function can be found in the online environment database, and the second business data table corresponding to the first business data table can be found in the test environment database.

[0087] In practical applications, the first business data table and the second business data table can be found in various ways. For example: database management software, command line, API interface, etc. An exemplary solution will be provided below.

[0088] In an alternative embodiment, as Figure 2 shown, step S102 may include:

[0089] Step S200, perform syntax and lexical analysis on the target SQL statement to obtain the target database name and the target data table name.

[0090] Step S202: Search for the first business data table from the online environment database according to the target database name and the target data table name.

[0091] Step S204: Search for the second business data table from the test environment database according to the target database name and the target data table name.

[0092] Exemplarily, lexical analysis and syntax analysis can be performed on the target SQL statement: The target SQL statement is split into different lexical units such as keywords (SELECT, FROM, WHERE, etc.), identifiers (table names, column names), operators (such as =, >, <), and delimiters (commas, semicolons) through tools such as a lexical analyzer. Then, tools such as a syntax analyzer can be used to analyze the combination method between the lexical units to form a syntax analysis tree, which helps to check whether the syntax of the target SQL statement conforms to the SQL syntax specification and reduce unexpected errors. Based on the results of the lexical analysis and syntax analysis of the target SQL statement, the target database name and the target data table name can be obtained. Using the target database name and the target data table name as identifiers, the first business data table and the second business data table can be quickly located and found.

[0093] In this embodiment, by parsing the target SQL statement, the target database name and the target data table name involved in the target SQL statement are extracted, so that the first business data table or the second business data table can be quickly located in the online environment or the test environment, saving the retrieval time and effectively improving the efficiency of anomaly simulation.

[0094] In an alternative embodiment, the anomaly analysis method may further include: matching the target database name and the target data table name with the pre-configured database name and data table name; in the case of successful matching, searching for the first business data table and the second business data table according to the target database name and the target data table name, and obtaining the table structures of the first business data table and the second business data table respectively.

[0095] To ensure that the database and data table to be operated meet the expectations, the target database name and target data table name extracted from the target SQL statement can be matched and verified with the database name and data table name pre-configured inside the program. If the verification fails, the program ends. This can reduce the adverse effects on the system caused by operation errors and ensure the security and correctness of the operation. If the verification passes, a TCP (Transmission Control Protocol) connection to the online environment database can be established, and the first business data table can be searched in the online environment database according to the target database name and target data table name, and the table structure of the first business data table can be obtained. Correspondingly, a TCP connection to the test environment database is established, and the second business data table is searched in the test environment database according to the target database name and target data table name, and the table structure of the second business data table is obtained.

[0096] In this embodiment, the target database name and target data table name are matched and verified to ensure their legality and effectiveness, and reduce the adverse effects caused by misoperations.

[0097] The above embodiment introduces that the target SQL statement can be used to obtain the table structures of the first business data table and the second business data table. In fact, the target SQL statement can also be used to obtain the business data associated with the abnormal function. An exemplary introduction will be given below.

[0098] Step S104 , obtain target data according to the target SQL statement and the first business data table.

[0099] The target data can be the business data of the business scenario associated with the abnormal function and can be used for abnormal simulation analysis. The target SQL statement can also be used to extract the identification information of the target data to be used to locate and obtain the required target data in multiple first business data tables. The identification information can include: primary key value, unique key value, foreign key value, combined field value, index field value, etc. When multiple data tables are involved, the target SQL statement can connect multiple data tables at the same time to obtain the associated business data. For example: the primary key of the data table tb_product_1 can be used as the foreign key of the data table tb_product_2. By connecting the data table tb_product_1 and the data table tb_product_2, the associated data (target data) in the two data tables can be retrieved, and the corresponding identification information can be obtained, which is convenient for obtaining the target data later.

[0100] In this embodiment, the target SQL statement is executed for the online environment database, the first business data table is found and the target data is obtained, that is, the business data associated with the abnormal function is obtained, which can further improve the accuracy of the abnormal simulation; only synchronize the specified data, relieve the waste of storage resources caused by full-volume data synchronization, and save disk storage space.

[0101] There are multiple ways to obtain target data, such as through identification information indexing, full table scanning, aggregation functions, etc. An exemplary solution is provided below.

[0102] In an alternative embodiment, step S104 may include: obtaining the primary key of the first business data table according to the target SQL statement; and obtaining the target data from the online environment database according to the primary key of the first business data table.

[0103] Exemplarily, through the target SQL statement, the primary key value corresponding to the target data in the first business data table can be obtained, and the primary key value can be used to uniquely represent a certain piece of business data in the data table. Based on the primary key value of the target data, the corresponding row data can be obtained from the first business data table as the target data.

[0104] In this embodiment, by extracting the primary key value corresponding to the target data through the target SQL statement, the target data can be accurately and efficiently obtained from the first business data table, thereby further improving the efficiency of data synchronization and exception simulation.

[0105] The above embodiment introduces an exemplary solution for obtaining target data from the online environment database through the target SQL statement. Next, how to insert the target data into the test environment database to achieve data synchronization will be introduced.

[0106] Step S106 , determine the table structure differences between the first business data table and the second business data table.

[0107] In practical applications, developers may make experimental modifications to the table structure of the test environment based on debugging requirements, which will result in differences in the table structure between the test environment and the online environment. Such table structure differences will cause data synchronization failures. To improve the success rate of data synchronization, the table structure differences can be obtained in advance and the data synchronization process can be adaptively adjusted according to the table structure differences.

[0108] According to the table structures of the first business data table and the second business data table obtained in the foregoing embodiment, determine the table structure differences between the first business data table and the second business data table. The table structure differences may include field differences, index differences, etc. Taking field differences as an example, the field differences may include: field type differences, field length differences, field precision differences, field default value differences, etc.

[0109] After determining the table structure differences, the data synchronization solution can be adaptively adjusted, exemplarily:

[0110] Step S108,Synchronize the target data to the second business data table according to the table structure difference and the preset rules for abnormal simulation analysis.

[0111] After determining the table structure difference, the target data can be processed by means of data conversion, assignment, merging, filtering, mapping, type conversion, etc. Synchronize the processed target data to the second business data table for abnormal simulation analysis in the test environment.

[0112] An exemplary solution is provided below.

[0113] In an alternative embodiment, the table structure difference includes field differences. As Figure 3 shown, step S108 may include:

[0114] Step S300, determine the first data synchronization statement and the second data synchronization statement according to the table structure difference and the target data.

[0115] Step S302, synchronize the target data to the second business data table according to the first data synchronization statement and the second data synchronization statement.

[0116] Among them, the first data synchronization statement is used to: delete the corresponding fields in the target data according to the table structure difference; the second data synchronization statement is used to: add corresponding fields to the target data according to the table structure difference, and set the values of the newly added fields to preset values.

[0117] For example, in the test environment, some fields in the second business data table are changed or deleted, and some fields are added, resulting in a table structure difference between the first business data table and the second business data table. According to this table structure difference, the target data extracted from the first business data table is modified to be compatible with the second business data table: fill in the corresponding fields for the target data according to the table structure difference, and assign default values (preset values) to the corresponding fields to make them not empty, reducing errors; remove the fields that need to be filtered in the target data according to the table structure difference. The target data after the above processing can be successfully synchronized to the second business database, alleviating the problem of data synchronization failure.

[0118] In this embodiment, according to the table structure difference and the preset rules, the target data can be flexibly processed to solve the problem of field mismatch. The processed target data can be accurately synchronized to the second business data table, thus providing support for abnormal simulation analysis in the test environment and improving the business reproduction efficiency.

[0119] In an alternative embodiment, when synchronizing the target data to the second business data table, perform abnormal simulation analysis through the test environment database.

[0120] After synchronizing the target data to the second business data table, abnormal simulations, analyses, and repairs can be carried out in the test environment by means of assertions, logging, etc. with the help of the test environment database. This method allows data to be verified in the simulation environment, potential problems to be explored, and its impact on the business process to be evaluated, so as to obtain a business anomaly repair solution. After verifying that the repair solution is effective, it can be deployed and applied to the online environment to ensure the stability and security of the production environment.

[0121] To make this application easier to understand, the following is combined with Figure 4 Provide an exemplary application.

[0122] S11: In the case of abnormal online functions, such as: business anomalies in the commodity price scenario, obtain the SQL statement (target SQL statement) for extracting the primary key of the associated business scenario data table through the data synchronization engine. This is an SQL statement for the commodity price module and may involve multiple data tables.

[0123] S12: The data synchronization engine performs syntax analysis and lexical analysis on the SQL statement, extracts the (target) database name and (target) data table name involved in the SQL statement. It is verified against the database name and data table name configured internally in the program. If the verification fails, the program terminates. After passing the verification, a TCP connection is established with the online environment database, and the table structure of the data table (the first business data table) is retrieved.

[0124] S13: Execute the SQL statement against the online environment database to obtain the query result (primary key value).

[0125] S14: The data synchronization engine obtains the table structure of the test environment database according to the database name and data table name extracted from the SQL statement. Compare the table structures of the online environment and the test environment, and extract the fields that need to be filled or filtered in the test environment for its data tables with respect to the online environment.

[0126] S15: Retrieve the row data (target data) from the online environment database according to the query result of S13.

[0127] S16: For the retrieved row data, assign default values to the fields that need to be filled and remove the fields that need to be filtered, resulting in two data insertion statements.

[0128] S17: Execute the data insertion statements in the test environment database to insert the target data into the corresponding data table (the second business data table), ultimately achieving data synchronization.

[0129] S18: The test environment or the local environment depends on the test data to quickly test by means of assertions, etc., and repair the online business anomalies.

[0130] In this exemplary application: (1) Match relevant business data tables according to business exception function points, obtain a structured query language (SQL) statement (cross-database join queries can be performed when multiple tables are involved), and configure the SQL statement to the background of the data synchronization (online environment - test environment) engine to achieve data synchronization. Subsequently, exception simulation, analysis, and repair can be carried out in the test environment through methods such as assertion and logging. (2) Perform lexical and syntactic analysis on the SQL statement to specify data for synchronization. One SQL statement can synchronize multiple data tables, and automatic compatibility is achieved for cases where there are differences in table structures between the test environment and the online environment. (3) Quickly and efficiently synchronize the data in the online environment to the test environment database, improve the efficiency of business reproduction; save disk storage space by only synchronizing specified data, and alleviate the waste of storage resources caused by full-volume data synchronization.

[0131] Embodiment Two

[0132] Figure 5 A block diagram of an exception analysis device according to Embodiment Two of the present application is schematically shown. The device can be divided into one or more program modules. One or more program modules are stored in a storage medium and executed by one or more processors to complete the embodiments of the present application. The program modules referred to in the embodiments of the present application refer to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. As Figure 5 shown, the device 1000 may include: a first acquisition module 1100, a search module 1200, a second acquisition module 1300, a determination module 1400, and a synchronization module 1500, where:

[0133] The first acquisition module 1100 is configured to obtain a target SQL statement in the case of an online function exception;

[0134] The search module 1200 is configured to search for a first business data table associated with the exception function from the online environment database according to the target SQL statement, and search for a second business data table corresponding to the first business data table from the test environment database;

[0135] The second acquisition module 1300 is configured to obtain target data according to the target SQL statement and the first business data table;

[0136] The determination module is configured to determine the table structure difference between the first business data table and the second business data table;

[0137] The synchronization module is configured to synchronize the target data to the second business data table according to the table structure difference and a preset rule for exception simulation analysis.

[0138] As an alternative embodiment, the lookup module 1200 is further configured to:

[0139] Perform syntax and lexical analysis on the target SQL statement to obtain the target database name and the target data table name;

[0140] Search for the first business data table from the online environment database according to the target database name and the target data table name;

[0141] Search for the second business data table from the test environment database according to the target database name and the target data table name.

[0142] As an alternative embodiment, the exception analysis device 1000 is further configured to:

[0143] Match the target database name and the target data table name with the pre-configured database name and data table name;

[0144] In the case of successful matching, search for the first business data table and the second business data table according to the target database name and the target data table name, and obtain the table structures of the first business data table and the second business data table respectively.

[0145] As an alternative embodiment, the second acquisition module 1300 is further configured to:

[0146] Obtain the primary key of the first business data table according to the target SQL statement;

[0147] Obtain the target data from the online environment database according to the primary key of the first business data table.

[0148] As an alternative embodiment, the table structure difference includes field difference; As an alternative embodiment, the synchronization module 1500 is further configured to:

[0149] Determine a first data synchronization statement and a second data synchronization statement according to the table structure difference and the target data;

[0150] Synchronize the target data to the second business data table according to the first data synchronization statement and the second data synchronization statement;

[0151] Wherein, the first data synchronization statement is used to: delete the corresponding fields in the target data according to the table structure difference; the second data synchronization statement is used to: add corresponding fields to the target data according to the table structure difference, and set the values of the newly added fields to preset values.

[0152] As an alternative embodiment, the first service data table includes: one or more data tables in the online environment database that are associated with the abnormal function;

[0153] The second service data table includes: one or more data tables in the test environment database that correspond to the first service data table.

[0154] As an alternative embodiment, the abnormal analysis device 1000 is further configured to:

[0155] In the case of synchronizing the target data to the second service data table, perform abnormal simulation analysis through the test environment database.

[0156] Embodiment III

[0157] Figure 6 Schematically shows a hardware architecture diagram of a computer device 10000 suitable for implementing the abnormal analysis method according to Embodiment III of the present application. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle-mounted terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server or a server cluster composed of multiple servers). As Figure 6 shown, the computer device 10000 includes, but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them:

[0158] The memory 10010 includes at least one type of computer-readable storage medium. The readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disc, etc. In some embodiments, the memory 10010 may be an internal storage module of the computer device 10000, such as the hard disk or memory of the computer device 10000. In other embodiments, the memory 10010 may also be an external storage device of the computer device 10000, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc. equipped on the computer device 10000. Of course, the memory 10010 may also include both the internal storage module and the external storage device of the computer device 10000. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed on the computer device 10000, such as the program code of the anomaly analysis method. In addition, the memory 10010 can also be used to temporarily store various types of data that have been output or will be output.

[0159] In some embodiments, the processor 10020 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other chip. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.

[0160] The network interface 10030 may include a wireless network interface or a wired network interface, which is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an enterprise intranet (Intranet), the Internet, the Global System of Mobile communication (GSM for short), Wideband Code Division Multiple Access (WCDMA for short), 4G network, 5G network, Bluetooth, Wi-Fi, etc.

[0161] It should be noted that Figure 6 Only the computer device with components 10010 - 10030 is shown, but it should be understood that it is not required to implement all the shown components, and more or fewer components may be alternatively implemented.

[0162] In this embodiment, the anomaly analysis method stored in the memory 10010 may also be divided into one or more program modules and executed by one or more processors (such as the processor 10020) to complete the embodiments of this application.

[0163] Embodiment 4

[0164] The embodiments of this application also provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the anomaly analysis method in the embodiments are implemented.

[0165] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the computer-readable storage medium may be an internal storage unit of the computer device, such as the hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium may also be an external storage device of the computer device, such as the plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc. equipped on the computer device. Of course, the computer-readable storage medium may also include both the internal storage unit and the external storage device of the computer device. In this embodiment, the computer-readable storage medium is generally used to store the operating system and various application software installed on the computer device, such as the program code of the anomaly analysis method in the embodiment. In addition, the computer-readable storage medium may also be used to temporarily store various data that have been output or will be output.

[0166] Obviously, those skilled in the art should understand that the above-mentioned modules or steps of the embodiments of the present application can be implemented by a general computer device. They can be concentrated on a single computer device or distributed on a network composed of multiple computer devices. Optionally, they can be implemented by program codes executable by the computer device. Thus, they can be stored in a storage device and executed by the computer device. And in some cases, the steps shown or described can be executed in a different order than here, or they can be separately made into individual integrated circuit modules, or multiple modules or steps of them can be made into a single integrated circuit module to implement. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0167] It should be noted that the above are only the preferred embodiments of the present application, and do not limit the patent protection scope of the present application. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, shall be similarly included in the patent protection scope of the present application.

Claims

1. An abnormal analysis method, characterized in that, The method includes: When there is an abnormality in the online function, obtaining the target SQL statement; According to the target SQL statement, finding the first business data table associated with the abnormal function from the online environment database, and finding the second business data table corresponding to the first business data table from the test environment database; Obtaining target data according to the target SQL statement and the first business data table; Determining the table structure differences between the first business data table and the second business data table; Synchronizing the target data to the second business data table according to the table structure differences and preset rules for abnormal simulation analysis.

2. The method according to claim 1, wherein The step of finding the first business data table associated with the abnormal function from the online environment database and finding the second business data table corresponding to the first business data table from the test environment database according to the target SQL statement includes: Performing syntax and lexical analysis on the target SQL statement to obtain the target database name and the target data table name; Finding the first business data table from the online environment database according to the target database name and the target data table name; Finding the second business data table from the test environment database according to the target database name and the target data table name.

3. The method according to claim 2, wherein It further includes: Matching the target database name and the target data table name with the pre-configured database name and data table name; When the matching is successful, finding the first business data table and the second business data table according to the target database name and the target data table name, and obtaining the table structures of the first business data table and the second business data table respectively.

4. The method according to any one of claims 1 to 3, characterized in that The step of obtaining target data according to the target SQL statement and the first business data table includes: Obtaining the primary key of the first business data table according to the target SQL statement; Obtaining the target data from the online environment database according to the primary key of the first business data table.

5. The method according to any one of claims 1 to 3, characterized in that, The table structure differences include field differences; the step of synchronizing the target data to the second business data table according to the table structure differences and preset rules includes: Determining a first data synchronization statement and a second data synchronization statement according to the table structure differences and the target data; Synchronizing the target data to the second business data table according to the first data synchronization statement and the second data synchronization statement; Wherein, the first data synchronization statement is used to: delete the corresponding fields in the target data according to the table structure differences; the second data synchronization statement is used to: add corresponding fields to the target data according to the table structure differences, and set the values of the newly added fields to preset values.

6. The method according to any one of claims 1 to 3, characterized in that The first business data table includes: one or more data tables associated with the abnormal function in the online environment database; The second business data table includes: one or more data tables corresponding to the first business data table in the test environment database.

7. The method according to any one of claims 1 to 3, characterized in that, It further includes: In the case of synchronizing the target data to the second service data table, perform anomaly simulation analysis through the test environment database.

8. An anomaly analysis device, characterized in that, The device includes: A first acquisition module, configured to acquire a target SQL statement in the case of an online function anomaly; A search module, configured to search for a first service data table associated with the anomaly function from the online environment database according to the target SQL statement, and search for a second service data table corresponding to the first service data table from the test environment database; A second acquisition module, configured to acquire target data according to the target SQL statement and the first service data table; A determination module, configured to determine the table structure difference between the first service data table and the second service data table; A synchronization module, configured to synchronize the target data to the second service data table according to the table structure difference and a preset rule for anomaly simulation analysis.

9. A computer device, characterized in that, Includes: At least one processor; And A memory communicatively connected to the at least one processor; wherein: The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, Computer instructions are stored in the computer-readable storage medium, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.