A method, system, device and medium for realizing read-write sharing

By assigning shared tags to shared files in distributed storage systems, allowing multiple clients to perform read and write caches, it solves the performance degradation caused by synchronous read and write IO when multiple clients are mixed read and write, and achieves higher performance and ease Usability.

CN113568881BActive Publication Date: 2025-02-14JINAN INSPUR DATA TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110656287.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-11
Publication Date
2025-02-14
Estimated Expiration
2041-06-11

AI Technical Summary

Technical Problem

In distributed storage systems, when multiple clients read and write files in a mixed manner, synchronous reading and writing IO in the prior art leads to degradation of client performance, especially when the block size is small, which seriously affects the computing performance and storage media life of high-performance computing scenarios. .

Method used

By assigning a shared tag to shared read and write files, multiple clients can read and write cache when they hold read and write cache permissions or shared flags, freeing up data consistency requirements, and improving the mixed read and write or multiple clients at the same time. performance.

Benefits of technology

It greatly improves the performance of hybrid read and write or multiple clients at the same time, and improves client responsiveness and ease of use of distributed systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113568881B_ABST
    Figure CN113568881B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, system, device and storage medium for realizing read-write sharing, and the method comprises: in response to preparing to open a file in a read, write or read-write mixed mode, setting a corresponding value to the open mode field value in the handle of the file according to the type of operation and adding a read-write sharing identifier; in response to successfully opening the file, sending a request for applying for permission to a metadata server based on the open mode field value and the read-write sharing identifier and receiving the application result; in response to successfully applying for permission and reading or writing the file, judging whether there is a read cache permission, a write cache permission or a read-write sharing permission in the current permission; and in response to the existence of a read cache permission, a write cache permission or a read-write sharing permission in the current permission, cache reading or cache writing of the file. The present invention realizes the support of multi-client hybrid read-write sharing by using the read-write sharing technology, and improves the usability and robustness of the distributed system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of distributed systems, and more specifically, to a method, system, computer device and readable medium for realizing read-write sharing. Background Art

[0002] In a distributed storage system, the data consistency function is implemented based on the mixed reading and writing of files by multiple clients. The existing practice is: before reading and writing files, the client needs to apply for corresponding read and write permissions and read and write cache permissions from the metadata server (apply for read permissions and read cache permissions when reading files, and apply for write permissions and write cache permissions when writing files). When other clients write or mixed read and write the file and apply for permissions from the metadata server, the metadata server revokes the read and write cache permissions of other clients for the file, and forces all clients to perform synchronous read and write IO (input and output) on the file, that is, each read and write operation needs to be executed serially. Before the data is written to the storage medium or read from the storage medium successfully, in order to ensure data consistency, subsequent read / write operations are in a blocked state.

[0003] Synchronous read and write IO leads to a decrease in client read and write performance, especially when multiple clients perform mixed reading and writing on the same file and the block size is small, which amplifies the impact of synchronous read and write IO on client performance. In high-performance computing scenarios of scientific computing applications, there are situations where multiple clients read and write the same file at the same time (the read and write locations are different) and have high performance requirements. If multiple clients read and write files in a mixed manner, the read and write are executed serially, which seriously affects the computing performance and increases the number of read and write times of the storage medium, reducing the life of the storage medium and failing to give full play to the performance advantages of the distributed system. Summary of the invention

[0004] In view of this, the purpose of the embodiments of the present invention is to propose a method, system, computer device and computer-readable storage medium for realizing read-write sharing, and the present invention improves the synchronous read-write performance. By assigning a shared mark to the shared read-write file, when multiple clients read and write the file in a mixed manner, when the client holds the read-write cache permission or holds the shared mark, the client is allowed to read and write the cache, and the upper-layer application ensures the consistency of the data by calling the corresponding data consistency interface function; by relaxing the data consistency requirements, the performance of mixed reading and writing or simultaneous reading and writing by multiple clients is greatly improved, and the client responsiveness and the usability of the distributed system are improved.

[0005] Based on the above-mentioned purpose, one aspect of an embodiment of the present invention provides a method for realizing read-write sharing, comprising the following steps: in response to preparing to open a file in a read, write or read-write mixed mode, setting a corresponding value for the open mode field value in the handle of the file according to the type of operation and adding a read-write sharing identifier; in response to successfully opening the file, issuing a request for applying for permission to a metadata server based on the open mode field value and the read-write sharing identifier and receiving the application result; in response to successfully applying for permission and reading or writing the file, determining whether there is read cache permission, write cache permission or read-write sharing permission in the current permissions; and in response to the existence of read cache permission, write cache permission or read-write sharing permission in the current permissions, cache reading or cache writing of the file.

[0006] In some implementations, the method further includes: in response to receiving a request to reclaim the read-write sharing permission or the write cache permission, flushing the data in the cache to the storage medium and then releasing the corresponding permission.

[0007] In some implementations, the method further includes: in response to receiving a request to revoke the read-write sharing permission or the read-cache permission, invalidating the data in the cache and then releasing the corresponding permission.

[0008] In some embodiments, the request for permission issued to the metadata server based on the open method field value and the read-write sharing identifier and receiving the application result includes: recording the open method field value into the metadata field of the metadata server file, and returning corresponding permissions based on the metadata field and the read-write sharing identifier.

[0009] In some embodiments, returning corresponding permissions based on the metadata field and the read-write sharing identifier includes: determining whether there is currently a client performing a read operation and / or a write operation on the file; and in response to there not currently being a client performing a read operation and / or a write operation on the file, returning read cache permissions and / or write cache permissions based on the metadata field.

[0010] In some embodiments, returning corresponding permissions based on the metadata field and the read-write sharing identifier includes: in response to a client currently performing a read operation and / or a write operation on the file, reclaiming the client's read-write sharing permissions and read cache permissions and / or write cache permissions.

[0011] In some implementations, returning corresponding permissions based on the metadata field and the read-write sharing identifier includes: in response to completion of permission reclaiming, returning read-write sharing permissions and read cache permissions and / or write cache permissions based on the metadata field.

[0012] Another aspect of an embodiment of the present invention provides a system for implementing read-write sharing, including: an identification module, configured to, in response to preparing to open a file in a read, write, or read-write mixed manner, set a corresponding value to the open mode field value in the handle of the file according to the type of operation and add a read-write sharing identifier; an application module, configured to, in response to successfully opening the file, issue a request for applying for permission to a metadata server based on the open mode field value and the read-write sharing identifier and receive an application result; a judgment module, configured to, in response to successfully applying for permission and reading or writing the file, judge whether there is read cache permission, write cache permission, or read-write sharing permission in the current permissions; and an execution module, configured to, in response to the existence of read cache permission, write cache permission, or read-write sharing permission in the current permissions, cache read or cache write to the file.

[0013] According to another aspect of an embodiment of the present invention, a computer device is provided, comprising: at least one processor; and a memory, wherein the memory stores computer instructions executable on the processor, and the instructions implement the steps of the above method when executed by the processor.

[0014] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, which stores a computer program that implements the above method steps when executed by a processor.

[0015] The present invention has the following beneficial technical effects: the synchronous reading and writing performance is improved. By assigning a shared mark to a shared read-write file, when multiple clients read and write the file in a mixed manner, when the client holds the read-write cache permission or holds the shared mark, the client is allowed to read and write the cache, and the upper-layer application ensures the consistency of the data by calling the corresponding data consistency interface function; by relaxing the data consistency requirement, the performance of mixed reading and writing or simultaneous reading and writing by multiple clients is greatly improved, and the client response capability and the usability of the distributed system are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying creative work.

[0017] Figure 1 A schematic diagram of an embodiment of a method for implementing read-write sharing provided by the present invention;

[0018] Figure 2 A schematic diagram of the hardware structure of an embodiment of a computer device for realizing read-write sharing provided by the present invention;

[0019] Figure 3 A schematic diagram of an embodiment of a computer storage medium for realizing read-write sharing provided by the present invention. DETAILED DESCRIPTION

[0020] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.

[0021] It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two non-identical entities with the same name or non-identical parameters. It can be seen that "first" and "second" are only for the convenience of expression and should not be understood as limitations on the embodiments of the present invention. The subsequent embodiments will not explain this one by one.

[0022] A first aspect of an embodiment of the present invention provides an embodiment of a method for implementing read-write sharing. Figure 1 Shown is a schematic diagram of an embodiment of a method for implementing read-write sharing provided by the present invention.

[0023] like Figure 1 As shown, the embodiment of the present invention includes the following steps:

[0024] S1, in response to preparing to open a file in a read, write or read-write mixed mode, setting a corresponding value to the open mode field value in the handle of the file according to the type of operation and adding a read-write sharing identifier;

[0025] S2, in response to successfully opening the file, sending a request for permission to the metadata server based on the opening mode field value and the read-write sharing identifier and receiving the application result;

[0026] S3, in response to successfully applying for permission and reading or writing the file, determining whether there is a read cache permission, a write cache permission, or a read-write sharing permission in the current permission; and

[0027] S4: In response to the existence of read cache permission, write cache permission or read-write sharing permission in the current permission, cache read or cache write is performed on the file.

[0028] In response to preparing to open the file in a read, write or read-write mixed mode, a corresponding value is set to the open mode field value in the handle of the file according to the type of operation and a read-write sharing identifier is added.

[0029] Enable the cluster read-write sharing function to support high-performance computing (HPC), extend the POSIX standard interface, and add the sharing flag O_RWS. When the client opens a file in read, write, or read-write mixed mode, it assigns a value to the open mode field value mode in the file handle fh and appends the read-write sharing flag O_RWS. The permission field is represented by the character 'S'.

[0030] In response to successfully opening the file, a request for applying for permission is sent to the metadata server based on the opening mode field value and the read-write sharing identifier, and the application result is received.

[0031] In some embodiments, the request for permission is sent to the metadata server based on the open mode field value and the read-write sharing identifier and the application result is received, including: recording the open mode field value in the metadata field of the metadata server file, and returning the corresponding permission according to the metadata field and the read-write sharing identifier. The sharing identifier is attached to the metadata server message and sent to the metadata server; the metadata server processes the file opening message and records the open mode field value in the metadata field mode of the metadata server file.

[0032] In some embodiments, the returning of corresponding permissions according to the metadata field and the read-write sharing identifier includes: determining whether there is currently a client performing a read operation and / or a write operation on the file; and in response to the fact that there is currently no client performing a read operation and / or a write operation on the file, returning a read cache permission and / or a write cache permission according to the metadata field. For example, when client A writes a file, it applies for corresponding permissions from the metadata server. If there is currently no client writing the file, the metadata server authorizes the client to read (r), write (w) and read-write cache permissions (bc).

[0033] In some embodiments, returning corresponding permissions based on the metadata field and the read-write sharing identifier includes: in response to a client currently performing a read operation and / or a write operation on the file, reclaiming the client's read-write sharing permissions and read cache permissions and / or write cache permissions.

[0034] In some embodiments, the returning of corresponding permissions according to the metadata field and the read-write sharing identifier includes: in response to completion of permission recovery, returning read-write sharing permissions and read cache permissions and / or write cache permissions based on the metadata field. For example, when client B is reading or writing the file, the metadata server recovers client B's read-write cache permissions (bc) and authorized read-write sharing permissions (S), and authorizes write (w) and read-write sharing permissions (S) to the current client A. When client C reads the file, if another client D is writing the file at this time, the metadata server recovers client D's read-write cache permissions (bc) and authorized read-write sharing permissions (S). After the permissions of other clients are successfully updated, the metadata server authorizes read permissions (r) and read-write sharing permissions (S) to the current client C.

[0035] In some embodiments, the method further includes: in response to receiving a request to revoke the read-write sharing permission or the write cache permission, flushing the data in the cache to the storage medium and then releasing the corresponding permission. When the client receives a request from the metadata server to revoke the write cache permission or the read-write sharing permission, flushing the data in the cache to the storage medium and then releasing the corresponding permission.

[0036] In some embodiments, the method further includes: in response to receiving a request to revoke the read-write sharing permission or the read-cache permission, invalidating the data in the cache and then releasing the corresponding permission. When the client receives a request from the metadata server to revoke the read-cache permission or the read-write sharing permission, invalidating the data in the local cache and then releasing the corresponding permission. The read-write sharing function is implemented through the authorization and reclaiming operations of the cache permission or the read-write sharing permission, thereby improving the hybrid read-write performance of a single file.

[0037] In response to successfully applying for permission and reading or writing the file, determine whether the current permission includes read cache permission, write cache permission, or read-write sharing permission. In response to the existence of read cache permission, write cache permission, or read-write sharing permission in the current permission, cache read or cache write is performed on the file. After the client applies for permission, when there is read cache permission or read-write sharing permission, data can be read through cache to improve read and write performance, otherwise data can be read through direct read.

[0038] The following describes the embodiments of the present invention through the client and the metadata server respectively:

[0039] Run the distributed system and client program on the client, enable the read-write sharing function and extend the POSIX standard interface, and add the sharing identifier O_RWS; when the client opens the file in the read, write or read-write mixed mode, add the read-write sharing identifier O_RWS to the open mode field value mode in the file handle fh, attach the identifier to the message sent to the metadata server and send it to the metadata server. After the file is successfully opened, when the client reads / writes / mixes the file, it applies for corresponding permissions from the metadata server; wait for the metadata server to return the permission application result; after the permission application is successful, when reading / writing, if the read-write cache permission or read-write sharing permission is held, cache reading or writing is performed, otherwise direct reading or direct writing is performed; when the client receives the metadata server to revoke the write cache permission or read-write sharing permission, the data in the cache is flushed to the storage medium and then the corresponding permission is released; when the client receives the metadata server to revoke the read cache or read-write sharing permission, the data in the local cache is invalidated and then the corresponding permission is released to maintain data consistency.

[0040] The metadata server receives the message from the client to open the file; records the value of the opening method field in the metadata field mode of the metadata server file; performs relevant processing for opening the file and returns the result to the client; receives the client's request for read / write / mixed read / write permissions; if there is currently no client writing the file, the metadata server authorizes the client to read, write, and read-write cache permissions; if there is a client reading or writing the file, the read-write cache permissions of other clients are revoked and the read-write sharing permissions are authorized; after the permissions of other clients are successfully updated, the current client is authorized to read / write permissions and read-write sharing permissions, and recorded in the corresponding structure.

[0041] In high-performance scenarios, by relaxing the data consistency requirements and implementing shared read and write, the client can integrate multiple small-block writes into one write operation and write the data to the storage medium, reducing the number of operations on the storage medium and improving write performance; as for data consistency, the upper-layer application needs to ensure it by calling the interface provided by the bottom layer to achieve open read and write sharing. Through read and write sharing technology, the number of interactions between the client and the storage medium is reduced, the client's responsiveness is improved, and the usability of the distributed system is improved.

[0042] The embodiment of the present invention improves the synchronous read and write performance at the expense of strict and standard data consistency. By assigning a shared mark to the shared read and write file, when multiple clients read and write the file in a mixed manner, when the client holds the read and write cache permission or holds the shared mark, the client is allowed to read and write the cache, and the upper-layer application ensures data consistency by calling the corresponding data consistency interface function; by relaxing the data consistency requirements, the performance of mixed reading and writing or simultaneous reading and writing by multiple clients is greatly improved, and the client responsiveness and the usability of the distributed system are improved.

[0043] It should be pointed out in particular that the various steps in the various embodiments of the above-mentioned method for realizing read-write sharing can be cross-linked, replaced, added, and deleted. Therefore, these reasonable permutations, combinations and transformations of the method for realizing read-write sharing should also belong to the scope of protection of the present invention, and the scope of protection of the present invention should not be limited to the embodiments.

[0044] Based on the above purpose, the second aspect of an embodiment of the present invention proposes a system for realizing read-write sharing, including: an identification module, configured to respond to preparing to open a file in a read, write or read-write mixed manner, set a corresponding value to the open mode field value in the handle of the file according to the type of operation and add a read-write sharing identifier; an application module, configured to respond to successfully opening the file, issue a request for applying for permission to the metadata server based on the open mode field value and the read-write sharing identifier and receive the application result; a judgment module, configured to respond to successfully applying for permission and reading or writing the file, and judge whether there is read cache permission, write cache permission or read-write sharing permission in the current permissions; and an execution module, configured to respond to the existence of read cache permission, write cache permission or read-write sharing permission in the current permissions, and cache read or cache write the file.

[0045] In some embodiments, the system further includes a first recovery module configured to: in response to receiving a request to recover the read-write sharing permission or the write cache permission, flush the data in the cache to the storage medium and then release the corresponding permission.

[0046] In some implementations, the system further includes a second recovery module configured to: in response to receiving a request to recover the read-write sharing permission or the read-cache permission, invalidate the data in the cache and then release the corresponding permission.

[0047] In some implementations, the application module is configured to: record the open mode field value into a metadata field of a metadata server-side file, and return corresponding permissions based on the metadata field and the read-write sharing identifier.

[0048] In some embodiments, the application module is configured to: determine whether there is currently a client performing a read operation and / or a write operation on the file; and in response to there not currently being a client performing a read operation and / or a write operation on the file, return read cache permissions and / or write cache permissions based on the metadata field.

[0049] In some embodiments, the application module is configured to: in response to a client currently performing a read operation and / or a write operation on the file, revoke the client's read and write sharing permissions and read cache permissions and / or write cache permissions.

[0050] In some embodiments, the application module is configured to: in response to completion of permission reclaiming, return read-write sharing permission and read cache permission and / or write cache permission based on the metadata field.

[0051] Based on the above purpose, the third aspect of an embodiment of the present invention proposes a computer device, comprising: at least one processor; and a memory, the memory storing computer instructions that can be executed on the processor, the instructions being executed by the processor to implement the following steps: S1, in response to preparing to open a file in a read, write or read-write mixed manner, setting a corresponding value to the open mode field value in the handle of the file according to the type of operation and adding a read-write sharing identifier; S2, in response to successfully opening the file, issuing a request for applying for permission to a metadata server based on the open mode field value and the read-write sharing identifier and receiving the application result; S3, in response to successfully applying for permission and reading or writing the file, determining whether there is read cache permission, write cache permission or read-write sharing permission in the current permissions; and S4, in response to the existence of read cache permission, write cache permission or read-write sharing permission in the current permissions, cache reading or cache writing of the file.

[0052] In some implementations, the steps further include: in response to receiving a request to reclaim the read-write sharing permission or the write cache permission, flushing the data in the cache to the storage medium and then releasing the corresponding permission.

[0053] In some implementations, the steps further include: in response to receiving a request to revoke the read-write sharing permission or the read-cache permission, invalidating the data in the cache and then releasing the corresponding permission.

[0054] In some embodiments, the request for permission issued to the metadata server based on the open method field value and the read-write sharing identifier and receiving the application result includes: recording the open method field value into the metadata field of the metadata server file, and returning corresponding permissions based on the metadata field and the read-write sharing identifier.

[0055] In some embodiments, returning corresponding permissions based on the metadata field and the read-write sharing identifier includes: determining whether there is currently a client performing a read operation and / or a write operation on the file; and in response to there not currently being a client performing a read operation and / or a write operation on the file, returning read cache permissions and / or write cache permissions based on the metadata field.

[0056] In some embodiments, returning corresponding permissions based on the metadata field and the read-write sharing identifier includes: in response to a client currently performing a read operation and / or a write operation on the file, reclaiming the client's read-write sharing permissions and read cache permissions and / or write cache permissions.

[0057] In some implementations, returning corresponding permissions based on the metadata field and the read-write sharing identifier includes: in response to completion of permission reclaiming, returning read-write sharing permissions and read cache permissions and / or write cache permissions based on the metadata field.

[0058] like Figure 2 , which is a schematic diagram of the hardware structure of an embodiment of the computer device for realizing read-write sharing provided by the present invention.

[0059] As Figure 2 Taking the device shown as an example, the device includes a processor 201 and a memory 202, and may also include: an input device 203 and an output device 204.

[0060] The processor 201, the memory 202, the input device 203 and the output device 204 may be connected via a bus or other means. Figure 2 The example of connecting through bus is taken in the following.

[0061] The memory 202 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the method for implementing read-write sharing in the embodiment of the present application. The processor 201 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory 202, that is, the method for implementing read-write sharing in the above method embodiment is implemented.

[0062] The memory 202 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created according to the use of the method for implementing read-write sharing, etc. In addition, the memory 202 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 202 may optionally include a memory remotely arranged relative to the processor 201, and these remote memories may be connected to the local module via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0063] The input device 203 can receive input information such as user name and password. The output device 204 can include display devices such as display screens.

[0064] One or more program instructions / modules corresponding to the methods for implementing read-write sharing are stored in the memory 202 , and when executed by the processor 201 , the method for implementing read-write sharing in any of the above method embodiments is executed.

[0065] Any embodiment of a computer device that executes the above-mentioned method for implementing read-write sharing can achieve the same or similar effect as any corresponding embodiment of the above-mentioned method.

[0066] The present invention also provides a computer-readable storage medium, which stores a computer program that performs the above method when executed by a processor.

[0067] like Figure 3 As shown in FIG. 1 , a schematic diagram of an embodiment of the computer storage medium for realizing read-write sharing provided by the present invention is shown in FIG. Figure 3 Taking the computer storage medium shown as an example, the computer readable storage medium 3 stores a computer program 31 that performs the above method when executed by a processor.

[0068] Finally, it should be noted that a person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program for implementing the read-write sharing method can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium of the program can be a magnetic disk, an optical disk, a read-only storage memory (ROM) or a random access memory (RAM), etc. The above-mentioned computer program embodiments can achieve the same or similar effects as any of the above-mentioned method embodiments corresponding thereto.

[0069] The above are exemplary embodiments disclosed in the present invention, but it should be noted that various changes and modifications may be made without departing from the scope disclosed in the embodiments of the present invention as defined in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. In addition, although the elements disclosed in the embodiments of the present invention may be described or required in individual form, they may also be understood as multiple unless explicitly limited to the singular.

[0070] It should be understood that, as used herein, the singular forms "a", "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" refers to any and all possible combinations including one or more of the associated listed items.

[0071] The serial numbers of the embodiments disclosed in the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0072] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0073] A person skilled in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the disclosure of the embodiments of the present invention (including the claims) is limited to these examples; under the concept of the embodiments of the present invention, the technical features in the above embodiments or different embodiments can also be combined, and there are many other changes in different aspects of the embodiments of the present invention as above, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.

Claims

1. A method for realizing read-write sharing, characterized in that: The following steps are involved: In response to preparing to open the file in a read, write or read-write mixed mode, setting a corresponding value to the open mode field value in the handle of the file according to the type of operation and adding a read-write sharing identifier; In response to successfully opening the file, based on the open mode field value and the read-write sharing identifier, a request for applying for permission is sent to the metadata server and an application result is received; In response to successfully applying for permission and reading or writing the file, determining whether there is a read cache permission, a write cache permission, or a read-write sharing permission in the current permission; as well as In response to the existence of a read cache permission, a write cache permission, or a read-write sharing permission in the current permissions, cache reading or cache writing is performed on the file; The step of sending a request for permission to the metadata server based on the open mode field value and the read-write sharing identifier and receiving the result of the request comprises: recording the open mode field value into the metadata field of the metadata server file, and returning the corresponding permission according to the metadata field and the read-write sharing identifier; The method of returning corresponding permissions based on the metadata field and the read-write sharing identifier includes: determining whether there is currently a client performing a read operation and / or a write operation on the file; in response to the existence of a client currently performing a read operation and / or a write operation on the file, reclaiming the client's read-write sharing permissions and read cache permissions and / or write cache permissions; in response to completion of permission reclaiming, returning the read-write sharing permissions and read cache permissions and / or write cache permissions based on the metadata field.

2. The method according to claim 1, characterized in that The method also includes: In response to receiving a request to revoke the read-write sharing permission or the write cache permission, the data in the cache is flushed to the storage medium and then the corresponding permission is released.

3. The method according to claim 1, characterized in that The method also includes: In response to receiving a request to revoke the read-write sharing permission or the read-cache permission, the data in the cache is invalidated and then the corresponding permission is released.

4. The method according to claim 1, characterized in that The sending of a request for permission to the metadata server based on the open mode field value and the read-write sharing identifier and receiving the application result includes: The open mode field value is recorded in the metadata field of the metadata server-side file, and the corresponding authority is returned according to the metadata field and the read-write sharing identifier.

5. The method according to claim 4, characterized in that The returning corresponding permissions according to the metadata field and the read-write sharing identifier also includes: In response to the fact that there is currently no client performing a read operation and / or a write operation on the file, the read cache permission and / or the write cache permission is returned according to the metadata field.

6. A system for realizing read-write sharing, characterized in that: include: an identification module configured to, in response to preparing to open a file in a read, write or read-write mixed mode, set a corresponding value to an open mode field value in a handle of the file according to the type of operation and add a read-write shared identification; An application module, configured to, in response to successfully opening a file, send a request for permission to a metadata server based on the opening mode field value and the read-write sharing identifier and receive an application result; A judgment module configured to judge whether there is a read cache permission, a write cache permission or a read-write sharing permission in the current permission in response to a successful permission application and reading or writing the file; as well as an execution module, configured to perform cache reading or cache writing on the file in response to the existence of a read cache permission, a write cache permission, or a read-write sharing permission in the current permission; Among them, the application module is also configured to record the opening method field value into the metadata field of the metadata server-side file, and return corresponding permissions based on the metadata field and the read-write sharing identifier; the returning of corresponding permissions based on the metadata field and the read-write sharing identifier includes: judging whether there is currently a client performing a read operation and / or a write operation on the file; in response to the current existence of a client performing a read operation and / or a write operation on the file, reclaiming the client's read-write sharing permissions and read cache permissions and / or write cache permissions; in response to completion of permission reclaiming, returning read-write sharing permissions and read cache permissions and / or write cache permissions based on the metadata field.

7. A computer device, characterized in that: include: at least one processor; as well as A memory storing computer instructions executable on the processor, wherein the instructions, when executed by the processor, implement the steps of the method according to any one of claims 1 to 5.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • System and method for coordinating access to data for a distributed application

    US20030131041A1