A code change risk estimation and review method and device

By generating a code incremental change list and analyzing the behavior description information of the database operation code, and combining the risk weights of multi-dimensional characteristics for risk estimation and auditing, the system performance risk identification problem caused by code changes is solved, the testing cost and change cost are reduced, and the testing cost is improved. The reliability of system performance.

CN111949540BActive Publication Date: 2024-11-12INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010820287.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-14
Publication Date
2024-11-12
Estimated Expiration
2040-08-14

AI Technical Summary

Technical Problem

The existing technology is difficult to identify and solve the system performance risks caused by code changes in a timely manner, resulting in high testing costs and huge changes after problems are discovered.

Method used

By comparing the differences between the latest code and the current code, a list of code incremental changes is generated, the database operation code is parsed into an abstract syntax tree, the risk weight of multi-dimensional features is defined, and risk estimation is reviewed based on the behavior description information and the relationship between the feature , determine whether it passes the review.

Benefits of technology

It realizes timely identification of potential database operation risks during code iteration and continuous integration, reduces R&D costs, and improves the reliability and response efficiency of system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111949540B_ABST
    Figure CN111949540B_ABST
Patent Text Reader

Abstract

The present invention provides a code change risk estimation and review method and device, including: comparing the difference between the latest code obtained and the current code to generate the code incremental change list of the day; generating behavioral description information of the database operation according to the database operation code in the code incremental change list; defining the risk weight of each type of feature dimension in the acquired database multi-dimensional features; and conducting risk estimation and review of the database operation code according to the correspondence between the behavioral description information of the database operation and the database multi-dimensional features. The present application estimates and automatically reviews the database operations in the code changes to prevent the submission and implementation of changes with high performance risks, and because the performance risks introduced by the changes can be discovered within T+1 day, the cost of risk modification is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of database security technology and can be applied to the financial field. Specifically, it relates to a code change risk estimation and review method and device. Background Art

[0002] With the continuous development of software development models, the introduction and use of agile development and continuous integration concepts in the software development process are becoming more and more common for the sake of rapid delivery and rapid iteration. This makes the version iteration cycle shorter and the demand changes more frequent. Correspondingly, the risks introduced by version iteration and demand changes are also increasing. Among them, performance risk is a type of risk with a relatively large impact. Once it occurs, it affects the normal operation of a business scenario or even the entire system. It must be discovered and eliminated as early as possible during the iteration and continuous integration process.

[0003] Among a series of software operations that affect system performance, operations on the database will directly affect the efficiency of the overall operation. In addition, the horizontal expansion of the database is often not as easy as the horizontal expansion of the application side. Therefore, the performance risks caused by database operations (including DML for adding, deleting, modifying and checking and DDL for changing the database structure) have a very important impact on software availability and response efficiency.

[0004] In the traditional software development model, software performance is not considered until the testing phase. Testing consumes a huge amount of manpower (for example, a large number of people need to be organized to conduct performance experience, or complex performance test scripts need to be developed to simulate user concurrent behaviors), and the cost of changes after problems are discovered is also huge. Summary of the invention

[0005] The present application provides a code change risk estimation and review method and device to at least solve the current problem that potential system performance risks caused by code changes cannot be identified in a timely manner.

[0006] According to one aspect of the present application, a code change risk estimation and review method is provided, comprising:

[0007] Compare the differences between the latest code and the current code to generate a list of incremental code changes for the day;

[0008] Generate behavioral description information of database operations based on the database operation codes in the code incremental change list;

[0009] Define the risk weight of each characteristic dimension in the acquired database multi-dimensional characteristics; the multi-dimensional characteristics at least include: the tables contained in the database, the field composition of the data table, the index composition and other structural information and the total amount of data in the data table;

[0010] Perform risk assessment and review on database operation codes based on the correspondence between the behavioral description information of database operations and the multi-dimensional characteristics of the database.

[0011] In one embodiment, generating behavior description information of a database operation according to the database operation code in the code incremental change list includes:

[0012] Extract database operation codes described in SQL statements from the code incremental change list;

[0013] Parse the database operation code described by SQL statements into an abstract syntax tree;

[0014] Traverse the abstract syntax tree to generate behavioral description information of database operations.

[0015] In one embodiment, the risk weight of each characteristic dimension in the acquired database multi-dimensional characteristics is defined, specifically including:

[0016] Based on historical data, corresponding risk weights are configured for each characteristic dimension.

[0017] In one embodiment, risk assessment and review of database operation codes is performed based on the correspondence between the behavior description information of the database operation and the multi-dimensional features of the database, including:

[0018] Match the behavior description information of database operations with the corresponding database feature dimensions;

[0019] Query the risk weight corresponding to the characteristic dimension of the database and assign description information to the behavior;

[0020] The risk value of the database operation code is calculated based on the risk weight of the behavior description information.

[0021] In one embodiment, the code change risk assessment and review method further includes:

[0022] Whether the review is passed is determined based on the relationship between the risk value and the preset threshold.

[0023] According to another aspect of the present application, a code change risk estimation and review device is also provided, comprising:

[0024] A code incremental change list generation unit is used to compare the difference between the latest code obtained and the current code to generate the code incremental change list for the day;

[0025] A behavior description information generating unit, used to generate behavior description information of database operations according to database operation codes in the code incremental change list;

[0026] The risk weight definition unit is used to define the risk weight of each characteristic dimension in the acquired database multi-dimensional characteristics; the multi-dimensional characteristics at least include: the tables contained in the database, the field composition of the data table, the index composition and other structural information and the total amount of data in the data table;

[0027] The risk estimation and review unit is used to perform risk estimation and review on the database operation code according to the correspondence between the behavior description information of the database operation and the multi-dimensional characteristics of the database.

[0028] In one embodiment, the behavior description information generating unit includes:

[0029] A database operation code extraction module is used to extract database operation codes described in SQL statements from the code incremental change list;

[0030] An abstract syntax tree acquisition module is used to parse the database operation code described by SQL statements into an abstract syntax tree;

[0031] The behavior description information acquisition module is used to traverse the abstract syntax tree to generate behavior description information of database operations.

[0032] In one embodiment, the risk weight definition unit specifically includes:

[0033] The weight configuration module is used to configure the corresponding risk weight for each type of feature dimension based on historical data.

[0034] In one embodiment, the risk assessment review unit includes:

[0035] A feature dimension matching module is used to match the behavior description information of database operations with the corresponding database feature dimensions;

[0036] The risk assignment module is used to query the risk weight corresponding to the characteristic dimension of the database and assign the behavior description information;

[0037] The risk value calculation module is used to calculate the risk value of the database operation code according to the risk weight of the behavior description information.

[0038] In one embodiment, the code change risk estimation and review device further includes:

[0039] The review unit is used to determine whether the review is passed based on the size relationship between the risk value and the preset threshold. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0041] Figure 1 This is a structural block diagram of a code change risk estimation and review device provided in this application.

[0042] Figure 2 A flow chart of a code change risk estimation review method provided for this application.

[0043] Figure 3 A behavior description information flow chart for generating database operations in an embodiment of the present application.

[0044] Figure 4 This is an abstract syntax tree flowchart for generating SQL statements in an embodiment of the present application.

[0045] Figure 5 This is a flow chart of the risk assessment and review method in an embodiment of the present application.

[0046] Figure 6 This is a specific implementation of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0048] At present, there are more and more risks introduced by program code version iteration and demand changes. Among them, the performance risk caused to the system is a relatively large risk. Once it occurs, it affects the normal operation of a business scenario or even the entire system. It must be discovered and eliminated as early as possible during the program code iteration and continuous integration process. In order to be able to detect system risks in a timely manner and reduce R&D costs, this application provides a code change risk estimation and audit method, such as Figure 2 As shown, including:

[0049] S201: Compare the differences between the latest code obtained and the current code to generate a code incremental change list for the day.

[0050] In a specific embodiment, the code download unit 1 regularly downloads the latest code from the code library. For each version branch (Branch), the present invention needs to save two code snapshots, corresponding to the previous day's build and the current day's build. For each version branch, based on the two code snapshots saved by the code download unit 1, incremental comparison is performed file by file to find the incremental coding content of the day and form an incremental code change list. The granularity of the incremental code can be to the program file or code snippet.

[0051] S202: Generate behavior description information of the database operation according to the database operation code in the code incremental change list.

[0052] In a specific embodiment, with respect to the incremental code change list output by the change comparison unit 2 , the logic code involving database operations is analyzed, decomposed into the form of SQL statements, and then disassembled into specific operation behaviors.

[0053] S203: Define the risk weight of each characteristic dimension in the acquired database multi-dimensional characteristics; the multi-dimensional characteristics at least include: the tables contained in the database, the field composition of the data table, the index composition and other structural information and the total amount of data in the data table.

[0054] In a specific embodiment, multi-dimensional data features of the database are collected, including but not limited to the field composition, index composition, index data distribution and discrimination of the database, the number of records with different values ​​for each index and each field, and other information. Through dynamic retrieval statistical means, the database is queried and scanned using collection rules. The collection rules are defined in a configuration format, and each rule corresponds to an evaluation dimension. Different weights are configured for the four collection dimensions defined by the data information collection unit. When evaluating performance risks, high-weight dimensions may cause higher risks. The weight configuration information is saved in JSON format.

[0055] S204: Perform risk assessment and review on the database operation code according to the correspondence between the behavior description information of the database operation and the multi-dimensional characteristics of the database.

[0056] In one embodiment, the behavior description information of the database operation is generated according to the database operation code in the code incremental change list, such as Figure 3 As shown, including:

[0057] S301: Extracting database operation codes described in SQL statements from the code incremental change list.

[0058] In a specific embodiment, after a daily code build, through code download and comparison, it is found that three files in the project have been changed on that day. After analysis by the behavior analysis unit 3, a newly added XML file adds a query operation on the USER table of the database in the form of a configuration file. Generally, the configuration file has a mapper node, which contains an id node, that is, a SQL statement.

[0059] S302: Parse the database operation code described in the SQL statement into an abstract syntax tree.

[0060] In a specific embodiment, the SQL statement is lexically and grammatically parsed to generate an abstract syntax tree of the SQL statement, such as Figure 4 As shown, starting from the SELECT node, the abstract syntax tree is traversed using the in-order traversal algorithm to extract information from tree nodes such as SELECT LIST, FROM, and WHERE that describe SQL behaviors, forming a behavior description in JSON format.

[0061] S303: traverse the abstract syntax tree to generate behavior description information of database operations.

[0062] In one embodiment, the risk weight of each characteristic dimension in the acquired database multi-dimensional characteristics is defined, specifically including:

[0063] Based on historical data, corresponding risk weights are configured for each characteristic dimension.

[0064] In a specific embodiment, the present application configures different weights for the four defined collection dimensions of the data information collection unit. When evaluating performance risks, dimensions with high weights may cause higher risks. The weight configuration information is saved in JSON format, for example:

[0065] {"TYPE":"TABLENAME","WEIGHT":[{"USER":"7"},{"T_BRACH_INFO":"10"},

[0066] {"T_INCOME_DETAIL":"80"}]}

[0067] {"TYPE":COLUMNSDISTINCT","WEIGHT":"70"}

[0068] {"TYPE":"COLUMNS","DETAIL":[{"T_TABLENAME_INFO":"USER","WEIGH

[0069] TS”:[{“COLUMN

[0070] NAME":"NAME","WEIGHT":[{"NULL":30000},{"JACK":5}...]},{"COLUMNNAME":"BRANCHID","WEIGHT":[{"000001000":100}...]},{"COLUMN

[0071] NAME":"STATUS","WEIGHT":[{"1":300},{"0":3}]}...]}}

[0072] In one embodiment, risk assessment and review of database operation codes are performed based on the correspondence between the behavior description information of the database operation and the multi-dimensional features of the database, such as Figure 5 As shown, including:

[0073] S501: Matching the behavior description information of the database operation with the corresponding database feature dimension.

[0074] S502: Query the risk weight corresponding to the characteristic dimension of the database and assign the behavior description information.

[0075] S503: Calculate the risk value of the database operation code according to the risk weight of the behavior description information.

[0076] In a specific embodiment, for the operation behavior description deconstructed by the behavior analysis unit 3, the risk value of the program change is calculated according to the statistical information collected by the data information collection unit 4 and the weight configured by the weight configuration unit 5:

[0077] If the operation behavior involves a dimensional feature in the statistical information, the risk estimation unit 6 will include the weight of the dimensional feature in the calculation when calculating the risk value;

[0078] If the operation behavior involves multiple types of dimensional features at the same time, such as querying a table and matching the field value to a specific value, the risk value of the change is the product of the risk weights of the relevant types.

[0079] In particular, if the same behavior feature is hit multiple times, for example, when a conditional query involves multiple field associations, the risk value for this feature is the sum of the risks of each value.

[0080] In combination with the above-mentioned examples of the behavior analysis unit 3, the data information collection unit 4, and the weight configuration unit 5, a specific embodiment of the risk estimation unit 6 is given.

[0081] From the above-mentioned embodiment, it can be known that the code change on that day involves a database operation behavior. The behavior description deconstructed by the behavior analysis unit 3 mainly includes the following (described in text):

[0082] 1. Query the USER table.

[0083] 2. Filter the BRANCHID field and select the value as '000001000'.

[0084] 3. Filter the STATUS field and set the filter value to 1.

[0085] 4. The two filter items BRANCHID and STATUS are in an "and" relationship and need to be met at the same time.

[0086] Based on this, the risk estimation unit 6 calculates the risk value of the change in combination with the weight configured by the weight configuration unit 5 as follows:

[0087] 1. Query the USER table, the weight is 7.

[0088] 2. Filter the records whose BRANCHID field value in the USER table is '000001000', with a weight of 100.

[0089] 3. Filter the records whose STATUS field value in the USER table is 1, with a weight of 300.

[0090] 4. Therefore, the risk value of this change is: 7x(100+300)=2800.

[0091] In one embodiment, the code change risk assessment and review method further includes:

[0092] Whether the review is passed is determined based on the relationship between the risk value and the preset threshold.

[0093] In a specific embodiment, operations with risk values ​​higher than the risk threshold are considered high-risk operations. For incremental changes involving database operations in daily builds, automatic review is completed based on the range of the risk threshold with the aid of the estimation results of the risk estimation unit 6. Code changes higher than the risk threshold are automatically rejected and transferred to the manual review process, and the reviewer is notified by email or SMS; on the contrary, code changes lower than the risk threshold are automatically approved.

[0094] Based on the same inventive concept, the embodiments of the present application also provide a code change risk estimation and auditing device, which can be used to implement the method described in the above embodiments, as described in the following embodiments. Since the principle of solving the problem by the code change risk estimation and auditing device is similar to that of the code change risk estimation and auditing method, the implementation of the code change risk estimation and auditing device can refer to the implementation of the code change risk estimation and auditing method, and the repeated parts will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements the predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.

[0095] This application provides a code change risk estimation and auditing device, such as Figure 1 As shown, it includes a code download unit 1, a change comparison unit 2, a behavior analysis unit 3, a data information collection unit 4, a weight configuration unit 5, a risk estimation unit 6, and an automatic review unit 7. Among them:

[0096] The code download unit 1 cooperates with the daily build of continuous integration to regularly start downloading the latest code from the code base. For each version branch, the present invention needs to save two code snapshots, corresponding to the daily build of the previous day and the daily build of the current day.

[0097] Change comparison unit 2, for each version branch, performs incremental comparison file by file based on the two code snapshots saved by code download unit 1, finds the incremental coding content of the day, and forms an incremental code set. The granularity of the incremental code can be down to the program file or code snippet.

[0098] The behavior analysis unit 3 analyzes the logic of database operations in the incremental code set output by the change comparison unit 2, decomposes it into the form of SQL statements, and disassembles it into specific operation behaviors. It includes a code parsing module 31, a configuration file parsing module 32, an SQL file parsing module 33, an SQL statement analysis module 34, and a behavior description module 35. The behavior analysis unit 3 includes the following modules:

[0099] 1) Code parsing module 31, for the case where database access logic is integrated into the code text, compiles the source code into an abstract syntax tree, then traverses the syntax tree to extract the SQL statements contained in the program logic and program annotations

[0100] 2) Configuration file parsing module 32, for the case where the database access logic is stored separately in the configuration file (for example, the MyBatis framework commonly used in the industry, which puts the database access logic in an XML file for program reference), parses the configuration file and extracts the SQL statements therein

[0101] 3) SQL file parsing module 33, for the case where the database access logic is placed in the form of stored procedures on the database side, parses the definition file of the stored procedure, generates an abstract syntax tree and traverses it to obtain the SQL statements contained in the stored procedure

[0102] 4) SQL statement analysis module 34, for the SQL statement set generated by the aforementioned code parsing module 31, configuration file parsing module 32, and SQL file parsing module 33, parses and generates an abstract syntax tree of the SQL statement

[0103] 5) Behavior description module 35, traverses the program syntax tree generated by SQL statement analysis module 34, and forms a behavior description of the SQL statement, including but not limited to the statement operation type, which tables are involved, which fields are operated, which fields are involved in the conditional predicate, and the specific values ​​of the conditional predicate fields.

[0104] The data information collection unit 4 is used to support the weight estimation and risk identification of data operation behaviors, and collect multi-dimensional data features of the database, including but not limited to the field composition, index composition, index data distribution and discrimination of the database, the number of records with different values ​​for each index and each field, and other information.

[0105] The data information collection unit 4 supports the collection of data from common relational databases in the industry such as ORACLE, MYSQL, DB2, and distributed caches such as SSDB and REDIS. It uses dynamic retrieval statistics and collection rules to conduct query scans on the database. The collection rules are defined in a configuration format, and each rule corresponds to an evaluation dimension.

[0106] For example, after pre-configuring five collection dimensions, including TABLENAME, ROWNUM, COLUMNS, INDEX, and COLUMNS DISTINCT, the aforementioned USER table is analyzed and the following features are collected and saved in JSON format: {“TABLENAME”:”USER”, “ROWNUM”:”24718”, “COLUMNS”:{“ID”:”NUMBER”, “NAME”:”VARCHAR(10)”, “BRANCHID”:”VARCHAR(20)”, “STATUS”:”NUMBER”},”INDEX”:{“PK_USER”:”ID”},”COLUMNS DISTINCT":{"NAME":{"JACK":2,"ALBERT":1,"LUCY":7,"NULL":24708},"BRANCHID":{"00012000":14000,"000001000":10718},"STSTUS":{"0":10,"1":24708}}}

[0107] The weight configuration unit 5 configures different weights for the four collection dimensions defined in the data information collection unit. When evaluating performance risks, dimensions with high weights may cause higher risks. The weight configuration information is saved in JSON format, for example:

[0108] {"TYPE":"TABLENAME","WEIGHT":[{"USER":"7"},{"T_BRACH_INFO":"10"},{"T_INCOME_DETAIL":"80"}]}

[0109] {"TYPE":COLUMNSDISTINCT","WEIGHT":"70"}

[0110] {"TYPE":"COLUMNS","DETAIL":[{"T_TABLENAME_INFO":"USER","WEIGH TS":[{"COLUMN

[0111] NAME":"NAME","WEIGHT":[{"NULL":30000},{"JACK":5}...]},{"COLUMNNAME":"BRANCHID","WEIGHT":[{"000001000":100}...]},{"COLUMN NAME":"STATUS","WEIGHT":[{"1":300},{"0":3}]}...]}}

[0112] The risk estimation unit 6 calculates the risk value of the program change based on the operation behavior description deconstructed by the behavior analysis unit 3, the statistical information collected by the data information collection unit 4, and the weight configured by the weight configuration unit 5:

[0113] If the operation behavior involves a dimensional feature in the statistical information, the risk estimation unit 6 will include the weight of the dimensional feature in the calculation when calculating the risk value;

[0114] If the operation behavior involves multiple types of dimensional features at the same time, such as querying a table and matching the field value to a specific value, the risk value of the change is the product of the risk weights of the relevant types.

[0115] In particular, if the same behavior feature is hit multiple times, for example, when a conditional query involves multiple field associations, the risk value for this feature is the sum of the risks of each value.

[0116] In combination with the above-mentioned examples of the behavior analysis unit 3, the data information collection unit 4, and the weight configuration unit 5, a specific embodiment of the risk estimation unit 6 is given.

[0117] From the above-mentioned embodiment, it can be known that the code change on that day involves a database operation behavior. The behavior description deconstructed by the behavior analysis unit 3 mainly includes the following (described in text):

[0118] 1. Query the USER table;

[0119] 2. Filter the BRANCHID field and select the value as '000001000';

[0120] 3. Filter the STATUS field and set the value to 1;

[0121] 4. The two filter items BRANCHID and STATUS are in an "and" relationship and need to be met at the same time.

[0122] Based on this, the risk estimation unit 6 calculates the risk value of the change in combination with the weight configured by the weight configuration unit 5 as follows:

[0123] 5. Query the USER table, the weight is 7;

[0124] 6. Filter the records whose BRANCHID field value is '000001000' in the USER table, with a weight of 100;

[0125] 7. Filter the records whose STATUS field value is 1 in the USER table, with a weight of 300;

[0126] 8. Therefore, the risk value of this change is: 7x(100+300)=2800;

[0127] The automatic review unit 7 includes a threshold definition module 71 and an automatic review module 72. R&D personnel use the threshold definition module 71 to configure the risk threshold, and operations above the risk threshold are considered high-risk operations. The automatic review module 72 uses the estimation results of the risk estimation unit 6 to complete automatic review based on the risk threshold for incremental changes involving database operations in daily builds. Changes above the risk threshold are automatically rejected and transferred to the manual review process, and the reviewer is notified by email or SMS; on the contrary, changes below the risk threshold are automatically approved and allowed to be produced.

[0128] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0129] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0130] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0131] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

[0132] The embodiments of the present application also provide a specific implementation of an electronic device that can implement all the steps in the method in the above embodiments, see Figure 6 , the electronic device specifically includes the following contents:

[0133] Processor (processor) 901, memory 902, communication interface (Communications Interface) 903, bus 904 and non-volatile memory 905;

[0134] The processor 901, memory 902, and communication interface 903 communicate with each other via the bus 904;

[0135] The processor 901 is used to call the computer program in the memory 902 and the non-volatile memory 905. When the processor executes the computer program, all the steps in the method in the above embodiment are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0136] S201: Compare the differences between the latest code obtained and the current code to generate a code incremental change list for the day.

[0137] S202: Generate behavior description information of the database operation according to the database operation code in the code incremental change list.

[0138] S203: Define the risk weight of each characteristic dimension in the acquired database multi-dimensional characteristics; the multi-dimensional characteristics at least include: the tables contained in the database, the field composition of the data table, the index composition and other structural information and the total amount of data in the data table.

[0139] S204: Perform risk assessment and review on the database operation code according to the correspondence between the behavior description information of the database operation and the multi-dimensional characteristics of the database.

[0140] The embodiments of the present application also provide a computer-readable storage medium capable of implementing all the steps of the method in the above embodiments. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, all the steps of the method in the above embodiments are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0141] S201: Compare the differences between the latest code obtained and the current code to generate a code incremental change list for the day.

[0142] S202: Generate behavior description information of the database operation according to the database operation code in the code incremental change list.

[0143] S203: Define the risk weight of each characteristic dimension in the acquired database multi-dimensional characteristics; the multi-dimensional characteristics at least include: the tables contained in the database, the field composition of the data table, the index composition and other structural information and the total amount of data in the data table.

[0144] S204: Perform risk assessment and review on the database operation code according to the correspondence between the behavior description information of the database operation and the multi-dimensional characteristics of the database.

[0145] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the hardware + program embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. Although the embodiment of this specification provides the method operation steps described in the embodiment or flow chart, more or less operation steps can be included based on conventional or non-creative means. The order of steps listed in the embodiment is only one way of executing the order of many steps, and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiment or the accompanying drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or device including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, product or device. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or device including the elements. For the convenience of description, the above device is described by dividing it into various modules according to its functions. Of course, when implementing the embodiments of this specification, the functions of each module can be implemented in the same one or more software and / or hardware, or the module implementing the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The present invention is described with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiments of the present invention. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the process and / or box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0146] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, the embodiments of this specification may be in the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the embodiments of this specification may be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts refer to the partial description of the method embodiment. In the description of this specification, the description of the reference term "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of this specification.

[0147] In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradicting each other. The above is only an embodiment of the embodiment of this specification and is not intended to limit the embodiment of this specification. For those skilled in the art, the embodiment of this specification may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiment of this specification shall be included in the scope of the claims of the embodiment of this specification.

Claims

1. A code change risk estimation and review method, characterized in that: include: Compare the differences between the latest code and the current code to generate a list of incremental code changes for the day; Generate behavior description information of the database operation according to the database operation code in the code incremental change list, specifically including: Deconstruct the database operation code into the form of SQL statements and then break it down into specific operation behaviors; Matching risk weights for each characteristic dimension in the acquired database multi-dimensional characteristics; the multi-dimensional characteristics at least include: the tables contained in the database, the field composition of the data table, the index composition and other structural information and the total amount of data in the data table; Conduct risk assessment and review of database operation codes based on the correspondence between the behavior description information of the database operation and the multi-dimensional features of the database; The difference between the latest code obtained by comparison and the current code generates a code incremental change list for the day, including: Download the latest code from the code base regularly. For each version branch, save two code snapshots, one corresponding to the previous day's build and the other corresponding to the current day's build. For each version branch, based on the two saved code snapshots, incremental comparison is performed file by file to obtain the incremental coding content of the day and form the incremental code change list of the day. The granularity of the incremental code is program files or code snippets. The generating behavior description information of the database operation according to the database operation code in the code incremental change list includes: Extracting database operation codes described in SQL statements from the code incremental change list; Parsing the database operation code described in the SQL statement into an abstract syntax tree specifically includes: Perform lexical and grammatical analysis on SQL statements to generate an abstract syntax tree for SQL statements; Traversing the abstract syntax tree to generate behavior description information of database operations; The risk estimation and review of the database operation code according to the correspondence between the behavior description information of the database operation and the multi-dimensional features of the database includes: Matching the behavior description information of the database operation with the corresponding database feature dimension; Query the risk weight corresponding to the characteristic dimension of the database and assign description information to the behavior; The risk value of the database operation code is calculated based on the risk weight of the behavior description information.

2. The code change risk estimation and auditing method according to claim 1, characterized in that: The risk weight matching for each feature dimension in the acquired database multi-dimensional features specifically includes: Based on historical data, corresponding risk weights are configured for each characteristic dimension.

3. The code change risk estimation and auditing method according to claim 1, characterized in that: Also includes: Whether the review is passed is determined based on the size relationship between the risk value and the preset threshold.

4. A code change risk estimation and review device, characterized in that: include: A code incremental change list generation unit is used to compare the difference between the latest code obtained and the current code to generate the code incremental change list for the day; A behavior description information generating unit, used to generate behavior description information of database operations according to the database operation code in the code incremental change list, specifically used to deconstruct the database operation code into the form of SQL statements, and disassemble it into specific operation behaviors; A risk weight definition unit is used to match risk weights for each characteristic dimension in the acquired database multi-dimensional characteristics; the multi-dimensional characteristics at least include: structural information such as tables contained in the database, field composition of the data table, index composition, and the total amount of data in the data table; A risk estimation and review unit, configured to perform risk estimation and review on the database operation code according to the correspondence between the behavior description information of the database operation and the multi-dimensional characteristics of the database; The code incremental change list generating unit is specifically used to download the latest code from the code base regularly, and for each version branch, save two code snapshots, which correspond to the previous day's build and the current day's build respectively; for each version branch, based on the two saved code snapshots, perform incremental comparison file by file to obtain the incremental coding content of the current day, and form the code incremental change list of the current day, where the granularity of the incremental code is program files or code snippets; The behavior description information generating unit comprises: A database operation code extraction module, used to extract database operation codes described in SQL statements from the code incremental change list; The abstract syntax tree obtaining module is used to parse the database operation code described in the SQL statement into an abstract syntax tree, specifically including: Perform lexical and grammatical analysis on SQL statements to generate an abstract syntax tree for SQL statements; A behavior description information acquisition module, used for traversing the abstract syntax tree to generate behavior description information of database operations; The risk assessment review unit includes: A feature dimension matching module, used to match the behavior description information of the database operation with the corresponding database feature dimension; The risk assignment module is used to query the risk weight corresponding to the characteristic dimension of the database and assign the behavior description information; The risk value calculation module is used to calculate the risk value of the database operation code according to the risk weight of the behavior description information.

5. The code change risk estimation and auditing device according to claim 4, characterized in that: The risk weight definition unit specifically includes: The weight configuration module is used to configure the corresponding risk weight for each type of feature dimension based on historical data.

6. The code change risk estimation and auditing device according to claim 4, characterized in that: Also includes: The review unit is used to determine whether the review is passed based on the size relationship between the risk value and a preset threshold.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the code change risk estimation and review method described in any one of claims 1 to 3 is implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the code change risk estimation and review method described in any one of claims 1 to 3 is implemented.