Database operation platform adaptation method, system and equipment
By analyzing and modifying dynamic link segments in ELF files, the database adaptation problem is solved in a multi-platform environment, achieving rapid response, cost reduction and compatibility improvement.
Patent Information
- Application Number
- CN202510221966.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2025-05-16
AI Technical Summary
The existing database adaptation methods have problems such as insufficient compatibility, large performance losses and long adaptation cycles in multi-platform environments, which are difficult to meet the needs of rapid delivery and economic benefits.
By analyzing the ELF file structure, modifying the DT_RUNPATH dynamic table entry in the dynamic link segment, setting the dynamic library search path, updating the dynamic link segment and ELF files, and achieving efficient database adaptation in a multi-platform environment.
It significantly shortens the delivery cycle of the database in a multi-platform environment, improves compatibility and performance, reduces R&D and testing costs, and enhances the competitiveness of the product.
Smart Images

Figure CN120010911A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of database adaptation, and in particular to a method, system and device for adapting an operating platform of a database. Background Art
[0002] With the rapid development of information technology, database systems have become the core components of modern information processing and are widely used in various fields. However, with the diversification of operating systems and processor platforms, the adaptation problem of database systems in different environments has become increasingly prominent. Traditional database adaptation methods usually require separate compilation adaptation and testing for different versions of each operating system and specific processor. This adaptation method not only increases the workload of R&D and testing, but also significantly prolongs the product adaptation cycle. In addition, the frequent updates of operating system versions and the diversification of processor types make it difficult for traditional adaptation methods to be sustained and effective, further exacerbating the complexity and cost of adaptation.
[0003] In the existing technology, although there have been some attempts to simplify the adaptation process through middleware or virtualization technology, these methods often have problems such as insufficient compatibility or large performance loss. For example, some middleware may not be able to fully cover the functional characteristics of all operating system platforms, resulting in unstable operation of the database in certain specific environments; and although virtualization technology can isolate hardware differences to a certain extent, it may introduce additional performance overhead and affect the performance of the database.
[0004] Therefore, how to achieve efficient and universal multi-platform adaptation while ensuring database performance has become a technical problem that needs to be solved urgently.
[0005] Application Contents In view of this, in order to overcome the deficiencies of the prior art, the present application aims to provide a method, system and device for adapting an operating platform of a database.
[0006] According to a first aspect of the present application, a method for adapting an operating platform of a database is provided, the method comprising: Step S1: parse the ELF file structure and obtain the dynamic link segment of the ELF file; Step S2: Search for a dynamic table entry with a location type of DT_RUNPATH from the dynamic link segment; Step S3: modify the dynamic table entry of DT_RUNPATH, and set the dynamic library search path for the ELF file according to the modified dynamic table entry of DT_RUNPATH; Step S4: Update the dynamic link segment and ELF file according to the modified dynamic table entry of DT_RUNPATH.
[0007] Optionally, the operating platform adaptation method of the database of the present application, step S1, comprises: Parse the ELF file structure, obtain the ELF file information and program header table, and obtain the offset position of the segment header table based on the obtained program header table; The position and size of the dynamic link segment in the ELF file are obtained according to the offset position of the segment header table, and the dynamic link segment of the ELF file is located according to the position and size of the dynamic link segment.
[0008] Optionally, the operating platform adaptation method of the database of the present application, step S2, includes: traversing the dynamic table entries in the dynamic link segment, searching for dynamic table entries of type DT_RUNPATH according to the keys of the dynamic table entries, and obtaining the values of the dynamic table entries of type DT_RUNPATH.
[0009] Optionally, the operating platform adaptation method of the database of the present application, step S3, includes: before setting the dynamic library search path, comparing the dynamic library search path to be set with the original dynamic library search path, and modifying the dynamic table entry of type DT_RUNPATH according to the comparison result.
[0010] Optionally, the operating platform adaptation method of the database of the present application, step S3, includes: converting the dynamic library search path to be set into a string, calculating the length of the string, and comparing the length of the dynamic library search path to be set with the length of the original dynamic library search path.
[0011] Optionally, the operating platform adaptation method of the database of the present application, step S3, includes: when the length of the dynamic library search path to be set exceeds the length of the original dynamic library search path, specify a new location in the ELF file to store the converted string, and update the value of the dynamic table item of type DT_RUNPATH so that the value points to the new location.
[0012] Optionally, the operating platform adaptation method of the database of the present application, step S3, also includes: when the length of the dynamic library search path to be set does not exceed the length of the original dynamic library search path, the position of the original dynamic library search path is obtained according to the value of the dynamic table item of type DT_RUNPATH, and the converted string is overwritten at this position.
[0013] Optionally, the operating platform adaptation method of the database of the present application, step S4, includes: updating the dynamic link segment according to the modified dynamic table entry of DT_RUNPATH, writing the updated dynamic link segment back to the ELF file, and updating the corresponding fields of the ELF file header and segment header table.
[0014] According to a second aspect of the present application, there is provided a database operation platform adaptation system, the system comprising an adaptation server, the adaptation server comprising: ELF file parsing module, used to parse the ELF file structure and obtain the dynamic link segment of the ELF file; DT_RUNPATH dynamic table entry location module, used to find and locate dynamic table entries of type DT_RUNPATH from the dynamic link segment; DT_RUNPATH dynamic table entry modification module, used to modify the dynamic table entry of DT_RUNPATH, and set the dynamic library search path for the ELF file according to the modified dynamic table entry of DT_RUNPATH; The ELF file update module is used to update the dynamic link segment and ELF file according to the modified dynamic table entry of DT_RUNPATH.
[0015] According to a third aspect of the present application, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect of the present application when executing the program.
[0016] The database operation platform adaptation method, system and device of the present application have the following beneficial technical effects: 1. Quick response In traditional technology, when a customer makes an adaptation request, it is necessary to go through a complex analysis, development, and testing process before the adapted installation package can be provided. This process is time-consuming and difficult to meet the customer's demand for fast delivery. This application pre-adapts multiple processor architectures and generates corresponding installation packages to ensure that the adapted installation package can be quickly provided when the customer makes a request. This rapid response capability greatly shortens the delivery cycle, improves customer satisfaction, and enhances the competitiveness of the product in the market.
[0017] 2. Reduce costs In the process of database system development and adaptation, the workload of R&D and testing accounts for a large proportion of the cost. This application reduces the dependence on the operating system and processor architecture through system dependency minimization and generalized adaptation technology, thereby reducing the complexity and diversity of problems that need to be dealt with during the adaptation process. On the one hand, it reduces the repeated R&D workload for different platforms; on the other hand, it reduces the difficulty of setting up the test environment and the scope of testing, effectively reducing the testing workload. Through these measures, the labor cost is significantly reduced, the development efficiency is improved, and significant economic benefits are brought to the enterprise.
[0018] 3. Improve compatibility When a database system runs in a multi-platform environment, it often faces differences in operating system versions, processor architectures, and dynamic library versions. These differences can easily lead to compatibility issues and affect the stability and performance of the system. This application significantly improves the compatibility of the database through the following measures: Minimize system dependency: It only relies on the most basic underlying components such as the Linux operating system kernel and GLIBC library. By leveraging its versatility and backward compatibility, it minimizes the database's dependency on the operating system during runtime, thus avoiding compatibility issues caused by differences in operating system versions.
[0019] Universal adaptation: Universal adaptation of high-availability components and database kernels enables them to adapt to the needs of different operating systems, further enhancing the adaptability of the database in a multi-platform environment.
[0020] Dynamic library management optimization: By modifying the RUNPATH property of the ELF file, it is ensured that the database uses the dependent libraries included in the installation package when running, avoiding conflicts with the built-in library versions in the operating system, and further improving the compatibility and stability of the system.
[0021] Through the above-mentioned technical means, the present application effectively solves the adaptation problem of the database in multi-platform operation, significantly improves the compatibility of the database, and enables it to run stably on different operating systems and processor architectures. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1 This is an example diagram of the architecture of an operating platform adaptation system for a database according to an embodiment of the present application; Figure 2 This is an example diagram of the architecture of the adaptation server of the database operation platform adaptation system according to an embodiment of the present application; Figure 3 A flowchart of a method for adapting an operating platform of a database according to an embodiment of the present application; Figure 4 A schematic diagram of the structure of the device provided in this application. DETAILED DESCRIPTION
[0024] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0025] It should be noted that the following embodiments and features in the embodiments may be combined with each other in the absence of conflict; and, based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making any creative work are within the scope of protection of the present disclosure.
[0026] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.
[0027] Figure 1 FIG. 1 is an example diagram of the architecture of an operating platform adaptation system for a database according to an embodiment of the present application. Figure 1 As shown, the system may include an adaptation server 101, a communication network 102 and / or one or more adaptation clients 103. Figure 1 The example shown is a plurality of adaptation clients 103 .
[0028] The adaptation server 101 can be any appropriate server for storing information, data, programs and / or any other suitable type of content. In some embodiments, the adaptation server 101 can perform appropriate functions. For example, in some embodiments, the adaptation server 101 can be used to adapt the operating platform for the database. As an optional example, in some embodiments, the adaptation server 101 can be used to implement the operating platform adaptation of the database by modifying the dynamic link segment. For example, the adaptation server 101 can be used to: parse the ELF file structure, obtain the dynamic link segment of the ELF file; search for the dynamic table entry with the location type of DT_RUNPATH from the dynamic link segment; modify the dynamic table entry of DT_RUNPATH, and set the dynamic library search path for the ELF file according to the modified dynamic table entry of DT_RUNPATH; update the dynamic link segment and the ELF file according to the modified dynamic table entry of DT_RUNPATH.
[0029] Figure 2 FIG. 1 is an example diagram of the architecture of the adaptation server of the operating platform adaptation system of the database according to the embodiment of the present application, such as Figure 2 As shown, in this embodiment, the adaptation server 101 includes: ELF file parsing module, used to parse the ELF file structure and obtain the dynamic link segment of the ELF file; DT_RUNPATH dynamic table entry location module, used to find and locate dynamic table entries of type DT_RUNPATH from the dynamic link segment; DT_RUNPATH dynamic table entry modification module, used to modify the dynamic table entry of DT_RUNPATH, and set the dynamic library search path for the ELF file according to the modified dynamic table entry of DT_RUNPATH; The ELF file update module is used to update the dynamic link segment and ELF file according to the modified dynamic table entry of DT_RUNPATH.
[0030] As another example, in some embodiments, the adaptation server 101 may send the operating platform adaptation method of the database to the adaptation client 103 for the user to use according to the request of the adaptation client 103 .
[0031] As an optional example, in some embodiments, the adaptation client 103 is used to provide a visual adaptation interface, which is used to receive a user's selection input operation for a database adaptation operating platform, and, in response to the selection input operation, obtain an adaptation interface corresponding to the option selected by the selection input operation from the adaptation server 101 and display the adaptation interface, wherein the adaptation interface at least displays information about the database adaptation operating platform and operation options for the information about the database adaptation operating platform.
[0032] In some embodiments, the communication network 102 can be any suitable combination of one or more wired and / or wireless networks. For example, the communication network 102 can include any one or more of the following: the Internet, an intranet, a wide area network (WAN), a local area network (LAN), a wireless network, a digital subscriber line (DSL) network, a frame relay network, an asynchronous transfer mode (ATM) network, a virtual private network (VPN), and / or any other suitable communication network. The adaptation client 103 can be connected to the communication network 102 via one or more communication links (e.g., communication link 104), and the communication network 102 can be linked to the adaptation server 101 via one or more communication links (e.g., communication link 105). The communication link can be any communication link suitable for transmitting data between the adaptation client 103 and the adaptation server 101, such as a network link, a dial-up link, a wireless link, a hard-wired link, any other suitable communication link, or any suitable combination of such links.
[0033] The adaptation client 103 may include any one or more clients that present an interface related to the database adaptation operating platform in an appropriate form for use and operation by a user. In some embodiments, the adaptation client 103 may include a device of any suitable type. For example, in some embodiments, the adaptation client 103 may include a mobile device, a tablet computer, a laptop computer, a desktop computer and / or any other suitable type of client device.
[0034] Although the adaptation server 101 is illustrated as one device, in some embodiments, any suitable number of devices may be used to perform the functions performed by the adaptation server 101. For example, in some embodiments, multiple devices may be used to implement the functions performed by the adaptation server 101. Alternatively, the functions of the adaptation server 101 may be implemented using a cloud service.
[0035] Based on the above system, an embodiment of the present application provides a method for adapting an operating platform of a database.
[0036] Figure 3 1 is a flowchart of the steps of a method for adapting an operating platform of a database according to an embodiment of the present application. The method for adapting an operating platform of a database in this embodiment can be executed at the adaptation server end, such as Figure 3 As shown, the operating platform adaptation method of the database includes the following steps: Step S1: parse the ELF file structure and obtain the dynamic link segment of the ELF file.
[0037] As an optional example, in this embodiment, the ELF file structure is parsed to obtain ELF file information and a program header table, and the offset position of the segment header table is obtained according to the obtained program header table; the position and size of the dynamic link segment in the ELF file are obtained according to the offset position of the segment header table, and the dynamic link segment of the ELF file is located according to the position and size of the dynamic link segment.
[0038] Step S2: Search the dynamic table entry with the location type of DT_RUNPATH from the dynamic link segment.
[0039] As an optional example, in this embodiment, the dynamic table entries in the dynamic link segment are traversed, and the dynamic table entry of the type DT_RUNPATH is searched according to the key of the dynamic table entry to obtain the value of the dynamic table entry of the type DT_RUNPATH.
[0040] Step S3: modify the dynamic table entry of DT_RUNPATH, and set the dynamic library search path for the ELF file according to the modified dynamic table entry of DT_RUNPATH.
[0041] In this embodiment, before setting the dynamic library search path, the dynamic library search path to be set is compared with the original dynamic library search path, and the dynamic table entry of the DT_RUNPATH type is modified according to the comparison result.
[0042] As an optional example, this embodiment converts the dynamic library search path to be set into a character string, calculates the length of the character string, and compares the length of the dynamic library search path to be set with the length of the original dynamic library search path.
[0043] When the length of the dynamic library search path to be set exceeds the length of the original dynamic library search path, specify a new location in the ELF file to store the converted string, and update the value of the dynamic table entry of type DT_RUNPATH to point to the new location.
[0044] When the length of the dynamic library search path to be set does not exceed the length of the original dynamic library search path, the location of the original dynamic library search path is obtained according to the value of the dynamic table item of type DT_RUNPATH, and the converted string is overwritten at this location.
[0045] Step S4: Update the dynamic link segment and ELF file according to the modified dynamic table entry of DT_RUNPATH.
[0046] As an optional example, in this embodiment, according to the modified dynamic table entry of DT_RUNPATH, the dynamic link segment is updated, the updated dynamic link segment is written back to the ELF file, and the corresponding fields of the ELF file header and the segment header table are updated.
[0047] The following is a further explanation of the operating platform adaptation method of the database in the embodiment of the present application in a specific scenario.
[0048] This embodiment takes the openGauss database as an example and proposes a solution to achieve stable operation of the database system on different operating systems and processor architectures by modifying the RUNPATH attribute of the ELF file and combining multi-platform adaptation technology.
[0049] In this scenario, the operating platform adaptation method of the database in the embodiment of the present application is implemented according to the following steps: Step 1: Dynamic library dependency analysis and management 1. Dynamic library scanning and screening: Use the ldd-r command to scan all executable files and dynamic library files in the openGauss database installation package and analyze the dynamic libraries they depend on. Except for glibc and the Linux kernel virtual dynamic library, add other dynamic library files to the installation package. For some low-level or copyright-related dynamic libraries, the operating system is required to have them, such as: ld-linux, linux-vdso, libasound.so, libreadline.so, libc.so, libclntsh.so, libdl.so, libjvm.so, libm.so, libpthread.so, libresolv.so, librt.so, libselinux.so, libX11.so, libiXau.so, libxcb.so, libXext.so, libXi.so, etc.
[0050] 2. Dynamic library storage path setting: define the installation directory of the openGauss database as the environment variable $GAUSSHOME, and store the newly added dynamic library files in the $GAUSSHOME / lib directory.
[0051] 3. Environment variable optimization: Remove the operation of adding $GAUSSHOME / lib to the LD_LIBRARY_PATH environment variable to avoid system library conflicts caused by environment variable settings.
[0052] Step 2: Modify the RUNPATH attribute of the ELF file 1. ELF file structure analysis ELF Header: Read the ELF file header and get the offsets of the Section Header Table and Program Header Table. The key fields include e_shoff (section header table offset) and e_phoff (program header table offset).
[0053] Program Header Table: Locate the PT_LOAD type program header to determine the code and data segments that need to be loaded into memory; locate the PT_DYNAMIC type program header to obtain the location and related information of the .dynamic section.
[0054] Section Header Table: Use the section header table to find the location of the .dynstr section and the .dynamic section, and obtain their offset, size, and other information.
[0055] 2. RUNPATH property modification Locate the DT_RUNPATH entry in the .dynamic section: traverse the dynamic table entries in the .dynamic section, find the entry of type DT_RUNPATH, and obtain the offset position of its value.
[0056] Modify the RUNPATH value: If the length of the new RUNPATH path does not exceed the length of the original path, the new path string is directly overwritten at the original location.
[0057] If the new path length exceeds the original path length, the .dynstr section needs to be extended, the new RUNPATH path string is written to the end of the .dynstr section, and the value of the DT_RUNPATH entry is updated to point to the new path string location.
[0058] Update ELF file structure: If the .dynstr section is expanded, the sh_size attribute of the .dynstr section in the section header table and the sh_offset offset of the adjacent section need to be updated synchronously.
[0059] If the .dynamic section is modified or moved, the p_filesz and p_memsz fields of the PT_DYNAMIC segment in the program header table need to be updated to ensure that the loader can correctly recognize the newly added entries.
[0060] Specific modification method: In-place replacement mode: traverse the .dynamic section and locate the existing DT_RUNPATH entry. If it exists, modify its path string directly; if it does not exist, move the .dynamic section to the end of the file. Get the string length, if the length is sufficient, modify it directly; otherwise, expand the .dynstr section and place the .dynamic section after the .dynstr section.
[0061] Migrate to end-of-file mode: Expand the .dynstr section, write the new RUNPATH path string to the end of the .dynstr section, and write the expanded .dynstr section at the end of the file with alignment requirements. Create a new DT_RUNPATH dynamic entry at the end of the .dynamic section, set its d_tag to DT_RUNPATH, d_val to the offset of the path string in the .dynstr section, and add a DT_NULL termination marker. Update the p_filesz and p_memsz fields of the PT_DYNAMIC segment in the program header table, and the sh_offset and sh_size fields of the .dynamic section in the section header table.
[0062] In this scenario, each processor architecture (such as x86_64, ARM, etc.) can be adapted to generate the corresponding installation package to ensure that the installation package can run in all operating systems on the processor architecture. It only relies on the most basic underlying components such as the Linux operating system kernel and the `GLIBC` library, and uses its versatility and backward compatibility to minimize the database's dependence on the operating system during runtime. Universally adapt high-availability components and database kernels to enable them to meet the needs of different operating systems.
[0063] Taking the adaptation of the openGauss database on the Linux operating system of the x86_64 architecture as an example, after following the above steps, the test results show that the database can run stably on different versions of the Linux operating system, and there are no problems caused by dynamic library version conflicts. At the same time, by comparing the RUNPATH attributes of the ELF file before and after the modification, the correctness and effectiveness of the RUNPATH setting are verified.
[0064] In practical applications, the operating platform adaptation method of the database in the embodiment of the present application realizes efficient adaptation and stable operation of the database system in a multi-platform environment, and has significant beneficial technical effects, as follows: 1. Quick response In traditional technology, when a customer makes an adaptation request, it is necessary to go through a complex analysis, development, and testing process before the adapted installation package can be provided. This process is time-consuming and difficult to meet the customer's demand for fast delivery. This application pre-adapts multiple processor architectures and generates corresponding installation packages to ensure that the adapted installation package can be quickly provided when the customer makes a request. This rapid response capability greatly shortens the delivery cycle, improves customer satisfaction, and enhances the competitiveness of the product in the market.
[0065] 2. Reduce costs In the process of database system development and adaptation, the workload of R&D and testing accounts for a large proportion of the cost. This application reduces the dependence on the operating system and processor architecture through system dependency minimization and generalized adaptation technology, thereby reducing the complexity and diversity of problems that need to be dealt with during the adaptation process. On the one hand, it reduces the repeated R&D workload for different platforms; on the other hand, it reduces the difficulty of setting up the test environment and the scope of testing, effectively reducing the testing workload. Through these measures, the labor cost is significantly reduced, the development efficiency is improved, and significant economic benefits are brought to the enterprise.
[0066] 3. Improve compatibility When a database system runs in a multi-platform environment, it often faces differences in operating system versions, processor architectures, and dynamic library versions. These differences can easily lead to compatibility issues and affect the stability and performance of the system. This application significantly improves the compatibility of the database through the following measures: Minimize system dependency: It only relies on the most basic underlying components such as the Linux operating system kernel and GLIBC library. By leveraging its versatility and backward compatibility, it minimizes the database's dependency on the operating system during runtime, thus avoiding compatibility issues caused by differences in operating system versions.
[0067] Universal adaptation: Universal adaptation of high-availability components and database kernels enables them to adapt to the needs of different operating systems, further enhancing the adaptability of the database in a multi-platform environment.
[0068] Dynamic library management optimization: By modifying the RUNPATH property of the ELF file, it is ensured that the database uses the dependent libraries included in the installation package when running, avoiding conflicts with the built-in library versions in the operating system, and further improving the compatibility and stability of the system.
[0069] Through the above-mentioned technical means, the present application effectively solves the adaptation problem of the database in multi-platform operation, significantly improves the compatibility of the database, and enables it to run stably on different operating systems and processor architectures.
[0070] like Figure 4 As shown, the present application also provides a device, including a processor 310, a communication interface 320, a memory 330 for storing a processor executable computer program, and a communication bus 340. The processor 310, the communication interface 320, and the memory 330 communicate with each other through the communication bus 340. The processor 310 implements the above-mentioned database operation platform adaptation method by running the executable computer program.
[0071] Among them, the computer program in the memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0072] The system embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected based on actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0073] Through the description of the above implementation modes, those skilled in the art can clearly understand that each implementation mode can be implemented by means of software plus a necessary general hardware platform, or of course by hardware. Based on such an understanding, the above technical solution can essentially or in other words be embodied in the form of a software product that contributes to the prior art. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.
[0074] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for adapting a database operating platform, characterized in that: The method comprises: Step S1: parse the ELF file structure and obtain the dynamic link segment of the ELF file; Step S2: Search for a dynamic table entry with a location type of DT_RUNPATH from the dynamic link segment; Step S3: modify the dynamic table entry of DT_RUNPATH, and set the dynamic library search path for the ELF file according to the modified dynamic table entry of DT_RUNPATH; Step S4: Update the dynamic link segment and ELF file according to the modified dynamic table entry of DT_RUNPATH.
2. The method for adapting the database operating platform according to claim 1, characterized in that: Step S1 includes: Parse the ELF file structure, obtain the ELF file information and program header table, and obtain the offset position of the segment header table based on the obtained program header table; The position and size of the dynamic link segment in the ELF file are obtained according to the offset position of the segment header table, and the dynamic link segment of the ELF file is located according to the position and size of the dynamic link segment.
3. The method for adapting the database operating platform according to claim 1, characterized in that: Step S2 includes: traversing the dynamic table entries in the dynamic link segment, searching for a dynamic table entry of type DT_RUNPATH according to a key of the dynamic table entry, and obtaining a value of the dynamic table entry of type DT_RUNPATH.
4. The method for adapting the database operating platform according to claim 1, characterized in that: Step S3 includes: before setting the dynamic library search path, comparing the dynamic library search path to be set with the original dynamic library search path, and modifying the dynamic table entry of the DT_RUNPATH type according to the comparison result.
5. The method for adapting the database operating platform according to claim 4, characterized in that: Step S3 includes: converting the dynamic library search path to be set into a character string, calculating the length of the character string, and comparing the length of the dynamic library search path to be set with the length of the original dynamic library search path.
6. The method for adapting the database operating platform according to claim 5, characterized in that: Step S3 includes: when the length of the dynamic library search path to be set exceeds the length of the original dynamic library search path, specifying a new location in the ELF file to store the converted string, and updating the value of the dynamic table entry of type DT_RUNPATH to point to the new location.
7. The method for adapting the database operating platform according to claim 5, characterized in that: Step S3 also includes: when the length of the dynamic library search path to be set does not exceed the length of the original dynamic library search path, the position of the original dynamic library search path is obtained according to the value of the dynamic table item of type DT_RUNPATH, and the converted string is overwritten at the position.
8. The method for adapting the database operating platform according to claim 1, characterized in that: Step S4 includes: updating the dynamic link segment according to the modified dynamic table entry of DT_RUNPATH, writing the updated dynamic link segment back into the ELF file, and updating the corresponding fields of the ELF file header and the segment header table.
9. A database operating platform adaptation system, characterized in that: The system includes an adaptation server, which includes: ELF file parsing module, used to parse the ELF file structure and obtain the dynamic link segment of the ELF file; DT_RUNPATH dynamic table entry location module, used to find and locate dynamic table entries of type DT_RUNPATH from the dynamic link segment; DT_RUNPATH dynamic table entry modification module, used to modify the dynamic table entry of DT_RUNPATH, and set the dynamic library search path for the ELF file according to the modified dynamic table entry of DT_RUNPATH; The ELF file update module is used to update the dynamic link segment and ELF file according to the modified dynamic table entry of DT_RUNPATH.
10. A computer device, characterized in that: The computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method according to any one of claims 1 to 8 when executing the program.