Switch configuration data synchronization determination method and device, storage medium and program product
By building the intersection of the switch configuration call chain tree and the code change impact tree, determining the impact of code changes on the switch configuration data, solving the problem of low security in the existing technology of switch configuration data, and achieving a safer and more reliable synchronization process.
Patent Information
- Application Number
- CN202510180891.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-06-10
AI Technical Summary
When synchronizing switch configuration data in the prior art, the synchronization security is low, and it is impossible to effectively identify and verify the switch configuration data that needs to be modified or added.
By building a switch configuration call chain tree based on the switch configuration identifier of the current production version and performing intersection calculations with the code change impact tree, determine whether the code changes have an impact on the switch configuration data, thereby determining the switch configuration data that does not require verification.
Improves the security of switching configuration data synchronization, ensuring that only switching configuration data that does not require verification is synchronized, avoiding synchronizing unverified data in the test environment, thereby improving the security and reliability of the synchronization process.
Smart Images

Figure CN120123233A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a method, device, storage medium, and program product for synchronously determining switch configuration data. Background Art
[0002] When performing software development and testing, there are usually two versions of software, namely the production version and the test version. After the development of the production version is completed, it is necessary to deploy the production version from the production environment to the test environment, that is, to determine the newly deployed production version in the test environment as the latest test version. At the same time, it is necessary to synchronously deploy the switch configuration data in the production environment corresponding to the production version to the test environment to complete the testing of the software.
[0003] In the prior art, the synchronous deployment of switch configuration data is achieved by full synchronization or incremental synchronization, that is, all switch configuration data is determined from the database and / or configuration center in the production environment for full synchronization, or based on the comparison of the synchronization records of the switch configuration data last time, the currently unsynchronized switch configuration data is determined for incremental synchronization.
[0004] However, the solution in the prior art has the problem of low synchronization security when synchronizing switch configuration data. Summary of the Invention
[0005] Embodiments of this application provide a method, device, storage medium, and program product for synchronously determining switch configuration data to solve the problem of low synchronization security in the solution of the prior art when synchronizing switch configuration data.
[0006] In a first aspect, embodiments of this application provide a method for synchronously determining switch configuration data, including:
[0007] According to the switch configuration identifier of the current production version, obtain a switch configuration call chain tree, where the switch configuration identifier is used to indicate the switch configuration data called by the current production version, and the switch configuration call chain tree is used to indicate the call relationship between at least two call objects corresponding to the switch configuration data; according to the current production version and the current test version, obtain a code change impact tree, where the code change impact tree is used to indicate the target call object corresponding to the code that has changed based on the current production version and the current test version, and the current test version is at least the previous production version of the current production version; according to the switch configuration call chain tree and the code change impact tree, determine a target switch configuration identifier, where the target switch configuration identifier is used to indicate the switch configuration data that does not need to be verified and is synchronized from the production environment to the test environment, the production environment is the operating environment of the production version, and the test environment is the operating environment of the test version.
[0008] In a possible implementation, obtaining the switch configuration call chain tree according to the switch configuration identifier of the current production version includes: obtaining object call information according to the switch configuration identifier, where the object call information is used to indicate the call object that needs to be called when the current production version calls the switch configuration data; and obtaining the switch configuration call chain tree according to the object call information.
[0009] In a possible implementation, obtaining the code change impact tree according to the current production version and the current test version includes: obtaining current production code data according to the current production version, where the current production code data represents the code content of the current production version; obtaining current test code data according to the current test version, where the current test code data represents the code content of the current test version; and obtaining the code change impact tree according to the current production code data and the current test code data.
[0010] In a possible implementation, obtaining the code change impact tree according to the current production code data and the current test code data includes: obtaining a production version file identifier according to the current production version, where the production version file identifier is used to indicate the target program file to be called when the current production version runs; obtaining file feature information according to the production version file identifier, where the file feature information represents the classes, interfaces, methods, and dependencies declared by the target program file; obtaining target changed code data according to the current production code data and the current test code data, where the target changed code data is used to indicate the code content added, and / or deleted, and / or modified in the current production code data compared with the current test code data; and obtaining the code change impact tree according to the target changed code data and the file feature information.
[0011] In a possible implementation manner, obtaining the target changed code data according to the current production code data and the current test code data includes: inputting the user description information and the current production code data into a pre-trained large language model to determine at least one segment of production code data and the remaining production code data, where the user description information represents the changed features described by the user for the current production code data compared with the current test code data, and the segment production code data is used to indicate the code segments in the current production code data determined based on the changed features; obtaining first target changed code data according to the segment production code data and the current test code data; and / or obtaining second target changed code data according to the remaining production code data and the current test code data; and obtaining the target changed code data according to the first target changed code data and / or the second target changed code data.
[0012] In a possible implementation manner, obtaining the first target changed code data according to the segment production code data and the current test code data includes: obtaining a code segment identifier according to the segment production code data; determining segment test code data according to the code segment identifier and the current test code data; and obtaining the first target changed code data according to the segment production code data and the segment test code data.
[0013] In a second aspect, an embodiment of the present application provides a switch configuration data synchronization determination device, including:
[0014] A first processing module, configured to obtain a switch configuration call chain tree according to the switch configuration identifier of the current production version, where the switch configuration identifier is used to indicate the switch configuration data called by the current production version, and the switch configuration call chain tree is used to indicate the call relationship between at least two call objects corresponding to the switch configuration data;
[0015] A second processing module, configured to obtain a code change impact tree according to the current production version and the current test version, where the code change impact tree is used to indicate the target call object corresponding to the code that has changed determined based on the current production version and the current test version, and the current test version is at least the previous production version of the current production version;
[0016] A determination module, configured to determine a target switch configuration identifier according to the switch configuration call chain tree and the code change impact tree, where the target switch configuration identifier is used to indicate the switch configuration data that does not need to be verified and is synchronized from the production environment to the test environment, the production environment is the operating environment of the production version, and the test environment is the operating environment of the test version.
[0017] In a possible implementation manner, when obtaining the switch configuration call chain tree according to the switch configuration identifier of the current production version, the first processing module is specifically configured to: obtain object call information according to the switch configuration identifier, where the object call information is used to indicate the call objects that need to be called correspondingly when the current production version calls the switch configuration data; and obtain the switch configuration call chain tree according to the object call information.
[0018] In a possible implementation manner, when obtaining the code change impact tree according to the current production version and the current test version, the second processing module is specifically configured to: obtain current production code data according to the current production version, where the current production code data represents the code content of the current production version; obtain current test code data according to the current test version, where the current test code data represents the code content of the current test version; and obtain the code change impact tree according to the current production code data and the current test code data.
[0019] In a possible implementation manner, when obtaining the code change impact tree according to the current production code data and the current test code data, the second processing module is specifically configured to: obtain a production version file identifier according to the current production version, where the production version file identifier is used to indicate the target program file to be called when the current production version runs; obtain file feature information according to the production version file identifier, where the file feature information represents the classes, interfaces, methods, and dependency relationships declared by the target program file; obtain target change code data according to the current production code data and the current test code data, where the target change code data is used to indicate the code content added, and / or deleted, and / or modified in the current production code data compared with the current test code data; and obtain the code change impact tree according to the target change code data and the file feature information.
[0020] In a possible implementation, when obtaining the target change code data according to the current production code data and the current test code data, the second processing module is specifically configured to: input the user description information and the current production code data into a pre-trained large language model to determine at least one segment of production code data and the remaining production code data, where the user description information represents the change features described by the user for the current production code data compared to the current test code data, and the segment production code data is used to indicate the code segments in the current production code data determined based on the change features; obtain first target change code data according to the segment production code data and the current test code data; and / or obtain second target change code data according to the remaining production code data and the current test code data; and obtain the target change code data according to the first target change code data and / or the second target change code data.
[0021] In a possible implementation, when obtaining the first target change code data according to the segment production code data and the current test code data, the second processing module is specifically configured to: obtain a code segment identifier according to the segment production code data; determine segment test code data according to the code segment identifier and the current test code data; and obtain the first target change code data according to the segment production code data and the segment test code data.
[0022] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;
[0023] The memory stores computer-executable instructions;
[0024] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.
[0025] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, they are used to implement the above first aspect and / or various possible implementations of the first aspect.
[0026] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the above first aspect and / or various possible implementations of the first aspect.
[0027] The method, device, storage medium, and program product for determining switch configuration data synchronization provided by the embodiments of the present application obtain a switch configuration call chain tree according to the switch configuration identifier of the current production version, where the switch configuration identifier is used to indicate the switch configuration data called by the current production version, and the switch configuration call chain tree is used to indicate the call relationship between at least two call objects corresponding to the switch configuration data; obtain a code change impact tree according to the current production version and the current test version, where the code change impact tree is used to indicate the target call object corresponding to the code that has changed based on the current production version and the current test version, and the current test version is at least the previous production version of the current production version; determine a target switch configuration identifier according to the switch configuration call chain tree and the code change impact tree, where the target switch configuration identifier is used to indicate the switch configuration data that does not need to be verified and is synchronized from the production environment to the test environment, the production environment is the operating environment of the production version, and the test environment is the operating environment of the test version. On the basis of constructing a switch configuration call chain tree for the current production version, by comparing the code of the current production version and the current test version, a corresponding code change impact tree is obtained, and then by calculating the intersection of the switch configuration call chain tree and the code change impact tree to determine whether the code change affects the switch configuration data. If there is an intersection, it indicates that the code change affects the switch configuration data, so the corresponding switch configuration data needs to be modified and / or verified before it can be synchronously deployed to the test environment. If it is an empty set, it indicates that the code change does not affect the switch configuration data, so the corresponding switch configuration data does not need to be verified, and then the corresponding switch configuration identifier is determined as the target switch configuration identifier, and then the corresponding switch configuration data that does not need to be verified is synchronized from the production environment to the test environment, solving the problem of low synchronization security in the existing technology solutions when synchronizing switch configuration data. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present application and used together with the specification to explain the principles of the present application.
[0029] Figure 1 It is a schematic diagram of the scenario of the method for determining switch configuration data synchronization provided by the present application;
[0030] Figure 2 It is a flowchart of the method for determining switch configuration data synchronization provided by an embodiment of the present application;
[0031] Figure 3 is Figure 2 a schematic diagram of the specific implementation steps of step S101 in the shown embodiment;
[0032] Figure 4 Structural schematic diagram of the switch configuration call chain tree provided by an embodiment of the present application;
[0033] Figure 5 Schematic diagram of determining the code change impact tree based on the change of the call relationship provided by an embodiment of the present application;
[0034] Figure 6 Schematic diagram of determining the target switch configuration identifier based on the node set provided by an embodiment of the present application;
[0035] Figure 7 Flowchart of the method for determining switch configuration data synchronization provided by another embodiment of the present application;
[0036] Figure 8 is Figure 7 Schematic diagram of the specific implementation steps of step S204 in the shown embodiment;
[0037] Figure 9 is Figure 8 Schematic diagram of the specific implementation steps of step S2044 in the shown embodiment;
[0038] Figure 10 Structural schematic diagram of the switch configuration data synchronization determination device provided by an embodiment of the present application;
[0039] Figure 11 Structural schematic diagram of the electronic device provided by the present application.
[0040] Through the above-mentioned drawings, the specific embodiments of the present application have been shown, and there will be more detailed descriptions hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. Detailed Description of the Embodiments
[0041] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of the devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0042] In the technical solution of the present application, the collection, storage, use, processing, transmission, provision, and disclosure of the user's personal information and data involved all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.
[0043] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.
[0044] The application scenarios of the embodiments of this application will be explained below:
[0045] Figure 1 It is a schematic diagram of the scenario for the method of determining switch configuration data synchronization provided by this application. As Figure 1 shown, the specific application scenario of this application is the scenario of determining the switch configuration data that can be synchronized when testing the production version of software. The execution subject of the method provided by the embodiments of this application can be an electronic control unit, a terminal device, or a server. After the production version of the software is developed, it is necessary to deploy the current production version from the production environment to the test environment. Since there is at least a test version corresponding to the previous production version of the current production version in the test environment, when deploying the current production version to the test environment, it is necessary to synchronously deploy the switch configuration data corresponding to the current production version to the test environment to test the current production version in the test environment.
[0046] In the prior art, the synchronous deployment of switch configuration data is achieved through full synchronization or incremental synchronization, that is, determining all the switch configuration data from the database and / or configuration center of the production environment for full synchronization, or determining the currently unsynchronized switch configuration data for incremental synchronization based on comparing the synchronization record of the previous switch configuration data. Combining the above scenarios, in the prior art, when synchronizing switch configuration data through full synchronization or incremental synchronization, since new, modified, and unchanged switch configuration data cannot be identified, unvalidated new or modified switch configuration data may be synchronized in the test environment, thus resulting in the problem of low synchronization security when synchronizing switch configuration data.
[0047] The technical solutions of this application and how the technical solutions of this application solve the above technical problems will be described in detail below with specific embodiments. These specific embodiments below can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0048] Figure 2 It is a flowchart of the method for determining switch configuration data synchronization provided by an embodiment of this application. As Figure 2As shown in the figure, the execution subject of the switch configuration data synchronization determination method provided in this embodiment can be an electronic control unit, a terminal device, or a server. Exemplarily, in this embodiment, the electronic control unit is used as the execution subject of the method in this embodiment for description. The switch configuration data synchronization determination method provided in this embodiment includes the following steps:
[0049] Step S101: Obtain a switch configuration call chain tree according to the switch configuration identifier of the current production version. The switch configuration identifier is used to indicate the switch configuration data called by the current production version, and the switch configuration call chain tree is used to indicate the call relationship between at least two call objects corresponding to the switch configuration data.
[0050] Exemplarily, the switch configuration identifier is used to indicate the switch configuration data called by the current production version, that is, the name of the switch configuration data called by the current generated version can be used as the identifier of the corresponding switch configuration data, that is, the switch configuration identifier; the switch configuration call chain tree is used to indicate the call relationship between at least two call objects corresponding to the switch configuration data, where the call objects include declared classes, methods, and interfaces; furthermore, the electronic control unit determines the corresponding switch configuration identifier according to the switch configuration data called by the current production version, and further traverses all Java files corresponding to the current production version according to the switch configuration identifier, that is, determines the call relationship corresponding to the switch configuration data; furthermore, starting from the class or method declared by the switch configuration data, tracing back the call relationship corresponding to the switch configuration data in reverse, the call relationship between at least two call objects corresponding to the switch configuration data can be obtained, that is, the switch configuration call chain tree can be obtained.
[0051] In a possible implementation manner, Figure 3 For Figure 2 The schematic diagram of the specific implementation steps of step S101 in the shown embodiment is as follows. As Figure 3 shown, the specific implementation steps of step S101 include:
[0052] Step S1011: Obtain object call information according to the switch configuration identifier. The object call information is used to indicate the call objects that need to be called when the current production version calls the switch configuration data.
[0053] Step S1012: Obtain a switch configuration call chain tree according to the object call information.
[0054] Exemplarily, the object call information is used to indicate the call objects that need to be called when the current production version calls the switch configuration data; by traversing all Java files corresponding to the current production version through the switch configuration identifier, that is, determining the call objects that need to be called corresponding to the switch configuration data, and then tracing back the corresponding call relationship for the call objects in reverse, the switch configuration call chain tree can be obtained. Specifically, for example,Figure 4 This is a schematic structural diagram of the switch configuration call chain tree provided by the embodiments of the present application. As Figure 4 shown, starting from the FeatureX.activate method: First, based on the value of Config.enableFeatureX, the FeatureX.activate method is called, that is, FeatureX.activate(Config.enableFeatureX); then, through reverse tracing, the calling object that calls FeatureX.activate is determined, that is, it is determined that the calling object of FeatureX.activate is FeatureManager.initializeFeatures(); then, in the FeatureManager.initializeFeatures method, that is, it is determined whether to call FeatureX.activate according to the value of Config.enableFeatureX, and then, through reverse tracing, the calling object that calls FeatureManager.initializeFeatures is determined, that is, it is determined that the calling object of FeatureManager.initializeFeatures is Main.startApplication(); then, in the Main.startApplication method, first, Config.enableFeatureX is referenced for a certain check, and then FeatureManager.initializeFeatures is called; therefore, through reverse tracing, the switch configuration call chain tree of the switch configuration data Config.enableFeatureX is finally obtained.
[0055] Step S102: Obtain a code change impact tree according to the current production version and the current test version. The code change impact tree is used to indicate the target calling object corresponding to the code with changes determined based on the current production version and the current test version. The current test version is at least the previous production version of the current production version.
[0056] Exemplarily, the code change impact tree is used to indicate the target calling object corresponding to the code with changes determined based on the current production version and the current test version. The current test version is at least the previous production version of the current production version, where the current test version corresponds to Figure 1The test version corresponding to at least the previous production version of the current production version in the illustrated embodiment. Further, by comparing the current production version and the current test version, the changed code is determined. Then, based on the changed code, the called object with changes is determined, that is, the target called object is determined. Thus, the corresponding changed call relationship is obtained. Further, the corresponding code change impact tree is determined through the changed call relationship. Specifically, for example, Figure 5 is a schematic diagram of determining a code change impact tree based on a changed call relationship provided by an embodiment of the present application. As Figure 5 shown, by comparing the codes of the current production version and the current test version, the changed code is obtained. Then, according to the changed code, the call relationship rela_1 in the current production version is determined correspondingly, and according to the changed code, the call relationship rela_2 in the current test version is determined correspondingly. For example, the call relationship rela_1 is that D_1 is called by C_1, C_1 is called by B_1, B_1 is called by A_1, and A_1 is called by M_1. The call relationship rela_2 is that D_2 is called by C_2, C_2 is called by F_1, F_1 is called by A_1, and A_1 is called by M_1. Therefore, by comparing the call relationship rela_1 corresponding to the current production version and the call relationship rela_2 corresponding to the current test version, the code change impact tree is obtained, that is, the code change impact tree is that D_1 is called by C_1, C_1 is called by B_1, and B_1 is called by A_1.
[0057] Step S103, according to the switch configuration call chain tree and the code change impact tree, determine the target switch configuration identifier, which is used to indicate the switch configuration data that does not need to be verified and is synchronized from the production environment to the test environment. The production environment is the running environment of the production version, and the test environment is the running environment of the test version.
[0058] Exemplarily, the production environment is the running environment of the production version, and the test environment is the running environment of the test version. The target switch configuration identifier is used to indicate the switch configuration data that does not need to be verified when synchronized from the production environment to the test environment. That is, the switch configuration data corresponding to the target switch configuration identifier is the switch configuration data that does not need to be modified, which corresponds to the unchanged switch configuration data in the prior art. Further, by comparing the class nodes, interface nodes, and method nodes declared in the switch configuration call chain tree and the code change impact tree, if there is an intersection, it indicates that at least one node exists in both the switch configuration call chain tree and the code change impact tree. If there is no intersection, it indicates that the nodes corresponding to the code change impact tree do not exist in the switch configuration call chain tree, that is, the changed code does not affect the call relationship of the relevant switch configuration data. Further, by comparing each code change impact tree with all the switch configuration call chain trees respectively, a full set of intersections or an empty set (no intersection) can be obtained. Then, according to the existence or non-existence of the intersection, the corresponding target switch configuration identifier is determined, that is, the switch configuration data that does not need to be verified when synchronized from the production environment to the test environment is determined.
[0059] In a possible implementation manner, Figure 6 is a schematic diagram for determining the target switch configuration identifier based on a node set provided by an embodiment of the present application, as Figure 6As shown, according to the switch configuration identifier label_1, the switch configuration call chain tree T_1 is determined. The switch configuration call chain tree T_1 is A - B - C - D. According to the switch configuration identifier label_2, the switch configuration call chain tree T_2 is determined. The switch configuration call chain tree T_2 is E - G - C - M. According to the switch configuration identifier label_3, the switch configuration call chain tree T_3 is determined. The switch configuration call chain tree T_3 is N - S - R - Y. The code change impact tree T_0 is T - B - C - Q. The intersection calculations are respectively performed on the code change impact tree T_0 and each switch configuration call chain tree. Then, the intersection inters_1 (B, C) of the code change impact tree T_0 and the switch configuration call chain tree T_1, the intersection inters_2 (C) of the code change impact tree T_0 and the switch configuration call chain tree T_2, and the intersection inters_3 of the code change impact tree T_0 and the switch configuration call chain tree T_3 are obtained. The intersection inters_3 is an empty set, that is, there is no intersection between the code change impact tree T_0 and the switch configuration call chain tree T_3. Therefore, the switch configuration identifier label_3 corresponding to the switch configuration call chain tree T_3 is determined as the target switch configuration identifier, that is, the switch configuration data data_3 corresponding to the switch configuration identifier label_3 is the switch configuration data without changes, which means the switch configuration data data_3 does not need to be verified. Therefore, the switch configuration data data_3 can be synchronized from the production environment to the switch configuration data in the test environment. Correspondingly, the switch configuration identifier label_1 corresponding to the switch configuration call chain tree T_1 and the switch configuration identifier label_2 corresponding to the switch configuration call chain tree T_2 are non - target switch configuration identifiers. Therefore, the switch configuration data data_1 corresponding to the switch configuration identifier label_1 and the switch configuration data data_2 corresponding to the switch configuration identifier label_2 need to be modified and / or verified before being synchronously deployed in the test environment.
[0060] In this embodiment, a switch configuration call chain tree is obtained according to the switch configuration identifier of the current production version. The switch configuration identifier is used to indicate the switch configuration data called by the current production version, and the switch configuration call chain tree is used to indicate the call relationship between at least two call objects corresponding to the switch configuration data. A code change impact tree is obtained according to the current production version and the current test version. The code change impact tree is used to indicate the target call object corresponding to the code with changes determined based on the current production version and the current test version. The current test version is at least the previous production version of the current production version. According to the switch configuration call chain tree and the code change impact tree, a target switch configuration identifier is determined. The target switch configuration identifier is used to indicate the switch configuration data that does not need to be verified and is synchronized from the production environment to the test environment. The production environment is the operating environment of the production version, and the test environment is the operating environment of the test version. Based on constructing the switch configuration call chain tree for the current production version, by comparing the codes of the current production version and the current test version, the corresponding code change impact tree is obtained. Then, by performing an intersection calculation on the switch configuration call chain tree and the code change impact tree, it is determined whether the code change affects the switch configuration data. If there is an intersection, it indicates that the code change affects the switch configuration data. Therefore, the corresponding switch configuration data needs to be modified and / or verified before it can be synchronously deployed to the test environment. If it is an empty set, it indicates that the code change does not affect the switch configuration data. Therefore, the corresponding switch configuration data does not need to be verified. Then, the corresponding switch configuration identifier is determined as the target switch configuration identifier. Then, according to the target switch configuration identifier, the corresponding switch configuration data that does not need to be verified is synchronized from the production environment to the test environment, solving the problem of low synchronization security in the existing technology solution when synchronizing switch configuration data.
[0061] Figure 7 The flowchart of the switch configuration data synchronization determination method provided by another embodiment of this application is as follows Figure 7 As shown, the switch configuration data synchronization determination method provided in this embodiment is based on Figure 2 the switch configuration data synchronization determination method provided in the embodiment shown, and step S102 is further refined. Then, the switch configuration data synchronization determination method provided in this embodiment includes the following steps:
[0062] Step S201: Obtain a switch configuration call chain tree according to the switch configuration identifier of the current production version. The switch configuration identifier is used to indicate the switch configuration data called by the current production version, and the switch configuration call chain tree is used to indicate the call relationship between at least two call objects corresponding to the switch configuration data.
[0063] Step S202: Obtain the current production code data according to the current production version. The current production code data represents the code content of the current production version.
[0064] Step S203: Obtain the current test code data according to the current test version. The current test code data represents the code content of the current test version.
[0065] Step S204: Obtain a code change impact tree according to the current production code data and the current test code data.
[0066] Exemplarily, the current production code data is used to indicate the code content of the current production version, and the current test code data is used to indicate the code content of the current test version. That is, according to the current production version, obtain the code content corresponding to the current production version, and according to the current test version, obtain the code content of the current test version. Then, by comparing the code content corresponding to the current production version with the code content of the current test version, the changed code can be obtained. Furthermore, based on the changed code, the corresponding code change impact tree can be determined.
[0067] In a possible implementation manner, Figure 8 is Figure 7 a schematic diagram of the specific implementation steps of step S204 in the illustrated embodiment. As Figure 8 shown, the specific implementation steps of step S204 include:
[0068] Step S2041: Obtain a production version file identifier according to the current production version. The production version file identifier is used to indicate the target program file to be called when the current production version runs.
[0069] Step S2042: Obtain file feature information according to the production version file identifier. The file feature information represents the classes, interfaces, methods, and dependency relationships declared by the target program file.
[0070] Exemplarily, the production version file identifier is used to indicate the target program file to be called when the current production version runs, and the file feature information represents the classes, interfaces, methods, and dependency relationships of the target program file. That is, according to the target program file to be called when the current production version runs, determine the corresponding file identifier, that is, obtain the production version file identifier. Furthermore, since different target program files correspond to different classes, interfaces, methods, and dependency relationships declared by them, the corresponding target program file can be determined through the production version file identifier, and then the classes, interfaces, methods, and dependency relationships declared by it can be determined, that is, the file feature information is obtained.
[0071] Step S2043: Obtain target changed code data according to the current production code data and the current test code data. The target changed code data is used to indicate the code content added, and / or deleted, and / or modified in the current production code data compared with the current test code data.
[0072] Step S2044: Obtain a code change impact tree based on the target change code data and file feature information.
[0073] Exemplarily, the target change code data is used to indicate the code content added, and / or deleted, and / or modified in the current production code data compared to the current test code data. That is, by comparing the current production code data and the current test code data, the code content added, and / or deleted, and / or modified in the current production code data is determined, thus obtaining the target change code data. Furthermore, based on the target change code data, the calling objects that have changed are determined. Further still, based on the calling objects that have changed, the classes, interfaces, methods, and dependencies corresponding to the file feature information they affect are determined, and an impact path chain is constructed from the data access layer to the control layer, thus obtaining the code change impact tree.
[0074] Further still, Figure 9 For Figure 8 a schematic diagram of the specific implementation steps of step S2044 in the illustrated embodiment, as Figure 9 shown, the specific implementation steps of step S2044 include:
[0075] Step S20441: Input the user description information and the current production code data into a pre-trained large language model to determine at least one segment of production code data and the remaining production code data. The user description information represents the change characteristics described by the user for the current production code data compared to the current test code data. The segment production code data is used to indicate the code segments in the current production code data determined based on the change characteristics.
[0076] Step S20442: Obtain the first target change code data based on the segment production code data and the current test code data; and / or, obtain the second target change code data based on the remaining production code data and the current test code data.
[0077] Step S20443: Obtain the target change code data based on the first target change code data and / or the second target change code data.
[0078] Exemplarily, the user description information is used to indicate the change features described by the user for the current production code data compared to the current test code data. The fragment production code data is used to indicate the code fragments in the current production code data determined based on the change features. That is, compared to the current test code data, the corresponding description text, i.e., the user description information, is determined through the change features described by the user for the current production version. The pre-trained large language model parses and splits the current production code data according to the user description information, determines at least one segment of fragment production code data corresponding to the change features, and determines the code fragments not determined as fragment production code data as the remaining production code data. Furthermore, by comparing the fragment production code data with the current test code data, the first target changed code data is obtained, and / or by comparing the remaining production code data with the current test code data, the second target changed code data is obtained. Then, based on the first target changed code data and / or the second target changed code data, the target changed code data can be obtained. It can be understood that the first comparison process of comparing the fragment production code data with the current test code data and the second comparison process of comparing the remaining production code data with the current test code data can be executed asynchronously or synchronously.
[0079] In the steps of this embodiment, the pre-trained large language model is used to split the current production code data, and the obtained fragment production code data and the remaining production code data are respectively compared with the current test code data, and then the target changed code data is obtained. The above first comparison process and second comparison process can be completed asynchronously (or synchronously) in a multi-threaded or multi-process manner, which improves the comparison efficiency of the code data while ensuring the comparison accuracy.
[0080] In a possible implementation, the specific implementation of the above first comparison process further includes: obtaining a code segment identifier according to the segment production code data; determining segment test code data according to the code segment identifier and the current test code data; and obtaining first target changed code data according to the segment production code data and the segment test code data. Specifically, for example, according to the segment production code data C_data_1, the corresponding code segment identifier is determined to be code_1, and according to the segment production code data C_data_2, the corresponding code segment identifier is determined to be code_2; then, according to the code segment identifier code_1, the corresponding segment test code data T_data_1 is determined from the current test code data, and according to the code segment identifier code_2, the corresponding segment test code data T_data_2 is determined from the current test code data; then, the segment production code data C_data_1 and the segment test code data T_data_1, and the segment production code data C_data_2 and the segment test code data T_data_2 are respectively compared, so as to obtain the first target changed code data B_data_1 corresponding to the segment production code data C_data_1 and the first target changed code data B_data_2 corresponding to the segment production code data C_data_2, that is, the first target changed code data corresponding to the segment production code data is obtained according to B_data_1 and B_data_2, which means that the comparison efficiency of code data comparison is improved in the steps of this embodiment. It can be understood that the second comparison process can also adopt the above-mentioned method of determining segment test code data based on the code segment identifier to obtain second target changed code data, and its implementation is the same, which will not be elaborated here.
[0081] Step S205: Determine a target switch configuration identifier according to the switch configuration call chain tree and the code change impact tree. The target switch configuration identifier is used to indicate the switch configuration data that does not need to be verified and is synchronized from the production environment to the test environment. The production environment is the operating environment of the production version, and the test environment is the operating environment of the test version.
[0082] In this embodiment, the implementation manners of step S201 and step S205 are the same as those of Figure 2 step S101 and step S103 in the embodiments shown in this application, and will not be elaborated one by one here.
[0083] Figure 10 It is a schematic structural diagram of a switch configuration data synchronization determination device provided by an embodiment of this application. As Figure 10 shown, the switch configuration data synchronization determination device 3 provided in this embodiment includes:
[0084] The first processing module 31 is configured to obtain a switch configuration call chain tree according to the switch configuration identifier of the current production version. The switch configuration identifier is used to indicate the switch configuration data called by the current production version. The switch configuration call chain tree is used to indicate the call relationship between at least two call objects corresponding to the switch configuration data.
[0085] The second processing module 32 is configured to obtain a code change impact tree according to the current production version and the current test version. The code change impact tree is used to indicate the target call object corresponding to the code that has changed based on the current production version and the current test version. The current test version is at least the previous production version of the current production version.
[0086] The determination module 33 is configured to determine a target switch configuration identifier according to the switch configuration call chain tree and the code change impact tree. The target switch configuration identifier is used to indicate the switch configuration data that does not need to be verified and is synchronized from the production environment to the test environment. The production environment is the operating environment of the production version, and the test environment is the operating environment of the test version.
[0087] In a possible implementation manner, when obtaining the switch configuration call chain tree according to the switch configuration identifier of the current production version, the first processing module 31 is specifically configured to: obtain object call information according to the switch configuration identifier. The object call information is used to indicate the call objects that need to be called correspondingly when the current production version calls the switch configuration data; obtain the switch configuration call chain tree according to the object call information.
[0088] In a possible implementation manner, when obtaining the code change impact tree according to the current production version and the current test version, the second processing module 32 is specifically configured to: obtain the current production code data according to the current production version. The current production code data represents the code content of the current production version; obtain the current test code data according to the current test version. The current test code data represents the code content of the current test version; obtain the code change impact tree according to the current production code data and the current test code data.
[0089] In a possible implementation manner, when the second processing module 32 obtains the code change impact tree according to the current production code data and the current test code data, it specifically is used for: obtaining a production version file identifier according to the current production version, where the production version file identifier is used to indicate the target program file to be called when the current production version runs; obtaining file feature information according to the production version file identifier, where the file feature information characterizes the classes, interfaces, methods, and dependency relationships declared by the target program file; obtaining target changed code data according to the current production code data and the current test code data, where the target changed code data is used to indicate the code content added, and / or deleted, and / or modified in the current production code data compared with the current test code data; and obtaining the code change impact tree according to the target changed code data and the file feature information.
[0090] In a possible implementation manner, when the second processing module 32 obtains the target changed code data according to the current production code data and the current test code data, it specifically is used for: inputting the user description information and the current production code data into a pre-trained large language model to determine at least one segment of segment production code data and the remaining production code data, where the user description information characterizes the change features described by the user for the current production code data compared with the current test code data, and the segment production code data is used to indicate the code segments in the current production code data determined based on the change features; obtaining first target changed code data according to the segment production code data and the current test code data; and / or obtaining second target changed code data according to the remaining production code data and the current test code data; and obtaining the target changed code data according to the first target changed code data and / or the second target changed code data.
[0091] In a possible implementation manner, when the second processing module 32 obtains the first target changed code data according to the segment production code data and the current test code data, it specifically is used for: obtaining a code segment identifier according to the segment production code data; determining segment test code data according to the code segment identifier and the current test code data; and obtaining the first target changed code data according to the segment production code data and the segment test code data.
[0092] Among them, the first processing module 31, the second processing module 32, and the determination module 33 are connected in sequence. The switch configuration data synchronization determination device 3 provided in this embodiment can execute the technical solutions of the method embodiments shown in Figures 2 - 9 any one, and the implementation principles and technical effects are similar, which will not be elaborated here.
[0093] Figure 11 This is a schematic structural diagram of the electronic device provided in this application. As Figure 11As shown in the figure, the electronic device 50 provided in this embodiment includes: at least one processor 501 and a memory 502. Optionally, the device 50 further includes a communication component 503. Among them, the processor 501, the memory 502, and the communication component 503 are connected through a bus 504.
[0094] In the specific implementation process, at least one processor 501 executes the computer-executable instructions stored in the memory 502, so that at least one processor 501 executes the above-mentioned method.
[0095] For the specific implementation process of the processor 501, reference can be made to the above method embodiment, and its implementation principle and technical effects are similar, so they will not be elaborated here in this embodiment.
[0096] In the above embodiment, it should be understood that the processor may be a central processing unit (English: Central Processing Unit, abbreviated as: CPU), or other general-purpose processors, digital signal processors (English: Digital Signal Processor, abbreviated as: DSP), application specific integrated circuits (English: Application Specific Integrated Circuit, abbreviated as: ASIC), etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the invention can be directly embodied as being executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
[0097] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.
[0098] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.
[0099] This application also provides a computer program product, including a computer program, which implements the above-mentioned method when executed by a processor.
[0100] The present application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above method.
[0101] The above-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disk. The readable storage medium can be any available medium accessible by a general-purpose or special-purpose computer.
[0102] An exemplary readable storage medium is coupled to the processor so that the processor can read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist as discrete components in a device.
[0103] The division of units is only a logical function division. In actual implementation, there may be other division methods. For example, 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 displayed or discussed couplings or direct couplings or communication connections to each other can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.
[0104] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place, or can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0105] In addition, in each embodiment of the present invention, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.
[0106] If a function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs, etc., all kinds of media that can store program codes.
[0107] Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When this program is executed, it executes the steps including the above method embodiments; and the aforementioned storage medium includes: ROMs, RAMs, magnetic disks, or optical discs, etc., all kinds of media that can store program codes.
[0108] Finally, it should be noted that: After considering the specification and practicing the invention disclosed herein, those skilled in the art will readily think of other implementation manners of the present invention. The present invention is intended to cover any variations, uses, or adaptive changes of the present invention. These variations, uses, or adaptive changes follow the general principles of the present invention and include the common general knowledge or conventional technical means in the technical field of the present invention that are not disclosed in the present invention. It is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present invention is only limited by the appended claims.
Claims
1. A method for synchronously determining switch configuration data, characterized in that: The method comprises: Obtaining a switch configuration call chain tree according to the switch configuration identifier of the current production version, wherein the switch configuration identifier is used to indicate the switch configuration data called by the current production version, and the switch configuration call chain tree is used to indicate a call relationship between at least two call objects corresponding to the switch configuration data; Obtaining a code change impact tree according to the current production version and the current test version, wherein the code change impact tree is used to indicate a target call object corresponding to a code that has been changed based on the current production version and the current test version, wherein the current test version is a production version that is at least a previous version of the current production version; According to the switch configuration call chain tree and the code change impact tree, a target switch configuration identifier is determined, where the target switch configuration identifier is used to indicate switch configuration data that does not require verification and is synchronized from a production environment to a test environment. The production environment is an operating environment for a production version, and the test environment is an operating environment for a test version.
2. The method according to claim 1, characterized in that: The switch configuration call chain tree is obtained according to the switch configuration identifier of the current production version, including: Obtaining object calling information according to the switch configuration identifier, wherein the object calling information is used to indicate a calling object to be called when the current production version calls the switch configuration data; The switch configuration call chain tree is obtained according to the object call information.
3. The method according to claim 1, characterized in that The step of obtaining a code change impact tree according to the current production version and the current test version includes: According to the current production version, current production code data is obtained, wherein the current production code data represents the code content of the current production version; According to the current test version, current test code data is obtained, wherein the current test code data represents the code content of the current test version; The code change impact tree is obtained according to the current production code data and the current test code data.
4. The method according to claim 3, characterized in that The obtaining the code change impact tree according to the current production code data and the current test code data includes: According to the current production version, a production version file identifier is obtained, wherein the production version file identifier is used to indicate a target program file to be called when the current production version is running; According to the production version file identifier, file characteristic information is obtained, wherein the file characteristic information represents the classes, interfaces, methods and dependencies declared by the target program file; Obtaining target change code data according to the current production code data and the current test code data, wherein the target change code data is used to indicate code content added, / or code content deleted, and / or code content modified in the current production code data compared to the current test code data; The code change impact tree is obtained according to the target change code data and the file feature information.
5. The method according to claim 4, characterized in that The step of obtaining target change code data according to the current production code data and the current test code data includes: Inputting user description information and the current production code data into a pre-trained large language model to determine at least one segment of production code data and remaining production code data, wherein the user description information represents a change feature described by the user for the current production code data compared to the current test code data, and the segment production code data is used to indicate a code segment in the current production code data determined based on the change feature; Obtaining first target changed code data according to the fragment production code data and the current test code data; and / or, obtaining second target change code data according to the remaining production code data and the current test code data; The target change code data is obtained according to the first target change code data and / or the second target change code data.
6. The method according to claim 5, characterized in that The step of obtaining first target changed code data according to the segment production code data and the current test code data includes: Generate code data according to the fragment to obtain a code fragment identifier; Determine the fragment test code data according to the code fragment identifier and the current test code data; The first target change code data is obtained according to the fragment production code data and the fragment test code data.
7. A device for determining switch configuration data synchronization, characterized in that: include: A first processing module is configured to obtain a switch configuration call chain tree according to a switch configuration identifier of a current production version, wherein the switch configuration identifier is used to indicate switch configuration data called by the current production version, and the switch configuration call chain tree is used to indicate a call relationship between at least two call objects corresponding to the switch configuration data; A second processing module is used to obtain a code change impact tree according to the current production version and the current test version, wherein the code change impact tree is used to indicate a target call object corresponding to the changed code determined based on the current production version and the current test version, wherein the current test version is a production version of at least a previous version of the current production version; A determination module is used to determine a target switch configuration identifier according to the switch configuration call chain tree and the code change impact tree, wherein the target switch configuration identifier is used to indicate switch configuration data that does not require verification and is synchronized from a production environment to a test environment, wherein the production environment is an operating environment for a production version, and the test environment is an operating environment for a test version.
8. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the switch configuration data synchronization determination method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the switch configuration data synchronization determination method according to any one of claims 1 to 6.