Updating method and system of configuration file and program product

Incremental hot updates of configuration files are achieved by using timestamps and update flags in sub-configuration files. This solves the service interruption problem caused by configuration file updates, improves system response speed and stability, and is suitable for multi-language environments.

CN121541913APending Publication Date: 2026-02-17AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511685088.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-17
Publication Date
2026-02-17

AI Technical Summary

Technical Problem

In existing technologies, updating configuration files requires restarting the application, which leads to business interruption and connection pool reconstruction, resulting in long processing times. Furthermore, existing hot update methods are not universally applicable to information systems written in non-Java languages.

Method used

By using the timestamp and update flag of the sub-configuration file, it is determined whether the configuration file has been updated. If it has not been updated, it is merged into the target cache space. Finally, the configuration nodes in the target cache space are stored in the main configuration file to achieve incremental hot update.

Benefits of technology

It avoids service interruptions when updating configuration files, improves system response speed and stability, ensures the real-time and accuracy of configuration information, provides rollback capability, and is suitable for multi-language environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121541913A_ABST
    Figure CN121541913A_ABST
Patent Text Reader

Abstract

The invention provides a configuration file updating method and system and a program product, and relates to the technical field of computers.The method comprises the steps that whether a sub-configuration file is updated or not is determined based on a timestamp of the sub-configuration file, the sub-configuration file comprises part of configuration nodes of an application program, and the configuration nodes comprise the minimum configuration item of the application program; under the condition that the sub-configuration file is updated, reading an updating identification bit of the sub-configuration file; under the condition that the updating identification bit indicates that updating is not carried out, the configuration nodes in the sub-configuration files are merged into the target cache space; the configuration nodes in the target cache space are stored in a main configuration file, the main configuration file comprises all effective configuration nodes capable of being loaded by the application program, and the technical problems that in the related technology, the whole configuration file is updated, the application program needs to be restarted, and service interruption exists are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a method, system, and program product for updating configuration files. Background Technology

[0002] In related technologies, the following problems exist when updating the application's configuration file:

[0003] (1) During the current program operation, after modifying the configuration file, it is necessary to restart and reread the configuration file for it to take effect, which causes business interruption and connection pool reconstruction, taking tens of seconds to several minutes.

[0004] (2) Some existing hot update methods rely on Java's mechanism and are not universal for information systems written in other languages. Summary of the Invention

[0005] The main purpose of this application is to provide a method, system, and program product for updating configuration files, so as to at least solve the technical problem in the related art that updating the entire configuration file requires restarting the application, resulting in service interruption.

[0006] To achieve the above objectives, according to one aspect of this application, a method for updating a configuration file is provided. The method includes: determining whether a sub-configuration file has been updated based on a timestamp of the sub-configuration file, wherein the sub-configuration file includes: partial configuration nodes of an application, the configuration nodes including: the minimum configuration items of the application; if the sub-configuration file has been updated, reading an update flag of the sub-configuration file, wherein the update flag indicates whether the configuration nodes in the sub-configuration file have been merged into a target cache space; if the update flag indicates no update, merging the configuration nodes in the sub-configuration file into the target cache space; and storing the configuration nodes in the target cache space into a main configuration file, wherein the main configuration file includes: all effective configuration nodes that can be loaded by the application.

[0007] Furthermore, the target cache space records: a main configuration object, a list of node identifiers, and a sub-configuration effective timestamp. The main configuration object is used to cache all configuration nodes of the main configuration file. The list of node identifiers includes the identifiers of all configuration nodes in the main configuration object. The sub-configuration effective timestamp includes the timestamp when the sub-configuration file becomes effective in the application.

[0008] Further, determining whether the sub-configuration file has been updated based on its timestamp includes: reading the sub-configuration's effective timestamp from the target cache space; reading the latest modification timestamp of the sub-configuration file to obtain a modification timestamp; comparing the sub-configuration's effective timestamp and the modification timestamp to obtain a comparison result; and determining whether the sub-configuration file has been updated based on the comparison result.

[0009] Further, based on the comparison result, determining whether the sub-configuration file has been updated includes: if the comparison result indicates that the effective timestamp and the modification timestamp of the sub-configuration file are inconsistent, determining that the sub-configuration file has been updated; if the comparison result indicates that the effective timestamp and the modification timestamp of the sub-configuration file are consistent, determining that the sub-configuration file has not been updated.

[0010] Further, merging the configuration nodes in the sub-configuration file into the target cache space includes: searching for the identifier of each configuration node in the sub-configuration file in the node identifier list to obtain the search result; if the search result indicates that the identifier of any configuration node in the sub-configuration file already exists in the node identifier list, then the configuration node is used to overwrite the corresponding configuration node in the main configuration object; if the search result indicates that the identifier of any configuration node in the sub-configuration file does not exist in the node identifier list, then the configuration node is added to the main configuration object, and the identifier of the configuration node is added to the node identifier list.

[0011] Furthermore, before merging the configuration nodes in the sub-configuration file into the target cache space, the method further includes: backing up the main configuration object, the node identifier list, and the sub-configuration effective timestamp in the target cache space to obtain the backed-up main configuration object, the backed-up node identifier list, and the backed-up sub-configuration effective timestamp; if a merging failure occurs during the merging of the configuration nodes in the sub-configuration file into the target cache space, or if a storage failure occurs during the storage of the configuration nodes in the target cache space into the main configuration file, the target cache space is rolled back based on the backed-up main configuration object, the backed-up node identifier list, and the backed-up sub-configuration effective timestamp, and the main configuration object in the rolled-back target cache space is stored in the main configuration file.

[0012] Furthermore, before merging the configuration nodes in the sub-configuration file into the target cache space, the method further includes: controlling the data read and write permissions of the target cache space through a read-write lock; and restoring the data read and write permissions of the target cache space after storing the configuration nodes in the target cache space into the main configuration file.

[0013] To achieve the above objectives, according to another aspect of this application, a configuration file update system is provided. This system is used to execute the configuration file update method, comprising: a scanner for determining whether a sub-configuration file has been updated based on a timestamp of the sub-configuration file, wherein the sub-configuration file includes: partial configuration nodes of an application, the configuration nodes including: the minimum configuration items of the application; a flag verifier for reading an update flag of the sub-configuration file if the sub-configuration file has been updated, wherein the update flag indicates whether the configuration nodes in the sub-configuration file have been merged into a target cache space; a node merger for merging the configuration nodes in the sub-configuration file into the target cache space if the update flag indicates no update; and a persistent storage for storing the configuration nodes in the target cache space into a main configuration file, wherein the main configuration file includes: all configuration nodes that can be loaded and activated by the application.

[0014] Furthermore, the configuration file update system also includes a writeback unit, used to roll back the target cache space and store the main configuration object in the rolled-back target cache space to the main configuration file in the event that a merging failure occurs during the process of merging the configuration nodes in the sub-configuration file into the target cache space, or in the event that a storage failure occurs during the process of storing the configuration nodes in the target cache space into the main configuration file.

[0015] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored executable program, wherein, when the executable program is executed, it controls the device where the computer-readable storage medium is located to perform the configuration file update method.

[0016] According to another aspect of this application, an electronic device is provided, comprising: a memory storing an executable program; and a processor for running the program, wherein the program executes the configuration file update method during runtime.

[0017] According to another aspect of this application, a computer program product is provided, including computer instructions that, when executed by a processor, implement the steps of the configuration file update method.

[0018] In this application, the following method is adopted: Based on the timestamp of the sub-configuration file, it is determined whether the sub-configuration file has been updated. The sub-configuration file includes partial configuration nodes of the application, and each configuration node includes the minimum configuration items of the application. If the sub-configuration file has been updated, the update flag of the sub-configuration file is read. The update flag indicates whether the configuration nodes in the sub-configuration file have been merged into the target cache space. If the update flag indicates no update, the configuration nodes in the sub-configuration file are merged into the target cache space. The configuration nodes in the target cache space are stored in the main configuration file. The main configuration file includes all effective configuration nodes that can be loaded by the application. This solves the technical problem in related technologies where updating the entire configuration file requires restarting the application, resulting in service interruption. In this application, the main configuration file is updated using the timestamp and update flag of the sub-configuration file, avoiding the need to restart the application and cause service interruption as in related technologies, thus achieving the technical effect of incremental hot updating of the configuration file. Attached Figure Description

[0019] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0020] Figure 1 A hardware structure block diagram of a mobile terminal for performing a configuration file update method according to an embodiment of this application is shown;

[0021] Figure 2 A flowchart illustrating a method for updating a configuration file according to an embodiment of this application is shown.

[0022] Figure 3 A structural block diagram of a configuration file update system provided according to an embodiment of this application is shown.

[0023] Figure 4 A structural block diagram of another configuration file update system provided according to an embodiment of this application is shown.

[0024] Figure 5 A structural block diagram of a configuration file updating device provided according to an embodiment of this application is shown. Detailed Implementation

[0025] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0028] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:

[0029] Main configuration file: refers to the single configuration file or collection thereof that is loaded and takes effect by the application at runtime. It contains all currently valid configuration nodes of the system and can be persistently stored in structured formats such as YAML (a human-readable data serialization format), JSON (a lightweight data interchange format), CSV (a simple file format), and Properties (a common configuration file format in Java, typically used to store configuration information in key-value pair form).

[0030] Sub-configuration files: These are configuration files stored separately from the main configuration file and contain only some configuration nodes or partial changes. Sub-configuration files perform incremental updates to the main configuration file without replacing its entire content.

[0031] Memory Cache: The memory cache maintains a copy of the "main configuration object (used to record the configuration files in the main configuration file)", "main configuration node ID list" and "sub-configuration effective timestamp" data, as well as the corresponding backup data of the previous version, for business threads to read with zero copy; at the same time, it provides version numbers or read-write locks to ensure thread safety in concurrent scenarios.

[0032] It should be noted that the information collected in this application (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of this data all comply with relevant laws, regulations, and standards, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding access points are provided for users to choose to authorize or refuse. For example, interfaces are set up between this system and relevant users or organizations, providing users with corresponding access points to choose to agree to or refuse automated decision-making results; if the user chooses to refuse, the process proceeds to the expert decision-making stage.

[0033] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.

[0034] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a configuration file update method according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0035] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the configuration file update method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The transmission device 106 is used to receive or send data via a network. Specific examples of the aforementioned networks may include wireless networks provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0036] This embodiment provides a method that runs on a mobile terminal, computer terminal, or similar computing device. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0037] Figure 2 This is a flowchart illustrating a configuration file update method according to an embodiment of this application. Figure 2 As shown, the method includes the following steps:

[0038] Step S201: Based on the timestamp of the sub-configuration file, determine whether the sub-configuration file has been updated. The sub-configuration file includes: partial configuration nodes of the application, and the configuration nodes include: the minimum configuration items of the application.

[0039] The timestamp of the sub-configuration file mentioned above may include: the latest modification timestamp of the sub-configuration file, and the effective timestamp of the sub-configuration file recorded in the memory cache. By comparing the modification timestamp and the effective timestamp, it can be determined whether the sub-configuration file has been updated. If there is no update, the sub-configuration file can continue to be scanned periodically to see if there is an update. If there is an update, step S202 can be executed.

[0040] Step S202: If the sub-configuration file is updated, read the update flag bit of the sub-configuration file, whereby the update flag bit is used to indicate whether the configuration node in the sub-configuration file is merged into the target cache space.

[0041] If a sub-configuration file is updated, the update flag of the sub-configuration file can be read to determine whether the sub-configuration file should be merged into the memory cache (i.e., the target cache space).

[0042] Step S203: If the update flag indicates that it has not been updated, merge the configuration nodes in the sub-configuration file into the target cache space.

[0043] If the update flag indicates that the configuration nodes in the sub-configuration file have not been updated, the configuration nodes in the sub-configuration file can be merged into the target cache space to achieve incremental updates of the configuration files in the target cache space.

[0044] When the update flag indicates that the sub-configuration file has been updated, it can be determined that the sub-configuration file has been merged into the target cache space. Therefore, it is not necessary to merge the configuration nodes in the sub-configuration file into the target cache space again, which avoids the repeated merging of sub-configuration files and ensures idempotency.

[0045] Step S204: Store the configuration nodes in the target cache space into the main configuration file, wherein the main configuration file includes all effective configuration nodes that can be loaded by the application.

[0046] In this embodiment, the main configuration object in the target cache space can be persistently stored in the main configuration file, so that the configuration nodes in the target cache space can be stored in the main configuration file. This achieves the purpose of incrementally updating the main configuration file through the sub-configuration file without having to replace the complete content of the main configuration file.

[0047] Through the above steps, in this embodiment, the main configuration file is updated using the timestamp and update flag of the sub-configuration file. This avoids the need to restart the application and cause service interruption as in related technologies where updating the entire configuration file directly requires restarting the application. This achieves the technical effect of incremental hot updating of the configuration file, thus solving the technical problem of service interruption caused by updating the entire configuration file in related technologies.

[0048] Optionally, the target cache space records: a main configuration object, a list of node identifiers, and sub-configuration effective timestamps. The main configuration object is used to cache all configuration nodes of the main configuration file. The list of node identifiers includes the identifiers of all configuration nodes in the main configuration object. The sub-configuration effective timestamps include the timestamps when the sub-configuration files take effect in the application.

[0049] The aforementioned main configuration object can be a representation of the entire main configuration file in a memory cache, containing all configuration nodes required by the application during its current runtime. The main configuration object can be loaded into memory when the application starts and changes in real-time during runtime based on updates, ensuring that business threads can read the latest configuration information.

[0050] The node identifier list mentioned above is a collection containing unique identifiers for all configuration nodes in the main configuration object. This identifier can be a key, ID, or node path, and is used for quickly locating and identifying configuration nodes. When performing incremental updates to configuration nodes, the node identifier list can be used to find and locate the nodes that need to be updated or added, ensuring the accuracy and efficiency of the update.

[0051] The sub-configuration effective timestamp can record when each sub-configuration file last took effect in the application. For example, the time when the contents of a sub-configuration file were merged into the main configuration object after it was last successfully updated and began to have an impact on the application.

[0052] In this embodiment, the modification timestamp of the sub-configuration file can be checked periodically and compared with the sub-configuration effective timestamp to determine whether the sub-configuration file needs to be updated to the memory cache.

[0053] By using a memory cache, applications can efficiently and quickly read and update configuration files without frequent disk access, thus improving system responsiveness and stability. Simultaneously, by recording node identifiers and sub-configuration effective timestamps, the accuracy and idempotency of update operations are ensured, unnecessary duplicate updates are avoided, and the ability to roll back in case of update failure is provided.

[0054] Optionally, determining whether the sub-configuration file has been updated based on its timestamp includes: reading the sub-configuration's effective timestamp from the target cache space; reading the latest modification timestamp of the sub-configuration file to obtain the modification timestamp; comparing the sub-configuration's effective timestamp and modification timestamp to obtain a comparison result; and determining whether the sub-configuration file has been updated based on the comparison result.

[0055] For example, the effective timestamp of each sub-configuration file can be read from the target cache space, which can record when the sub-configuration file last took effect in the application.

[0056] It can also read the latest modification timestamp of the sub-configuration file. This allows you to obtain the last modification time of the sub-configuration file.

[0057] The latest modification timestamp of the read sub-configuration file is compared with the effective timestamp of the sub-configuration recorded in the target cache space. Based on the comparison result, it is determined whether the sub-configuration file has been updated. If the sub-configuration file has been updated, an incremental update can be triggered. If the sub-configuration file "has not been updated," it can be determined that the sub-configuration file does not require additional data processing.

[0058] By comparing timestamps, it is possible to efficiently determine whether sub-configuration files need to be updated, avoiding unnecessary file reading and data processing, reducing resource consumption, and ensuring the real-time nature and accuracy of configuration information.

[0059] Optionally, based on the comparison results, determining whether the sub-configuration file has been updated includes: if the comparison results indicate that the sub-configuration's effective timestamp and modification timestamp are inconsistent, determining that the sub-configuration file has been updated; if the comparison results indicate that the sub-configuration's effective timestamp and modification timestamp are consistent, determining that the sub-configuration file has not been updated.

[0060] If the latest modification timestamp is later than the child configuration's effective timestamp, it means that the child configuration file has been modified since the last update, and the child configuration file is "updated". If the latest modification timestamp is not later than (earlier than or equal to) the child configuration's effective timestamp, it means that the child configuration file has not been modified since the last update, and the child configuration file is "not updated".

[0061] Optionally, merging configuration nodes in the sub-configuration file into the target cache space includes: searching for the identifier of each configuration node in the sub-configuration file in the node identifier list to obtain the search result; if the search result indicates that the identifier of any configuration node in the sub-configuration file already exists in the node identifier list, then the configuration node is used to overwrite the corresponding configuration node in the main configuration object; if the search result indicates that the identifier of any configuration node in the sub-configuration file does not exist in the node identifier list, then the configuration node is added to the main configuration object, and the identifier of the configuration node is added to the node identifier list.

[0062] When a sub-configuration file needs to be merged, you can iterate through all the configuration nodes in the sub-configuration file and query each node's identifier (which may be a node ID, path, or other unique identifier) ​​to see if it appears in the node identifier list of the target cache space.

[0063] If the search result indicates that the identifier of a certain configuration node in the sub-configuration file already exists in the node identifier list, this means that there is already a corresponding configuration node for that configuration node in the main configuration object. In this case, the configuration node in the sub-configuration file can be used to override the corresponding configuration node in the main configuration object, that is, to update the configuration information of the node in the main configuration.

[0064] If the search results indicate that the identifier of a configuration node in a sub-configuration file does not exist in the node identifier list, it means that the configuration node is a newly added configuration node. In this case, you can add the configuration node to the main configuration object and simultaneously add the identifier of the configuration node to the node identifier list to ensure that any future updates to the node can be correctly tracked and processed.

[0065] The target cache space is updated based on the sub-configuration files and the node identifier list, avoiding a full update of the main configuration file, reducing resource consumption and update risks, while maintaining the real-time performance and accuracy of the configuration. This approach is particularly important in high-concurrency scenarios with frequent configuration changes, ensuring that configuration changes take effect promptly without affecting running business threads due to update operations.

[0066] Optionally, before merging the configuration nodes in the sub-configuration files into the target cache space, the method further includes: backing up the main configuration object, the node identifier list, and the sub-configuration effective timestamps in the target cache space to obtain the backed-up main configuration object, the backed-up node identifier list, and the backed-up sub-configuration effective timestamps; if a merging failure occurs during the merging of configuration nodes in the sub-configuration files into the target cache space, or if a storage failure occurs during the storage of configuration nodes in the target cache space into the main configuration file, the target cache space is rolled back based on the backed-up main configuration object, the backed-up node identifier list, and the backed-up sub-configuration effective timestamps, and the main configuration object in the rolled-back target cache space is stored in the main configuration file.

[0067] In this embodiment, before starting any configuration file update operation, the current main configuration object, the complete list of node identifiers, and the effective timestamps of all sub-configuration files can be backed up in the target cache space. This backup data can be stored in the target cache space as a fallback point to deal with any potential failures during the update process.

[0068] If merging configuration nodes from sub-configuration files into the target cache space fails, or if persisting the main configuration object from the target cache space to the main configuration file on disk fails, a rollback mechanism can be triggered. For example, a rollback can be performed using backup data (e.g., the backed-up main configuration object, the backed-up list of node identifiers, and the backed-up timestamps of the sub-configurations). The backed-up main configuration object, node identifier list, and sub-configuration timestamps can be restored to the target cache space, returning it to its state before the update.

[0069] After the data in the target cache space is rolled back, the main configuration file in the target cache space can be persisted back to the main configuration file, restoring the original state of the configuration file. At the same time, the "update flag" of the corresponding sub-configuration file will also be set back to "not updated", ensuring that any new changes can be correctly detected during the next scan.

[0070] This backup and rollback mechanism ensures the atomicity and consistency of configuration updates. Even if errors occur during the update process, it can quickly and safely restore to a previous stable state, avoiding system failures and service interruptions caused by configuration issues, and enhancing the reliability and robustness of applications. It also addresses the problem of hot-updating configuration files in related technologies, where failure to automatically roll back to the previous effective version could lead to system crashes and significant losses.

[0071] Optionally, before merging the configuration nodes in the sub-configuration file into the target cache space, the method further includes: controlling the data read and write permissions of the target cache space through a read-write lock; and restoring the data read and write permissions of the target cache space after storing the configuration nodes in the target cache space into the main configuration file.

[0072] The read-write lock described above is a locking mechanism that allows multiple readers to access data simultaneously, but only one writer is allowed to lock the data for modification. This means that multiple read operations can occur concurrently, but write operations must exclusively hold the lock until completion, thus preventing data inconsistency or corruption that might result from concurrent reads during the write process.

[0073] In this embodiment, before the configuration nodes are merged into the target cache space, a read-write lock can be used to lock the target cache space to prevent other write operations (including merging other configuration nodes and possible modification operations by other modules), but without affecting existing read operations. This ensures that the content of the target cache space is not changed by other operations during the merging of configuration nodes of sub-configuration files, thereby avoiding data conflicts.

[0074] After configuring the node to be stored in the main configuration file, release the read-write lock to unlock the target cache space to allow writing.

[0075] By using the read-write locks described above, it is ensured that the data in the target cache space is in a controlled state when incremental hot updates of the configuration file are performed. This not only guarantees the integrity and consistency of the data, but also maximizes the system performance of the application. Especially in high-concurrency environments, it can effectively manage and balance read and write operations, avoiding potential data races and inconsistency issues.

[0076] To enable those skilled in the art to better understand the technical solution of this application, the implementation process of the configuration file update method of this application will be described in detail below with reference to specific embodiments.

[0077] This embodiment relates to a specific method for updating a configuration file, including the following steps:

[0078] 1. Periodically traverse the metadata of all sub-configuration files, extract the "latest modification timestamp," and compare it with the "effective timestamp" recorded in the memory cache to determine whether the sub-configuration file has undergone any new changes. If it is determined to be "changed," a trigger signal is output downstream. If it is determined to be "not changed," the periodic scanning continues.

[0079] 2. After receiving the scanner's trigger signal, the "update flag" in the corresponding sub-configuration file can be read. Subsequent processes are allowed to continue only if the flag shows "not updated"; if the flag is already "updated", the current round of processing ends directly to avoid repeated merging and ensure idempotency.

[0080] 3-node merging:

[0081] ① Back up the "Main Configuration Object", "Main Configuration Node ID List" and "Sub-Configuration Effective Timestamp" data in the memory cache separately as "Main Configuration Object Backup", "Main Configuration Node ID List Backup" and "Sub-Configuration Effective Timestamp Backup" to prevent rollback if subsequent merging and persistence steps fail.

[0082] ② After the identifier verification passes, parse the sub-configuration file to extract all nodes to be updated and their unique IDs. Then, search for them in the node ID list of the main configuration file:

[0083] If the ID already exists, replace it with the content of the child configuration node in its original position;

[0084] If the ID does not exist, a new node will be added and the ID list in the main configuration will be expanded synchronously.

[0085] ③ The merged result is written to the main configuration object in memory in real time, ensuring that business threads can read the latest configuration immediately.

[0086] ④ If the merge is successful, the persistent module is called; if the merge fails, the writeback module is called to perform a memory rollback.

[0087] (4) Persistent storage:

[0088] ① Write the updated main configuration object in memory to disk and persist it as the main configuration file;

[0089] ② Set the "update flag" of the corresponding sub-configuration file to "updated" and immediately synchronize it to the disk.

[0090] 5. Write-back is used to handle two types of scenarios: node merging failure and persistence failure.

[0091] ① Read the data of "backup of main configuration object in memory cache", "backup of main configuration node ID list" and "backup of sub-configuration effective timestamp", and update and overwrite the "main configuration object", "main configuration node ID list" and "sub-configuration effective timestamp" respectively.

[0092] ② Write the updated main configuration object from memory to disk and restore the main configuration file.

[0093] ③ Set the "update flag" of the corresponding sub-configuration file to "not updated" and write back to restore the sub-configuration file.

[0094] In this embodiment, the sub-configuration to be incrementally merged is located using a dual trigger condition of "timestamp + update flag"; the node is located in the main configuration using the "unique node ID" and is atomically replaced or added; the configuration state before the update in the backup provides the ability to roll back if the update fails; after the update is completed, the memory image is synchronously written to disk and the sub-configuration flag is written back, achieving a closed loop. This embodiment allows merging to be triggered only when a sub-configuration file undergoes a true incremental change, with a merging granularity of "node level," minimizing the scope of configuration effectiveness. It can also update existing configuration nodes and add new configuration nodes. This embodiment allows sub-configuration files to take effect immediately without restarting the application, possessing idempotency and rollback capabilities, and is not dependent on any specific programming language or framework.

[0095] This application also provides a configuration file update system and a configuration file update method for performing the update.

[0096] Figure 3 A structural block diagram of a configuration file update system according to an embodiment of this application is shown, such as... Figure 3 As shown, it includes: a scanner, a flag checker, a node merger, and persistent storage.

[0097] The system includes: a scanner to determine if a sub-configuration file has been updated based on its timestamp; a sub-configuration file containing partial configuration nodes of the application, including the minimum configuration items of the application; a flag verifier to read the update flag of the sub-configuration file if it has been updated, indicating whether the configuration nodes in the sub-configuration file should be merged into the target cache space; a node merger to merge the configuration nodes in the sub-configuration file into the target cache space if the update flag indicates no update; and a persistent storage to store the configuration nodes in the target cache space into the main configuration file, which includes all configuration nodes that can be loaded and activated by the application.

[0098] Figure 4 A structural block diagram of a configuration file update system according to an embodiment of this application is shown, such as... Figure 4 As shown, Figure 4 As shown, it includes: scanner, flag verifier, node merger, persistentizer, writeback, memory cache, main configuration file, and sub-configuration files, as detailed below:

[0099] (1) Scanner module (corresponding to the scanner mentioned above):

[0100] It is responsible for periodically traversing the metadata of all sub-configuration files, extracting the "latest modification timestamp," and comparing it with the "effective timestamp" recorded in memory to determine whether the sub-configuration file has undergone any new changes. If it is determined that "it has been changed," a trigger signal is output to the downstream module. If it is determined that "it has not been changed," the periodic scanning continues.

[0101] (2) Flag bit verifier module (corresponding to the flag bit verifier):

[0102] Upon receiving the scanner's trigger signal, the "update flag" in the corresponding sub-configuration file is read. Subsequent processes are allowed to continue only if the flag shows "not updated"; if the flag is already "updated", the current round of processing ends directly to avoid duplicate merging and ensure idempotency.

[0103] (3) Node merger module (corresponding to the node merger):

[0104] ① Back up the "Main Configuration Object", "Main Configuration Node ID List" and "Sub-Configuration Effective Timestamp" data in the memory cache (corresponding to the target cache space) into "Main Configuration Object Backup", "Main Configuration Node ID List Backup" and "Sub-Configuration Effective Timestamp Backup" respectively, to prevent rollback if subsequent merging and persistence steps fail.

[0105] ② After the flag verification passes (i.e., the flag has not changed), the sub-configuration file is parsed to extract all nodes to be updated and their unique IDs (i.e., node identifiers). Then, the nodes are searched in the node ID list (corresponding to the node identifier list) of the main configuration file.

[0106] If the ID already exists in the memory cache, replace it in place with the content of the child configuration node;

[0107] If the ID does not exist in the memory cache, a new configuration node is appended and the ID list of the main configuration is expanded synchronously.

[0108] ③ The merged result is written to the main configuration object in memory in real time, ensuring that business threads can read the latest configuration immediately.

[0109] ④ If the merge is successful, the persistent module is called; if the merge fails, the writeback module is called to perform a memory rollback.

[0110] (4) Persistentizer module (corresponding to persistent memory):

[0111] ① Write the updated main configuration object in memory to disk and persist it as the main configuration file;

[0112] ② Set the "update flag" of the corresponding sub-configuration file to "updated" and immediately synchronize it to the disk.

[0113] It should be noted that the memory cache maintains a copy of the "main configuration object", "main configuration node ID list" and "sub-configuration effective timestamp" data, as well as the corresponding backup data of the previous version, for business threads to read with zero copy; at the same time, it provides version numbers or read-write locks to ensure thread safety in concurrent scenarios.

[0114] In this embodiment, the main configuration file can refer to a single configuration file or a collection thereof that is loaded and takes effect by the application at runtime. It contains all currently valid configuration nodes of the system and is typically persistently stored in structured formats such as YAML, JSON, CSV, and Properties.

[0115] In this embodiment, a sub-configuration file can refer to a configuration file stored separately from the main configuration file, containing only some configuration nodes or partial changes. The sub-configuration file performs incremental updates to the main configuration file without replacing the entire content of the main configuration file.

[0116] Optionally, the configuration file update system also includes a writeback mechanism, used to roll back the target cache space and store the main configuration object in the rolled-back target cache space to the main configuration file if a merging failure occurs during the merging of configuration nodes in the sub-configuration file into the target cache space, or if a storage failure occurs during the storage of configuration nodes in the target cache space into the main configuration file.

[0117] like Figure 4 As shown, the configuration file update system also includes a writeback module (corresponding to the writeback process) to handle two scenarios: node merging failure and persistence failure, as detailed below:

[0118] ① Read the data of "backup of main configuration object in memory cache", "backup of main configuration node ID list" and "backup of sub-configuration effective timestamp", and update and overwrite the "main configuration object", "main configuration node ID list" and "sub-configuration effective timestamp" respectively.

[0119] ② Write the updated main configuration object from memory to disk and restore the main configuration file.

[0120] ③ Set the "update flag" of the corresponding sub-configuration file to "not updated" and write back to restore the sub-configuration file.

[0121] In this embodiment, a scanner module periodically scans the timestamps of sub-configuration files and compares them with the effective timestamps. This allows for near real-time acquisition of configuration update status while avoiding duplicate and invalid updates. A flag bit validator reads the "update flag bit" from the corresponding sub-configuration file, serving as a crucial criterion for determining whether a configuration update is needed, preventing abnormal updates caused by accidental manipulation of sub-configuration files. A node ID mechanism ensures that each update is a precise update to a specific node, preventing duplicate additions of the same node and providing idempotency. A node merger enables the addition of incremental configurations and the updating of existing configurations; simultaneously, it backs up historical configurations, providing rollback capabilities. A persistent module ensures the persistence and readability of the currently effective configuration; the configuration information currently in memory can be determined by reading the configuration file. A write-back module ensures the atomicity of each update and persistence, guaranteeing rollback in case of update failure, preventing system crashes and configuration data loss due to update failures, and improving system robustness during hot updates.

[0122] This application also provides a configuration file updating device. It should be noted that the configuration file updating device of this application can be used to execute the configuration file updating method provided in this application. This device is used to implement the above embodiments and preferred embodiments, and details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0123] The following describes the configuration file updating device provided in the embodiments of this application.

[0124] Figure 5 This is a structural block diagram of a configuration file updating device according to an embodiment of this application. Figure 5 As shown, the device includes: a determining unit 51, a reading unit 52, a merging unit 53, and a storage unit 54.

[0125] The determining unit 51 is used to determine whether the sub-configuration file has been updated based on the timestamp of the sub-configuration file. The sub-configuration file includes: partial configuration nodes of the application, and the configuration nodes include: the minimum configuration items of the application.

[0126] The reading unit 52 is used to read the update flag of the sub-configuration file when there is an update in the sub-configuration file, wherein the update flag is used to indicate whether the configuration node in the sub-configuration file is merged into the target cache space;

[0127] Merging unit 53 is used to merge the configuration nodes in the sub-configuration file into the target cache space when the update flag indicates that it has not been updated;

[0128] Storage unit 54 is used to store configuration nodes in the target cache space to the main configuration file, wherein the main configuration file includes all effective configuration nodes that can be loaded by the application.

[0129] In the configuration file update apparatus provided in this embodiment of the invention, the existence of an update for a sub-configuration file can be determined by the timestamp of the sub-configuration file determined by the determining unit 51. The sub-configuration file includes partial configuration nodes of the application, and each configuration node includes the minimum configuration items of the application. If the sub-configuration file is updated, the reading unit 52 reads the update flag of the sub-configuration file. The update flag indicates whether the configuration nodes in the sub-configuration file have been merged into the target cache space. If the update flag indicates no update, the merging unit 53 merges the configuration nodes in the sub-configuration file into the target cache space. The storage unit 54 stores the configuration nodes in the target cache space into the main configuration file. The main configuration file includes all effective configuration nodes that can be loaded by the application. This solves the technical problem in related technologies where updating the entire configuration file requires restarting the application, resulting in service interruption. In this embodiment, updating the main configuration file using the timestamp and update flag of the sub-configuration file avoids the service interruption caused by directly updating the entire configuration file in related technologies, thus achieving the technical effect of incremental hot updating of the configuration file.

[0130] Furthermore, the target cache space records: a main configuration object, a list of node identifiers, and sub-configuration effective timestamps. The main configuration object is used to cache all configuration nodes of the main configuration file. The list of node identifiers includes the identifiers of all configuration nodes in the main configuration object. The sub-configuration effective timestamps include the timestamps when the sub-configuration files take effect in the application.

[0131] Furthermore, the determining unit includes: a first reading subunit, used to read the sub-configuration effective timestamp from the target cache space; a second reading subunit, used to read the latest modification timestamp of the sub-configuration file to obtain the modification timestamp; a comparison subunit, used to compare the sub-configuration effective timestamp and the modification timestamp to obtain a comparison result; and a determining subunit, used to determine whether the sub-configuration file has been updated based on the comparison result.

[0132] Furthermore, the determination sub-unit includes: a first determination module, used to determine that the sub-configuration file has been updated when the comparison result indicates that the sub-configuration effective timestamp and modification timestamp are inconsistent; and a second determination module, used to determine that the sub-configuration file has not been updated when the comparison result indicates that the sub-configuration effective timestamp and modification timestamp are consistent.

[0133] Furthermore, the merging unit includes: a search subunit, used to search for the identifier of each configuration node in the sub-configuration file in the node identifier list to obtain the search result; an overwrite subunit, used to overwrite the corresponding configuration node in the main configuration object if the search result indicates that the identifier of any configuration node in the sub-configuration file already exists in the node identifier list; and a processing subunit, used to add the configuration node in the main configuration object and add the identifier of the configuration node in the node identifier list if the search result indicates that the identifier of any configuration node in the sub-configuration file does not exist in the node identifier list.

[0134] Furthermore, the configuration file update device also includes: a backup unit, used to back up the main configuration object, node identifier list, and sub-configuration effective timestamp in the target cache space before merging the configuration nodes in the sub-configuration file into the target cache space, to obtain the backed-up main configuration object, the backed-up node identifier list, and the backed-up sub-configuration effective timestamp; and a rollback unit, used to roll back the target cache space based on the backed-up main configuration object, the backed-up node identifier list, and the backed-up sub-configuration effective timestamp, and to store the main configuration object in the rolled-back target cache space into the main configuration file, in the event that a merging failure occurs during the merging of the configuration nodes in the sub-configuration file into the target cache space, or in the event that a storage failure occurs during the storage of the configuration nodes in the target cache space into the main configuration file.

[0135] Furthermore, the configuration file update device also includes: a control unit, used to control the data read and write permissions of the target cache space by means of a read-write lock before merging the configuration nodes in the sub-configuration file into the target cache space; and a recovery unit, used to restore the data read and write permissions of the target cache space after storing the configuration nodes in the target cache space into the main configuration file.

[0136] The configuration file updating device includes a processor and a memory. The aforementioned determining unit 51, reading unit 52, merging unit 53, and storage unit 54 are all stored as program units in the memory. The processor executes the aforementioned program units stored in the memory to implement the corresponding functions. All of the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0137] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and by adjusting kernel parameters, the main configuration file can be updated using the timestamps and update flags of the sub-configuration files. This avoids the need to restart the application and cause service interruptions, as required by related technologies that directly update the entire configuration file. This achieves the technical effect of incremental hot updates of the configuration file.

[0138] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0139] This invention provides a computer-readable storage medium including a stored program, wherein, when the program is running, a method for controlling the device where the computer-readable storage medium is located to perform a configuration file update is provided.

[0140] Specifically, the methods for updating the configuration file include:

[0141] Step S201: Based on the timestamp of the sub-configuration file, determine whether the sub-configuration file has been updated. The sub-configuration file includes: partial configuration nodes of the application, and the configuration nodes include: the minimum configuration items of the application.

[0142] The timestamp of the sub-configuration file mentioned above may include: the latest modification timestamp of the sub-configuration file, and the effective timestamp of the sub-configuration file recorded in the memory cache. By comparing the modification timestamp and the effective timestamp, it can be determined whether the sub-configuration file has been updated. If there is no update, the sub-configuration file can continue to be scanned periodically to see if there is an update. If there is an update, step S202 can be executed.

[0143] Step S202: If the sub-configuration file is updated, read the update flag bit of the sub-configuration file, whereby the update flag bit is used to indicate whether the configuration node in the sub-configuration file is merged into the target cache space.

[0144] If a sub-configuration file is updated, the update flag of the sub-configuration file can be read to determine whether the sub-configuration file should be merged into the memory cache (i.e., the target cache space).

[0145] Step S203: If the update flag indicates that it has not been updated, merge the configuration nodes in the sub-configuration file into the target cache space.

[0146] If the update flag indicates that the configuration nodes in the sub-configuration file have not been updated, the configuration nodes in the sub-configuration file can be merged into the target cache space to achieve incremental updates of the configuration files in the target cache space.

[0147] When the update flag indicates that the sub-configuration file has been updated, it can be determined that the sub-configuration file has been merged into the target cache space. Therefore, it is not necessary to merge the configuration nodes in the sub-configuration file into the target cache space again, which avoids the repeated merging of sub-configuration files and ensures idempotency.

[0148] Step S204: Store the configuration nodes in the target cache space into the main configuration file, wherein the main configuration file includes all effective configuration nodes that can be loaded by the application.

[0149] In this embodiment, the main configuration object in the target cache space can be persistently stored in the main configuration file, thereby storing the configuration nodes in the target cache space in the main configuration file. This achieves the goal of incrementally updating the main configuration file through the sub-configuration file without having to replace the complete content of the main configuration file.

[0150] Optionally, based on the timestamp of the sub-configuration file, it is determined whether the sub-configuration file has been updated. The sub-configuration file includes: some configuration nodes of the application, and the configuration nodes include: the minimum configuration items of the application. If the sub-configuration file has been updated, the update flag of the sub-configuration file is read, where the update flag is used to indicate whether the configuration nodes in the sub-configuration file have been merged into the target cache space. If the update flag indicates that there has been no update, the configuration nodes in the sub-configuration file are merged into the target cache space. The configuration nodes in the target cache space are stored in the main configuration file, where the main configuration file includes: all effective configuration nodes that can be loaded by the application.

[0151] Optionally, the target cache space records: a main configuration object, a list of node identifiers, and sub-configuration effective timestamps. The main configuration object is used to cache all configuration nodes of the main configuration file. The list of node identifiers includes the identifiers of all configuration nodes in the main configuration object. The sub-configuration effective timestamps include the timestamps when the sub-configuration files take effect in the application.

[0152] Optionally, determining whether the sub-configuration file has been updated based on its timestamp includes: reading the sub-configuration's effective timestamp from the target cache space; reading the latest modification timestamp of the sub-configuration file to obtain the modification timestamp; comparing the sub-configuration's effective timestamp and modification timestamp to obtain a comparison result; and determining whether the sub-configuration file has been updated based on the comparison result.

[0153] Optionally, based on the comparison results, determining whether the sub-configuration file has been updated includes: if the comparison results indicate that the sub-configuration's effective timestamp and modification timestamp are inconsistent, determining that the sub-configuration file has been updated; if the comparison results indicate that the sub-configuration's effective timestamp and modification timestamp are consistent, determining that the sub-configuration file has not been updated.

[0154] Optionally, merging configuration nodes in the sub-configuration file into the target cache space includes: searching for the identifier of each configuration node in the sub-configuration file in the node identifier list to obtain the search result; if the search result indicates that the identifier of any configuration node in the sub-configuration file already exists in the node identifier list, then the configuration node is used to overwrite the corresponding configuration node in the main configuration object; if the search result indicates that the identifier of any configuration node in the sub-configuration file does not exist in the node identifier list, then the configuration node is added to the main configuration object, and the identifier of the configuration node is added to the node identifier list.

[0155] Optionally, before merging the configuration nodes in the sub-configuration files into the target cache space, the method further includes: backing up the main configuration object, the node identifier list, and the sub-configuration effective timestamps in the target cache space to obtain the backed-up main configuration object, the backed-up node identifier list, and the backed-up sub-configuration effective timestamps; if a merging failure occurs during the merging of configuration nodes in the sub-configuration files into the target cache space, or if a storage failure occurs during the storage of configuration nodes in the target cache space into the main configuration file, the target cache space is rolled back based on the backed-up main configuration object, the backed-up node identifier list, and the backed-up sub-configuration effective timestamps, and the main configuration object in the rolled-back target cache space is stored in the main configuration file.

[0156] Optionally, before merging the configuration nodes in the sub-configuration file into the target cache space, the method further includes: controlling the data read and write permissions of the target cache space through a read-write lock; and restoring the data read and write permissions of the target cache space after storing the configuration nodes in the target cache space into the main configuration file.

[0157] This invention provides a processor for running a program, wherein the program executes a configuration file update method during runtime.

[0158] Specifically, the methods for updating the configuration file include:

[0159] Step S201: Based on the timestamp of the sub-configuration file, determine whether the sub-configuration file has been updated. The sub-configuration file includes: partial configuration nodes of the application, and the configuration nodes include: the minimum configuration items of the application.

[0160] The timestamp of the sub-configuration file mentioned above may include: the latest modification timestamp of the sub-configuration file, and the effective timestamp of the sub-configuration file recorded in the memory cache. By comparing the modification timestamp and the effective timestamp, it can be determined whether the sub-configuration file has been updated. If there is no update, the sub-configuration file can continue to be scanned periodically to see if there is an update. If there is an update, step S202 can be executed.

[0161] Step S202: If the sub-configuration file is updated, read the update flag bit of the sub-configuration file, whereby the update flag bit is used to indicate whether the configuration node in the sub-configuration file is merged into the target cache space.

[0162] If a sub-configuration file is updated, the update flag of the sub-configuration file can be read to determine whether the sub-configuration file should be merged into the memory cache (i.e., the target cache space).

[0163] Step S203: If the update flag indicates that it has not been updated, merge the configuration nodes in the sub-configuration file into the target cache space.

[0164] If the update flag indicates that the configuration nodes in the sub-configuration file have not been updated, the configuration nodes in the sub-configuration file can be merged into the target cache space to achieve incremental updates of the configuration files in the target cache space.

[0165] When the update flag indicates that the sub-configuration file has been updated, it can be determined that the sub-configuration file has been merged into the target cache space. Therefore, it is not necessary to merge the configuration nodes in the sub-configuration file into the target cache space again, which avoids the repeated merging of sub-configuration files and ensures idempotency.

[0166] Step S204: Store the configuration nodes in the target cache space into the main configuration file, wherein the main configuration file includes all effective configuration nodes that can be loaded by the application.

[0167] In this embodiment, the main configuration object in the target cache space can be persistently stored in the main configuration file, thereby storing the configuration nodes in the target cache space in the main configuration file. This achieves the goal of incrementally updating the main configuration file through the sub-configuration file without having to replace the complete content of the main configuration file.

[0168] Optionally, based on the timestamp of the sub-configuration file, it is determined whether the sub-configuration file has been updated. The sub-configuration file includes: some configuration nodes of the application, and the configuration nodes include: the minimum configuration items of the application. If the sub-configuration file has been updated, the update flag of the sub-configuration file is read, where the update flag is used to indicate whether the configuration nodes in the sub-configuration file have been merged into the target cache space. If the update flag indicates that there has been no update, the configuration nodes in the sub-configuration file are merged into the target cache space. The configuration nodes in the target cache space are stored in the main configuration file, where the main configuration file includes: all effective configuration nodes that can be loaded by the application.

[0169] Optionally, the target cache space records: a main configuration object, a list of node identifiers, and sub-configuration effective timestamps. The main configuration object is used to cache all configuration nodes of the main configuration file. The list of node identifiers includes the identifiers of all configuration nodes in the main configuration object. The sub-configuration effective timestamps include the timestamps when the sub-configuration files take effect in the application.

[0170] Optionally, determining whether the sub-configuration file has been updated based on its timestamp includes: reading the sub-configuration's effective timestamp from the target cache space; reading the latest modification timestamp of the sub-configuration file to obtain the modification timestamp; comparing the sub-configuration's effective timestamp and modification timestamp to obtain a comparison result; and determining whether the sub-configuration file has been updated based on the comparison result.

[0171] Optionally, based on the comparison results, determining whether the sub-configuration file has been updated includes: if the comparison results indicate that the sub-configuration's effective timestamp and modification timestamp are inconsistent, determining that the sub-configuration file has been updated; if the comparison results indicate that the sub-configuration's effective timestamp and modification timestamp are consistent, determining that the sub-configuration file has not been updated.

[0172] Optionally, merging configuration nodes in the sub-configuration file into the target cache space includes: searching for the identifier of each configuration node in the sub-configuration file in the node identifier list to obtain the search result; if the search result indicates that the identifier of any configuration node in the sub-configuration file already exists in the node identifier list, then the configuration node is used to overwrite the corresponding configuration node in the main configuration object; if the search result indicates that the identifier of any configuration node in the sub-configuration file does not exist in the node identifier list, then the configuration node is added to the main configuration object, and the identifier of the configuration node is added to the node identifier list.

[0173] Optionally, before merging the configuration nodes in the sub-configuration files into the target cache space, the method further includes: backing up the main configuration object, the node identifier list, and the sub-configuration effective timestamps in the target cache space to obtain the backed-up main configuration object, the backed-up node identifier list, and the backed-up sub-configuration effective timestamps; if a merging failure occurs during the merging of configuration nodes in the sub-configuration files into the target cache space, or if a storage failure occurs during the storage of configuration nodes in the target cache space into the main configuration file, the target cache space is rolled back based on the backed-up main configuration object, the backed-up node identifier list, and the backed-up sub-configuration effective timestamps, and the main configuration object in the rolled-back target cache space is stored in the main configuration file.

[0174] Optionally, before merging the configuration nodes in the sub-configuration file into the target cache space, the method further includes: controlling the data read and write permissions of the target cache space through a read-write lock; and restoring the data read and write permissions of the target cache space after storing the configuration nodes in the target cache space into the main configuration file.

[0175] This invention provides a device including a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs at least the following steps: determining whether a sub-configuration file has been updated based on its timestamp, wherein the sub-configuration file includes: partial configuration nodes of an application, and each configuration node includes: the minimum configuration items of the application; if the sub-configuration file has been updated, reading the update flag of the sub-configuration file, wherein the update flag indicates whether the configuration nodes in the sub-configuration file have been merged into a target cache space; if the update flag indicates no update, merging the configuration nodes in the sub-configuration file into the target cache space; and storing the configuration nodes in the target cache space into a main configuration file, wherein the main configuration file includes: all effective configuration nodes that can be loaded by the application.

[0176] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.

[0177] Optionally, based on the timestamp of the sub-configuration file, it is determined whether the sub-configuration file has been updated. The sub-configuration file includes: some configuration nodes of the application, and the configuration nodes include: the minimum configuration items of the application. If the sub-configuration file has been updated, the update flag of the sub-configuration file is read, where the update flag is used to indicate whether the configuration nodes in the sub-configuration file have been merged into the target cache space. If the update flag indicates that there has been no update, the configuration nodes in the sub-configuration file are merged into the target cache space. The configuration nodes in the target cache space are stored in the main configuration file, where the main configuration file includes: all effective configuration nodes that can be loaded by the application.

[0178] Optionally, the target cache space records: a main configuration object, a list of node identifiers, and sub-configuration effective timestamps. The main configuration object is used to cache all configuration nodes of the main configuration file. The list of node identifiers includes the identifiers of all configuration nodes in the main configuration object. The sub-configuration effective timestamps include the timestamps when the sub-configuration files take effect in the application.

[0179] Optionally, determining whether the sub-configuration file has been updated based on its timestamp includes: reading the sub-configuration's effective timestamp from the target cache space; reading the latest modification timestamp of the sub-configuration file to obtain the modification timestamp; comparing the sub-configuration's effective timestamp and modification timestamp to obtain a comparison result; and determining whether the sub-configuration file has been updated based on the comparison result.

[0180] Optionally, based on the comparison results, determining whether the sub-configuration file has been updated includes: if the comparison results indicate that the sub-configuration's effective timestamp and modification timestamp are inconsistent, determining that the sub-configuration file has been updated; if the comparison results indicate that the sub-configuration's effective timestamp and modification timestamp are consistent, determining that the sub-configuration file has not been updated.

[0181] Optionally, merging configuration nodes in the sub-configuration file into the target cache space includes: searching for the identifier of each configuration node in the sub-configuration file in the node identifier list to obtain the search result; if the search result indicates that the identifier of any configuration node in the sub-configuration file already exists in the node identifier list, then the configuration node is used to overwrite the corresponding configuration node in the main configuration object; if the search result indicates that the identifier of any configuration node in the sub-configuration file does not exist in the node identifier list, then the configuration node is added to the main configuration object, and the identifier of the configuration node is added to the node identifier list.

[0182] Optionally, before merging the configuration nodes in the sub-configuration files into the target cache space, the method further includes: backing up the main configuration object, the node identifier list, and the sub-configuration effective timestamps in the target cache space to obtain the backed-up main configuration object, the backed-up node identifier list, and the backed-up sub-configuration effective timestamps; if a merging failure occurs during the merging of configuration nodes in the sub-configuration files into the target cache space, or if a storage failure occurs during the storage of configuration nodes in the target cache space into the main configuration file, the target cache space is rolled back based on the backed-up main configuration object, the backed-up node identifier list, and the backed-up sub-configuration effective timestamps, and the main configuration object in the rolled-back target cache space is stored in the main configuration file.

[0183] Optionally, before merging the configuration nodes in the sub-configuration file into the target cache space, the method further includes: controlling the data read and write permissions of the target cache space through a read-write lock; and restoring the data read and write permissions of the target cache space after storing the configuration nodes in the target cache space into the main configuration file.

[0184] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having at least the following method steps: determining whether a sub-configuration file has been updated based on a timestamp of the sub-configuration file, wherein the sub-configuration file includes: partial configuration nodes of the application, and the configuration nodes include: the minimum configuration items of the application; if the sub-configuration file has been updated, reading the update flag of the sub-configuration file, wherein the update flag is used to indicate whether the configuration nodes in the sub-configuration file have been merged into the target cache space; if the update flag indicates that there has been no update, merging the configuration nodes in the sub-configuration file into the target cache space; storing the configuration nodes in the target cache space into a main configuration file, wherein the main configuration file includes: all effective configuration nodes that can be loaded by the application.

[0185] Optionally, based on the timestamp of the sub-configuration file, it is determined whether the sub-configuration file has been updated. The sub-configuration file includes: some configuration nodes of the application, and the configuration nodes include: the minimum configuration items of the application. If the sub-configuration file has been updated, the update flag of the sub-configuration file is read, where the update flag is used to indicate whether the configuration nodes in the sub-configuration file have been merged into the target cache space. If the update flag indicates that there has been no update, the configuration nodes in the sub-configuration file are merged into the target cache space. The configuration nodes in the target cache space are stored in the main configuration file, where the main configuration file includes: all effective configuration nodes that can be loaded by the application.

[0186] Optionally, the target cache space records: a main configuration object, a list of node identifiers, and sub-configuration effective timestamps. The main configuration object is used to cache all configuration nodes of the main configuration file. The list of node identifiers includes the identifiers of all configuration nodes in the main configuration object. The sub-configuration effective timestamps include the timestamps when the sub-configuration files take effect in the application.

[0187] Optionally, determining whether the sub-configuration file has been updated based on its timestamp includes: reading the sub-configuration's effective timestamp from the target cache space; reading the latest modification timestamp of the sub-configuration file to obtain the modification timestamp; comparing the sub-configuration's effective timestamp and modification timestamp to obtain a comparison result; and determining whether the sub-configuration file has been updated based on the comparison result.

[0188] Optionally, based on the comparison results, determining whether the sub-configuration file has been updated includes: if the comparison results indicate that the sub-configuration's effective timestamp and modification timestamp are inconsistent, determining that the sub-configuration file has been updated; if the comparison results indicate that the sub-configuration's effective timestamp and modification timestamp are consistent, determining that the sub-configuration file has not been updated.

[0189] Optionally, merging configuration nodes in the sub-configuration file into the target cache space includes: searching for the identifier of each configuration node in the sub-configuration file in the node identifier list to obtain the search result; if the search result indicates that the identifier of any configuration node in the sub-configuration file already exists in the node identifier list, then the configuration node is used to overwrite the corresponding configuration node in the main configuration object; if the search result indicates that the identifier of any configuration node in the sub-configuration file does not exist in the node identifier list, then the configuration node is added to the main configuration object, and the identifier of the configuration node is added to the node identifier list.

[0190] Optionally, before merging the configuration nodes in the sub-configuration files into the target cache space, the method further includes: backing up the main configuration object, the node identifier list, and the sub-configuration effective timestamps in the target cache space to obtain the backed-up main configuration object, the backed-up node identifier list, and the backed-up sub-configuration effective timestamps; if a merging failure occurs during the merging of configuration nodes in the sub-configuration files into the target cache space, or if a storage failure occurs during the storage of configuration nodes in the target cache space into the main configuration file, the target cache space is rolled back based on the backed-up main configuration object, the backed-up node identifier list, and the backed-up sub-configuration effective timestamps, and the main configuration object in the rolled-back target cache space is stored in the main configuration file.

[0191] Optionally, before merging the configuration nodes in the sub-configuration file into the target cache space, the method further includes: controlling the data read and write permissions of the target cache space through a read-write lock; and restoring the data read and write permissions of the target cache space after storing the configuration nodes in the target cache space into the main configuration file.

[0192] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0193] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0194] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0195] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0196] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0197] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0198] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0199] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0200] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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.

[0201] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0202] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method of updating a configuration file, characterized by, The method comprises the following steps: determining whether the sub-configuration file has an update based on a timestamp of the sub-configuration file, wherein the sub-configuration file comprises partial configuration nodes of an application, and the configuration nodes comprise minimum configuration items of the application; in a case where the sub-configuration file has an update, reading an update identification bit of the sub-configuration file, wherein the update identification bit is used to indicate whether the configuration nodes in the sub-configuration file are merged into a target cache space; in a case where the update identification bit indicates no update, merging the configuration nodes in the sub-configuration file into the target cache space; storing the configuration nodes in the target cache space into a master configuration file, wherein the master configuration file comprises all effective configuration nodes that can be loaded by the application.

2. The method of claim 1, wherein, The target cache space records a master configuration object, a node identification list and a sub-configuration effective timestamp, the master configuration object is used to cache all configuration nodes of the master configuration file, the node identification list comprises identifications of all configuration nodes in the master configuration object, and the sub-configuration effective timestamp comprises a timestamp at which the sub-configuration file is effective in the application.

3. The method of claim 2, wherein, The method for determining whether the sub-configuration file has an update based on the timestamp of the sub-configuration file comprises the following steps: reading the sub-configuration effective timestamp in the target cache space; reading a latest modification timestamp of the sub-configuration file to obtain a modification timestamp; comparing the sub-configuration effective timestamp and the modification timestamp to obtain a comparison result; determining whether the sub-configuration file has an update based on the comparison result.

4. The method of claim 3, wherein, The method for determining whether the sub-configuration file has an update based on the comparison result comprises the following steps: in a case where the comparison result indicates that the sub-configuration effective timestamp and the modification timestamp are inconsistent, determining that the sub-configuration file has an update; in a case where the comparison result indicates that the sub-configuration effective timestamp and the modification timestamp are consistent, determining that the sub-configuration file has no update.

5. The method of claim 2, wherein, The method for merging the configuration nodes in the sub-configuration file into the target cache space comprises the following steps: finding an identification of each configuration node in the sub-configuration file in the node identification list to obtain a finding result; if the finding result indicates that the identification of any configuration node in the sub-configuration file already exists in the node identification list, the configuration node is used to cover the corresponding configuration node in the master configuration object; if the finding result indicates that the identification of any configuration node in the sub-configuration file does not exist in the node identification list, the configuration node is added in the master configuration object, and the identification of the configuration node is added in the node identification list.

6. The method according to claim 2, further comprising the following step before the configuration nodes in the sub-configuration file are merged into the target cache space: backing up the master configuration object, the node identification list and the sub-configuration effective timestamp in the target cache space to obtain a backed-up master configuration object, a backed-up node identification list and a backed-up sub-configuration effective timestamp. In a case where merging of the configuration nodes in the sub-configuration file into the target cache space fails, or in a case where storing of the configuration nodes in the target cache space into the master configuration file fails, the target cache space is rolled back based on the backed-up master configuration object, the backed-up node identifier list, and the backed-up sub-configuration effective timestamp, and the master configuration object in the rolled-back target cache space is stored into the master configuration file.

7. The method of claim 1, wherein, Before the configuration nodes in the sub-configuration file are merged into the target cache space, the method further comprises controlling data read / write permissions of the target cache space by a read-write lock. After the configuration nodes in the target cache space are stored into the master configuration file, the data read / write permissions of the target cache space are restored.

8. An update system of a configuration file, characterized by, The configuration file updating system is configured to implement the configuration file updating method of any one of claims 1 to 7, and comprises: a scanner configured to determine whether the sub-configuration file is updated based on a timestamp of the sub-configuration file, wherein the sub-configuration file comprises partial configuration nodes of an application program, and the configuration nodes comprise minimum configuration items of the application program; an identifier bit checker configured to read an update identifier bit of the sub-configuration file in a case where the sub-configuration file is updated, wherein the update identifier bit is used to indicate whether the configuration nodes in the sub-configuration file are merged into a target cache space; a node merger configured to merge the configuration nodes in the sub-configuration file into the target cache space in a case where the update identifier bit indicates that the sub-configuration file is not updated; a persistent storage configured to store the configuration nodes in the target cache space into a master configuration file, wherein the master configuration file comprises all configuration nodes that can be loaded and take effect by the application program.

9. The system of claim 8, wherein, The configuration file updating system further comprises: a write-back device configured to roll back the target cache space in a case where merging of the configuration nodes in the sub-configuration file into the target cache space fails, or in a case where storing of the configuration nodes in the target cache space into the master configuration file fails, and store the master configuration object in the rolled-back target cache space into the master configuration file.

10. A computer program product comprising computer programs / instructions, characterized in that, The computer program / instruction is executed by the processor to implement the steps of the configuration file updating method of any one of claims 1 to 7.