CN111857545B - Read-write lock conflict judging method, system, equipment and computer medium - Google Patents

Read-write lock conflict judging method, system, equipment and computer medium Download PDF

Info

Publication number
CN111857545B
CN111857545B CN201910351081.2A CN201910351081A CN111857545B CN 111857545 B CN111857545 B CN 111857545B CN 201910351081 A CN201910351081 A CN 201910351081A CN 111857545 B CN111857545 B CN 111857545B
Authority
CN
China
Prior art keywords
target
request
write operation
data offset
offset range
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910351081.2A
Other languages
Chinese (zh)
Other versions
CN111857545A (en
Inventor
何绍涵
李润辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sangfor Technologies Co Ltd
Original Assignee
Sangfor Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sangfor Technologies Co Ltd filed Critical Sangfor Technologies Co Ltd
Priority to CN201910351081.2A priority Critical patent/CN111857545B/en
Publication of CN111857545A publication Critical patent/CN111857545A/en
Application granted granted Critical
Publication of CN111857545B publication Critical patent/CN111857545B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]

Abstract

The application discloses a read-write lock conflict judging method, a system, equipment and a computer medium, which are applied to a distributed storage system and are used for obtaining a target request corresponding to target data in the distributed storage system; analyzing the type of the target request; if the type of the target request is the target read request, judging whether a write operation request exists in a target operation linked list corresponding to the target data, and if not, directly adding the target read request into the target operation linked list. According to the read-write lock conflict judging method, when the write operation request does not exist in the target operation linked list, the distributed storage system directly adds the target read request into the target operation linked list, so that the process of judging whether the target read request conflicts with the read operation request in the target operation linked list is omitted, and CPU resources are saved. The read-write lock conflict judging system, the read-write lock conflict judging equipment and the computer readable storage medium also solve the corresponding technical problems.

Description

Read-write lock conflict judging method, system, equipment and computer medium
Technical Field
The present disclosure relates to the field of distributed storage technologies, and in particular, to a read-write lock conflict determination method, system, device, and computer medium.
Background
The distributed storage system is software for managing the storage server cluster, so that the server cluster is externally represented as a whole, and has consistency, expandability and fault tolerance, and the distributed storage system has become a mainstream trend of the storage system.
The distributed storage system is composed of distributed storage system software and hardware, and in the hardware, the distributed storage system is composed of a plurality of storage hosts connected through a network, and each host comprises a plurality of storage devices. However, hardware devices in a distributed storage system are prone to failure, such as host failure, hard disk failure, etc. In order to provide data protection under the condition of hardware equipment failure, one existing method is to protect data by adopting Erasure Code (EC), and the Erasure Code is a data coding strategy, and uses coding data with calculated redundancy for protecting data as backup, and after the protecting data is lost, lost data can be recovered according to residual original data and redundant coding. In this process, multiple write operations may be concurrently written to the same data location in the file, so the distributed storage system also needs to use a distributed file lock to maintain data consistency, because the operations of the EC storage module are mostly in units of stripes, the operations may act on one or more stripes, so the distributed file system may also use stripe locks to maintain data consistency, and the implementation principle of the stripe locks is to maintain an operation linked list corresponding to the operation currently being performed in each file lock, and the operation linked list stores a file offset range corresponding to the operation. The EC storage module refers to a module for providing data fault tolerance based on erasure codes in a distributed storage system; the operation of the EC memory module refers to a read operation, a write operation.
However, in the process of applying the stripe lock, the distributed storage system needs to determine whether the operation conflicts each time, for example, whether the read operation conflicts with the write operation, and this process consumes CPU resources, so that the consumption of CPU resources is large.
In summary, how to reduce the consumption of CPU resources in the application of stripe locks in a distributed storage system is a problem to be solved by those skilled in the art.
Disclosure of Invention
The purpose of the application is to provide a read-write lock conflict judging method, which can solve the technical problem of how to reduce the consumption of CPU resources in the process of applying stripe locks to a distributed storage system to a certain extent. The application also provides a read-write lock conflict judging system, a device and a computer readable storage medium.
In order to achieve the above object, the present application provides the following technical solutions:
a read-write lock conflict judging method is applied to a distributed storage system and comprises the following steps:
acquiring a target request corresponding to target data in the distributed storage system;
analyzing the type of the target request;
if the type of the target request is a target read request, judging whether a write operation request exists in a target operation linked list corresponding to the target data, and if not, directly adding the target read request into the target operation linked list.
Preferably, the determining whether a write operation request exists in the target operation linked list corresponding to the target data includes:
judging whether a write operation request exists in a write operation linked list of the target operation linked list, if the write operation request exists in the write operation linked list, judging that the write operation request exists in the target operation linked list, and if the write operation request does not exist in the write operation linked list, judging that the write operation request does not exist in the target operation linked list;
the adding the target read request to the target operation linked list includes:
and adding the target read request to a read operation linked list of the target operation linked list.
Preferably, the determining whether a write operation request exists in the target operation linked list corresponding to the target data includes:
judging whether the count value of the number of the write operation requests in the target operation linked list is 0 or not;
if the number count value is 0, judging that the write operation request does not exist in the target operation linked list; and if the number count value is not 0, judging that the write operation request exists in the target operation linked list.
Preferably, after the determining whether the write operation request exists in the target operation linked list corresponding to the target data, the method further includes:
if the write operation request exists in the target operation linked list, judging whether the target read request conflicts with the write operation request or not;
and if the target read request does not conflict with the write operation request, adding the target read request into the target operation linked list.
Preferably, the determining whether the target read request collides with the write operation request includes:
ordering each write operation data offset range of the write operation request according to a range size;
sequentially judging whether the target data offset range of the target read request coincides with each write operation data offset range according to the ordering sequence of the write operation data offset ranges; and if the target data offset range is not overlapped with each write operation data offset range, judging that the target read request is not in conflict with the write operation request.
Preferably, the ordering each write operation data offset range of the write operation request according to a range size includes:
and ordering each write operation data offset range of the write operation request according to the principle that the range is large and then the range is small.
Preferably, the ordering each write operation data offset range of the write operation request according to a range size includes:
and ordering each write operation data offset range of the write operation request according to the principle of small range before large range.
Preferably, the determining whether the target read request collides with the write operation request includes:
determining the proportion of the write operation data offset range of the write operation request to the target data;
judging whether the proportion is smaller than a preset value or not;
if the ratio is smaller than the preset value, judging whether a target data offset range of the target read request coincides with the write operation data offset range, if the target data offset range coincides with the write operation data offset range, judging that the target read request collides with the write operation request, and if the target data offset range does not coincide with the write operation data offset range, judging that the target read request does not collide with the write operation request;
and if the ratio is greater than or equal to the preset value, determining a residual data offset range of the target data except the write operation data offset range, judging whether the target data offset range is overlapped with the residual data offset range, if the target data offset range is overlapped with the residual data offset range, judging that the target read request is not in conflict with the write operation request, and if the target data offset range is not overlapped with the residual data offset range, judging that the target read request is in conflict with the write operation request.
Preferably, after the parsing the type of the target request, the method further includes:
if the type of the target request is a target write request, judging whether the target write request conflicts with an operation request in the target operation linked list.
A read-write lock conflict judging system is applied to a distributed storage system, and comprises:
the first acquisition module is used for acquiring a target request corresponding to target data in the distributed storage system;
the first analysis module is used for analyzing the type of the target request;
and the first execution module is used for judging whether a write operation request exists in a target operation linked list corresponding to the target data when the type of the target request is a target read request, and if not, directly adding the target read request into the target operation linked list.
A read-write lock collision determination apparatus comprising:
a memory for storing a computer program;
and the processor is used for realizing the steps of the read-write lock conflict judging method when executing the computer program.
A computer readable storage medium having stored therein a computer program which when executed by a processor performs the steps of the read-write lock conflict determination method as described in any one of the above.
The read-write lock conflict judging method is applied to a distributed storage system and is used for obtaining a target request corresponding to target data in the distributed storage system; analyzing the type of the target request; if the type of the target request is the target read request, judging whether a write operation request exists in a target operation linked list corresponding to the target data, and if not, directly adding the target read request into the target operation linked list. In the read-write lock conflict judging method provided by the application, after the distributed storage system receives the target read request, whether the target read request conflicts with the operation request in the target operation linked list is judged firstly instead of judging whether the write operation request exists in the target operation linked list, if the write operation request does not exist in the target operation linked list, the target read request is directly added into the target operation linked list, the process of judging whether the target read request conflicts with the read operation request in the target operation linked list is omitted, CPU resources are saved, and the technical problem of CPU resource consumption in the process of applying the stripe lock by the distributed storage system is solved. The read-write lock conflict judging system, the read-write lock conflict judging equipment and the computer readable storage medium also solve the corresponding technical problems.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings may be obtained according to the provided drawings without inventive effort to a person skilled in the art.
FIG. 1 is a first flowchart of a method for determining a read-write lock conflict according to an embodiment of the present application;
fig. 2 is a first schematic diagram of a read-write lock conflict judging method provided in an embodiment of the present application;
fig. 3 is a schematic structural diagram of a read-write lock conflict judging system according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a device for determining collision between read and write locks according to an embodiment of the present application;
fig. 5 is another schematic structural diagram of a device for determining a collision between read and write locks according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
Referring to fig. 1, fig. 1 is a first flowchart of a read-write lock conflict determination method according to an embodiment of the present application.
The read-write lock conflict judging method provided by the embodiment of the application is applied to a distributed storage system and can comprise the following steps:
step S101: target requests corresponding to target data in the distributed storage system are obtained.
In practical application, the distributed storage system may first obtain a target request corresponding to target data in the distributed storage system, that is, when the external world needs to operate on the target data, the distributed storage system may send the target request to the distributed storage system. The distributed storage system to which the present application relates includes CEPH, glusterfs, HDFS, lustre and the like.
Step S102: the type of the target request is parsed.
In practical applications, the operations for the target data include a read operation and a write operation, so the types of the target requests include a target read request and a target write request, for the target write request, it needs to determine whether the target write request collides with each operation request in the target operation linked list corresponding to the target data, and for the target read request, because the read operation does not collide with the read operation, but the read operation may collide with the write operation, it only needs to determine whether the target read request collides with the write operation request in the target operation linked list, so the distributed storage system needs to analyze the types of the target requests after obtaining the target request. Taking the operation request in the target operation linked list as a read operation (1024 KB,1056 KB), a write operation (0 KB,128 KB), a write operation (128 KB,256 KB), a read operation (1008 KB,1040 KB) and a read operation (992 KB,1024 KB) as examples, the data offset ranges of the three read operations are overlapped, the data offset ranges of the two write operations and the data offset ranges of the three read operations are not overlapped, at this time, any read operation and new operation between (0 KB,256 KB) are blocked, and the write operation between (1008 KB,1056 KB) is only blocked, and the read operation between (1008 KB,1056 KB) is not blocked.
Step S103: if the type of the target request is the target read request, judging whether a write operation request exists in a target operation linked list corresponding to the target data, and if not, directly adding the target read request into the target operation linked list.
In practical application, when the type of the target request is a target read request, the distributed storage system needs to determine whether a write operation request exists in the target operation linked list, the operation request corresponding to the target data is stored in the target operation linked list, and if the write operation request does not exist in the target operation linked list, the target read request is directly added into the target operation linked list. In a specific application scenario, after analyzing the type of the target request, if the type of the target request is the target write request, whether the target write request conflicts with an operation request in the target operation linked list is needed to be judged, and if the target write request does not conflict with the operation request in the target operation linked list, the target write request is added into the target operation linked list. It should be noted that after the distributed storage system executes an operation request in the target operation linked list, the operation request needs to be deleted in the target operation linked list, so that other operations in the target operation linked list can be executed.
The read-write lock conflict judging method is applied to a distributed storage system and is used for obtaining a target request corresponding to target data in the distributed storage system; analyzing the type of the target request; if the type of the target request is the target read request, judging whether a write operation request exists in a target operation linked list corresponding to the target data, and if not, directly adding the target read request into the target operation linked list. In the read-write lock conflict judging method provided by the application, after the distributed storage system receives the target read request, whether the target read request conflicts with the operation request in the target operation linked list is judged firstly instead of judging whether the write operation request exists in the target operation linked list, if the write operation request does not exist in the target operation linked list, the target read request is directly added into the target operation linked list, the process of judging whether the target read request conflicts with the read operation request in the target operation linked list is omitted, CPU resources are saved, and the technical problem of CPU resource consumption in the process of applying the stripe lock by the distributed storage system is solved.
Referring to fig. 2, fig. 2 is a first schematic diagram of a read-write lock conflict determination method according to an embodiment of the present application.
In the analysis, no conflict judgment exists between the read operation and the read operation, and on the basis of ensuring that the consumption of CPU resources in the process of applying the stripe lock to the distributed storage system is reduced, in order to improve the read-write lock conflict judgment efficiency, the target operation linked list can be separated into a write operation linked list and a read operation linked list, only the write operation request is stored in the write operation linked list, and only the read operation request is stored in the read operation linked list, so that the read-write lock conflict judgment is carried out on the target read request and each write operation request in the write operation linked list, and the read-write lock conflict judgment is carried out on the target write request and each operation request in the write operation linked list and the read operation linked list, thereby saving the time of distinguishing the operation request types in the target operation linked list by the distributed storage system and improving the read-write lock conflict judgment efficiency; assuming that two write operation linked lists exist in the target operation linked list and are positioned in the middle of the target operation linked list, for a target read request, the read-write lock conflict judgment needs to be carried out on the target read request and the read operation request in the target operation linked list, for the target read request, the number of times of carrying out the read-write lock conflict judgment is more than 2, and after the target operation linked list is separated, the target read request only needs to carry out the read-write lock conflict judgment with two write operations in the write operation linked list, and the number of times of the read-write lock conflict judgment is further reduced. Therefore, in the read-write lock conflict judging method provided by the present application, step S103 is to judge whether there is a write operation request in the target operation linked list corresponding to the target data, which may specifically be: judging whether a write operation request exists in a write operation linked list of the target operation linked list, if so, judging that the write operation request exists in the target operation linked list, and if not, judging that the write operation request does not exist in the target operation linked list; accordingly, the step of adding the target read request to the target operation linked list may be specifically: and adding the target read request to a read operation linked list of the target operation linked list.
In the method for judging the conflict of the read-write lock provided by the embodiment of the application, the number count value of the write operation requests can be set, and whether the write operation requests exist in the target operation linked list is judged by means of the number count value, then step S103 of judging whether the write operation requests exist in the target operation linked list corresponding to the target data can be specifically: judging whether the count value of the number of the write operation requests in the target operation linked list is 0; if the number count value is 0, judging that a write operation request does not exist in the target operation linked list; if the number count value is not 0, determining that a write operation request exists in the target operation linked list. Taking an empty target operation linked list as an example, for the first read operation request, the count value of the number of the write operation requests is 0, and the first read operation request can be directly added into the target operation linked list; for the second read operation request, the count value is still 0, or the second read operation request can be directly added into the target operation linked list; for the first write operation request, after the first write operation request is required to be judged not to conflict with the first read operation request and the second read operation request, the first write operation request can be added into a target operation linked list, and the number count value is 1; for the third read operation request, since the count value is not 0, the read-write lock conflict judgment needs to be performed between the third read operation request and the operation request in the target operation linked list.
In the method for judging the read-write lock conflict provided in the embodiment of the present application, step S103: after judging whether a write operation request exists in a target operation linked list corresponding to target data, if the write operation request exists in the target operation linked list, judging whether a target read request conflicts with the write operation request or not; if the target read request does not conflict with the write operation request, the target read request is added to a target operation linked list.
In a specific application scenario, since the write operation requests in the target operation linked list are arranged according to time sequence, in the application, the write operation requests can be ordered according to external requirements, and then the read-write lock conflict judgment is sequentially performed on the target read requests and the write operation requests according to the ordering, so that the read-write lock conflict judgment process can meet the external requirements, for example, the write operation requests are ordered according to the size of the data offset range, and the step of judging whether the target read requests conflict with the write operation requests can be specifically: ordering each write operation data offset range of the write operation request according to the range size; sequentially judging whether the target data offset range of the target read request coincides with each write operation data offset range according to the ordering sequence of the write operation data offset ranges; if the target data offset range is coincident with any write operation data offset range, the target read request is judged to conflict with the write operation request, and if the target data offset range is not coincident with each write operation data offset range, the target read request is judged not to conflict with the write operation request. In a specific application scene, the target data offset range is easy to coincide with the write operation data offset range with a large range, so that in order to improve the read-write lock conflict judging efficiency, when each write operation data offset range of a write operation request is ordered according to the range size, each write operation data offset range of the write operation request can be ordered according to the principle that the range is large before the range is small; accordingly, the smaller the write operation data offset range is, the less CPU resources are consumed to judge that the target data offset range coincides with the write operation offset range, so in order to save CPU resources, when each write operation data offset range of the write operation request is ordered according to the range size, each write operation data offset range of the write operation request can be ordered according to the principle that the range is small before the range is large. In a specific application scenario, the higher the use frequency of data, the easier the corresponding read request and write request overlap, and based on this characteristic, in order to improve the read-write lock conflict judgment efficiency, the write operation requests may be further ordered according to the use frequency of data, and so on.
In the method for judging the conflict of the read-write lock provided in the embodiment of the present application, if the proportion of the target data in the stack of the offset range of the write operation data is large, at this time, the offset range of the target data is easy to overlap with the offset range of the write operation data, but the CPU resources consumed when the offset range of the target data overlaps with the offset range of the write operation data are large, at this time, in order to save the CPU resources, the offset range of the target data can be compared with the remaining offset ranges of the target data except for the offset range of the write operation data, and the step of judging whether the target read request conflicts with the write operation request can be specifically: determining the proportion of the write operation data offset range of the write operation request to the target data; judging whether the proportion is smaller than a preset value, if the proportion is smaller than the preset value, judging whether a target data offset range of a target read request is overlapped with a write operation data offset range, if the target data offset range is overlapped with the write operation data offset range, judging that the target read request is in conflict with the write operation request, and if the target data offset range is not overlapped with the write operation data offset range, judging that the target read request is not in conflict with the write operation request; if the ratio is greater than or equal to a preset value, determining a residual data offset range of the target data except the write operation data offset range, judging whether the target data offset range is overlapped with the residual data offset range, if the target data offset range is overlapped with the residual data offset range, judging that the target read request is not in conflict with the write operation request, and if the target data offset range is not overlapped with the residual data offset range, judging that the target read request is in conflict with the write operation request.
The application also provides a read-write lock conflict judging system which has the corresponding effect of the read-write lock conflict judging method. Referring to fig. 3, fig. 3 is a schematic structural diagram of a read-write lock conflict determination system according to an embodiment of the present application.
The read-write lock conflict judging system provided by the embodiment of the application is applied to a distributed storage system and can comprise:
a first obtaining module 101, configured to obtain a target request corresponding to target data in a distributed storage system;
a first parsing module 102, configured to parse a type of the target request;
the first execution module 103 is configured to determine whether a write operation request exists in a target operation linked list corresponding to target data when the type of the target request is a target read request, and if not, directly add the target read request to the target operation linked list.
The read-write lock conflict judging system provided by the embodiment of the application is applied to a distributed storage system, and the first execution module may include:
the first judging unit is used for judging whether a write operation request exists in a write operation linked list of the target operation linked list, if the write operation request exists in the write operation linked list, judging that the write operation request exists in the target operation linked list, and if the write operation request does not exist in the write operation linked list, judging that the write operation request does not exist in the target operation linked list;
and the first adding unit is used for adding the target read request to the read operation linked list of the target operation linked list.
The read-write lock conflict judging system provided by the embodiment of the application is applied to a distributed storage system, and the first execution module may include:
the second judging unit is used for judging whether the count value of the number of the write operation requests in the target operation linked list is 0; if the number count value is 0, judging that a write operation request does not exist in the target operation linked list; if the number count value is not 0, determining that a write operation request exists in the target operation linked list.
The read-write lock conflict judging system provided by the embodiment of the application is applied to a distributed storage system, and can further comprise:
the first judging module is used for judging whether the target read request conflicts with the write operation request if the write operation request exists in the target operation linked list after the first executing module judges whether the write operation request exists in the target operation linked list corresponding to the target data; if the target read request does not conflict with the write operation request, the target read request is added to a target operation linked list.
The read-write lock conflict judging system provided by the embodiment of the application is applied to a distributed storage system, and the first judging module may include:
a first ordering unit, configured to order each write operation data offset range of the write operation request according to a range size;
a third judging unit, configured to sequentially judge whether a target data offset range of the target read request coincides with each write operation data offset range according to an ordering order of the write operation data offset ranges; if the target data offset range is coincident with any write operation data offset range, the target read request is judged to conflict with the write operation request, and if the target data offset range is not coincident with each write operation data offset range, the target read request is judged not to conflict with the write operation request.
The read-write lock conflict judging system provided by the embodiment of the application is applied to a distributed storage system, and the first ordering unit may include:
and the first sequencing subunit is used for sequencing each write operation data offset range of the write operation request according to the principle that the range is large and then the range is small.
The read-write lock conflict judging system provided by the embodiment of the application is applied to a distributed storage system, and the first ordering unit may include:
and the second sequencing subunit is used for sequencing each write operation data offset range of the write operation request according to the principle that the range is small and then the range is large.
The read-write lock conflict judging system provided by the embodiment of the application is applied to a distributed storage system, and the first judging module may include:
a first determining unit configured to determine a proportion of a write operation data offset range of a write operation request to target data;
a fourth judging unit for judging whether the ratio is smaller than a preset value;
the first execution unit is used for judging whether the target data offset range of the target read request coincides with the write operation data offset range or not when the proportion is smaller than a preset value, if the target data offset range coincides with the write operation data offset range, the target read request is judged to conflict with the write operation request, and if the target data offset range does not coincide with the write operation data offset range, the target read request is judged to not conflict with the write operation request;
and the second execution unit is used for determining the residual data offset ranges of the target data except the write operation data offset range when the proportion is larger than or equal to a preset value, judging whether the target data offset range is overlapped with the residual data offset range, judging that the target read request is not in conflict with the write operation request if the target data offset range is overlapped with the residual data offset range, and judging that the target read request is in conflict with the write operation request if the target data offset range is not overlapped with the residual data offset range.
The read-write lock conflict judging system provided by the embodiment of the application is applied to a distributed storage system, and can further comprise:
and the second execution module is used for judging whether the target write request conflicts with the operation request in the target operation linked list if the type of the target request is the target write request after the first analysis module analyzes the type of the target request.
The application also provides a read-write lock conflict judging device and a computer readable storage medium, which have the corresponding effects of the read-write lock conflict judging method. Referring to fig. 4, fig. 4 is a schematic structural diagram of a read-write lock conflict determination apparatus according to an embodiment of the present application.
The device for judging the conflict of the read-write lock provided by the embodiment of the application may include:
a memory 201 for storing a computer program;
a processor 202 for implementing the steps of the read-write lock conflict judging method as described in any of the embodiments above when executing a computer program.
Referring to fig. 5, another device for determining a collision between read and write locks provided in the embodiment of the present application may further include: an input port 203 connected to the processor 202 for transmitting an externally input command to the processor 202; a display unit 204 connected to the processor 202, for displaying the processing result of the processor 202 to the outside; and the communication module 205 is connected with the processor 202 and is used for realizing the communication between the read-write lock conflict judging equipment and the outside. The display unit 204 may be a display panel, a laser scanning display, or the like; communication means employed by the communication module 205 include, but are not limited to, mobile high definition link technology (HML), universal Serial Bus (USB), high Definition Multimedia Interface (HDMI), wireless connection: wireless fidelity (WiFi), bluetooth communication, bluetooth low energy communication, ieee802.11s based communication.
The embodiment of the application provides a computer readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the steps of the read-write lock conflict judging method described in any embodiment above are implemented.
The computer readable storage medium referred to in this application includes Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The description of the related parts in the read-write lock conflict judging system, the device and the computer readable storage medium provided in the embodiments of the present application refers to the detailed description of the corresponding parts in the read-write lock conflict judging method provided in the embodiments of the present application, and is not repeated here. In addition, the parts of the above technical solutions provided in the embodiments of the present application, which are consistent with the implementation principles of the corresponding technical solutions in the prior art, are not described in detail, so that redundant descriptions are avoided.
It is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (9)

1. The read-write lock conflict judging method is characterized by being applied to a distributed storage system and comprising the following steps of:
acquiring a target request corresponding to target data in the distributed storage system;
analyzing the type of the target request;
if the type of the target request is a target read request, judging whether a write operation request exists in a target operation linked list corresponding to the target data, and if not, directly adding the target read request into the target operation linked list;
if the write operation request exists in the target operation linked list, judging whether the target read request conflicts with the write operation request or not;
if the target read request does not conflict with the write operation request, the target read request is added to the target operation linked list;
wherein said determining whether said target read request conflicts with said write operation request comprises: ordering each write operation data offset range of the write operation request according to a range size; sequentially judging whether the target data offset range of the target read request coincides with each write operation data offset range according to the ordering sequence of the write operation data offset ranges; if the target data offset range is overlapped with any write operation data offset range, the target read request is judged to conflict with the write operation request, and if the target data offset range is not overlapped with each write operation data offset range, the target read request is judged to not conflict with the write operation request;
and/or determining the proportion of the write operation data offset range of the write operation request to the target data; judging whether the proportion is smaller than a preset value or not; if the ratio is smaller than the preset value, judging whether a target data offset range of the target read request coincides with the write operation data offset range, if the target data offset range coincides with the write operation data offset range, judging that the target read request collides with the write operation request, and if the target data offset range does not coincide with the write operation data offset range, judging that the target read request does not collide with the write operation request; and if the ratio is greater than or equal to the preset value, determining a residual data offset range of the target data except the write operation data offset range, judging whether the target data offset range is overlapped with the residual data offset range, if the target data offset range is overlapped with the residual data offset range, judging that the target read request is not in conflict with the write operation request, and if the target data offset range is not overlapped with the residual data offset range, judging that the target read request is in conflict with the write operation request.
2. The method of claim 1, wherein the determining whether a write operation request exists in a target operation linked list corresponding to the target data comprises:
judging whether a write operation request exists in a write operation linked list of the target operation linked list, if the write operation request exists in the write operation linked list, judging that the write operation request exists in the target operation linked list, and if the write operation request does not exist in the write operation linked list, judging that the write operation request does not exist in the target operation linked list;
the adding the target read request to the target operation linked list includes:
and adding the target read request to a read operation linked list of the target operation linked list.
3. The method of claim 1, wherein the determining whether a write operation request exists in a target operation linked list corresponding to the target data comprises:
judging whether the count value of the number of the write operation requests in the target operation linked list is 0 or not;
if the number count value is 0, judging that the write operation request does not exist in the target operation linked list; and if the number count value is not 0, judging that the write operation request exists in the target operation linked list.
4. The method of claim 1, wherein ordering each write operation data offset range of the write operation request by range size comprises:
and ordering each write operation data offset range of the write operation request according to the principle that the range is large and then the range is small.
5. The method of claim 1, wherein ordering each write operation data offset range of the write operation request by range size comprises:
and ordering each write operation data offset range of the write operation request according to the principle of small range before large range.
6. The method of claim 1, wherein after said parsing the type of the target request, further comprising:
if the type of the target request is a target write request, judging whether the target write request conflicts with an operation request in the target operation linked list.
7. A read-write lock conflict determination system, characterized in that it is applied to a distributed storage system, comprising:
the first acquisition module is used for acquiring a target request corresponding to target data in the distributed storage system;
the first analysis module is used for analyzing the type of the target request;
the first execution module is used for judging whether a write operation request exists in a target operation linked list corresponding to the target data when the type of the target request is a target read request, and if not, directly adding the target read request into the target operation linked list;
the first judging module is used for judging whether the target read request conflicts with the write operation request if the write operation request exists in the target operation linked list; if the target read request does not conflict with the write operation request, the target read request is added to the target operation linked list;
wherein, the first judging module includes:
a first ordering unit, configured to order each write operation data offset range of the write operation request according to a range size;
a third judging unit, configured to sequentially judge whether a target data offset range of the target read request coincides with each of the write operation data offset ranges according to an ordering order of the write operation data offset ranges; if the target data offset range is overlapped with any write operation data offset range, the target read request is judged to conflict with the write operation request, and if the target data offset range is not overlapped with each write operation data offset range, the target read request is judged to not conflict with the write operation request;
and/or a first determining unit, configured to determine a proportion of a write operation data offset range of the write operation request to the target data;
a fourth judging unit for judging whether the ratio is smaller than a preset value;
the first execution unit is configured to determine whether a target data offset range of the target read request coincides with the write operation data offset range if the ratio is smaller than the preset value, determine that the target read request conflicts with the write operation request if the target data offset range coincides with the write operation data offset range, and determine that the target read request does not conflict with the write operation request if the target data offset range does not coincide with the write operation data offset range;
and the second execution unit is used for determining the residual data offset range of the target data except the write operation data offset range if the proportion is larger than or equal to the preset value, judging whether the target data offset range is overlapped with the residual data offset range, judging that the target read request is not in conflict with the write operation request if the target data offset range is overlapped with the residual data offset range, and judging that the target read request is in conflict with the write operation request if the target data offset range is not overlapped with the residual data offset range.
8. A read-write lock collision judgment apparatus, characterized by comprising:
a memory for storing a computer program;
a processor for implementing the steps of the read-write lock conflict judging method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, which when executed by a processor, implements the steps of the read-write lock collision determination method according to any one of claims 1 to 6.
CN201910351081.2A 2019-04-28 2019-04-28 Read-write lock conflict judging method, system, equipment and computer medium Active CN111857545B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910351081.2A CN111857545B (en) 2019-04-28 2019-04-28 Read-write lock conflict judging method, system, equipment and computer medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910351081.2A CN111857545B (en) 2019-04-28 2019-04-28 Read-write lock conflict judging method, system, equipment and computer medium

Publications (2)

Publication Number Publication Date
CN111857545A CN111857545A (en) 2020-10-30
CN111857545B true CN111857545B (en) 2023-12-29

Family

ID=72966321

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910351081.2A Active CN111857545B (en) 2019-04-28 2019-04-28 Read-write lock conflict judging method, system, equipment and computer medium

Country Status (1)

Country Link
CN (1) CN111857545B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112543237B (en) * 2020-11-27 2023-07-11 互联网域名系统北京市工程研究中心有限公司 Lock-free DNS caching method and DNS server

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09190414A (en) * 1996-01-12 1997-07-22 Hitachi Ltd Decentralized computer system with data conflict preventing device
CN102999378A (en) * 2012-12-03 2013-03-27 中国科学院软件研究所 Read-write lock implement method
CN106250212A (en) * 2016-07-29 2016-12-21 努比亚技术有限公司 Resource access method and device
WO2017114262A1 (en) * 2015-12-31 2017-07-06 华为技术有限公司 Method for managing distributed storage system, and distributed storage system
CN107678680A (en) * 2017-07-27 2018-02-09 深圳市云舒网络技术有限公司 The concurrent IO of correcting and eleting codes method and storage device in distributed block storage system
CN107807858A (en) * 2017-10-30 2018-03-16 北京神州绿盟信息安全科技股份有限公司 One kind read-write lock operation method and system, equipment
CN108572876A (en) * 2018-03-07 2018-09-25 北京神州绿盟信息安全科技股份有限公司 A kind of implementation method and device of Read-Write Locks
CN109032526A (en) * 2018-07-26 2018-12-18 郑州云海信息技术有限公司 data processing method and device for distributed file system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6678758B2 (en) * 2001-02-05 2004-01-13 Fujitsu Limited Dynamic queuing for read/write requests
US20070180155A1 (en) * 2006-02-01 2007-08-02 International Business Machines Corporation Method and apparatus for implementing transfer ordering using hardware linked list

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09190414A (en) * 1996-01-12 1997-07-22 Hitachi Ltd Decentralized computer system with data conflict preventing device
CN102999378A (en) * 2012-12-03 2013-03-27 中国科学院软件研究所 Read-write lock implement method
WO2017114262A1 (en) * 2015-12-31 2017-07-06 华为技术有限公司 Method for managing distributed storage system, and distributed storage system
CN106250212A (en) * 2016-07-29 2016-12-21 努比亚技术有限公司 Resource access method and device
CN107678680A (en) * 2017-07-27 2018-02-09 深圳市云舒网络技术有限公司 The concurrent IO of correcting and eleting codes method and storage device in distributed block storage system
CN107807858A (en) * 2017-10-30 2018-03-16 北京神州绿盟信息安全科技股份有限公司 One kind read-write lock operation method and system, equipment
CN108572876A (en) * 2018-03-07 2018-09-25 北京神州绿盟信息安全科技股份有限公司 A kind of implementation method and device of Read-Write Locks
CN109032526A (en) * 2018-07-26 2018-12-18 郑州云海信息技术有限公司 data processing method and device for distributed file system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
分布式系统环境下一种读写同步控制模型的实;李金忠等;《CNKI数据库》;第18-21页 *

Also Published As

Publication number Publication date
CN111857545A (en) 2020-10-30

Similar Documents

Publication Publication Date Title
CN109062512B (en) Distributed storage cluster, data read-write method, system and related device
US10198343B2 (en) Method for debugging a computer program
CN100592271C (en) Apparatus and method for high performance volatile disk drive memory access using an integrated DMA engine
CN103248667B (en) A kind of resource access method of distributed system and system
US9063887B2 (en) Restoring distributed shared memory data consistency within a recovery process from a cluster node failure
CN105786405A (en) Online upgrading method, device and system
CN109446147B (en) Data interaction method of network storage device and pcie device
CN109451098A (en) FPGA accelerator card MAC Address configuration method, device and accelerator card
CN110719345A (en) Virtual machine MAC address generation method, system, equipment and computer medium
CN111416825A (en) Inter-thread lock-free log management method and system, terminal and storage medium
CN113010265A (en) Pod scheduling method, scheduler, memory plug-in and system
CN115408730A (en) Data processing method, chip, electronic device and storage medium
CN111857545B (en) Read-write lock conflict judging method, system, equipment and computer medium
CN105302489A (en) Heterogeneous multi-core remote embedded memory system and method
US10901914B2 (en) Method for writing multiple copies into storage device, and storage device
CN107844360B (en) Method and device for executing application code by hard disk
US9201748B2 (en) Virtual device sparing
CN109981798A (en) A kind of method for writing data, system and electronic equipment and storage medium
CN110399166A (en) Store method, device, equipment and the storage medium of ME Nonce value
CN110045929B (en) Mounting point management method and related device
US20110200059A1 (en) BIT Inversion For Communication Interface
CN109522162A (en) A kind of data back up method, system, equipment and computer readable storage medium
CN111143125B (en) MCE error processing method and device, electronic equipment and storage medium
US9489246B2 (en) Method and device for determining parallelism of tasks of a program
CN112463228A (en) Storage pool hybrid deployment method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant