Lease management method, device, equipment, system and storage medium

By setting up client management services and metadata management services in a distributed system, the lease management of target files is achieved, which solves the problem that single-node servers are difficult to scale horizontally and manage multi-client leases, and improves file processing efficiency and data consistency.

CN119917476APending Publication Date: 2025-05-02SANGFOR TECH INC
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411811660.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

In the prior art, the server used for file sharing is a single node deployment, which is difficult to achieve horizontal scale and cannot effectively manage the leases of multiple clients in the distributed system, resulting in data consistency and processing efficiency problems.

Method used

In the distributed system, by setting up a first client management service and a first metadata management service, the lease management of the target file is realized, allowing the client to operate while holding the lease of the target file to ensure data consistency and processing efficiency.

Benefits of technology

Through this method, efficient processing and consistency management of target files in distributed systems is achieved, and the client's operation efficiency of target files is improved, while avoiding the problems of lease conflicts and data inconsistencies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119917476A_ABST
    Figure CN119917476A_ABST
Patent Text Reader

Abstract

The invention provides a lease management method, apparatus, device and system, and a storage medium, applied to a first service node of a distributed system, the method comprises: if a first client management service determines that a lease does not hold a target file in response to a file processing request, authorizing the lease for the first client management service, generating a first lease application result comprising the authorized lease type and the file identifier of the target file; and returning the first lease application result to the first client, so that the first client holds the lease of the target file. Through the method, the lease of the target file can be allocated to the client associated with the distributed system, so that the processing efficiency of the target file in the distributed system is improved, and meanwhile, the consistency of the target file is kept.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a lease management method, device, equipment, system and storage medium. Background Art

[0002] At present, in the related technology, the server used to provide file sharing is deployed in a single node, and the shared resources are also limited to the resources of the single-node server, such as the local file system on the server. When multiple clients access the file resources on the server, data consistency can be met by implementing a single-node lease management. When multiple clients access the service, different connections will be established, and multiple service processes will be started to respond to the corresponding client's request. The service process will record the file lease information authorized to the client in a stand-alone database. When other clients access the same file, the service process will determine whether it is necessary to recover the authorized lease and the lease that can be authorized for this operation based on the authorized information on the local database. By sharing and locking the local database, lease management in a single-node mode is implemented, but it is limited by the single-node resource limitation and is not easy to expand horizontally. Based on this, providing a method for lease management in a distributed system is a technical problem that needs to be solved urgently. Summary of the invention

[0003] In view of the above problems, the present application provides a lease management method, apparatus, device, system and storage medium, which can allocate leases of target files to clients associated with a distributed system, thereby improving the processing efficiency of target files in the distributed system while maintaining the consistency of the target files.

[0004] The embodiment of the present application is implemented by adopting the following technical solutions:

[0005] In a first aspect, an embodiment of the present application provides a lease management method, which is applied to a first service node of a distributed system, wherein the first service node includes a first client management service and a first metadata management service, and the method includes: the first client management service determines the lease holding status of a target file by the first client management service in response to a file processing request sent by the first client, wherein the file processing request carries the requested lease type; if the lease holding status indicates that the first client management service does not hold the lease of the target file, the first metadata management service authorizes the lease for the target file for the first client management service, and generates a first lease application result including the authorized lease type and the file identifier of the target file; the first metadata management service returns the first lease application result to the first client through the first client management service, so that the first client holds the lease of the target file and performs operations on the target file.

[0006] In a second aspect, an embodiment of the present application provides a lease management device, which is applied to a first service node of a distributed system, wherein the first service node includes a first client management service and a first metadata management service, and the device includes: a lease determination module, which is used to determine the lease holding status of the first client management service for a target file in response to a file processing request sent by the first client using the first client management service, wherein the file processing request carries the requested lease type, the client identifier of the first client, and the target file identifier of the target file; a lease authorization module, which is used to authorize the lease for the target file for the first client management service using the first metadata management service when the lease holding status indicates that the first client management service does not hold the lease of the target file, and generate a first lease application result including the authorized lease type and the file identifier of the target file; and a lease result return module, which is used to return the first lease application result to the first client through the first client management service using the first metadata management service, so that the first client holds the lease of the target file and operates on the target file.

[0007] In a third aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; a memory; one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the above-mentioned lease management method.

[0008] In a fourth aspect, an embodiment of the present application provides a lease management system, comprising multiple service nodes, each service node being used to connect to at least one client, each service node comprising a client management service and a metadata management service, and each of the service nodes being used to execute the method steps as described above.

[0009] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a program code, and the program code can be called by a processor to execute the above-mentioned lease management method.

[0010] The lease management method, apparatus, device, system and storage medium provided in the embodiments of the present application are applied to a first service node of a distributed system. The first service node sets a first client management service and a first metadata management service, and the first client management service is used as an entry for all clients associated with the first service node to access the first metadata management service, so that when the first client management service receives a file processing request sent by the first client, it responds to the file processing request and determines that it does not hold a lease for a target file, authorizes a lease for the first client management service, generates a first lease application result including an authorized lease type and a file identifier of the target file, and when the first client management service holds a lease for the target file, the first metadata management service uses the first lease application result to enable the first client to hold the lease for the target file, thereby authorizing the lease of the target file to the client associated with the distributed system, so that the client can improve the processing efficiency of the target file when holding the lease for the target file, while maintaining the consistency of the target file in the distributed system.

[0011] These and other aspects of the present application will become more clearly understood in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0013] Figure 1 It is a schematic diagram of an application scenario of a lease management method provided in an embodiment of the present application.

[0014] Figure 2 It is a flowchart of a lease management method provided in an embodiment of the present application.

[0015] Figure 3 yes Figure 2 Schematic diagram of the process of step S120.

[0016] Figure 4 yes Figure 2 Another flowchart diagram of step S120 in FIG.

[0017] Figure 5 This is another application scenario diagram of a lease management method provided in an embodiment of the present application.

[0018] Figure 6 It is a timing diagram of a lease management method provided in an embodiment of the present application.

[0019] Figure 7 This is another flowchart of a lease management method provided in an embodiment of the present application.

[0020] Figure 8 This is another timing diagram of a lease management method provided in an embodiment of the present application.

[0021] Fig. 9 This is another flow chart of a lease management method provided in an embodiment of the present application.

[0022] Fig.10 This is another timing diagram of a lease management method provided in an embodiment of the present application.

[0023] Fig.11 It is a flowchart of a lease management method provided in an embodiment of the present application.

[0024] Fig.12 It is a connection block diagram of a lease management device provided in an embodiment of the present application.

[0025] Fig.13 It is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0026] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.

[0027] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.

[0028] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0029] like Figure 1 , Figure 1 This is an application scenario diagram of a lease management method provided in an embodiment of the present application. The method can be applied to a first service node of a distributed system. The first service node includes a first client management service and a first metadata management service. Figure 2 As shown, the distributed system includes a first service node and multiple second service nodes, each service node is associated with one or more clients. Figure 2Only the case where the distributed system includes a first service node and a second service node, the first service node is associated with a first client and a third client, and the second service node is associated with two second clients is shown). Exemplarily, the first service node includes a first client management service and a first metadata management service, and the second service node includes a second client management service and a second metadata management service. The first service node and the second service node may also include processes corresponding to the associated clients (not shown in the figure).

[0030] The metadata management service and the client management service are software programs in the service nodes, respectively. The metadata management service can be responsible for managing and maintaining the metadata information of the file system in the distributed file system. The metadata information can be file names, directory structures, permission settings, etc. In this embodiment, it can also be used to manage the leases of client services in different service nodes. The client management service is used to interact with the metadata management service and the client. In this embodiment, it can also manage the leases of the associated clients for the target files, such as allocating or reclaiming the leases for the target files for the associated clients.

[0031] See also Figure 2 , the method comprising:

[0032] Step S110: The first client management service determines the lease holding status of the target file by the first client management service in response to the file processing request sent by the first client.

[0033] The file handling request carries the requested lease type.

[0034] In an optional implementation, the file processing request may specifically include a lease request and a file open request, the lease request carries the requested lease type, and the file open request carries information indicating opening the file indicated by the target file identifier; in this case, the lease request or the file open request also carries the client identifier of the first client and the target file identifier of the target file.

[0035] The first client refers to a client associated with the first service node and requiring a lease. The lease holding status of the first client management service for the target file is used to indicate that the first client management service holds the lease of the target file, or the first client management service does not hold the lease of the target file.

[0036] A lease is a method of managing access rights to files or resources. It defines the validity period of a client's access rights to a resource (such as a file). Lease types include read leases, write leases, and handle leases. A read lease is a method of granting a client read-only access to a file, which means that when a client holds a read lease on a file, it can only read the contents of the file but cannot modify it. A write lease is a method of granting a client write access to a file, which means that when a client holds a write lease on a file, it can modify the contents of the file. A handle lease usually refers to granting a client a persistent connection with a file server, which contains information about access rights to the file. When a client holds a handle lease on a file, it can retain the file handle and access the file at any time during the validity period.

[0037] The above lease request may be used to indicate a request for at least one type of lease of the target file, or to indicate a request for all types of leases. The above file open request indicates opening the target file.

[0038] In one possible implementation, the first service node may store a first lease list of the first client management service, and the first lease list may store file identifiers of files with leases held by the first client management service; the above step S110 may be: the first client management service obtains a target file identifier of a target file in response to a file processing request, and determines whether the first client management service holds a lease for the target file based on the first lease list and the target file identifier, wherein when the first client management service determines that the target file identifier exists in the first lease list, it confirms that it holds a lease for the target file.

[0039] In another possible implementation, the first service node may store a second lease list of the first client management service, and the second lease list stores file identifiers of multiple files and the client management service holding the lease of each file. The above step S110 may also be that the first client management service sends a lease query request including a target file identifier to the first metadata management service in response to the file processing request, and the first metadata management service queries the target client management service holding the lease of the target file from the second lease list in response to the lease query request; returns the lease query result to the first client management service, and the lease query result indicates the target client management service holding the lease; the first client management service determines the lease holding status for the target file based on the lease query result, wherein when the target client management service serves the first client, the lease holding status indicates that it holds the lease for the target file, and when the target client management service does not serve the first client, the lease holding status indicates that it does not hold the lease for the target file.

[0040] Step S120: If the lease holding status indicates that the first client management service does not hold the lease of the target file, the first metadata management service authorizes the lease for the target file for the first client management service, and generates a first lease application result including the authorized lease type and the file identifier of the target file.

[0041] When the first metadata management service authorizes the first client management service to lease the target file, the lease of the target file can be allocated to the first management client according to the lease type requested in the lease request. Exemplarily, if the lease type requested in the lease request includes a read lease, a write lease, and a handle lease, the read lease, the write lease, and the handle lease of the target file can be allocated to the first management client.

[0042] In some scenarios, the first management client may be allocated a lease of the target file according to the authentication result of the first client. For example, if the authentication result of the first client indicates that the first client can read the target file, a read lease and a handle lease indicating readability may be allocated; if the authentication result of the first client indicates that the first client can write data to the target file, a read lease, a write lease, and a handle lease of the target file may be allocated to the first client.

[0043] The client can perform file read and write operations on the target file through the file identifier of the target file, and the file identifier of the target file may include but is not limited to a file handle, a pointer or an index, etc. The embodiment of the present application does not impose any restrictions on the specific type of the file identifier.

[0044] In one possible implementation, the file identifier of the target file may be a file handle of the target file.

[0045] To improve the security of target file access, see Figure 3 In one possible implementation, the above step S120 includes the following steps:

[0046] Step S121: If the lease holding status indicates that the first client management service does not hold the lease of the target file, the first metadata management service performs authentication based on the client identifier and the target file identifier to obtain an authentication result.

[0047] The authentication result is used to indicate whether the first client has access rights to the target file.

[0048] In one possible implementation, specifically, the metadata management service in each service node of the distributed system respectively maintains a first permission management table, and the first permission management table maintained by each service node is the same; the first permission management table can store accessible client identifiers corresponding to multiple files. The above step S120 can be that the first metadata management service determines whether the target client belongs to the accessible client identifier of the target file indicated by the target file identifier based on the client identifier and the target file identifier. If so, it is determined that the target client has access rights to the target file (i.e., authentication is passed); if not, it is determined that the target client does not have access rights to the target file.

[0049] In another possible implementation, the metadata management service in each service node of the distributed system respectively maintains a second permission management table, and the second permission management table maintained by each service node is the same; the second permission management table can store multiple disclosure types corresponding to file identifiers, such as "fully public" and "partially public". For partially public files, the second permission management table also stores an accessible client identifier. The above step S120 can also be to determine the disclosure type corresponding to the target file identifier according to the second permission management table. If the disclosure type indicates fully public, an authentication result indicating that the target client has access rights to the target file is obtained. If the disclosure type indicates partially public, an authentication result is obtained according to the client identifier and the accessible client identifier corresponding to the target file identifier in the second permission management table, wherein if the client identifier belongs to the accessible client identifier corresponding to the target file identifier, the authentication result indicates that the first client has access rights to the target file (i.e., the authentication is passed).

[0050] Step S122: If the authentication result indicates that the first client has access rights to the target file, the first metadata management service authorizes the lease for the target file for the first client management service, and generates a first lease application result including the authorized lease type and the file identifier of the target file.

[0051] By adopting the above steps S121-S122, access rights can be strictly controlled: in step S121, when the first client management service does not hold the lease of the target file, the first metadata management service must authenticate based on the client identifier and the target file identifier, which means that any operation attempting to access the file needs to undergo strict permission verification to ensure that only authorized clients can obtain access rights. This mechanism effectively prevents unauthorized access and improves the security of target file access.

[0052] In one possible implementation, see Figure 4 , the above step S120 includes:

[0053] Step S124: If the lease holding status indicates that the first client management service does not hold the lease of the target file, the first metadata management service determines the lease status of the target file.

[0054] Among them, the lease status of the target file indicates whether there is a second client holding the lease of the target file, the second client is a client associated with a second service node in the distributed system, and the second service node is a service node other than the first service node in the distributed system.

[0055] Specifically, the metadata management services in each service node of the distributed system respectively maintain a file lease list, and the file lease list of the metadata management service maintained by each service node is the same; the above step S130 includes: the first metadata management service obtains the lease details corresponding to the target file identifier from the file lease list based on the target file identifier, the file lease list stores multiple preset file identifiers and the lease details corresponding to each preset file identifier, the lease details corresponding to the preset file identifier are used to indicate whether there is a client holding a lease for the file indicated by the preset file identifier, and when there is a client holding a lease for the file indicated by the preset file identifier, indicate the client holding the lease for the file corresponding to the preset file identifier; determine the lease status of the target file according to the lease details corresponding to the target file identifier, wherein, if the lease details corresponding to the target file identifier indicate that there is a client holding the lease for the target file, the lease status of the target file indicates the client holding the lease for the target file, and the client is the second client associated with the distributed system; if the lease details corresponding to the target file identifier indicate that there is no client holding the lease for the target file, the lease status of the target file indicates that the target file is not assigned a lease.

[0056] It should be understood that if the file processing request carries a file open request and a lease request, the method also includes: if the authentication result indicates that the first client has access rights to the target file, the first metadata management service opens the file indicated by the target file identifier in response to the file open request.

[0057] Step S125: If the lease status indicates that there is no second client holding a lease for the target file, the first metadata management service authorizes the lease for the target file for the first client management service, and generates a first lease application result including the authorized lease type and the file identifier of the target file.

[0058] It should be noted that there is no lease for the target file held by the second client, which means that there is no lease for the target file held by the second client management service. At this time, the first metadata management service can authorize a lease for the first client management service.

[0059] It should also be understood that after the first metadata management service assigns a lease to the first client management service, it will also change the lease details of the target file in the file lease list to indicate that a lease is assigned to the first client management service and the first client, as well as the specific assigned lease type.

[0060] In addition, after allocating a lease to the first client management service, the first metadata management service can also send an authentication task to the first client management service so that when a new client applies for a lease, the first client management service can authenticate the new client based on the client identifier and target file identifier of the new client.

[0061] By adopting the above steps S124-S125, when multiple clients simultaneously try to obtain the lease of the same file, by checking the file lease list to confirm whether other clients already hold the lease of the file, conflicts between concurrent requests can be effectively avoided. If it is found that no other client holds the lease of the file, a lease can be directly allocated to the current request (step S125), otherwise it is necessary to wait for the existing lease to be released or take other measures, thereby reducing file access conflicts.

[0062] It is worth mentioning that the above step S124 can be performed after the above step S122, that is, when the authentication result indicates that the first client has access rights to the target corpus, the above step S124 is performed.

[0063] Step S130: The first metadata management service returns the first lease application result to the first client through the first client management service, so that the first client holds the lease of the target file and operates the target file.

[0064] Among them, after the first client receives the first lease application result, it means that the first client already holds the lease of the target file. Among them, when the first client has a read lease for the target file, the content of the target file can be read in the client's cache, and it is not necessary to request data from the server every time during the reading process; when the first client holds a write lease for the target file, the first client caches the write data of the file. The first client can modify the file locally without immediately synchronizing to the first service node. When the first client holds the write lease for the target file, it can be guaranteed that its modifications to the target file will not be overwritten by other clients (that is, the first client can cache the modifications to the target file locally, and it is not necessary to submit the changes to the first service node every time when performing a write operation. When the first client completes the modification, the modified data in the cache is synchronized back to the first service node to update the content of the target file). When the first client holds the handle lease for the target file, the first client has a file handle cached locally, and there is no need to re-establish a connection with the first service node or reopen the file by the first service node every time the target file is opened subsequently.

[0065] By adopting the lease management method of the present application, the first service node sets up a first client management service and a first metadata management service, and the first client management service is used as an entry for all clients associated with the first service node to access the first metadata management service, so that when the first client management service receives a file processing request, it responds to the file processing request and determines that it does not hold the lease of the target file, and authorizes the lease for the first client management service, and generates a first lease application result including the authorized lease type and the file identifier of the target file. Furthermore, when the first client management service holds the lease of the target file, the first metadata management service uses the first lease application result to enable the first client to hold the lease of the target file, thereby realizing the authorization of the lease of the target file to the client associated with the distributed system, so that the client can improve the processing efficiency of the target file when holding the lease of the target file, while maintaining the consistency of the target file in the distributed system.

[0066] In a network file sharing scenario, the client usually uses a specific network file sharing protocol to request access rights to the target file, including obtaining read and write permissions for the file or locking the file. Therefore, when the client requests a lease for a file, it usually sends a request to the server through a network file sharing protocol. However, when data is transmitted between different management services in a service node, the protocol or processing mechanism used internally is usually used for data transmission.

[0067] In order to enable the service node to better utilize resources to process the request, the service node can convert the network file sharing protocol into a protocol or processing mechanism used internally. In one embodiment, the protocol type of the file processing request is a first protocol type, which is a protocol type used in the service node, and the first service node also includes a first process; before executing step S110, the method may also include: the first process performs protocol conversion on the first request sent by the first client to obtain a file processing request, and the protocol type of the first request is a network file sharing protocol; the first process sends the file processing request to the first client management service.

[0068] Among them, the first protocol type can be TCP (Transmission Control Protocol), UDP (User Datagram Protocol), HTTP (Hypertext Transfer Protocol) or any other protocol type suitable for use in a service node and between service nodes, and is not specifically limited in this embodiment.

[0069] In one possible implementation, if the file processing request includes a lease request and a file open request, the first process performs protocol conversion on the first request sent by the first client to obtain a file processing request, including: the first process executes the following steps: performs protocol parsing on the first request sent by the first client to obtain a lease request and a file open request included in the first request; integrates and encapsulates the lease request and the file open request into a file processing request of the first protocol type, and sends the file processing request to the first client management service; in this case, after executing step S130, the method also includes: if the authentication result indicates that the first client has access rights to the target file, the first metadata management service opens the target file indicated by the target file identifier.

[0070] By adopting the above process, the file opening request and the lease request are encapsulated into a file processing request, so that the first client only needs to send one request to request access to the target file and request the lease of the target file at the same time. After receiving the file request, the first metadata management service can implement authentication, authorize the lease, open the file and other processing, and only requires one authentication and one protocol conversion to complete the processing of the two requests, which effectively reduces the number of interactions and processing logic within the first service node and improves the file processing efficiency.

[0071] In this case, the protocol type of the first lease application result is the first protocol type. In one possible implementation, the above step S130 includes: the first metadata management service sends the first lease application result to the first process through the first client management service, wherein the first client management service determines that it holds the lease authorized by the first metadata management service for the target file when receiving the first lease application result. The first process performs protocol conversion on the first lease application result to obtain the first lease application result after protocol conversion, and the protocol type of the first lease application result after protocol conversion is a network file sharing protocol. The first process returns the first lease application result after protocol conversion to the first client.

[0072] As shown in FIG. 5 , a schematic diagram showing that the first service node includes the first process and the third process, and the second service node includes the second process, wherein each process corresponds to a client, such as Figure 3 As shown, the first process corresponds to the first client, the second process corresponds to the second client, and the third process corresponds to the third client. It should be understood that when there are multiple second clients, there are also multiple corresponding second processes. Each process is used to perform protocol conversion on the interactive data when data is interacted between its corresponding client and the service node.

[0073] like Figure 6 As shown, a timing flow chart of a lease management method is shown, the method comprising: the first client C1 executes step S11: sending a first request to the first process, wherein the first request comprises a file open request and a lease request, the lease request is used to indicate leases of all lease types of the requested target file, the file open request is used to indicate opening the target file, and the protocol type of the first request is a network file sharing protocol.

[0074] After receiving the first request, the first process executes step S12: parsing the first request to obtain the file opening request and the lease request included in the first request; then executing step S13: integrating and encapsulating the lease request and the file opening request into a file processing request; and executing step S14: sending the file processing request to the first client management service.

[0075] After receiving the file processing request, the first client management service executes step S15: determining whether the first client management service holds the lease of the target file authorized by the first metadata management service; when it is determined that the first client management service does not hold the lease of the target file, executing step S16: calling the open_file interface to send a file processing request to the first metadata management service.

[0076] After receiving the file processing request, the first metadata management service executes step S17: performs authentication based on the client identifier and the target file identifier to obtain an authentication result; if the authentication result indicates that the first client has access rights to the target file (i.e., the authentication is passed), then executes step S18: determines whether there is a client currently holding a lease for the target file; if it is determined that no other client holds a lease for the target file, then executes: opens the file and authorizes the lease of the target file to the first client management service; wherein, when the first metadata management service authorizes the lease of the target file to the first client management service, it generates a first lease application result including the authorized lease type and the file identifier of the target file. After generating the first lease application result, the first metadata management service executes step S19: returns the first lease application result to the first client management service.

[0077] When the first client management service receives the first lease application result, it confirms that it holds the lease of the target file. At this time, step S20 may be executed: sending the first lease application result to the first process.

[0078] When the first process receives the first lease application result, since the protocol type of the first lease application result is the first protocol type, it needs to be converted into a network file sharing protocol. Therefore, the first process can execute step S21: perform protocol conversion on the first lease application result to obtain the first lease application result after protocol conversion. And execute step S22: return the first lease application result after protocol conversion to the first client. So that when the first client receives the first lease application result, it holds all types of leases for the target file and operates the target file when holding all types of leases.

[0079] In one possible implementation, see Figure 7 As shown, if the first client management service holds the lease of the target file, the method further includes:

[0080] Step S140: The first client management service determines a third client holding a lease, and generates a second lease recovery notification for the third client.

[0081] The third client is another client associated with the first service node except the first client.

[0082] It should be noted that the second lease recovery notification may be used to instruct the third client to recover part or all of the lease for the target file.

[0083] In one possible implementation of the present application, when the first client applies for all leases of the target file (such as a read lease, a write lease, and a handle lease), the second lease reclaim notification is used to instruct the third client to release the write lease to ensure that only one client can have the write lease for the file in the same time period to ensure the consistency of the target file.

[0084] Step S50: The first client management service sends the second lease recovery notification to the third client, so that the third client releases the lease based on the second lease recovery notification.

[0085] Among them, the second lease recovery notification carries the type of lease to be released and the target file identifier. When the third client releases the lease, it can clear the local state related to the lease to be released. If the released lease involves a file handle or other resources, the resource needs to be released. After the third client completes the release, the local state is updated to reflect that the lease has been released. In addition, after completing the lease release, the third client also needs to send a lease release completion message to the first client management service, indicating that the lease to be released has been successfully released.

[0086] Step S160: If the first client management service determines that the third client has completed the lease release, authorize the first client to specify the lease, and generate a third lease application result including the specified lease and the file identifier of the target file.

[0087] The first client management service may determine that the third client has completed the lease release upon receiving a lease release completion message sent by the third client when the lease release is completed.

[0088] Step S170: The first client management service returns the third lease application result to the first client, so that the first client holds a designated lease for the target file.

[0089] The specific implementation process of the above steps S160-S180 is similar to the implementation process of steps S120-S130 in the aforementioned embodiment. Please refer to the specific description of steps S120-S130 in the aforementioned embodiment, and will not be repeated here one by one.

[0090] By adopting the above method, it is possible to implement two-level lease authorization using the first client management service and the first metadata management service, wherein the first metadata management service can be used to grant the first client management service a lease for the target file, and when the first client management service holds a lease for the target file authorized by the first metadata management service, the first client management service can grant a lease to its associated client, thereby ensuring that only one client associated with a server in the distributed system holds the lease for the file, and at the same time ensuring that only one client can hold the write lease for the target file at any time, thereby avoiding conflicts caused by concurrent modifications. In addition, the above method fully takes into account that multiple clients access shared resources (i.e., target files) on the same service node through configuration, which is prone to shared read and write opening. At this time, allowing partial authorization of leases can greatly improve the client access performance on the unified service node.

[0091] It should be noted that in order to improve the security of access to the target file, before executing the above step S160, the method also includes: the first client management service performs authentication based on the first client identifier and the target file identifier to obtain an authentication result, and when the authentication result indicates that the first client has access rights to the target file, the above step S160 is executed.

[0092] In one embodiment, the protocol type of the second lease recovery notification is a first protocol type, and the first service node also includes a second process. The above step S160 includes: the first client management service sends a second lease recovery notification to the second process; the second process performs protocol conversion on the second lease recovery notification to obtain a second lease recovery notification after protocol conversion, and the protocol type of the first lease application result after protocol conversion is a network file sharing protocol; the second process sends the second lease recovery notification after protocol conversion to the third client.

[0093] In one embodiment, the second process receives a lease release notification returned by the third client after releasing the write lease, the lease release notification is used to indicate that the third client has completed the lease downgrade and released the write lease, and the protocol type of the lease release notification is a network file sharing protocol; the second process performs protocol conversion on the lease release notification to obtain a lease release notification after protocol conversion, and the protocol type of the lease release notification after protocol conversion is the first protocol type; the second process sends the lease release notification after protocol conversion to the first client management service, so that the first client management service determines that the third client has completed the lease release when receiving the lease release notification.

[0094] like Figure 8As shown, a timing flow chart of a lease management method is shown, the method comprising: the first client C1 executes step S11: sending a first request to the first process, wherein the first request comprises a file open request and a lease request, the lease request is used to indicate leases of all lease types of the requested target file, the file open request is used to indicate opening the target file, and the protocol type of the first request is a network file sharing protocol.

[0095] After receiving the first request, the first process executes step S12: parsing the first request to obtain the file opening request and the lease request included in the first request; then executing step S13: integrating and encapsulating the lease request and the file opening request into a file processing request; and executing step S14: sending the file processing request to the first client management service.

[0096] After receiving the file processing request, the first client management service executes step S15: determining whether the first client management service holds the lease of the target file authorized by the first metadata management service; when it is determined that the lease of the target file is held, executing step S30: sending a second lease recovery notification to the second process, the second lease recovery notification is used to instruct the recovery of the third client's write lease for the target file.

[0097] When the second process receives the second lease recovery notification, step S31 is executed: the second lease recovery notification is converted into a protocol to obtain the second lease recovery notification after the protocol conversion; then, step S32 is executed: the second lease recovery notification after the protocol conversion is sent to the third client.

[0098] When the third client receives the second lease recovery notification after the protocol conversion, it executes step S33: releasing the write lease; after completing the release of the write lease, it generates a lease release notification, and executes step S34: sending the lease release notification to the second process.

[0099] After receiving the lease release notification, the second process executes step S35: performs protocol conversion on the lease release notification to obtain a lease release notification after protocol conversion; then, executes step S36: sends the lease release notification after protocol conversion to the first client management service.

[0100] When the first client management service receives the lease release notification after the protocol conversion, it determines that the third client has completed the lease release, and executes step S37: authorizes the specified lease for the first client, and generates a third lease application result of the specified lease and the file identifier of the target file, and then executes step S38: sends the third lease application result to the first process.

[0101] When the second process receives the third lease application result, it executes step S39: converts the third lease application result into a protocol to obtain the third lease application result after the protocol conversion; and then executes step S40: sends the third lease application result after the protocol conversion to the first client, so that when the second client receives the third lease application result, it holds the specified lease for the target file and operates the target file while holding the specified lease.

[0102] In one possible implementation, Fig. 9 As shown, if step S120 includes: if the lease holding status indicates that the first client management service does not hold the lease of the target file, the first metadata management service determines the lease status of the target file, and the lease status of the target file indicates whether there is a second client holding the lease of the target file; the second client is a client associated with a second service node in the distributed system, and the second service node is a service node other than the first service node in the distributed system, and if the lease status for the target file indicates that there is a target second client holding the lease of the target file, the method further includes:

[0103] Step S190: The first metadata management service sends a lease recovery instruction to the target client management service, so that the target client management service sends a first lease recovery notification to the target second client in response to the lease recovery instruction.

[0104] The target client management service is a client management service in a second service node associated with the target second client, and the first lease recovery notification is used to instruct the target second client to release all leases.

[0105] Regarding the target client management service sending the first lease recovery notification to the target second client and the subsequent recovery process, please refer to the specific process of the aforementioned step S150, which will not be repeated here.

[0106] Step S200: if a lease recovery completion message is received from the target client management service when it is determined that the target second client has completed the lease release, the first metadata management service generates a second lease application result of not authorizing the lease.

[0107] It should be understood that when the file processing request includes a file opening request and a lease request, the method further includes: opening the target file.

[0108] Step S210: The first metadata management service returns the second lease application result to the first client through the first client management service.

[0109] When receiving the second lease application result, the first client can confirm that it does not hold a lease for the target file and access the target file online.

[0110] For the specific process of the above step S210, please refer to the specific description of the above step S130, which will not be repeated here.

[0111] By adopting the above method, it is possible to realize unified cross-node lease authorization and recovery through cross-node data transmission between the target client management service and the first metadata management service, and when there is a cross-node lease conflict, all leases for the target file are recovered, and the lease authorization of some clients is not processed. This is because in the scenario where there are multiple clients operating the same shared resource (target file) by accessing the addresses of different service nodes, when each client requests access to the same file through different service nodes, the behavior of each client is independent, resulting in a lease conflict. At this time, by not granting the lease, the time spent on cross-node interaction and waiting for lease recovery is reduced, thereby improving the processing efficiency of the target file.

[0112] like Fig.10 As shown, a timing flow chart of a lease management method is shown, the method comprising: executing step S11 by a first client: sending a first request to a first process, wherein the first request comprises a file open request and a lease request, the lease request is used to indicate leases of all lease types of the requested target file, the file open request is used to indicate opening the target file, and the protocol type of the first request is a network file sharing protocol.

[0113] After receiving the first request, the first process executes step S12: parsing the first request to obtain the file opening request and the lease request included in the first request; then executing step S13: integrating and encapsulating the lease request and the file opening request into a file processing request; and executing step S14: sending the file processing request to the first client management service.

[0114] After receiving the file processing request, the first client management service executes step S15: determining whether the first client management service holds the lease of the target file authorized by the first metadata management service; when it is determined that the first client management service does not hold the lease of the target file, executing step S16: calling the open_file interface to send a file processing request to the first metadata management service.

[0115] After receiving the file processing request, the first metadata management service executes step S17: authentication is performed based on the client identifier and the target file identifier to obtain an authentication result; if the authentication result indicates that the first client has access rights to the target file (i.e., the authentication is passed), step S18 is executed: determining whether there is a client currently holding a lease for the target file; if it is determined that there is a target second client holding a lease for the target file, step S50 is executed: a lease recovery instruction is sent to the target client management service, wherein the target client management service is a client management service in the second service node associated with the target second client.

[0116] When the target client management service receives the lease recovery instruction, step S51 is executed: a first lease recovery notification is sent to a third process, wherein the third process is a process corresponding to the target second client.

[0117] When the third process receives the first lease recovery notification, it executes step S52: performs protocol conversion on the first lease recovery notification to obtain the first lease recovery notification after protocol conversion; then, it executes step S53: sends the first lease recovery notification after protocol conversion to the target second client.

[0118] When the target second client receives the first lease recovery notification after the protocol conversion, it executes step S54: releasing all leases; after completing the release of all leases, it generates a lease release completion message, and executes step S55: sending the lease release completion message to the third process.

[0119] After receiving the lease release completion message, the third process executes step S56: performs protocol conversion on the lease release completion message to obtain the lease release completion message after protocol conversion; then, executes step S57: sends the lease release completion message after protocol conversion to the target client management service.

[0120] When receiving the lease release notification after the protocol conversion, the target client management service determines that the target second client has completed the lease release, and executes step S58: sending a lease release completion message to the first metadata management service.

[0121] When the first metadata management service receives the lease release completion message, it executes step S59: opens the target file and generates a second lease application result indicating that the lease is not authorized. Then, it executes step S60: returns the second lease application result to the first client management service.

[0122] When receiving the second lease application result, the first client management service confirms that it does not hold a lease for the target file. At this time, step S61 may be executed: sending the second lease application result to the first process.

[0123] When the first process receives the second lease application result, since the protocol type of the second lease application result is the third protocol type, it needs to be converted to a network file sharing protocol. Therefore, the first process can execute step S62: perform protocol conversion on the second lease application result to obtain the second lease application result after protocol conversion. And execute step S63: return the second lease application result after protocol conversion to the first client. So that when the first client receives the second lease application result, it confirms that it does not hold the lease of the target file and can only access the target file online.

[0124] like Fig.11 As shown, by adopting the above-mentioned method of the present application, when the first service node in the distributed system receives a file processing request, it can be realized that whether the first client can exclusively access the target file can be first confirmed (that is, whether there are other clients holding the lease of the target file. If there are no other clients, the first service node can exclusively access the file. If there are other clients (such as the target second client or the third client), the first service node cannot exclusively access the file). When the first service node can exclusively access the target file, all leases of the target file can be allocated to the first client; if the first client cannot exclusively access the target file, it is determined whether it is a common node lease conflict, wherein, when the third client associated with the first service node has a lease for the target file, it is determined to be a same-node lease conflict. At this time, the first client service in the first service node can reclaim part of the lease of the third client, and authorize part of the lease to the first client. If the target second client holds the lease of the target file, it is determined to be a non-passive node lease conflict. At this time, all leases of the target second client for the target file can be reclaimed, and the lease for the target file will not be authorized for the first client. Through the above method, it is possible to reasonably allocate leases to target files in a distributed system, thereby improving the access efficiency and performance of the target files.

[0125] like Fig.12As shown, a lease management device 300 provided in an embodiment of the present application is shown, which is applied to the first service node of a distributed system. The first service node includes a first client management service and a first metadata management service. The lease management device 300 includes: a lease determination module 310, a lease authorization module 320 and a lease result return module 330. Among them, the lease determination module 310 is used to use the first client management service to determine the lease holding status of the first client management service for the target file in response to the file processing request sent by the first client, and the file processing request carries the requested lease type, the client identifier of the first client and the target file identifier of the target file; the lease authorization module 320 is used to use the first metadata management service to authorize the lease for the target file for the first client management service when the lease holding status indicates that the first client management service does not hold the lease of the target file, and generate a first lease application result including the authorized lease type and the file identifier of the target file; the lease result return module 330 is used to use the first metadata management service to return the first lease application result to the first client through the first client management service, so that the first client holds the lease of the target file and operates on the target file.

[0126] In one possible implementation, the protocol type of the file processing request is a first protocol type, which is a protocol type used in a service node, and the first service node also includes a first process; the lease management device 300 also includes: a protocol conversion module and a request sending module, the protocol conversion module is used to use the first process to perform protocol conversion on a first request sent by a first client to obtain a file processing request, and the protocol type of the first request is a network file sharing protocol; the request sending module is used to use the first process to send the file processing request to the first client management service.

[0127] In one possible implementation, the protocol type of the first lease application result is the first protocol type, and the lease result returning module 330 is further used to use the first metadata management service to send the first lease application result to the first process through the first client management service, wherein, when the first client management service receives the first lease application result, it determines that it holds the lease authorized by the first metadata management service for the target file; uses the first process to perform protocol conversion on the first lease application result to obtain the first lease application result after protocol conversion, and the protocol type of the first lease application result after protocol conversion is a network file sharing protocol; uses the first process to return the first lease application result after protocol conversion to the first client.

[0128] In one possible implementation, the protocol conversion module is further used to perform protocol parsing on a first request sent by a first client to obtain a lease request and a file opening request included in the first request; integrate and encapsulate the lease request and the file opening request into a file processing request of a first protocol type, and send the file processing request to the first client management service; the first metadata management service performs authentication based on the client identifier and the target file identifier, and after obtaining the authentication result, the method further includes: if the authentication result indicates that the first client has access rights to the target file, the first metadata management service opens the target file indicated by the target file identifier.

[0129] In one possible implementation, the lease authorization module includes an authentication submodule and a first authorization submodule, the authentication submodule being used for: when the lease holding status indicates that the first client management service does not hold the lease of the target file, the authentication module is used to perform authentication based on the client identifier and the target file identifier using the first metadata management service to obtain an authentication result; the authentication result is used to indicate whether the first client has access rights to the target file; and the first authorization submodule is used to authorize the lease for the target file for the first client management service using the first metadata management service when the authentication result indicates that the first client has access rights to the target file.

[0130] In one possible implementation, the lease authorization module includes a status determination submodule and a second authorization submodule, the status determination submodule being used to, when the lease holding status indicates that the first client management service does not hold the lease for the target file, determine the lease status of the target file using the first metadata management service, the lease status of the target file indicating whether there is a second client holding the lease for the target file; the second client is a client associated with a second service node in the distributed system, and the second service node is a service node other than the first service node in the distributed system; the second authorization submodule being used to, when the lease status indicates that there is no second client holding the lease for the target file, authorize the first client management service to hold the lease for the target file using the first metadata management service.

[0131] In one possible implementation, the lease management device 300 also includes an instruction sending module; the instruction sending module is used to use the first metadata management service to send a lease recovery instruction to the target client management service when the lease status of the target file indicates that there is a target second client holding the lease of the target file, so that the target client management service sends a first lease recovery notification to the target second client in response to the lease recovery instruction, the target client management service is a client management service in the second service node associated with the target second client, and the first lease recovery notification is used to instruct the target second client to release all leases; the lease authorization module is also used to use the first metadata management service to generate a second lease application result that does not authorize the lease when receiving a lease recovery completion message sent by the target client management service when determining that the target second client has completed the lease release; the lease result returning module is also used to use the first metadata management service to return the second lease application result to the first client through the first client management service.

[0132] In one possible implementation, the metadata management service in each service node of the distributed system respectively maintains a file lease list, and the file lease list of the metadata management service maintained by each service node is the same; the status determination submodule is further used to use the first metadata management service to obtain the lease details corresponding to the target file identifier from the file lease list based on the target file identifier, wherein the file lease list stores multiple preset file identifiers and the lease details corresponding to each preset file identifier, and the lease details corresponding to the preset file identifier are used to indicate whether there is a client holding a lease for the file indicated by the preset file identifier, and when there is a client holding a lease for the file indicated by the preset file identifier, indicate the client holding the lease for the file corresponding to the preset file identifier; the lease status of the target file is determined according to the lease details corresponding to the target file identifier, wherein if the lease details corresponding to the target file identifier indicate that there is a client holding a lease for the target file, the lease status of the target file indicates that the client holding the lease for the target file is a second client associated with the distributed system; if the lease details corresponding to the target file identifier indicate that there is no client holding a lease for the target file, the lease status of the target file indicates that the target file is not assigned a lease. In one possible implementation, if the first client management service holds the lease of the target file, the lease management device 300 also includes: a first notification sending module; a first notification sending module, used for the first client management service to send the second lease recovery notification to the third client, so that the third client releases the lease based on the second lease recovery notification; a lease authorization module 320, also used to generate a third lease application result including the specified lease and the file identifier of the target file when the first client management service determines that the third client has completed the lease release and authorizes the specified lease for the first client; a lease result return module 330, also used for the first client management service to return the third lease application result to the first client, so that the first client holds the specified lease for the target file.

[0133] In one possible implementation, the protocol type of the second lease recovery notification is the first protocol type, the first service node also includes a second process, and the lease result return module 330 includes a notification sending submodule, a protocol conversion submodule, and a lease recovery submodule. The notification sending submodule is used to use the first client management service to send the second lease recovery notification to the second process; the protocol conversion submodule is used to use the second process to perform protocol conversion on the second lease recovery notification to obtain the second lease recovery notification after protocol conversion, and the protocol type of the first lease application result after protocol conversion is a network file sharing protocol; the lease recovery submodule is used to use the second process to send the second lease recovery notification after protocol conversion to the third client.

[0134] In one possible implementation, the second lease recovery notification is used to instruct the third client to release the write lease, and the lease management device 300 also includes a notification receiving module, a protocol conversion module, and a notification sending module. The notification receiving module is used to use the second process to receive the lease release notification returned by the third client after releasing the write lease, the lease release notification is used to indicate that the third client has completed the lease downgrade and released the write lease, and the protocol type of the lease release notification is a network file sharing protocol; the protocol conversion module is used to use the second process to perform protocol conversion on the lease release notification to obtain the lease release notification after protocol conversion, and the protocol type of the lease release notification after protocol conversion is the first protocol type; the notification sending module is used to use the second process to send the lease release notification after protocol conversion to the first client management service, so that the first client management service determines that the third client has completed the lease release when receiving the lease release notification.

[0135] Correspondingly, such as Fig.13 The embodiment of the present application further provides an electronic device 400, which may be an electronic device capable of running applications, such as a smart phone, a tablet computer, or a server. The electronic device 400 may include one or more processors 410, a memory 420, and one or more applications, wherein the one or more applications are stored in the memory 420 and configured to be executed by the one or more processors 410, and the one or more applications are configured to execute the above-mentioned lease management method.

[0136] It can be understood that the processor 410 and the memory 420 are connected through a communication bus to complete the communication between them. The processor 420 can call the logic instructions in the memory 420 to execute the speech template generation method in any of the above embodiments. Exemplarily, the processor 410 can be implemented in a general CPU, a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit. ASIC), or one or more integrated circuits, etc., for executing related programs to implement the technical solution provided in this application. The memory can include ROM (Read 0nl yMemory, read-only memory), RAM (Random Access Memory, random access memory) static storage devices, dynamic storage devices, etc.

[0137] An embodiment of the present application also provides a lease management system, including multiple service nodes, each service node is used to connect to at least one client, each service node includes a client management service and a metadata management service, and each of the service nodes is used to execute the method steps in the aforementioned lease management method.

[0138] In one possible implementation, the multiple service nodes include a first service node and a second service node as in the aforementioned embodiment, wherein the first service node includes a first client management service and a first metadata management service, and the second service node includes a second client management service and a second metadata management service, and the first service node is used to execute the method steps in the aforementioned embodiment.

[0139] Correspondingly, an embodiment of the present application further provides a computer-readable storage medium, in which a program code is stored, and the program code can be called by a processor to execute the above-mentioned lease management method.

[0140] It can be understood that the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.

[0141] Part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0142] The above are only preferred embodiments of the present application, and are not intended to limit the present application in any form. Although the present application has been disclosed as above with preferred embodiments, it is not intended to limit the present application. Any technical personnel in the field can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present application. However, any brief modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present application without departing from the content of the technical solution of the present application are still within the scope of the technical solution of the present application.

Claims

1. A lease management method, characterized in that: A first service node applied to a distributed system, the first service node comprising a first client management service and a first metadata management service, the method comprising: Determining, by the first client management service, a lease holding status of the first client management service for the target file in response to a file processing request sent by the first client, wherein the file processing request carries a requested lease type; If the lease holding status indicates that the first client management service does not hold a lease for the target file, the first metadata management service authorizes the first client management service to hold a lease for the target file, and generates a first lease application result including an authorized lease type and a file identifier of the target file; The first metadata management service returns the first lease application result to the first client through the first client management service, so that the first client holds the lease of the target file and operates the target file.

2. The method according to claim 1, characterized in that: The protocol type of the file processing request is a first protocol type, and the first protocol type is a protocol type used in a service node, and the first service node further includes a first process; before the first client management service determines the lease holding status of the first client management service for the target file in response to the file processing request, the method further includes: The first process performs protocol conversion on the first request sent by the first client to obtain a file processing request, wherein the protocol type of the first request is a network file sharing protocol; The first process sends the file processing request to the first client management service.

3. The method according to claim 2, characterized in that The protocol type of the first lease application result is the first protocol type, and the first metadata management service returns the first lease application result to the first client through the first client management service, including: The first metadata management service sends a first lease application result to the first process through the first client management service, wherein the first client management service determines that it holds a lease authorized by the first metadata management service for the target file when receiving the first lease application result; The first process performs protocol conversion on the first lease application result to obtain a first lease application result after protocol conversion, wherein the protocol type of the first lease application result after protocol conversion is a network file sharing protocol; The first process returns the first lease application result after the protocol conversion to the first client.

4. The method according to claim 2, characterized in that: The first process performs protocol conversion on the first request sent by the first client to obtain a file processing request, including: The first process performs the following steps: Performing protocol parsing on the first request sent by the first client to obtain a lease request and a file open request included in the first request; The lease request and the file open request are integrated and encapsulated into a file processing request of a first protocol type, and the file processing request is sent to the first client management service.

5. The method according to claim 1, characterized in that If the lease holding state indicates that the first client management service does not hold a lease for the target file, the first metadata management service authorizes the first client management service to hold a lease for the target file, including: If the lease holding status indicates that the first client management service does not hold the lease of the target file, the first metadata management service performs authentication based on the client identifier and the target file identifier to obtain an authentication result; the authentication result is used to indicate whether the first client has access rights to the target file; If the authentication result indicates that the first client has access rights to the target file, the first metadata management service authorizes a lease for the target file for the first client management service.

6. The method according to claim 1, characterized in that If the lease holding state indicates that the first client management service does not hold a lease for the target file, the first metadata management service authorizes the first client management service to hold a lease for the target file, including: If the lease holding status indicates that the first client management service does not hold the lease of the target file, the first metadata management service determines the lease status of the target file, and the lease status of the target file indicates whether a second client holds the lease of the target file; the second client is a client associated with a second service node in the distributed system, and the second service node is a service node other than the first service node in the distributed system; If the lease status indicates that there is no second client holding a lease for the target file, the first metadata management service authorizes a lease for the target file for the first client management service.

7. The method according to claim 6, characterized in that: The method further comprises: If the lease status indication for the target file indicates that a target second client holds a lease for the target file, the first metadata management service sends a lease recovery instruction to the target client management service, so that the target client management service sends a first lease recovery notification to the target second client in response to the lease recovery instruction, the target client management service is a client management service in the second service node associated with the target second client, and the first lease recovery notification is used to instruct the target second client to release all leases; If a lease recovery completion message is received from the target client management service when it is determined that the target second client has completed the lease release, the first metadata management service generates a second lease application result of not authorizing the lease; The first metadata management service returns the second lease application result to the first client through the first client management service.

8. The method according to claim 6, characterized in that The metadata management service in each service node of the distributed system respectively maintains a file lease list, and the file lease list of the metadata management service maintained by each service node is the same; The determining, by the first metadata management service, the lease status of the target file includes: The first metadata management service obtains lease details corresponding to the target file identifier from a file lease list based on the target file identifier, wherein the file lease list stores multiple preset file identifiers and lease details corresponding to each preset file identifier, and the lease details corresponding to the preset file identifier are used to indicate whether there is a client holding a lease for the file indicated by the preset file identifier, and when there is a client holding a lease for the file indicated by the preset file identifier, indicate the client holding the lease for the file corresponding to the preset file identifier; Determining the lease status of the target file according to the lease details corresponding to the target file identifier, wherein if the lease details corresponding to the target file identifier indicate that there is a client holding a lease for the target file, the lease status of the target file indicates the client holding the lease for the target file, and the client is a second client associated with the distributed system; If the lease details corresponding to the target file identifier indicate that no client holds a lease for the target file, the lease status of the target file indicates that no lease is allocated to the target file.

9. The method according to claim 1, characterized in that: If the first client management service holds a lease for the target file, the method further includes: The first client management service determines a third client holding a lease, and generates a second lease recovery notification for the third client, wherein the third client is a client other than the first client among the clients associated with the first service node; The first client management service sends the second lease recovery notification to the third client, so that the third client releases the lease based on the second lease recovery notification; If the first client management service determines that the third client has completed the lease release, authorize the first client with a specified lease, and generate a third lease application result including the specified lease and a file identifier of the target file; The first client management service returns the third lease application result to the first client, so that the first client holds a designated lease for the target file.

10. The method according to claim 9, characterized in that The protocol type of the second lease recovery notification is the first protocol type, the first service node further includes a second process, and the returning of the third lease application result to the first client by the first client management service includes: The first client management service sends a second lease recovery notification to the second process; The second process performs protocol conversion on the second lease recovery notification to obtain a second lease recovery notification after protocol conversion, wherein the protocol type of the first lease application result after protocol conversion is a network file sharing protocol; The second process sends the second lease recovery notification after the protocol conversion to the third client.

11. The method according to claim 10, characterized in that The second lease reclaim notification is used to instruct the third client to release the write lease. Before authorizing the first client to specify the lease, the method further includes: The second process receives a lease release notification returned by the third client after releasing the write lease, wherein the lease release notification is used to indicate that the third client has completed the lease downgrade and released the write lease, and the protocol type of the lease release notification is a network file sharing protocol; The second process performs protocol conversion on the lease release notification to obtain a lease release notification after protocol conversion, wherein the protocol type of the lease release notification after protocol conversion is the first protocol type; The second process sends the lease release notification after the protocol conversion to the first client management service, so that the first client management service determines that the third client has completed the lease release when receiving the lease release notification.

12. A lease management device, characterized in that: A first service node applied to a distributed system, the first service node comprising a first client management service and a first metadata management service, the device comprising: a lease determination module, configured to determine, using the first client management service in response to a file processing request sent by the first client, a lease holding status of the first client management service for a target file, wherein the file processing request carries a requested lease type, a client identifier of the first client, and a target file identifier of the target file; a lease authorization module, configured to, when the lease holding status indicates that the first client management service does not hold a lease for the target file, authorize the first client management service to hold a lease for the target file using the first metadata management service, and generate a first lease application result including an authorized lease type and a file identifier of the target file; The lease result returning module is used to use the first metadata management service to return the first lease application result to the first client through the first client management service, so that the first client holds the lease of the target file and operates the target file.

13. An electronic device, characterized in that: include: one or more processors; Memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1-11.

14. A lease management system, characterized in that: It comprises a plurality of service nodes, each service node is used to connect with at least one client, each service node comprises a client management service and a metadata management service, and each of the service nodes is used to execute the method steps as described in any one of claims 1-11.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, and the program codes can be called by a processor to execute the method according to any one of claims 1 to 11.

Citation Information

Cited By

  • Distributed lease management method and system, storage medium and electronic equipment

    CN121967415A

  • Distributed lease management method and system, storage medium and electronic device

    CN121967415B