Shared library management method and device

By periodically comparing shared library data in the Linux system and performing validity checks based on software operation events, corresponding instructions are triggered, which solves the system instability problem caused by complex shared library dependencies and ensures stable system operation.

CN119669245BActive Publication Date: 2025-09-30CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411778438.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-09-30
Estimated Expiration
2044-12-05

AI Technical Summary

Technical Problem

The increase in the number of shared libraries in Linux systems leads to complex dependencies, which may cause problems such as abnormal shared library status, file loss, and insufficient permissions, affecting system stability.

Method used

By periodically comparing the data in the shared library with the database data, validity checks are performed, corresponding update or recovery instructions are triggered, software operation events are monitored, and shared libraries are added, updated, or deleted according to the type to ensure the stability of the shared library.

Benefits of technology

Improves the stability of the Linux system, prevents shared library anomalies from affecting system operation, and ensures the normal function of the software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119669245B_ABST
    Figure CN119669245B_ABST
Patent Text Reader

Abstract

The present application relates to a shared library management method and device; the method comprises: periodically acquiring first data in a shared library in a Linux system and comparing it with second data in a database to determine whether the shared library in the current Linux system has been modified or deleted, thereby triggering a database update instruction or a shared library recovery instruction; performing a validity check on a target shared library according to the type of software operation event when executing a software operation event, and triggering a shared library addition instruction, a shared library update instruction, or a shared library recovery instruction based on the check result; or acquiring target software that depends on the target shared library, determining whether the target software exists in the Linux system, and triggering a shared library update instruction or a shared library deletion instruction; the use of this method can improve the stability of the Linux system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a shared library management method and device. Background Art

[0002] In Linux systems, there are a large number of shared library files, which are relied upon by many upper-level software packages or other shared libraries. As the number of software in Linux systems increases, the number of shared libraries also increases, making the interdependence between shared libraries and software packages in Linux systems more cumbersome and complex, eventually leading to interdependence between shared libraries, multiple links between shared libraries, and many-to-many dependencies between software packages and shared libraries.

[0003] However, when operating a Linux system, one or more shared libraries may become abnormal, files may be lost, or permissions may be insufficient, thereby affecting the stable operation of the Linux system and causing poor stability of the Linux system. Summary of the Invention

[0004] Based on this, it is necessary to provide a shared library management method and device that can improve the stability of the Linux system in response to the above technical problems.

[0005] In a first aspect, the present application provides a shared library management method, which is applied to a Linux system and includes:

[0006] Comparing first data in the shared library with second data in the database at preset time intervals, and when it is determined that second data corresponding to the first data exists in the database and the first data and the second data are inconsistent, performing a validity check on the shared library, and triggering a database update instruction if the shared library passes the validity check, otherwise triggering a shared library recovery instruction;

[0007] When it is determined that the second data corresponding to the first data does not exist in the database, query whether the software exists in the Linux system based on the dependency information; if so, run the software, and trigger a shared library recovery instruction in the event that the software fails to run; if not, delete the dependency information; wherein the dependency information is used to characterize the software that depends on the shared library;

[0008] When the software operation event is completed, the application software associated with the software operation event is obtained, and the target shared library that the application software depends on is determined;

[0009] According to the type of software operation event, the target shared library is tested for validity to obtain the test results. Based on the test results, a shared library addition instruction, a shared library update instruction, or a shared library recovery instruction is triggered; or, the target software that depends on the target shared library is obtained, and it is checked whether the target software exists in the Linux system. If so, a shared library update instruction is triggered, otherwise a shared library deletion instruction is triggered.

[0010] In one embodiment, based on the type of software operation event, a validity check is performed on the target shared library to obtain a check result, and based on the check result, a shared library new instruction, a shared library update instruction, or a shared library recovery instruction is triggered, including:

[0011] When the type of the software operation event is a new addition event, it is determined that the second data corresponding to the data in the target shared library does not exist in the database, and the detection result is that the validity detection is passed, the shared library addition instruction is triggered.

[0012] In one embodiment, based on the type of software operation event, a validity check is performed on the target shared library to obtain a check result, and based on the check result, a shared library new instruction, a shared library update instruction, or a shared library recovery instruction is triggered, including:

[0013] When the type of the software operation event is a modification event, it is determined that second data corresponding to the data in the target shared library exists in the database, and the detection result is that the validity test passes, triggering a shared library update instruction;

[0014] When the type of the software operation event is a modification event, it is determined that second data corresponding to the data in the target shared library exists in the database, and the detection result is that the validity test fails, a shared library recovery instruction is triggered.

[0015] In one embodiment, the method further comprises:

[0016] In the case where a shared library recovery instruction is triggered, determining a file type corresponding to the shared library or the target shared library;

[0017] The target file corresponding to the shared library or the target shared library is searched in the backup database, and the target file is stored in the shared library or the target shared library according to the file type.

[0018] In one embodiment, storing the target file in a shared library or a target shared library according to the file type includes:

[0019] If the file type is a common file, the target file is copied and stored in the shared library or the target shared library;

[0020] If the file type is a link file, the target path corresponding to the target file is stored in the shared library or the target shared library.

[0021] In one embodiment, the method further comprises:

[0022] When the target file is not found in the backup database and the file type corresponding to the shared library or target shared library is a link file, the data file that the target file depends on is obtained, and the target path corresponding to the data file is stored in the shared library or target shared library.

[0023] In one embodiment, when the file type corresponding to the shared library is a common file, the first data includes metadata and object data; wherein the metadata and the object data are associated through an object reference, the metadata includes name information, address information, and dependency information of the shared library, and the object data includes file data in the shared library;

[0024] When the file type corresponding to the shared library is a link file, the first data includes name information, address information and dependency information of the shared library.

[0025] In a second aspect, the present application further provides a shared library management device, which is applied to a Linux system and includes:

[0026] a comparison module, configured to compare the first data in the shared library with the second data in the database at a preset time interval, and when it is determined that the second data corresponding to the first data exists in the database and the first data and the second data are inconsistent, perform a validity check on the shared library, and if the shared library passes the validity check, trigger a database update instruction, otherwise trigger a shared library recovery instruction;

[0027] The comparison module is further configured to, when determining that the second data corresponding to the first data does not exist in the database, query whether the software exists in the Linux system based on the dependency information; if so, run the software, and trigger a shared library recovery instruction if the software fails to run; if not, delete the dependency information; wherein the dependency information is used to characterize the software that depends on the shared library;

[0028] The monitoring module is used to obtain the application software associated with the software operation event and determine the target shared library that the application software depends on when the software operation event is completed;

[0029] The detection module is used to perform validity detection on the target shared library according to the type of software operation event, obtain the detection result, and trigger the shared library addition instruction, shared library update instruction, or shared library recovery instruction based on the detection result; or, obtain the target software that depends on the target shared library, query whether the target software exists in the Linux system, if so, trigger the shared library update instruction, otherwise trigger the shared library deletion instruction.

[0030] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0031] In a fourth aspect, the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0032] The above-mentioned shared library management method and device periodically obtain the first data in the shared library in the Linux system and compare it with the second data in the database to determine whether the shared library in the current Linux system has been modified or deleted, thereby triggering a database update instruction or a shared library recovery instruction. When executing a software operation event, the target shared library is tested for validity according to the type of software operation event, and based on the test result, a shared library new instruction, a shared library update instruction, or a shared library recovery instruction is triggered; or, the target software that depends on the target shared library is obtained, and it is determined whether the target software exists in the Linux system, and a shared library update instruction or a shared library deletion instruction is triggered to solve the problem of the existence of the shared library in the current Linux system. The present application improves the stability of the Linux system by monitoring the first data in the shared library in the Linux system and the target shared library after completing the software operation event, and updating, deleting or restoring the shared library or the target shared library when an abnormality is found. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.

[0034] Figure 1 A diagram illustrating an application environment of a shared library management method in one embodiment;

[0035] Figure 2 1 is a flow chart of a shared library management method according to an embodiment;

[0036] Figure 3 is a directed graph corresponding to the dependency relationship in one embodiment;

[0037] Figure 4 2. A schematic diagram of the structure of first data when the file type corresponding to the shared library is a common file in one embodiment;

[0038] Figure 5 A schematic diagram of the structure of first data when the file type corresponding to the shared library is a link file in one embodiment;

[0039] Figure 6 is a structural block diagram of a shared library management device in one embodiment;

[0040] Figure 7 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0041] To facilitate understanding of the present application, the present application will be described more fully below with reference to the accompanying drawings. The accompanying drawings provide embodiments of the present application. However, the present application may be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided to make the disclosure of the present application more thorough and comprehensive.

[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application pertains. The terms used herein in the specification of this application are for the purpose of describing specific embodiments only and are not intended to limit this application.

[0043] It is understood that the terms "first," "second," and the like used herein may be used to describe various elements herein, but these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, first data may be referred to as second data, and similarly, second data may be referred to as first data. Both first data and second data are data, but they are not the same data.

[0044] It can be understood that the “connection” in the following embodiments should be understood as “electrical connection”, “communication connection”, etc. if there is transmission of electrical signals or data between the connected circuits, modules, units, etc.

[0045] It is understood that “at least one” refers to one or more, “a plurality” refers to two or more, and “at least a portion of an element” refers to a portion or all of an element.

[0046] As used herein, the singular forms "a," "an," and "the" may also include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the terms "include," "comprising," "having," and the like specify the presence of stated features, integers, steps, operations, components, parts, or combinations thereof, but do not preclude the presence or addition of one or more other features, integers, steps, operations, components, parts, or combinations thereof. Furthermore, the term "and / or" as used in this specification includes any and all combinations of the relevant listed items.

[0047] Glossary:

[0048] A shared library, also known as a shared object, is a binary file containing reusable code and data that is dynamically loaded and linked at runtime. Shared libraries are loaded into memory during program execution, ultimately saving memory and disk space, facilitating updates and maintenance, and improving portability.

[0049] Object storage is a data storage model that differs from traditional file systems and block storage. Object storage stores data as objects. Each object contains the data itself, related metadata, and a globally unique identifier. This storage model is suitable for application scenarios that need to process unstructured data and require high scalability.

[0050] A software package is a pre-packaged set of files, metadata, and installation scripts used to easily install, update, configure, and remove software. Each software package typically contains an application, library files, configuration files, documentation, icons, and other related content, as well as metadata describing the software package information.

[0051] Software Dependency refers to other software packages or components that a software package or application depends on at runtime. These dependencies can be library files required at runtime, specific operating system functions, services provided by other software packages, or configuration files.

[0052] A symbolic link, also known as a soft link, is a special file that points to another file. The symbolic link itself contains the path to the target file, rather than the file contents. At the file system level, it is actually a special type of file that contains the path information of the target file.

[0053] Currently, software installation, operating system upgrades, dependency library conflicts, or manual modifications can cause one or more shared libraries to experience abnormal status, file loss, or insufficient permissions. This can impact the functionality of certain software at best, or even the stability of the entire Linux system at worst. If dependency library issues arise in online resource pools due to component upgrades or batch operations, they can cause significant issues such as business downtime and data loss, resulting in immeasurable losses for users and compromising the stability of the Linux system, leading to poor Linux system stability.

[0054] The shared library management method provided in the embodiment of the present application can be applied to Figure 1 The Linux system shown in the figure includes:

[0055] The shared library file information collection module is used to collect the shared library information installed in the Linux system (hereinafter referred to as the system) and its dependency information.

[0056] The shared library storage module uses a shared library object database, including a database and a backup database, to store shared library file information. Different shared library files of different file types are stored using different data structures to achieve the purpose of saving space and efficient access.

[0057] The system shared library monitoring module is mainly divided into two aspects of monitoring: regularly obtaining the shared library content in the system and comparing it with the data in the database to determine whether there are any changes or deletions in the shared library in the current system, thereby triggering the update and deletion operations of the database; by monitoring the software operation events in the system, when the system installs, uninstalls, upgrades, and downgrades the software package, the changed software package is scanned and the shared library information on which it depends is obtained, and this shared library information is compared with the shared library information in the database, thereby triggering the addition, update, and deletion operations of the database.

[0058] The shared library update module performs operations such as adding, deleting, and updating database objects according to the type of software operation events detected by the system shared library monitoring module.

[0059] The shared library recovery module, when a shared library problem is detected in the system and recovery is required, accesses the shared library information backed up in the database and performs recovery operations based on the type of shared library file.

[0060] The shared library detection module can verify the validity of a given shared library file. Validity here means that all software that depends on the shared library works properly and there are no issues related to the shared library file printed in the system log. It can also scan the shared library files that a given software depends on and perform the above validity checks on the dependent shared library files.

[0061] From shared library file status detection, validity detection to shared library file backup and recovery, through the division of labor and cooperation of 6 modules, the functions of shared library file monitoring, backup, recovery, validity detection, etc. are completed.

[0062] In an exemplary embodiment, Figure 2 As shown, a shared library management method is provided, which is applied to Figure 1 The Linux system in the example is used as an example. The method includes:

[0063] S202, comparing the first data in the shared library with the second data in the database at a preset time interval. When it is determined that the second data corresponding to the first data exists in the database and the first data is inconsistent with the second data, performing a validity check on the shared library. If the shared library passes the validity check, a database update instruction is triggered, otherwise a shared library recovery instruction is triggered.

[0064] Among them, the preset time interval can be set according to actual conditions and is not limited in the embodiments of the present application.

[0065] Specifically, the shared library file information acquisition module is used to traverse the software installed in the current system, obtain the shared libraries that the software depends on, and the dependency relationships between the shared libraries, and generate one or more directed graphs, such as Figure 3 As shown, there are multiple software installed in the system, for example: software A, software B, software C, software D, software E, software F, software G, software H, software I, software J and software K. The dependency relationship between each software and each shared library, as well as the dependency relationship between each shared library are as follows: Figure 3 As shown, for example, the operation of software A, software B, software C, and software D depends on shared library so.1.0, and shared library so.1.0 depends on shared library so.1.1, and so on, which will not be repeated in the embodiments of this application.

[0066] According to the obtained directed graph relationship, the shared library file information, i.e., the first data, is extracted, and the shared library file information is stored in a shared library object database. Each shared library is stored in different types of objects according to its file type; wherein the first data includes the shared library's permissions, file data, and version, etc., which are not limited in the embodiments of the present application.

[0067] Enabling the shared library monitoring module mainly monitors the shared library in two ways and triggers different database operations based on the monitoring results: comparing the first data in the shared library with the second data in the database (shared library object database) at preset time intervals. If the second data corresponding to the first data exists in the database and the first data and the second data are consistent, it means that no abnormality is found in the shared library and no operation is required; if the second data corresponding to the first data exists in the database and the first data and the second data are inconsistent, the shared library is tested for validity. If the shared library passes the validity test, the database update instruction is triggered to read the information of the shared library that needs to be updated and write it to the backup database. If the shared library fails the validity test, it indicates that the current version of the shared library has an abnormality and needs to be restored, triggering the shared library recovery instruction.

[0068] S204, when it is determined that the second data corresponding to the first data does not exist in the database, query whether the software exists in the Linux system based on the dependency information. If it does, run the software, and trigger the shared library recovery instruction in the event of software failure. If it does not exist, delete the dependency information; wherein the dependency information is used to characterize the software that depends on the shared library.

[0069] Specifically, if the system does not find the shared library in the database, that is, if it is determined that the second data corresponding to the first data does not exist in the database, then the list of software that depends on the shared library is queried in the database, and the system is queried to see whether these software are still installed in the system. When the software that depends on the shared library is still in the system, the executable file in the software is executed to confirm whether the software can still run normally. If the operation fails, it indicates that the normal operation of the software is affected by the lack of the shared library, and the shared library recovery instruction is triggered. If all software that depends on the shared library is not installed in the current system, and the shared library has no dependency relationship with other shared libraries, it means that no software depends on the shared library, and the dependency information of the shared library in the database is deleted. It should be noted that no shared library in the system is deleted, so that the shared library can be directly applied later.

[0070] S206 , when the execution of the software operation event is completed, obtaining the application software associated with the software operation event, and determining the target shared library that the application software depends on.

[0071] Specifically, the software package manager related events in the system are monitored, and when the software operation event is completed, the target shared library that the application software associated with the software operation event depends on is determined.

[0072] Exemplarily, the software package manager related events include software operation events, such as yum related operations, which are not limited in the embodiments of the present application.

[0073] S208, according to the type of software operation event, perform validity check on the target shared library, obtain the test result, and based on the test result, trigger the shared library new instruction, shared library update instruction, or shared library recovery instruction; or, obtain the target software that depends on the target shared library, query whether the target software exists in the Linux system, if so, trigger the shared library update instruction, otherwise trigger the shared library deletion instruction.

[0074] Specifically, by performing a validity check on the target shared library according to the type of software operation event, or obtaining the target software that depends on the target shared library, when performing a validity check on the target shared library, triggering corresponding instructions based on the test results to resolve the abnormal situation of the shared library; when obtaining the target software that depends on the target shared library, query whether the target software exists in the Linux system. If it does, it means that the target shared library is still dependent on the target software, then triggering the shared library update instruction, reading the information of the shared library that needs to be updated and writing it into the backup database; if the dependency information in the target shared library only contains the uninstalled target software, and there is no dependency relationship with other shared libraries, then it means that the target shared library is no longer dependent on other software, triggering the shared library deletion instruction, and deleting the first data of the shared library in the database.

[0075] In the above-mentioned shared library management method, the stability of the Linux system is improved by monitoring the first data in the shared library in the Linux system and the target shared library after completing the software operation event, and updating, deleting or restoring the shared library or the target shared library when an abnormality is found.

[0076] In one embodiment, based on the type of software operation event, a validity check is performed on the target shared library to obtain a check result, and based on the check result, a shared library new instruction, a shared library update instruction, or a shared library recovery instruction is triggered, including:

[0077] When the type of the software operation event is a new addition event, it is determined that the second data corresponding to the data in the target shared library does not exist in the database, and the detection result is that the validity detection is passed, the shared library addition instruction is triggered.

[0078] Specifically, when the type of software operation event is a new event, it can be understood that the new event includes the new installation of application software, scanning the newly installed application software and finding the target shared library on which it depends. If the data of the target shared library does not find the corresponding data in the database, the target shared library is first tested for validity. When the test result passes the validity test, the shared library new addition instruction is triggered, and the information of the target shared library that needs to be added is read and written into the backup database.

[0079] It should be noted that shared libraries and target shared libraries are both represented as shared libraries within the system, and the different names are used to distinguish shared libraries in different scenarios. Software, target software and application software are all represented as software within the system, and the different names are used to distinguish shared software in different scenarios.

[0080] In an embodiment of the present application, when a new application software is installed in the system, the newly installed application software is scanned and the target shared library on which it depends is found. If the data of the target shared library cannot be found in the database, then when it is confirmed that the target shared library has passed the validity test, the information of the newly added target shared library will be read and written into the backup database to ensure the normal operation of the application software and improve the stability of the Linux system.

[0081] In one embodiment, based on the type of software operation event, a validity check is performed on the target shared library to obtain a check result, and based on the check result, a shared library new instruction, a shared library update instruction, or a shared library recovery instruction is triggered, including:

[0082] When the type of the software operation event is a modification event, it is determined that second data corresponding to the data in the target shared library exists in the database, and the detection result is that the validity test passes, triggering a shared library update instruction;

[0083] When the type of the software operation event is a modification event, it is determined that second data corresponding to the data in the target shared library exists in the database, and the detection result is that the validity test fails, a shared library recovery instruction is triggered.

[0084] Specifically, when the type of software operation event is a modification event, it can be understood that after the system newly installs, upgrades, or downgrades the target software, it scans these target software and obtains the target shared libraries on which they depend, determines whether there is second data corresponding to the data in the target shared library in the database, and performs a validity check on the target shared library. If the target shared library passes the validity check, a shared library update event is triggered; if the target shared library fails the validity check, it indicates that the target shared library in the system has affected the operation of the software, triggering a shared library recovery event.

[0085] It should be noted that when a shared library is upgraded, the old version of the shared library file is not deleted but retained to ensure that the software that depends on the old version of the shared library can continue to run normally. The old and new versions of the shared library will coexist with different names, and the new version will be detected and added to the database as a new shared library.

[0086] In an embodiment of the present application, when the system newly installs, upgrades, or downgrades the target software, the target software is scanned and the target shared libraries on which it depends are obtained. It is determined that there is second data in the database corresponding to the data in the target shared library, and the target shared library is tested for validity. If it passes, a shared library update instruction is triggered; if it fails, a shared library recovery instruction is triggered to ensure the normal operation of the target software and application software. In addition, the validity of the application software is indirectly verified, thereby improving the stability of the Linux system.

[0087] In one embodiment, the method further comprises:

[0088] In the case where a shared library recovery instruction is triggered, determining a file type corresponding to the shared library or the target shared library;

[0089] The target file corresponding to the shared library or the target shared library is searched in the backup database, and the target file is stored in the shared library or the target shared library according to the file type.

[0090] Specifically, when a shared library recovery instruction is triggered, different recovery operations are determined according to the file type corresponding to the shared library or the target shared library, so as to store the target file in the shared library or the target shared library according to the file type.

[0091] In an embodiment of the present application, the target file is stored in the shared library or the target shared library according to the file type corresponding to the shared library or the target shared library, thereby completing the recovery of the shared library or the target shared library, thereby improving the stability of the Linux system.

[0092] In one embodiment, storing the target file in a shared library or a target shared library according to the file type includes:

[0093] If the file type is a common file, the target file is copied and stored in the shared library or the target shared library;

[0094] If the file type is a link file, the target path corresponding to the target file is stored in the shared library or the target shared library.

[0095] Specifically, when the file type corresponding to the shared library or target shared library that needs to be restored is a normal file, the target file is directly copied from the backup database to the specified location, the saved permissions are set, and the file is named with the name saved in the backup database; when the file type corresponding to the shared library or target shared library that needs to be restored is a link file, the target file in the backup database is read, and the corresponding link file is created under the specified path (the target path corresponding to the target file) and the corresponding permissions are set.

[0096] For example, when the shared library recovery instruction is completed, that is, after the recovery operation is completed, it is necessary to perform a detection on this shared library to ensure that the shared library or the target shared library that has completed the recovery operation can operate normally.

[0097] In the embodiment of the present application, different recovery methods are used according to different file types to complete the recovery of the shared library or the target shared library, thereby improving the stability of the Linux system.

[0098] In one embodiment, the method further comprises:

[0099] When the target file is not found in the backup database and the file type corresponding to the shared library or target shared library is a link file, the data file that the target file depends on is obtained, and the target path corresponding to the data file is stored in the shared library or target shared library.

[0100] Specifically, if the file type corresponding to the shared library or target shared library is a link file, and the target file does not exist in the backup database, the data file that the target file depends on is obtained from the backup database, and the target path corresponding to the data file is stored in the shared library or target shared library, and so on, and finally a complete dependency relationship is established to solve the dependency problem.

[0101] In an embodiment of the present application, when the target file is not found in the backup database and the file type corresponding to the shared library or the target shared library is a link file, the dependency relationship is determined by cyclically accessing the database, and multiple recovery operations are performed to solve the problem of multi-layer link dependency and improve the stability and robustness of the Linux system.

[0102] In one embodiment, when the file type corresponding to the shared library is a common file, the first data includes metadata and object data; wherein the metadata and the object data are associated through an object reference, the metadata includes name information, address information, and dependency information of the shared library, and the object data includes file data in the shared library;

[0103] When the file type corresponding to the shared library is a link file, the first data includes name information, address information and dependency information of the shared library.

[0104] Specifically, the name information of the shared library includes the shared library file name, the shared library version, and the hash value corresponding to the shared library file name, wherein the shared library file name is hashed using the SHA-1 algorithm to obtain a uniquely identified hash value, which is used as the identifier of the shared library in the database. The shared library file name is used to record the name of the current shared library in the system, and the shared library version is the software version of the current shared library. The address information of the shared library includes the path where the shared library is located, that is, the absolute path of this shared library file in the system. The dependency information of the shared library includes a list of software packages that depend on this shared library, including the names of all software packages that depend on this shared library, and the SHA-1 values ​​of other shared library files that depend on this shared library.

[0105] When the file type corresponding to the shared library is a common file, the object data includes the data of the shared library file itself (file data) and the SHA-1 value corresponding to the data itself. The data structure corresponding to the first data is as follows: Figure 4 As shown, metadata corresponds to Figure 4 The upper part includes the hash value corresponding to the above shared library name (shared library file hash value), shared library file name, shared library version, list of software packages that depend on this shared library, hash values ​​of other shared library files that depend on this shared library, hash values ​​of the shared library path and file data, object data, corresponding to Figure 4 The lower half includes the hash value corresponding to the file data and the file data. The metadata and object data are associated through the hash value corresponding to the file data, so that the metadata is separated from the file data to reduce redundancy and improve access efficiency.

[0106] When the file type corresponding to the shared library is a link file, the data structure corresponding to the first data is as follows: Figure 5 As shown, it includes the hash value corresponding to the above-mentioned shared library name (shared library file hash value), shared library file name, shared library version, list of software packages that depend on this shared library, hash values ​​of other shared library files that depend on this shared library, path where the shared library is located, hash value of the link file linked to the shared library file, and absolute path of the link file.

[0107] In an embodiment of the present application, shared libraries for different file types are divided into data structures for two different file types: ordinary files and linked files. Object storage is used to store file contents in a manner that separates metadata and file data. While ensuring efficient access, it can also save a certain amount of storage space.

[0108] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.

[0109] Based on the same inventive concept, embodiments of the present application also provide a shared library management device for implementing the aforementioned shared library management method. The implementation solution provided by this device is similar to the implementation solution described in the aforementioned method. Therefore, the specific limitations in one or more of the following shared library management device embodiments can be found in the aforementioned limitations on the shared library management method and will not be further elaborated here.

[0110] In an exemplary embodiment, Figure 6 As shown, a shared library management device 600 is provided, which is applied to a Linux system and includes:

[0111] The comparison module 601 is used to compare the first data in the shared library with the second data in the database at a preset time interval. When it is determined that the second data corresponding to the first data exists in the database and the first data is inconsistent with the second data, the validity check is performed on the shared library. If the shared library passes the validity check, the database update instruction is triggered, otherwise the shared library recovery instruction is triggered.

[0112] The comparison module 601 is also used to query whether the software exists in the Linux system based on the dependency information when it is determined that the second data corresponding to the first data does not exist in the database. If so, the software is run and, if the software fails to run, the shared library recovery instruction is triggered; if not, the dependency information is deleted; wherein the dependency information is used to characterize the software that depends on the shared library.

[0113] The monitoring module 602 is used to obtain the application software associated with the software operation event and determine the target shared library that the application software depends on when the software operation event is completed.

[0114] The detection module 603 is used to perform validity detection on the target shared library according to the type of software operation event, obtain the detection result, and trigger the shared library addition instruction, shared library update instruction, or shared library recovery instruction based on the detection result; or, obtain the target software that depends on the target shared library, query whether the target software exists in the Linux system, and if so, trigger the shared library update instruction, otherwise trigger the shared library deletion instruction.

[0115] In one embodiment, the detection module 603 is also used to trigger a shared library new addition instruction when the type of the software operation event is a new addition event, it is determined that there is no second data corresponding to the data in the target shared library in the database, and the detection result is that the validity test is passed.

[0116] In one embodiment, the detection module 603 is further configured to trigger a shared library update instruction when the type of the software operation event is a modification event, when it is determined that second data corresponding to the data in the target shared library exists in the database, and the detection result is that the validity test passes;

[0117] When the type of the software operation event is a modification event, it is determined that second data corresponding to the data in the target shared library exists in the database, and the detection result is that the validity test fails, a shared library recovery instruction is triggered.

[0118] In one embodiment, the apparatus 600 further includes a recovery module for determining a file type corresponding to the shared library or the target shared library when the shared library recovery instruction is triggered;

[0119] The target file corresponding to the shared library or the target shared library is searched in the backup database, and the target file is stored in the shared library or the target shared library according to the file type.

[0120] In one embodiment, the recovery module is further configured to copy the target file if the file type is a common file, and store the copied target file in a shared library or a target shared library;

[0121] If the file type is a link file, the target path corresponding to the target file is stored in the shared library or the target shared library.

[0122] In one embodiment, the recovery module is also used to obtain the data file that the target file depends on when the target file is not found in the backup database and the file type corresponding to the shared library or the target shared library is a link file, and store the target path corresponding to the data file in the shared library or the target shared library.

[0123] In one embodiment, when the file type corresponding to the shared library is a common file, the first data includes metadata and object data; wherein the metadata and the object data are associated through an object reference, the metadata includes name information, address information, and dependency information of the shared library, and the object data includes file data in the shared library;

[0124] When the file type corresponding to the shared library is a link file, the first data includes name information, address information and dependency information of the shared library.

[0125] Each module in the shared library management device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.

[0126] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store second data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a shared library management method is implemented.

[0127] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0128] In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the above-mentioned shared library management method when executing the computer program.

[0129] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the shared library management method described above is implemented.

[0130] In one embodiment, a computer program product is provided, including a computer program, which implements the above-mentioned shared library management method when executed by a processor.

[0131] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0132] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), quantum computing-based data processing logic devices, artificial intelligence (AI) processors, and the like.

[0133] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0134] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A shared library management method, characterized in that: The method is applied to a Linux system and includes: comparing first data in a shared library with second data in a database at a preset time interval; and when it is determined that second data corresponding to the first data exists in the database and the first data and the second data are inconsistent, performing a validity check on the shared library; and triggering a database update instruction if the shared library passes the validity check, otherwise triggering a shared library recovery instruction; When it is determined that the second data corresponding to the first data does not exist in the database, query whether the software exists in the Linux system based on the dependency information; if so, run the software, and trigger the shared library recovery instruction when the software fails to run; if not, delete the dependency information; wherein the dependency information is used to characterize the software that depends on the shared library; When the software operation event is completed, obtaining the application software associated with the software operation event and determining the target shared library that the application software depends on; According to the type of the software operation event, the validity check is performed on the target shared library to obtain a test result, and based on the test result, a shared library new addition instruction, a shared library update instruction, or the shared library recovery instruction is triggered; or, the target software that depends on the target shared library is obtained, and it is checked whether the target software exists in the Linux system. If so, the shared library update instruction is triggered, otherwise the shared library deletion instruction is triggered.

2. The method according to claim 1, characterized in that The method further includes: performing the validity check on the target shared library according to the type of the software operation event to obtain a check result, and triggering a shared library new addition instruction, a shared library update instruction, or the shared library recovery instruction based on the check result, including: When the type of the software operation event is a new addition event, it is determined that the second data corresponding to the data in the target shared library does not exist in the database, and the detection result is that the validity test is passed, the shared library addition instruction is triggered.

3. The method according to claim 1, characterized in that The method further includes: performing the validity check on the target shared library according to the type of the software operation event to obtain a check result, and triggering a shared library new addition instruction, a shared library update instruction, or the shared library recovery instruction based on the check result, including: When the type of the software operation event is a modification event, it is determined that the second data corresponding to the data in the target shared library exists in the database, and the detection result is that the validity test passes, triggering the shared library update instruction; When the type of the software operation event is a modification event, it is determined that the second data corresponding to the data in the target shared library exists in the database, and the detection result is that the validity test fails, the shared library recovery instruction is triggered.

4. The method according to claim 1, wherein The method further comprises: In a case where the shared library recovery instruction is triggered, determining a file type corresponding to the shared library or the target shared library; A target file corresponding to the shared library or the target shared library is searched in a backup database, and the target file is stored in the shared library or the target shared library according to the file type.

5. The method according to claim 4, characterized in that The storing the target file in the shared library or the target shared library according to the file type includes: If the file type is a common file, copying the target file and storing the copied target file in the shared library or the target shared library; If the file type is a link file, the target path corresponding to the target file is stored in the shared library or the target shared library.

6. The method according to claim 4, characterized in that The method further comprises: When the target file is not found in the backup database and the file type corresponding to the shared library or the target shared library is a link file, the data file that the target file depends on is obtained, and the target path corresponding to the data file is stored in the shared library or the target shared library.

7. The method according to claim 1, characterized in that When the file type corresponding to the shared library is a common file, the first data includes metadata and object data; wherein the metadata and the object data are associated through an object reference, the metadata includes name information, address information and dependency information of the shared library, and the object data includes file data in the shared library; When the file type corresponding to the shared library is a link file, the first data includes the name information, the address information, and the dependency information of the shared library.

8. A shared library management device, characterized in that: The device is applied to a Linux system and includes: a comparison module, configured to compare first data in a shared library with second data in a database at a preset time interval, and when it is determined that second data corresponding to the first data exists in the database and the first data and the second data are inconsistent, perform a validity check on the shared library; if the shared library passes the validity check, trigger a database update instruction; otherwise, trigger a shared library recovery instruction; The comparison module is further configured to, when it is determined that the second data corresponding to the first data does not exist in the database, query whether the software exists in the Linux system based on the dependency information; if so, run the software, and trigger the shared library recovery instruction if the software fails to run; if not, delete the dependency information; wherein the dependency information is used to characterize the software that depends on the shared library; A monitoring module is used to obtain the application software associated with the software operation event and determine the target shared library that the application software depends on when the software operation event is completed; A detection module is used to perform the validity detection on the target shared library according to the type of the software operation event, obtain the detection result, and trigger the shared library new addition instruction, shared library update instruction, or the shared library recovery instruction based on the detection result; or, obtain the target software that depends on the target shared library, query whether the target software exists in the Linux system, and if so, trigger the shared library update instruction, otherwise trigger the shared library deletion instruction.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.