Configuration item updating and querying method and device, computer equipment and storage medium
By recording only the configuration item contents during each version update in the database and using the version identifier to generate query statements, the problem of high occupancy of configuration item snapshot data when applying version update is solved, and the space utilization and query efficiency of the database are improved .
Patent Information
- Application Number
- CN202411047396.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-12-17
AI Technical Summary
When the application version is updated, the increase in the configuration item snapshot data leads to excessive data space occupancy in the database, affecting efficiency.
By recording only the configuration item contents when each version is updated in the database, rather than recording the complete configuration item snapshot data, the version identification generation query statement is used to query the update information in the preset database to determine the configuration value of the configuration item.
Reduces the space occupied by configuration items, improves the space utilization of the database, and reduces the cost of data storage and query.
Smart Images

Figure CN119149087A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a configuration item updating and querying method, apparatus, computer equipment and storage medium. Background Art
[0002] Typically, an application contains multiple configuration items, and a version change of an application usually refers to updating and adjusting the configuration results of these configuration items in the application.
[0003] At present, when an application is updated, snapshot data of all configuration items of the application after the version change is usually recorded. In order to make the user aware of the changes in the application configuration items when the version is changed, snapshot data of all configuration items of the application before the version change is usually recorded at the same time. However, as the application functions expand, there will be more and more configuration items in the application, which will lead to an increase in the snapshot data of the configuration items stored in the database, resulting in an excessively high data space occupancy rate. Summary of the invention
[0004] In response to the above technical problems, the embodiments of the present application provide a configuration item update and query method, apparatus, computer equipment and storage medium, which aim to solve the problem of high space occupancy of configuration item data during version change of the application.
[0005] In a first aspect, an embodiment of the present application provides a configuration item query method, including:
[0006] Determine the configuration item whose configuration value is to be queried in the application;
[0007] Generate a query statement according to the configuration item and the version identifier of the application;
[0008] Performing a query in a first preset database according to the query statement, and if update information corresponding to the query statement is found in the first preset database, determining the update information as update information of the configuration item;
[0009] The first preset database stores the configuration items updated by each version of the application and the update information corresponding to the updated configuration items;
[0010] A configuration value query result of the configuration item is determined from the update information.
[0011] In a second aspect, an embodiment of the present application provides a configuration item updating method, including:
[0012] When a configuration item of an application is updated, obtaining a fourth version identifier of the application, and a first configuration result of the application after the configuration item is updated and a second configuration result of the application before the configuration item is updated;
[0013] Determine, according to a difference between the first configuration result and the second configuration result, a first configuration item that has an update in the application, and update information of the first configuration item;
[0014] Generate a query statement according to the fourth version identifier and the first configuration item;
[0015] The query statement and the update information of the first configuration item are stored in a first preset database in correspondence.
[0016] In a third aspect, an embodiment of the present application provides a configuration item query device, including:
[0017] A first determination module is used to determine a configuration item of a configuration value to be queried in an application;
[0018] A first generating module, used to generate a query statement according to the configuration item and the version identifier of the application;
[0019] A query module, which queries a first preset database according to the query statement, and if update information corresponding to the query statement is found in the first preset database, determines the update information as update information of the configuration item; wherein the first preset database stores the configuration items updated by each version of the application and the update information corresponding to the updated configuration items;
[0020] The second determining module is used to determine the configuration value query result of the configuration item from the update information.
[0021] In a fourth aspect, an embodiment of the present application provides a configuration item updating device, including:
[0022] an acquisition module, configured to acquire, when a configuration item of an application is updated, a fourth version identifier of the application, and a first configuration result of the application after the configuration item is updated and a second configuration result of the application before the configuration item is updated;
[0023] A third determining module, configured to determine, according to a difference between the first configuration result and the second configuration result, a first configuration item having an update in the application and update information of the first configuration item;
[0024] A second generating module, configured to generate a query statement according to the fourth version identifier and the first configuration item;
[0025] The storage module is used to store the query statement and the update information of the first configuration item in a first preset database in correspondence.
[0026] In a fifth aspect, an embodiment of the present application further provides a computer device, comprising a memory storing a plurality of instructions; a processor loads instructions from the memory to execute the steps of any one of the configuration item query method or configuration item update method provided in the embodiment of the present application.
[0027] In a sixth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores a plurality of instructions, and the instructions are suitable for a processor to load to execute the steps of any configuration item query method or configuration item update method provided in the embodiment of the present application.
[0028] By adopting the scheme of the embodiment of the present application, after determining the configuration item to be queried, a query statement will be first generated based on the configuration item and the version identifier, and the query will be performed in the first preset database. Since the first preset database stores the configuration items updated by each version and the update information of the corresponding updated configuration items, after obtaining the update information stored corresponding to the configuration item, the configuration query result of the configuration item can be determined based on the update information. In the embodiment of the present application, since the database only records the content of the configuration items updated when each version is updated, rather than recording the complete configuration item snapshot data, the space occupied by the configuration items is reduced, and the space utilization rate in the database is effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0030] Figure 1 A schematic diagram of an application environment of a configuration item updating method or a configuration item query method provided in an embodiment of the present application;
[0031] Figure 2 A schematic diagram of the steps of the configuration item query method provided in an embodiment of the present application;
[0032] Figure 3 A schematic diagram of another step flow of performing a query in a database provided in an embodiment of the present application;
[0033] Figure 4 A schematic diagram of a process flow for adjusting a version identifier provided in an embodiment of the present application;
[0034] Figure 5 A schematic diagram of the steps of a configuration item updating method provided in an embodiment of the present application;
[0035] Figure 6A schematic diagram of a process flow for generating and storing a query statement provided in an embodiment of the present application;
[0036] Figure 7 This is a schematic diagram of the structure of a configuration item query device provided in an embodiment of the present application;
[0037] Figure 8 A schematic diagram of the structure of a configuration item updating device provided in an embodiment of the present application;
[0038] Fig. 9 It is a schematic diagram of the internal structure of the computer device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0039] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application. At the same time, in the description of the embodiments of the present application, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0040] In order to better understand the configuration item update and query method, device, electronic device and storage medium provided by the embodiment of the present application, the application environment applicable to the embodiment of the present application is described below. Specifically, the operation of the application depends on multiple configuration items pre-set by the technician, and the version change of the application usually also includes the content of updating and adjusting the configuration results of these configuration items. When most applications are updated, the snapshot data of all configuration items of the application after the version change is usually recorded. At the same time, in order to enable the technician to clearly understand the changes of different configuration items when the version is changed, the snapshot data of each configuration item in multiple historical versions before the version change will also be recorded. However, with the expansion of application functions, there are more and more configuration items in the application, and more and more version update data, which leads to an increase in the snapshot data of the configuration items stored in the database, making the space occupancy rate of the application data too high.
[0041] In order to reduce the amount of stored data and lower the space occupancy rate of application data, the embodiment of the present application records in the database the contents of the configuration items updated when each version is updated, rather than recording the complete snapshot data of the configuration items. When a configuration item needs to be found, the updated data of each version is usually queried in turn to obtain the configuration result of the configuration item. At the same time, the space occupied by the configuration items is effectively reduced, thereby effectively improving the space utilization rate in the database.
[0042] For details, please refer to Figure 1 , Figure 1 A schematic diagram of an application environment of a configuration item update method and a configuration item query method provided in an embodiment of the present application is shown. As an implementation mode, the configuration item update method and the configuration item query method provided in an embodiment of the present application can be applied to the same electronic device. The electronic device can be as follows: Figure 1 The server 110 shown in the figure can be connected to the terminal device 120 through a network. The network is used to provide a medium for a communication link between the server 110 and the terminal device 120. The network can include various connection types, such as a wired communication link, a wireless communication link, etc., which are not limited in the embodiments of the present application. Optionally, in other embodiments, the electronic device can also be a smart phone, a laptop computer, etc.
[0043] It should be understood that Figure 1 The server 110, network and terminal device 120 are merely illustrative. Depending on the implementation requirements, there may be any number of servers, networks and terminal devices. For example, the server 110 may be a physical server or a server cluster composed of multiple servers, and the terminal device 120 may be a mobile phone, a tablet, a desktop computer, a laptop computer, and the like. It is understood that the embodiments of the present application may also allow multiple terminal devices 120 to access the server 110 at the same time.
[0044] In some embodiments, the terminal device 120 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart watch, an Internet of Things device, a portable wearable device, etc. The terminal device 120 can respond to the user's operation instructions (update operations or query operations on application configuration items), generate corresponding requests, and transmit them to the server 110 through the network. After receiving the request sent by the terminal device 120, the server 110 implements the corresponding update or query of the application configuration items and returns the corresponding results to the terminal device 120.
[0045] Among them, the scheme of this application can refer to Figure 2 , Figure 2 A schematic diagram of the steps of the configuration item query method provided in the embodiment of the present application. The method can be performed by Figure 1The method is performed by a server or a terminal device, or by a server and a terminal device in collaboration. Figure 1 The server execution in is taken as an example to illustrate, including the following steps:
[0046] Step S210: determining a configuration item of the application whose configuration value is to be queried.
[0047] In the embodiment of the present application, the application is an application program, which refers to a computer program developed by an Internet manufacturer to complete one or more specific tasks. The embodiment of the present application does not elaborate on the application.
[0048] Among them, an application usually includes multiple configuration items, and the adjustment of these configuration items will affect the operation of the application. Therefore, when it is necessary to update the application, it usually refers to updating the configuration items in the application, for example, adding, modifying or deleting a configuration item, and different versions correspond to different configuration results of the configuration items. Therefore, when it is necessary to obtain the configuration value of a configuration item in the application, the configuration item can be determined as the configuration item of the configuration value to be queried. Specifically, the determination of the configuration item can usually be determined by the selection method of the technician based on human-computer interaction, and of course it can also be determined spontaneously by the program when the application performs a certain function. The embodiment of the present application does not limit the implementation scheme of determining the configuration item. In addition, the configuration item can be a single configuration item among all the configuration items contained in the application, and of course it can also be a collection of several configuration items, or all configuration items, and the number of configuration items does not affect the specific implementation of the implementation scheme of the present application.
[0049] S220: Generate a query statement according to the configuration item and the version identifier of the application.
[0050] In the related technical solutions, since the database records the snapshot information of all configuration items of an application under a certain version, the version identifier of the application is usually used as a query statement to directly obtain the configuration query result of the application. In the embodiment of the present application, since the database no longer records the snapshot information of all configuration items of the application, but only records the configuration items and update information updated in each version, it is necessary to generate a corresponding query statement for each configuration item and the version identifier of the application.
[0051] Specifically, under normal circumstances, configuration items usually generate query statements with the version identifier of the latest version of the application. Of course, when it is necessary to execute a version rollback instruction on the application, it is necessary to consider using the version identifier of a historical version to generate a query statement. Of course, it should be noted that in order to better implement the query of the application version identifier, as another feasible embodiment of the present application, the record of application version updates can also be implemented through a second preset database, that is, a version control database, that is, each time the application version is updated, the latest version identifier and historical version identifier of the application will be recorded. At this time, based on the configuration item and the version identifier of the application, the query statement generated specifically includes:
[0052] Querying the first version identifier and the second version identifier of the application through a second preset database;
[0053] generating a query statement according to the configuration item and the first version identifier without executing a version rollback instruction for the application;
[0054] When executing a version rollback instruction for the application, a third version identifier is determined from the second version identifier, and a query statement is generated according to the configuration item and the third version identifier, wherein the third version identifier corresponds to the rollback version in the version rollback instruction.
[0055] In the embodiment of the present application, the version control database can be used to query the database to obtain the first version identifier corresponding to the latest version of the application and multiple second version identifiers corresponding to historical versions. For example, taking the latest version as V6 as an example, the first version identifier can be V6, and V5, V4, V3, V2, V1, etc. can be regarded as second version identifiers.
[0056] On this basis, when there is no need to execute the version rollback instruction for the application, that is, when there is no need to roll back the version of the application, a query statement can be directly generated based on the configuration item and the first version identifier corresponding to the latest version. Correspondingly, when it is necessary to execute the version rollback instruction for the application, for example, to roll back to the historical version V4, at this time, the third version identifier corresponding to the rollback version in the version rollback instruction can be determined from the multiple second version identifiers mentioned above, and a query statement can be generated based on the configuration item and the third version identifier, thereby realizing subsequent configuration-based queries. .
[0057] S230: query a first preset database according to the query statement, and if update information corresponding to the query statement is found in the first preset database, determine the update information as update information of the configuration item.
[0058] The first preset database can be understood as a version change database, which records the configuration item data of the application when the version is changed. Specifically, in the embodiment of the present application, the first preset database stores the configuration items updated by each version of the application, and the update information of the corresponding updated configuration items. Specifically, as a feasible implementation scheme of the present application, the first preset database can usually record the association between the configuration items updated in each version and the update information of the configuration items in the form of key-value pairs (i.e., key-value). For example, the version identifier and the configuration items updated in the version can be used as query keys (i.e., query keywords), and the update information of the configuration items can be used as the value of the query key in the first preset database. Specifically, taking an application including configuration items A, B, and C as an example, when the configuration item A is modified from value A1 to A2 in the second version update, at this time, the version identifier and the configuration items updated in the version can be used as query keys, i.e., V2 / A (version 2, version 2), and the update information of the configuration items of this version, that is, the data A2 after the configuration item A is updated, is used as the value of the query key. Of course, the above is only an example of modifying a configuration item. In fact, in a version change process, the types of operations for updating the configuration items of an application include but are not limited to the aforementioned modifications, as well as additions, deletions, etc. In order to better implement configuration queries for an application, the update information may also include the type of operation. Of course, the above content will be further explained in subsequent embodiments.
[0059] Of course, it should be noted that the V2 / A and A2 mentioned above can be understood as the necessary information in the query key and the corresponding value. In fact, the key-value pairs recorded in the first preset database can also contain more other information. For example, the query key can further include the application name and the version identifier of the previous version, and the value can also include the application name, operation type, etc. However, in any case, as long as the association between the updated configuration items in each version and the update information of the configuration items is recorded in the first preset database, it will not affect the implementation of the technical solution of the present application.
[0060] It can be seen that since the first preset database only records the configuration item information that has changed within the version, when querying the first preset database according to the query statement, two results may be queried, among which the update information stored in association with the query statement is queried in the first preset database. For example, the query statement is version identifier-configuration A (V2 / A), at this time, the value corresponding to the query statement, that is, A2, can be queried in the first preset database. However, for the query statements of V2 / B and V2 / C, it is impossible to query the value corresponding to the query key in the first preset database. That is to say, when querying the first preset database according to the query statement, two results may be queried. In the target version of the query, a configuration item has just changed. At this time, the query statement generated based on the configuration item and the target version identifier can directly query the first preset database to obtain the associated stored information, which is the update information describing the change of the query configuration item parameters. The other is that in the target version identifier of the query, the configuration item has not changed. At this time, the first preset database does not store the information associated with the version identifier and the configuration item, but because the configuration item has not changed, the historical version can be further used to further query and obtain the update information of the queried configuration item.
[0061] In the embodiment of the present application, combined with the foregoing relevant description, it can be known that when a configuration item happens to change in the queried version, the query statement generated based on the configuration item and the version identifier can directly query the first preset database to obtain the associated stored information, that is, when the first preset database is queried to obtain the update information associated with the query statement, the update information is the update information that describes the change of the configuration parameters of the configuration item, for example, it may include the update type of the configuration item or the configuration value after the update.
[0062] Of course, if a certain configuration item has not changed in the target version of the query, the query statement generated based on the configuration item and the version identifier is obviously unable to obtain the update information stored in association with the query statement from the first preset database. At this time, as another feasible embodiment of the present application, the version identifier in the query statement will be further adjusted to obtain the adjusted query statement. For details, please refer to Figure 3 , Figure 3 Another schematic flow chart of the steps of performing a query in a database provided in an embodiment of the present application, specifically, includes steps S310 to S320:
[0063] S310: If no update information corresponding to the query statement is found in the first preset database, a version identifier in the query statement is adjusted to obtain an adjusted query statement.
[0064] In an embodiment of the present application, when a configuration item has not changed in the queried version, the update information corresponding to the query statement is not found in the first preset database, but considering that the configuration item has not changed, that is, the configuration result is the same as the configuration item in the historical version, therefore, it can be considered to adjust the version identifier in the query statement to query in the historical version, that is, adjust the version identifier in the query statement to obtain the adjusted query statement, and at this time, the adjusted query statement can query configuration items of other versions.
[0065] S320: query the first preset database according to the adjusted query statement, and if update information corresponding to the adjusted query statement is found in the first preset database, determine the update information as update information of the configuration item.
[0066] In an embodiment of the present application, when using the adjusted query statement to query in the first preset database, it is obvious that the first preset database may contain update information stored in association with the adjusted query statement. At this time, this update information can be used as the update information of the configuration item. Of course, if the first preset database still does not contain update information stored in association with the adjusted query statement, then you can consider further adjusting the version identifier in the query statement to use the adjusted query statement to query again in the first preset database. Until after a certain adjustment, when the update information stored in association with the adjusted query statement is queried in the first preset database, the update information queried this time can be determined as the update information of the configuration item.
[0067] Of course, in order to better adjust the version identifier in the query statement, as a feasible embodiment of the present application, the version identifier can usually be in the form of a version number, that is, as the application version is updated, the version number will also increase, for example, version 1.0, version 1.1, version 1.2, etc. At this time, adjusting the version identifier in the query statement to obtain the adjusted query statement usually requires adjusting the version identifier in the query statement so as to use the adjusted query statement to query in the historical version. At this time, please refer to Figure 4 , Figure 4 A schematic flow chart of a step of adjusting a version identifier provided in an embodiment of the present application, specifically, comprising steps S410 to S430:
[0068] S410: Reduce the version number in the query statement to obtain an adjusted query statement.
[0069] In the embodiments of the present application, combined with the above-mentioned related description, it can be known that since the version identifier exists in the form of a version number, and the version number gradually increases with the update of the version, therefore, when it is necessary to adjust the version identifier so as to use the adjusted query statement to query in the historical version, it is usually necessary to reduce the version number in the query statement to obtain the adjusted query statement. For example, taking the query statement V2 / B or V2 / C mentioned above as an example, since the update information of configuration item B and configuration item C is not queried in the V2 version, the version number in the query statement is reduced at this time, and V1 / B and V1 / C are further obtained as the adjusted query statement for query.
[0070] S420: If the version number of the adjusted query statement is greater than the version number of the initial version of the application, query the first preset database according to the adjusted query statement.
[0071] S430: If the version number of the adjusted query statement is smaller than the version number of the initial version of the application, confirm that the configuration value of the configuration item does not exist.
[0072] In the embodiment of the present application, when the version number in the adjusted query statement is greater than (or equal to) the version number of the initial version of the application, it indicates that the historical version can be queried according to the query statement, that is, the step of querying in the first preset database according to the adjusted query statement can be executed. On the contrary, when the version number in the adjusted query statement is less than the version number of the initial version of the application, it indicates that the configuration result of the configuration item has not been queried in the most initial version. At this time, it can be considered that the configuration query of the configuration item is wrong, and it can usually be determined that the configuration value of the configuration item does not exist and output it.
[0073] S240: Determine a configuration value query result of the configuration item from the update information.
[0074] In the embodiment of the present application, when the latest update record of a configuration item in a certain version, that is, the update information, is obtained by querying the query statement mentioned above, since the update information contains a variety of information related to the configuration item, it is also necessary to parse the update information to obtain the configuration value query result of the configuration item. Specifically, for ease of understanding, the update information includes the update type of the configuration item and the configuration value updated by the configuration item as an example for explanation. Specifically, as a feasible implementation scheme of the present application, the configuration value query result of the configuration item determined from the update information includes:
[0075] If the update type of the configuration item is the first update type, determining the updated configuration value of the configuration item as the configuration value query result of the configuration item;
[0076] If the update type of the configuration item is the second update type, it is confirmed that no configuration value query result of the configuration item is found and output.
[0077] In the embodiment of the present application, the first update type refers to an update type such as addition or modification. At this time, when the configuration item is of this update type, the configuration value of the configuration item updated contained in the update information can be determined as the configuration value query result of the configuration item. The second update type refers to an update type such as deletion. At this time, when the configuration item is of this update type, it indicates that the configuration item is deleted. Therefore, it can be determined that there is no configuration value query result for the configuration item, and it can be output to prompt the user.
[0078] By adopting the scheme of the embodiment of the present application, after determining the configuration item to be queried, a query statement will be first generated based on the configuration item and the version identifier, and the query will be performed in the first preset database. Since the first preset database records the association between the configuration item updated in each version and the update information of the configuration item, after obtaining the update information stored in association with the configuration item, the configuration query result of the configuration item can be determined based on the update information. In the embodiment of the present application, since the database only records the content of the configuration item updated when each version is updated, rather than recording the complete configuration item snapshot data, the space occupied by the configuration item is reduced, and the space utilization rate in the database is effectively improved.
[0079] Of course, it can be understood that in the configuration item query process provided above, the configuration query result depends on the association relationship between the configuration items updated in each version recorded in the first preset database and the update information of the configuration items. Therefore, in order to better implement the configuration item query process, as another feasible embodiment of the present application, the embodiment of the present application also provides a configuration item update method. For details, please refer to Figure 5 , Figure 5 A schematic flow chart of a configuration item updating method provided in an embodiment of the present application, specifically, comprising steps S510 to S540:
[0080] S510: When a configuration item of an application is updated, obtain a fourth version identifier of the application, and a first configuration result of the application after the configuration item is updated and a second configuration result of the application before the configuration item is updated.
[0081] In the embodiment of the present application, the configuration item update of the application generally refers to the program developer calling the configuration update instruction to update the configuration item of the application. At this time, after the corresponding instruction is triggered, the fourth version identifier of the application will be obtained first, wherein the fourth version identifier is generally the version identifier of the current version of the application, and the first configuration result of the application after the configuration item is updated and the second configuration result before the configuration item is updated are obtained. Specifically, the fourth version identifier can be stored in the second preset database, that is, the version control database.
[0082] S520: Determine, according to a difference between the first configuration result and the second configuration result, a first configuration item that has been updated in the application and update information of the first configuration item.
[0083] In an embodiment of the present application, by comparing the first configuration result of the application after the configuration item is updated with the second configuration result before the configuration item is updated, the first configuration item that is updated in the application during this version update can be determined, as well as the update information of the first configuration item, such as the updated configuration value or the update operation type such as addition, modification, and deletion.
[0084] S530, generating a query statement according to the fourth version identifier and the first configuration item;
[0085] S540: Store the query statement and the update information of the first configuration item in a first preset database in correspondence thereto.
[0086] In an embodiment of the present application, by using the fourth version identifier and the first configuration item to generate a query statement, and storing the update information of the configuration item as the value of the query statement in the first preset database, the latest update information of each configuration item can be obtained from the first preset database when the configuration item is subsequently queried.
[0087] Of course, considering that the version update process of the application usually includes an editing stage and a publishing stage, and only after the publishing stage is completed, the configuration item update data executed in the editing stage will be applied. Therefore, as a feasible embodiment of the present application, in addition to the current version identifier, the second preset database can also generally include an editing version identifier, wherein, in the editing stage, the editing version identifier is updated to indicate that the user can update the configuration items of the application, and in the publishing stage, that is, after the application is published after the configuration items are updated, the current version identifier will be updated so that the user can query and obtain the corresponding update information through the version identifier. The specific implementation scheme can be referred to as follows Figure 6 and its explanation. Figure 6 As shown, Figure 6A schematic flow chart of steps for generating and storing a query statement provided in an embodiment of the present application, wherein the fourth version identifier is stored in a second preset database; the second preset database also includes an edit version identifier, specifically, steps S610 to S620:
[0088] S610: Update the edit version identifier in the second preset database according to the fourth version identifier.
[0089] In this embodiment, when the edit version identifier in the second preset database is updated, it indicates that the application version is currently in the update stage, and different users can update the configuration items through the configuration update instructions of the application to determine the final updated configuration items and the update information of the configuration items. In the application editing stage, since the current version identifier is not updated, the version is in an unpublished state.
[0090] S620: After the application is released, the edit version identifier in the second preset database and the configuration item are concatenated to generate a query statement, and the edit version identifier and the fourth version identifier in the second preset database are updated.
[0091] In an embodiment of the present application, after the configuration item parameters of the application are updated and released, the edit version identifier and the first configuration item can be concatenated to generate a query keyword, and stored in association with the update information of the configuration item in the first preset database. At the same time, the edit version identifier and the current version identifier in the second preset database, that is, the fourth version identifier, are updated. For example, the edit version identifier is reset and initialized, and the fourth version identifier is increased by 1.
[0092] The configuration item updating method provided in the embodiment of the present application can make multiple changes in a single release process by adding an edit version identifier, which also increases the efficiency of configuration changes.
[0093] Specifically, in order to facilitate the configuration item update method provided in the embodiment of the present application, the following will provide specific implementation steps for updating and querying the configuration items of the application in combination with a specific implementation scheme, specifically including the following contents:
[0094] (1) Storage data structure. Specifically, take the data stored in Zookeeper (a distributed database) as an example. Zookeeper stores key-value pairs in the following form, where the query key data structure is as follows: / conf / {configuration item name} / v{N}-p{M}-<app_name> , where v{N} represents the current version identifier, p{M} represents the previous version identifier, and taking the configuration item A of application X as an example, taking the newly added configuration item A in the first identifier as A1 as an example, at this time, the data structure of the query key is as follows: / conf / A / v1-p0-X, and its corresponding value is: {"app_name":"X","version":1,"preVersion":0,"action":A,"data":"A1"}, where version and preVersion are the current version identifier and the previous version identifier respectively, and "action" is the operation type, where "action":A represents a new action, "action":U represents a modification action, and "action":D represents a deletion action, and "data" represents a specific configuration value result. For example, "data":"A1" means that in this operation, the specific configuration value result of configuration item A is changed to A1;
[0095] Zookeeper also stores key-value pairs in the following format, where the key data structure is as follows: / app / <app_name> , its corresponding value includes the current version identifier, edit version identifier and latest version identifier, that is, {"currentVersion":a,"editVersion":b,"maxVersion":c}, that is, the current version, edit version and latest version of the APP can be obtained through APP query;
[0096] (2) Every time a configuration item is updated, the value of the edited version will be set to the value of the latest version + 1. For example, during the initial update of application X, the value corresponding to / app / X stored in Zookeeper will be adjusted from {"currentVersion":0,"editVersion":0,"maxVersion":0} to {"currentVersion":0,"editVersion":1,"maxVersion":0}. After the release, the current version will be set to the latest version = the edited version, and the value of the edited version will be reset to 0. That is, the value corresponding to / app / X will be set from {"currentVersion":0,"editVersion":1,"maxVersion":0} to {"currentVersion":0,"editVersion":1,"maxVersion":0}. sion":0} is adjusted to {"currentVersion":1,"editVersion":0,"maxVersion":1}, and the same applies to other version update processes. Of course, when you need to perform a version rollback process for application X, you need to adjust the current version "currentVersion" to the specified rollback version. For example, when you need to roll the application after the fifth version update to the fourth version update, at this time, the value corresponding to / app / X will be adjusted from {"currentVersion":5,"editVersion":0,"maxVersion":5} to {"currentVersion":4,"editVersion":0,"maxVersion":5}
[0097] (3) After each configuration item is edited and published, a key-value pair of the updated configuration item and the updated information of the configuration item is added to Zookeeper;
[0098] For example, in the first version release, when configuration item A is A1 and configuration item B is B1 and released, the following key-value pairs will be stored in Zookeeper:
[0099] The key is / conf / A / v1-p0-X, and the value is {"app_name":"X","version":1,"preVersion":0,"action":A,"data":"A1"};
[0100] The key is / conf / B / v1-p0-X, and the value is {"app_name":"X","version":1,"preVersion":0,"action":A,"data":"B1"};
[0101] At this time, when the user needs to query the configuration items, the current latest version is identified as 1 (the previous version is identified as 0), and the configuration items include A and B. At this time, the query keys of / conf / A / v1-p0-X and / conf / B / v1-p0-X can be constructed, so as to query the operation type of configuration item A as new addition and the value as A1, and the operation type of configuration item B as B and the value as B1. The configuration query result finally determined as the application is (A1, B1);
[0102] In the second version release, if only the value of configuration item A is changed from A1 to A2, the following key-value pair will be stored in ZooKeeper after the application is released:
[0103] The key is / conf / A / v2-p1-X, and the value is {"app_name":"X","version":1,"preVersion":0,"action":U,"data":"A2"}
[0104] At this time, when the user needs to query the configuration item, it is determined that the current latest version is identified as 2, and the configuration items include A and B. At this time, the query keys of / conf / A / v2-p1-X and / conf / B / v2-p1-X can be constructed. Since Zookeeper only stores the query key / conf / A / v2-p1-X, only the operation type of configuration item A can be queried as modification, and the modified value is A2, but the result of / conf / B / v2-p1-X cannot be queried. At this time, the version identifier in / conf / B / v2-p1-X can be adjusted, and / conf / B / v1-p0-X can be used for query, so that the operation type of configuration item B is B and the value is B1, so that the configuration query result of the application is determined to be (A2, B1);
[0105] In addition, if in the third version release, the value of configuration item C is added as C1, and in the fourth version release, the value of configuration item A is deleted from A2, then, based on similar reasons, when the user needs to query the configuration item, the current latest version is identified as 4, and the configuration items include A, B, and C. At this time, the query statements of / conf / A / v4-p3-X, / conf / B / v4-p3-X, and / conf / C / v4-p3-X can be constructed. Since Zookeeper only stores the query key / conf / A / v4-p3-X (because the fourth version only involves the modification of configuration item A), and the operation type of configuration item A is deleted, the configuration item will be deleted. At the same time, based on the query statements of the historical versions, for example, / conf / C / v3-p2-X and / conf / B / v1-p0-X, the values of configuration item B and configuration item C are respectively queried as B1 and C1, thereby determining that the configuration query result of the application is (B1, C1).
[0106] By adopting the scheme of the embodiment of the present application, after determining the configuration item to be queried, a query statement will be first generated based on the configuration item and the version identifier, and the query will be performed in the first preset database. Since the first preset database records the association between the configuration item updated in each version and the update information of the configuration item, after obtaining the update information stored in association with the configuration item, the configuration query result of the configuration item can be determined based on the update information. In the embodiment of the present application, since the database only records the content of the configuration item updated when each version is updated, rather than recording the complete configuration item snapshot data, the space occupied by the configuration item is reduced, and the space utilization rate in the database is effectively improved.
[0107] Based on the same inventive concept, the embodiment of the present application also provides a configuration item query device for implementing the configuration item query method involved above and a configuration item update device for the configuration item update method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of one or more configuration item query devices and configuration item update devices provided below can refer to the above limitations on the configuration item query method and configuration item update method, and the specific limitations will not be repeated here.
[0108] This embodiment also provides a configuration item query device, which can be integrated into a server. Figure 7 As shown, the configuration item query device may include:
[0109] A first determination module 710 is used to determine a configuration item of a configuration value to be queried in an application;
[0110] A first generating module 720, configured to generate a query statement according to the configuration item and the version identifier of the application;
[0111] The query module 730 queries a first preset database according to the query statement, and if update information corresponding to the query statement is found in the first preset database, the update information is determined as update information of the configuration item; wherein the first preset database stores the configuration items updated by each version of the application and the update information corresponding to the updated configuration items;
[0112] The second determination module 740,
[0113] Used to determine the configuration value query result of the configuration item from the update information.
[0114] In some embodiments, after the step of querying the first preset database according to the query statement, the second determination module 740 is also used to adjust the version identifier in the query statement to obtain an adjusted query statement if the update information associated with the query statement is not queried in the first preset database; query the first preset database according to the adjusted query statement, and when the update information associated with the adjusted query statement is queried in the first preset database, determine the update information as the update information of the configuration item.
[0115] In some embodiments, the second determination module 740 is also used to reduce the version number in the query statement to obtain an adjusted query statement; if the version number in the adjusted query statement is greater than the version number of the initial version of the application, the step of querying in the first preset database according to the adjusted query statement is executed; if the version number in the adjusted query statement is less than the version number of the initial version of the application, it is confirmed that the configuration value of the configuration item does not exist.
[0116] In some embodiments, the second determination module 740 is further used to determine the updated configuration value of the configuration item as the configuration value query result of the configuration item if the update type of the configuration item is the first update type; if the update type of the configuration item is the second update type, confirm that there is no configuration value query result of the configuration item.
[0117] In some embodiments, the first generation module 720 is also used to query the first version identifier and the second version identifier of the application through a second preset database; without executing a version rollback instruction for the application, generate a query statement based on the configuration item and the first version identifier; when executing a version rollback instruction for the application, determine from the second version identifier a third version identifier corresponding to the rollback version in the version rollback instruction, and generate a query statement based on the configuration item and the third version identifier.
[0118] This embodiment also provides a configuration item updating device, which can be integrated in a server. Figure 8 As shown, the configuration item updating device may include:
[0119] The acquisition module 810 is used to acquire the fourth version identifier of the application, the first configuration result of the application after the configuration item is updated, and the second configuration result of the application before the configuration item is updated when the configuration item of the application is updated;
[0120] A third determining module 820, configured to determine, according to a difference between the first configuration result and the second configuration result, a first configuration item having an update in the application and update information of the first configuration item;
[0121] A second generating module 830, configured to generate a query statement according to the fourth version identifier and the first configuration item;
[0122] The storage module 840 is used to associate the query statement with the update information of the first configuration item and store them in a first preset database.
[0123] In some embodiments, the second generation module 830 is also used to update the edit version identifier in the second preset database according to the fourth version identifier; after the application is released, the edit version identifier of the second preset database and the first configuration item are concatenated to generate a query statement, and the edit version identifier and the fourth version identifier in the second preset database are updated.
[0124] The configuration item query device provided in the embodiment of the present application, after determining the configuration item to be queried, will first generate a query statement based on the configuration item and the version identifier, and query in the first preset database. Since the first preset database stores the updated configuration items of each version and the update information of the corresponding updated configuration items, after obtaining the update information stored in association with the configuration item, the configuration query result of the configuration item can be determined based on the update information. In the embodiment of the present application, since the database only records the content of the configuration items updated when each version is updated, rather than recording the complete configuration item snapshot data, the space occupied by the configuration items is reduced, and the space utilization rate in the database is effectively improved.
[0125] Based on the same inventive concept, the embodiment of the present application also provides a computer device, which may be a server or a terminal device, and includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the above configuration item query method or configuration item update steps are implemented. Various functions are implemented, such as executing the following steps:
[0126] Determine the configuration item whose configuration value is to be queried in the application;
[0127] Generate a query statement according to the configuration item and the version identifier of the application;
[0128] A query is performed in a first preset database according to the query statement, and if update information corresponding to the query statement is found in the first preset database, the update information is determined as update information of the configuration item; wherein the first preset database stores the configuration items updated by each version of the application and the update information corresponding to the updated configuration items;
[0129] A configuration value query result of the configuration item is determined from the update information.
[0130] Alternatively, perform the following steps:
[0131] When a configuration item of an application is updated, obtaining a fourth version identifier of the application, and a first configuration result of the application after the configuration item is updated and a second configuration result of the application before the configuration item is updated;
[0132] Determine, according to a difference between the first configuration result and the second configuration result, a first configuration item that has an update in the application, and update information of the first configuration item;
[0133] Generate a query statement according to the fourth version identifier and the first configuration item;
[0134] The query statement is associated with the update information of the first configuration item and stored in a first preset database.
[0135] According to the scheme of the embodiment of the application, after determining the configuration item to be queried, a query statement will be generated based on the configuration item and the version identifier, and the query will be performed in the first preset database. Since the configuration items updated by each version and the update information of the corresponding updated configuration items are stored in the first preset database, after obtaining the update information stored in association with the configuration item, the configuration query result of the configuration item can be determined based on the update information. In the embodiment of the present application, since the database only records the contents of the configuration items updated when each version is updated, rather than recording the complete snapshot data of the configuration items, the space occupied by the configuration items is reduced, and the space utilization rate in the database is effectively improved.
[0136] In one embodiment, the computer device is a terminal device, for example, its internal structure diagram can be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a configuration item query method or a configuration item update method is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0137] Those skilled in the art will understand that Fig. 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0138] Based on the same inventive concept, an embodiment of the present application also provides a computer-readable storage medium, which may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0139] Since the computer program stored in the computer-readable storage medium can execute any one of the configuration item query methods or configuration item update methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the configuration item query methods or configuration item update methods provided in the embodiments of the present application can be achieved. For details, please refer to the previous embodiments and will not be repeated here.
[0140] According to the scheme of the embodiment of the application, after determining the configuration item to be queried, a query statement will be generated based on the configuration item and the version identifier, and the query will be performed in the first preset database. Since the first preset database stores the configuration items updated by each version and the update information of the corresponding updated configuration items, after obtaining the update information stored in association with the configuration item, the configuration query result of the configuration item can be determined based on the update information. In the embodiment of the present application, since the database only records the contents of the configuration items updated when each version is updated, rather than recording the complete snapshot data of the configuration items, the space occupied by the configuration items is reduced, and the space utilization rate in the database is effectively improved.
[0141] Based on the same inventive concept, the embodiment of the present application further provides a computer program product or a computer program, which includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in various optional implementations in the above embodiments.
[0142] It should be noted that the object data (including but not limited to user device information, user personal information, etc.) and conversation data involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions. A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods.
[0143] Any reference to the memory, database or other media used in the embodiments provided in the present application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (Re RAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0144] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.
[0145] In the above configuration item query device or configuration item update device, computer-readable storage medium, computer device, and computer program product embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, reference can be made to the relevant description of other embodiments. Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process and beneficial effects of the above-described configuration item query device or configuration item update device, computer-readable storage medium, computer program product, computer device and its corresponding units can refer to the description of the configuration item query method or configuration item update method in the above embodiments, and will not be repeated here.
[0146] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0147] The above is a detailed introduction to a configuration item update and query method, device, computer equipment and storage medium, and computer program product provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A configuration item query method, characterized in that: include: Determine the configuration item whose configuration value is to be queried in the application; Generate a query statement according to the configuration item and the version identifier of the application; Performing a query in a first preset database according to the query statement, and if update information corresponding to the query statement is found in the first preset database, determining the update information as update information of the configuration item; The first preset database stores the configuration items updated by each version of the application and the update information corresponding to the updated configuration items; A configuration value query result of the configuration item is determined from the update information.
2. The method according to claim 1, characterized in that After querying the first preset database according to the query statement, the method further includes: If no update information corresponding to the query statement is found in the first preset database, adjusting the version identifier in the query statement to obtain an adjusted query statement; The first preset database is queried according to the adjusted query statement, and when update information corresponding to the adjusted query statement is found in the first preset database, the update information is determined as update information of the configuration item.
3. The method according to claim 2, characterized in that The version identifier includes a version number; The step of adjusting the version identifier in the query statement to obtain an adjusted query statement includes: Reducing the version number in the query statement to obtain an adjusted query statement; If the version number of the adjusted query statement is greater than the version number of the initial version of the application, executing the step of querying the first preset database according to the adjusted query statement; If the version number of the adjusted query statement is smaller than the version number of the initial version of the application, it is confirmed that the configuration value of the configuration item does not exist.
4. The method according to claim 1, characterized in that The update information includes the update type of the configuration item and the updated configuration value of the configuration item; The determining the configuration value query result of the configuration item from the update information includes: If the update type of the configuration item is the first update type, determining the updated configuration value of the configuration item as the configuration value query result of the configuration item; If the update type of the configuration item is the second update type, it is confirmed that no configuration value query result of the configuration item is found.
5. The method according to claim 4, characterized in that The first update type is at least one of addition and modification; the second update type is deletion.
6. The method according to any one of claims 1 to 5, characterized in that: The generating a query statement according to the configuration item and the version identifier of the application includes: Querying the first version identifier and the second version identifier of the application through a second preset database; generating a query statement according to the configuration item and the first version identifier without executing a version rollback instruction for the application; When executing a version rollback instruction for the application, a third version identifier is determined from the second version identifier, and a query statement is generated according to the configuration item and the third version identifier, wherein the third version identifier corresponds to the rollback version of the version rollback instruction.
7. A configuration item updating method, characterized in that: include: When a configuration item of an application is updated, obtaining a fourth version identifier of the application, and a first configuration result of the application after the configuration item is updated and a second configuration result of the application before the configuration item is updated; Determine, according to a difference between the first configuration result and the second configuration result, a first configuration item that has an update in the application, and update information of the first configuration item; Generate a query statement according to the fourth version identifier and the first configuration item; The query statement and the update information of the first configuration item are stored in a first preset database in correspondence.
8. The configuration item updating method according to claim 7, characterized in that: The fourth version identifier is stored in the second preset database; The second preset database also includes an edit version identifier; The generating a query statement according to the fourth version identifier and the first configuration item includes: Updating the edit version identifier in the second preset database according to the fourth version identifier; After the application is released, the edit version identifier of the second preset database and the first configuration item are concatenated to generate a query statement, and the edit version identifier and the fourth version identifier in the second preset database are updated.
9. A configuration item query device, characterized in that: include: A first determination module is used to determine a configuration item of a configuration value to be queried in an application; A first generating module, used to generate a query statement according to the configuration item and the version identifier of the application; A query module, which queries a first preset database according to the query statement, and if update information corresponding to the query statement is found in the first preset database, determines the update information as update information of the configuration item; wherein the first preset database stores the configuration items updated by each version of the application and the update information corresponding to the updated configuration items; The second determining module is used to determine the configuration value query result of the configuration item from the update information.
10. A configuration item updating device, characterized in that: include: an acquisition module, configured to acquire, when a configuration item of an application is updated, a fourth version identifier of the application, and a first configuration result of the application after the configuration item is updated and a second configuration result of the application before the configuration item is updated; A third determining module, configured to determine, according to a difference between the first configuration result and the second configuration result, a first configuration item having an update in the application and update information of the first configuration item; A second generating module, configured to generate a query statement according to the fourth version identifier and the first configuration item; The storage module is used to store the query statement and the update information of the first configuration item in a first preset database in correspondence.
11. A computer device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps of the configuration item query method according to any one of claims 1 to 6 or the steps of the configuration item update method according to any one of claims 7 to 8.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, which are suitable for being loaded by a processor to execute the steps of the configuration item query method according to any one of claims 1 to 6 or the steps of the configuration item update method according to any one of claims 7 to 8.
Citation Information
Cited By
Configuration system and method, equipment and storage medium
CN120610749A
