Method and device for hot upgrade of distributed storage client

CN119002974APending Publication Date: 2024-11-22BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310552696.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-16
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

Existing distributed storage products need to stop the process when the client is upgraded, resulting in unavailability of the service and affecting user services. The upgrade process takes a long time and lacks a high availability solution.

Method used

By obtaining the new version dynamic library, the old version dynamic library is suspended to read user requests. After processing the request, the current service status is temporarily stored, the old version dynamic library is uninstalled and the new version dynamic library is loaded, the service status is restored, and the service is continued.

Benefits of technology

It realizes hot upgrades to the client, avoids service interruptions, shortens the upgrade cycle, and improves the availability and high availability of user-side services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119002974A_ABST
    Figure CN119002974A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a method and a device for hot upgrade of a distributed storage client. A specific embodiment of the method comprises the following steps: obtaining a new version dynamic library; pausing the old version dynamic library to read the user requests, and processing all the user requests being processed through the old version dynamic library; temporarily storing the state of the current service of the old version dynamic library to the outer layer of the client; unloading the old version dynamic library, and loading the new version dynamic library; transmitting the state of the current service stored in the outer layer of the client to the new version dynamic library; and reading a user request through the new version dynamic library, and continuing to provide the service. According to the embodiment, when the client of the distributed file system is upgraded, the read-write request of the user is not interrupted, the user is not perceived, and the whole upgrading process is completed in a second level.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of distributed storage technology, and more particularly to a method and device for hot upgrading a distributed storage client. Background Art

[0002] Currently, the client side of the open source distributed storage products in the industry generally adopts the following upgrade methods:

[0003] 1. Stop the client process;

[0004] 2. Replace the client executable file with the new version;

[0005] 3. Restart the client process.

[0006] Currently, the distributed storage products in the industry have not disclosed the client hot upgrade solution. The process needs to be restarted during the upgrade. The service is unavailable during the upgrade. Accessing the distributed file system client will report an error, and all services on the dependent link will be affected. For a single client, the process needs to be restarted, and the upgrade takes a certain amount of time. For the entire user-side service cluster, the upgrade will affect user services, requiring the business side to have a good high-availability solution. The cluster completes the upgrade of all client processes, which will take a long time. Summary of the invention

[0007] The embodiments of the present disclosure provide a method and apparatus for hot upgrading a distributed storage client.

[0008] In a first aspect, an embodiment of the present disclosure provides a method for hot upgrading a distributed storage client, comprising: obtaining a new version dynamic library; pausing the old version dynamic library to read user requests, and completing the processing of all user requests being processed through the old version dynamic library; temporarily storing the status of the current service of the old version dynamic library to the outer layer of the client; unloading the old version dynamic library, and loading the new version dynamic library; passing the status of the current service stored in the outer layer of the client to the new version dynamic library; reading user requests through the new version dynamic library and continuing to provide services.

[0009] In some embodiments, the uninstalling of the old version of the dynamic library and the loading of the new version of the dynamic library include: detecting the language type of the client; if it is written in C language, calling the system's own uninstall function to uninstall the old version of the dynamic library, and calling the system's own loading function to load the new version of the dynamic library; if it is written in other languages, modifying the old version of the dynamic library and the new version of the dynamic library, and uninstalling the old version of the dynamic library through the modified uninstall function, and loading the new version of the dynamic library through the modified loading function.

[0010] In some embodiments, the transformation of the old version dynamic library and the new version dynamic library includes: if written in Golang language, compiling the Golang language source code library separately into a standard dynamic library; dynamically linking the client outer layer, the old version dynamic library and the new version dynamic library to the standard dynamic library, so that when the new version dynamic library is dynamically loaded, the standard dynamic library is not loaded, and when the old version dynamic library is dynamically unloaded, the standard dynamic library is not unloaded.

[0011] In some embodiments, the method of unloading the old version of the dynamic library through the modified uninstall function and loading the new version of the dynamic library through the modified loading function includes: modifying the plug-in module to add a new plug-in uninstall interface, wherein the plug-in uninstall interface is used to call the system's own uninstall function to complete the uninstallation of the old version of the dynamic library; calling the plug-in uninstall interface to uninstall the old version of the dynamic library, and calling the plug-in loading interface to load the new version of the dynamic library.

[0012] In some embodiments, the method also includes: adding an initialization function for all Golang packages to reset the state of the standard dynamic library; when uninstalling the old version of the dynamic library, automatically recursively calling the initialization function of each Golang package according to the dependency relationship between the Golang packages to reset the state of the standard dynamic library.

[0013] In some embodiments, the status of the current service includes: the file handle opened in the current file system, and the offset position of the accessed file.

[0014] In some embodiments, temporarily storing the status of the current service of the old version dynamic library in the outer layer of the client includes: serializing the status of the current service of the old version dynamic library and temporarily storing it in the outer layer of the client; and passing the status of the current service stored in the outer layer of the client to the new version dynamic library includes: the new version dynamic library restores the status in the process before the upgrade according to the serialized status of the current service, reopens the specified file, and locates to the specified location.

[0015] In the second aspect, an embodiment of the present disclosure provides a device for hot upgrading of a distributed storage client, comprising: an acquisition unit, configured to acquire a new version of a dynamic library; a pause unit, configured to pause the old version of the dynamic library from reading user requests, and complete processing of all user requests being processed through the old version of the dynamic library; a storage unit, configured to temporarily store the status of the current service of the old version of the dynamic library to the outer layer of the client; an upgrade unit, configured to unload the old version of the dynamic library, and load the new version of the dynamic library; a recovery unit, configured to pass the status of the current service stored in the outer layer of the client to the new version of the dynamic library; a service unit, configured to read user requests through the new version of the dynamic library and continue to provide services.

[0016] In some embodiments, the upgrade unit is further configured to: detect the language type in which the client is written; if it is written in C language, call the system's own uninstall function to uninstall the old version of the dynamic library, and call the system's own loading function to load the new version of the dynamic library; if it is written in other languages, modify the old version of the dynamic library and the new version of the dynamic library, and uninstall the old version of the dynamic library through the modified uninstall function, and load the new version of the dynamic library through the modified loading function.

[0017] In some embodiments, the upgrade unit is further configured to: if written in Golang language, compile the Golang language source code library separately into a standard dynamic library; dynamically link the client outer layer, the old version dynamic library and the new version dynamic library to the standard dynamic library, so that when the new version dynamic library is dynamically loaded, the standard dynamic library is not loaded, and when the old version dynamic library is dynamically unloaded, the standard dynamic library is not unloaded.

[0018] In some embodiments, the upgrade unit is further configured to: transform the plug-in module to add a new plug-in uninstall interface, wherein the plug-in uninstall interface is used to call the system's own uninstall function to complete the uninstallation of the old version of the dynamic library; call the plug-in uninstall interface to uninstall the old version of the dynamic library, and call the plug-in loading interface to load the new version of the dynamic library.

[0019] In some embodiments, the device also includes an initialization unit: adding an initialization function for all Golang packages to reset the state of the standard dynamic library; when uninstalling the old version of the dynamic library, according to the dependency relationship between the Golang packages, automatically recursively calling the initialization function of each Golang package to reset the state of the standard dynamic library.

[0020] In some embodiments, the status of the current service includes: the file handle opened in the current file system, and the offset position of the accessed file.

[0021] In some embodiments, the storage unit is further configured to: serialize the status of the current service of the old version dynamic library and temporarily store it in the client outer layer; and pass the status of the current service stored in the client outer layer to the new version dynamic library, including: the new version dynamic library restores the status in the process before the upgrade according to the serialized status of the current service, reopens the specified file, and locates to the specified location.

[0022] In a third aspect, an embodiment of the present disclosure provides an electronic device for hot upgrading of a distributed storage client, comprising: one or more processors; a storage device on which one or more computer programs are stored, and when the one or more computer programs are executed by the one or more processors, the one or more processors implement a method as described in any one of the first aspects.

[0023] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method as described in any one of the first aspects.

[0024] The method and device for hot upgrading of a distributed storage client provided by the embodiment of the present disclosure splits the client into a client outer layer client-shell and a dynamic library libsdk.so containing complete read and write logic. The current service status is saved in the client outer layer before the old version of the dynamic library is uninstalled, and the current service status is migrated to the new version of the dynamic library after the new version of the dynamic library is loaded. Thus, hot upgrading of the dynamic library is supported.

[0025] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0027] Figure 1 is an exemplary system architecture diagram in which an embodiment of the present disclosure may be applied;

[0028] Figure 2 is a flow chart of an embodiment of a method for hot upgrading a distributed storage client according to the present disclosure;

[0029] Figure 3 It is a schematic diagram of an application scenario of the method for hot upgrading a distributed storage client according to the present disclosure;

[0030] Figure 4 is a flowchart of another embodiment of a method for hot upgrading a distributed storage client according to the present disclosure;

[0031] Figure 5 It is a structural schematic diagram of an embodiment of a device for hot upgrading a distributed storage client according to the present disclosure;

[0032] Figure 6 It is a structural diagram of a computer system of an electronic device suitable for implementing an embodiment of the present disclosure. DETAILED DESCRIPTION

[0033] The present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.

[0034] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0035] Figure 1 An exemplary system architecture of an embodiment of a method or apparatus for hot upgrading a distributed storage client to which the present disclosure may be applied is shown.

[0036] like Figure 1 As shown, the system architecture may include a client and a server. A network is a medium used to provide a communication link between the client and the server. The network may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0037] Users can use the client to interact with the server through the network to receive or send messages, etc. Various distributed storage products can be installed on the client, such as CephFS, MooseFS, GlusterFS, and HDFS.

[0038] The client is divided into user space and kernel space. Based on the traditional user space, the client is split into the client shell and the dynamic library (libsdk.so) containing the complete read and write logic. Under normal reading and writing conditions, the user request (issued by the application module) enters the kernel, passes through VFS, and reaches the kernel FUSE module. The kernel FUSE module writes the request to the block device file / dev / fuse, and the user-mode libfuse module reads the request from / dev / fuse and hands it over to the client sdk module for processing. The client sdk communicates with the server module, and after completing the reading and writing, it hands the result to the libfuse module, which writes the result back to / dev / fuse. The kernel FUSE module reads the result from / dev / fuse and returns it to the user through VFS.

[0039] If the client needs to support hot upgrade, it needs to be split into the shell layer client-shell responsible for hot upgrade and the dynamic library libsdk.so that can be dynamically loaded and unloaded. libsdk.so is a module that is dynamically replaced during hot upgrade, and it contains the complete logic for implementing the client function.

[0040] The server can be a server that provides various services, such as a backend web server that provides support for web pages displayed on the client. The backend web server can analyze and process the received web page request and other data, and feed back the processing results (such as web page data) to the client.

[0041] It should be noted that the server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules (for example, multiple software or software modules used to provide distributed services), or it can be implemented as a single software or software module. No specific limitation is made here. The server can also be a server of a distributed system, or a server combined with a blockchain. The server can also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.

[0042] It should be noted that the method for hot upgrading a distributed storage client provided in the embodiments of the present disclosure is generally executed by the client, and accordingly, the apparatus for hot upgrading a distributed storage client is generally disposed in the client.

[0043] It should be understood that Figure 1The number of clients and servers in the embodiment is only for illustration. Any number of clients and servers may be provided as required.

[0044] Continue to refer Figure 2 , shows a process 200 of an embodiment of a method for hot upgrading a distributed storage client according to the present disclosure. The method for hot upgrading a distributed storage client includes the following steps:

[0045] Step 201, obtain a new version of the dynamic library.

[0046] In this embodiment, the execution subject of the method for hot upgrading the distributed storage client (for example Figure 1 The client shown in the figure can download the new version of libsdk.so to the local computer after receiving the hot upgrade request from the user through a wired connection or a wireless connection. The client can download the corresponding version of the dynamic library from the specified address. The download address can be specified by the user who initiated the upgrade, or it can be the system default download address.

[0047] Step 202: suspend the old version dynamic library from reading user requests, and complete processing of all the user requests being processed through the old version dynamic library.

[0048] In this embodiment, under normal reading and writing conditions, the user request (issued by the Application module) enters the kernel, reaches the kernel FUSE module via VFS, and the kernel FUSE module writes the request to the block device file / dev / fuse. The user-mode libfuse module reads the request from / dev / fuse and hands it over to the client sdk module for processing. The Client sdk communicates with the server module, and after completing the reading and writing, it hands the result over to the libfuse module, which writes the result back to / dev / fuse. The kernel FUSE module reads the result from / dev / fuse and returns it to the user through VFS.

[0049] If the client needs to support hot upgrade, it needs to be split into the shell layer client-shell responsible for hot upgrade and the dynamic library libsdk.so that can be dynamically loaded and unloaded. libsdk.so is a module that is dynamically replaced during hot upgrade, and it contains the complete logic for implementing the client function.

[0050] When the client is to be hot-upgraded, the libfuse module is suspended from reading user requests from / dev / fuse, so that the user requests are temporarily blocked in / dev / fuse.

[0051] For the requests that have been read from / dev / fuse and are still being processed, wait for them to be processed and write all the processing results back to / dev / fuse.

[0052] Step 203: temporarily store the status of the current service of the old version dynamic library in the client outer layer.

[0053] In this embodiment, the service status that needs to be saved includes: file handles opened in the current file system, offset positions of accessed files, etc. Libsdk.so can serialize these statuses and send them to client-shell for storage.

[0054] Step 204, uninstall the old version of the dynamic library, and load the new version of the dynamic library.

[0055] In this embodiment, the Client-shell calls the system call dlclose to uninstall the old version of the libsdk.so library, and calls the system call dlopen to load the new version of the libsdk.so library.

[0056] If the client is written in C language, which natively supports dlopen and dlclose, this step can be implemented without any problems.

[0057] Step 205: transfer the current service status stored in the client's external storage to the new version dynamic library.

[0058] In this embodiment, the Client-shell transfers the state temporarily stored in step 203 to the new version libsdk.so library. The new version libsdk.so restores the state in the process before the upgrade, reopens the specified file, and locates it to the specified location.

[0059] Step 206: Read the user request through the new version dynamic library and continue to provide services.

[0060] In this embodiment, after the state is restored, the new version of the libsdk.so library continues to read user requests from / dev / fuse and continues to provide services. At this point, the hot upgrade of the client is completed.

[0061] The method provided by the above-mentioned embodiment of the present disclosure splits the client into a shell layer client-shell and a dynamic library libsdk.so containing complete read and write logic. Through architectural transformation, libsdk.so can be dynamically loaded / unloaded through system calls dlopen / dlclose, thereby supporting hot upgrades of dynamic libraries. For a single client, the upgrade process does not require restarting the process, during which the service is still available, and all services on the dependent links will not be affected. For the entire user-side service cluster, the upgrade will not affect user services, and the business side does not need to have a good high-availability solution. The cluster completes the upgrade of all client processes, and the duration will be very short.

[0062] In some optional implementations of the present embodiment, the uninstallation of the old version of the dynamic library and the loading of the new version of the dynamic library include: detecting the language type of the client; if it is written in C language, calling the system's own uninstall function to uninstall the old version of the dynamic library, and calling the system's own loading function to load the new version of the dynamic library; if it is written in other languages, the old version of the dynamic library and the new version of the dynamic library are transformed, and the old version of the dynamic library is uninstalled through the modified uninstall function, and the new version of the dynamic library is loaded through the modified loading function. If the client is written in C language, C language natively supports dlopen and dlclose. Call dlclose to uninstall the old version of the dynamic library; call dlopen to load the new version of the dynamic library. There is no need to modify the existing functions, so there is no need to train users, saving upgrade costs. There is no need to change the upgrade process, thereby ensuring the accuracy and stability of the upgrade process.

[0063] If written in other languages, the old version dynamic library and the new version dynamic library are modified to adapt the language. For example, other languages ​​are used to compile a standard dynamic library for the old version dynamic library and the new version dynamic library to call, and can also be called by the client outer layer. Correspondingly, since dlopen and dlclose cannot be called directly, an interface program for calling dlopen and dlclose needs to be written.

[0064] In some optional implementations of this embodiment, the current service status includes: the file handle opened in the current file system, and the offset position of the accessed file. In this way, the upgraded dynamic library can be restored to the state before the upgrade, the specified file can be reopened, and the specified position can be located. This ensures that the service is not interrupted and the upgrade is smooth.

[0065] In some optional implementations of the present embodiment, temporarily storing the status of the current service of the old version of the dynamic library in the outer layer of the client includes: serializing the status of the current service of the old version of the dynamic library and temporarily storing it in the outer layer of the client; and passing the status of the current service stored in the outer layer of the client to the new version of the dynamic library includes: the new version of the dynamic library restores the status in the process before the upgrade according to the serialized status of the current service, reopens the specified file, and locates to the specified location. Serialization refers to converting the status into a string. After conversion to a string, it is easy to store and query. Therefore, after the upgrade, it can quickly restore to the state before the upgrade. And serialization is sequential, and it is also restored in this order during recovery, which can avoid resource conflicts.

[0066] Continue to see Figure 3 , Figure 3 FIG. 1 is a schematic diagram of an application scenario of the method for hot upgrading a distributed storage client according to this embodiment. Figure 3 In the application scenario, the upgrade process is as follows:

[0067] ①The client downloads the corresponding version of the dynamic library from the specified address;

[0068] After receiving the hot upgrade request from the user, the client downloads the new version of libsdk.so to the local computer.

[0069] ②The old version of libsdk.so library suspends reading user requests;

[0070] Under normal reading and writing conditions, the user request (issued by the Application module) enters the kernel, passes through VFS, and reaches the kernel FUSE module. The kernel FUSE module writes the request to the block device file / dev / fuse, and the user-mode libfuse module reads the request from / dev / fuse and hands it over to the client sdk module for processing. The Client sdk communicates with the server module, and after completing the reading and writing, it hands the result over to the libfuse module, which writes the result back to / dev / fuse. The kernel FUSE module reads the result from / dev / fuse and returns it to the user through VFS.

[0071] If the client needs to support hot upgrade, it needs to be split into the shell layer client-shell responsible for hot upgrade and the dynamic library libsdk.so that can be dynamically loaded and unloaded. libsdk.so is a module that is dynamically replaced during hot upgrade, and it contains the complete logic for implementing the client function.

[0072] When the client is to be hot-upgraded, the libfuse module is suspended from reading user requests from / dev / fuse, so that the user requests are temporarily blocked in / dev / fuse.

[0073] ③The old version of libsdk.so library waits for all currently processed requests to be completed;

[0074] For the requests that have been read from / dev / fuse and are still being processed, wait for them to be processed and write all the processing results back to / dev / fuse.

[0075] ④ The old version of libsdk.so library serializes the status of the current service and temporarily stores it in client-shell;

[0076] The service status that needs to be saved includes: file handles opened in the current file system, offset positions of accessed files, etc. Libsdk.so serializes these statuses and gives them to client-shell for storage.

[0077] ⑤client-shell uninstalls the old version of libsdk.so library and loads the new version of libsdk.so library;

[0078] Client-shell calls the system call dlclose to uninstall the old version of the libsdk.so library, and calls the system call dlopen to load the new version of the libsdk.so library.

[0079] If the client is written in C, which natively supports dlopen and dlclose, this step can be implemented without any problems. If the client is written in Golang, some modifications to Golang are required to implement this step.

[0080] 1) Solve the problem that Golang runtime cannot be uninstalled

[0081] Golang has its own runtime (implemented by the runtime module). At the beginning of the Golang program, the runtime module will start multiple coroutines to be responsible for coroutine scheduling, memory management, garbage collection, etc. These coroutines exist with the existence of the process and have no termination logic. The existence of these long-running coroutines makes it impossible to unload the runtime module. (Because if we forcibly unload the runtime module code from the process memory, when the coroutine runs, it will access illegal memory, causing the entire process to crash.)

[0082] We compile the Golang language source code library (including the runtime module) into a dynamic library libstd.so separately, and dynamically link it with client-shell and libsdk.so. In this way, when dynamically loading / unloading libsdk.so, libstd.so is not loaded / unloaded, thus avoiding the problem that the client cannot be hot-upgraded due to the existence of the Golang language runtime.

[0083] 2) Enhance the dynamic characteristics of the Golang language

[0084] Golang's native plugin module only provides the plugin.Open interface for loading dynamic libraries, but does not provide an interface for unloading dynamic libraries. We modified the plugin module and added a plugin.Close interface, which calls the system call dlcolse to complete the unloading of dynamic libraries.

[0085] 3) Add status reset function for libstd.so

[0086] libstd.so is a dynamic library compiled from the Golang standard library. It runs stably in the client process and will not be unloaded. The program will modify the state of the libstd.so library during operation (for example, modify the value of global variables), and hot upgrade will not unload and reload libstd.so, so these modified states will not be reset, and these modified states will affect the operation of the upgraded program.

[0087] We add a new fini() function to all Golang packages, analogous to Golang's init() function, to reset the status of the libstd.so library. After Golang adds the new fini() function, when the program uninstalls libsdk.so, the program automatically recursively calls the fini() function of each package based on the dependencies between the packages to reset the status of the libstd.so library.

[0088] ⑥client-shell passes the current service status to the new version of libsdk.so library, and the new version of libsdk.so library restores these states;

[0089] Client-shell passes the status temporarily saved in step ④ to the new version of libsdk.so library. The new version of libsdk.so restores the status in the process before the upgrade, reopens the specified file, and locates it to the specified location.

[0090] ⑦The new version of the libsdk.so library reads user requests and continues to provide services.

[0091] After the status is restored, the new version of the libsdk.so library continues to read user requests from / dev / fuse and continues to provide services.

[0092] At this point, the hot upgrade of the client is completed.

[0093] Further references Figure 4 , which shows a process 400 of another embodiment of a method for hot upgrading a distributed storage client. The process 400 of the method for hot upgrading a distributed storage client includes the following steps:

[0094] Step 401, obtain a new version of the dynamic library.

[0095] Step 402, suspending the old version dynamic library from reading user requests, and completing the processing of all the user requests being processed through the old version dynamic library.

[0096] Step 403: temporarily store the status of the current service of the old version dynamic library in the client outer layer.

[0097] Steps 401-403 are substantially the same as steps 201-203, and thus are not described in detail herein.

[0098] Step 404, compile the Golang language source code library separately into a standard dynamic library.

[0099] In this embodiment, if the client is written in Golang language, in order to implement the client-shell calling dlclose to uninstall the old version of the libsdk.so library and calling the system call dlopen to load the new version of the libsdk.so library, some modifications to the Golang language are required.

[0100] Golang has its own runtime (implemented by the runtime module). At the beginning of the Golang program, the runtime module will start multiple coroutines to be responsible for coroutine scheduling, memory management, garbage collection, etc. These coroutines exist with the existence of the process and have no termination logic. The existence of these long-running coroutines makes it impossible to unload the runtime module. (Because if we forcibly unload the runtime module code from the process memory, when the coroutine runs, it will access illegal memory, causing the entire process to crash.)

[0101] We compile the Golang language source code library (including the runtime module) into a dynamic library libstd.so separately to solve the problem that the Golang runtime cannot be uninstalled.

[0102] Step 405, dynamically link the client outer layer, the old version dynamic library and the new version dynamic library to the standard dynamic library.

[0103] In this embodiment, client-shell and libsdk.so dynamically link the dynamic library libstd.so, so that when libsdk.so is dynamically loaded, libstd.so is not loaded, and when libsdk.so is dynamically unloaded, libstd.so is not unloaded, thereby avoiding the problem that the client cannot be hot-upgraded due to the existence of the Golang language runtime.

[0104] Step 406, uninstall the old version of the dynamic library, and load the new version of the dynamic library.

[0105] In this embodiment, the old version of the dynamic library can be uninstalled and the new version of the dynamic library can be loaded through the existing interface. Some modules can also be modified so that they can call dlclose to uninstall the old version of the libsdk.so library and call the system call dlopen to load the new version of the libsdk.so library.

[0106] Step 407: The status of the current service stored in the client's external storage is transferred to the new version of the dynamic library.

[0107] Step 408: Read the user request through the new version dynamic library and continue to provide services.

[0108] Steps 407-408 are substantially the same as steps 205-206, and thus will not be described in detail.

[0109] In some optional implementations of the present embodiment, the method of unloading the old version of the dynamic library through the modified uninstall function and loading the new version of the dynamic library through the modified loading function includes: modifying the plug-in module to add a new plug-in uninstall interface, wherein the plug-in uninstall interface is used to call the system's own uninstall function to complete the uninstallation of the old version of the dynamic library; calling the plug-in uninstall interface to uninstall the old version of the dynamic library, and calling the plug-in loading interface to load the new version of the dynamic library. Modifying the plugin module to add a new plugin.Close interface, wherein the plugin.Close interface is used to call dlcolse to complete the uninstallation of the old version of the dynamic library; calling plugin.Close to uninstall the old version of the dynamic library, and calling plugin.Open to load the new version of the dynamic library. Enhancing the dynamic characteristics of the Golang language can reduce the cost of modification and simplify the upgrade process, thereby reducing the upgrade cycle.

[0110] In some optional implementations of this embodiment, the method further includes: adding an initialization function for all Golang packages to reset the state of the standard dynamic library; when uninstalling the old version of the dynamic library, automatically recursively calling the initialization function of each Golang package according to the dependencies between the Golang packages to reset the state of the standard dynamic library. libstd.so is a dynamic library compiled from the Golang standard library, which will not be uninstalled when running stably in the client process. The program will modify the state of the libstd.so library during operation (such as modifying the value of global variables), and hot upgrades will not unload and reload libstd.so, so these modified states will not be reset, and these modified states will affect the operation of the upgraded program.

[0111] We added a new fini() function to all Golang packages, analogous to Golang's init() function, to reset the status of the libstd.so library. After Golang added the new fini() function, when the program uninstalls libsdk.so, the program automatically recursively calls the fini() function of each package based on the dependencies between packages to reset the status of the libstd.so library. This adds a status reset function to libstd.so to ensure smooth service switching without interruption during the upgrade process.

[0112] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device for hot upgrading a distributed storage client. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0113] like Figure 5 As shown, the apparatus 500 for hot upgrading a distributed storage client in this embodiment includes: an acquisition unit 501, a pause unit 502, a storage unit 503, an upgrade unit 504, and a recovery unit 505 and a service unit 506. The acquisition unit 501 is configured to acquire a new version of a dynamic library; the pause unit 502 is configured to pause the old version of the dynamic library from reading user requests, and complete the processing of all the user requests being processed through the old version of the dynamic library; the storage unit 503 is configured to temporarily store the status of the current service of the old version of the dynamic library to the client outer layer; the upgrade unit 504 is configured to unload the old version of the dynamic library and load the new version of the dynamic library; the recovery unit 505 is configured to pass the status of the current service stored in the client outer layer to the new version of the dynamic library; and the service unit 506 is configured to read the user request through the new version of the dynamic library and continue to provide services.

[0114] In this embodiment, the specific processing of the acquisition unit 501, the pause unit 502, the storage unit 503, the upgrade unit 504, the recovery unit 505 and the service unit 506 of the distributed storage client hot upgrade device 500 can be referred to Figure 2 Corresponding to step 201, step 202, step 203, step 204, step 205 and step 206 in the embodiment.

[0115] In some optional implementations of this embodiment, the upgrade unit 504 is further configured to: detect the language type in which the client is written; if the client is written in C language, call the system's own uninstall function to uninstall the old version of the dynamic library, and call the system's own loading function to load the new version of the dynamic library; if the client is written in other languages, modify the old version of the dynamic library and the new version of the dynamic library, and uninstall the old version of the dynamic library through the modified uninstall function, and load the new version of the dynamic library through the modified loading function.

[0116] In some optional implementations of this embodiment, the upgrading unit 504 is further configured to: if the client is written in Golang language, compile the Golang language source code library separately into a standard dynamic library; dynamically link the client outer layer, the old version dynamic library and the new version dynamic library to the standard dynamic library, so that when the new version dynamic library is dynamically loaded, the standard dynamic library is not loaded, and when the old version dynamic library is dynamically unloaded, the standard dynamic library is not unloaded.

[0117] In some optional implementations of this embodiment, the upgrade unit 504 is further configured to: transform the plug-in module to add a new plug-in uninstall interface, wherein the plug-in uninstall interface is used to call the system's own uninstall function to complete the uninstallation of the old version of the dynamic library; call the plug-in uninstall interface to uninstall the old version of the dynamic library, and call the plug-in loading interface to load the new version of the dynamic library.

[0118] In some optional implementations of this embodiment, the device also includes an initialization unit (not shown in the drawings): adding an initialization function for all Golang packages to reset the state of the standard dynamic library; when uninstalling the old version of the dynamic library, automatically recursively calling the initialization function of each Golang package according to the dependency relationship between the Golang packages to reset the state of the standard dynamic library.

[0119] In some optional implementations of this embodiment, the state of the current service includes: a file handle opened in the current file system, and an offset position of the accessed file.

[0120] In some optional implementations of this embodiment, the storage unit 503 is further configured to: serialize the status of the current service of the old version dynamic library and temporarily store it in the outer layer of the client; and pass the status of the current service stored in the outer layer of the client to the new version dynamic library, including: the new version dynamic library restores the status in the process before the upgrade according to the serialized status of the current service, reopens the specified file, and locates to the specified location.

[0121] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.

[0122] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.

[0123] An electronic device comprises: one or more processors; a storage device on which one or more computer programs are stored, and when the one or more computer programs are executed by the one or more processors, the one or more processors implement the method described in process 200 or 400.

[0124] A computer-readable medium stores a computer program, wherein the computer program implements the method described in process 200 or 400 when executed by a processor.

[0125] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0126] like Figure 6As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0127] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0128] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as a method for hot upgrading of a distributed storage client. For example, in some embodiments, the method for hot upgrading of a distributed storage client may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the method for hot upgrading of the distributed storage client described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform a method for hot upgrading of a distributed storage client by any other appropriate means (e.g., by means of firmware).

[0129] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0130] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0131] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0132] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0133] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0134] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the respective computers and having a client-server relationship with each other. The server may be a server of a distributed system, or a server combined with a blockchain. The server may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. The server may be a server of a distributed system, or a server combined with a blockchain. The server may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.

[0135] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0136] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A method for hot upgrading a distributed storage client. include: Get the new version of the dynamic library; The old version dynamic library is paused from reading user requests, and all the user requests being processed are processed through the old version dynamic library; Temporarily storing the current service status of the old version dynamic library in the client outer layer; Uninstall the old version of the dynamic library and load the new version of the dynamic library; Passing the current service status stored in the client's external storage to the new version dynamic library; The user request is read through the new version dynamic library to continue providing services.

2. The method according to claim 1, in, The step of uninstalling the old version of the dynamic library and loading the new version of the dynamic library includes: Detect the language type of the client; if the client is written in C language, call the system's own uninstall function to uninstall the old version of the dynamic library, and call the system's own loading function to load the new version of the dynamic library; If it is written in other languages, the old version dynamic library and the new version dynamic library are modified, and the old version dynamic library is uninstalled through the modified uninstall function, and the new version dynamic library is loaded through the modified loading function.

3. The method according to claim 2, in, The transformation of the old version dynamic library and the new version dynamic library includes: If the client is written in Golang language, the Golang language source code library is separately compiled into a standard dynamic library; The client outer layer, the old version dynamic library and the new version dynamic library are dynamically linked to the standard dynamic library, so that when the new version dynamic library is dynamically loaded, the standard dynamic library is not loaded, and when the old version dynamic library is dynamically unloaded, the standard dynamic library is not unloaded.

4. The method according to claim 3, in, The step of uninstalling the old version of the dynamic library through the modified uninstall function and loading the new version of the dynamic library through the modified loading function includes: The plug-in module is modified to add a plug-in uninstall interface, wherein the plug-in uninstall interface is used to call the system's own uninstall function to complete the uninstallation of the old version of the dynamic library; The plug-in uninstall interface is called to uninstall the old version of the dynamic library, and the plug-in loading interface is called to load the new version of the dynamic library.

5. The method according to claim 3, in, The method further comprises: Added initialization functions to all Golang packages to reset the state of the standard dynamic library; When the old version of the dynamic library is uninstalled, the initialization function of each Golang package is automatically recursively called according to the dependency relationship between the Golang packages to reset the state of the standard dynamic library.

6. The method according to claim 1, in, The current service status includes: the file handle opened in the current file system, and the offset position of the accessed file.

7. The method according to claim 1, in, The step of temporarily storing the current service status of the old version dynamic library in the client outer layer includes: Serializing the current service status of the old version dynamic library and temporarily storing it in the client outer layer; and The transferring of the current service status stored in the client outer layer to the new version dynamic library comprises: The new version dynamic library restores the state in the process before the upgrade according to the serialized state of the current service, reopens the specified file, and locates it to the specified location.

8. A device for hot upgrading of distributed storage clients, include: An acquisition unit, configured to acquire a new version of a dynamic library; A pause unit, configured to pause the old version dynamic library from reading user requests, and complete processing of all the user requests being processed through the old version dynamic library; A storage unit is configured to temporarily store the current service status of the old version dynamic library to the client outer layer; An upgrading unit, configured to uninstall the old version of the dynamic library and load the new version of the dynamic library; A recovery unit, configured to transfer the current service status stored in the client external layer to the new version dynamic library; The service unit is configured to read user requests through the new version dynamic library and continue to provide services.

9. An electronic device for hot upgrading of distributed storage clients, include: one or more processors; a storage device having one or more computer programs stored thereon, When the one or more computer programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

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

Citation Information

Cited By

  • Audio plug-in update method and electronic device

    CN122777156A