A method, device, and computer-readable storage medium for transferring dirty data
By transferring dirty data from cache to preset RAID group when RAID group fails, the problem of dirty data occupies cache and improving server performance is achieved.
Patent Information
- Application Number
- CN202211181337.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-27
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2042-09-27
AI Technical Summary
Due to the abnormality of the RAID group, dirty data cannot be transferred from the cache to the RAID group, occupying cache space and affecting server performance.
After detecting a RAID group failure, the dirty data in the cache is transferred to the preset RAID group, and the dirty data in the cache is deleted, and other RAID groups are used to store dirty data instead of the failed RAID group.
It avoids the cache space being occupied, ensures the storage of dirty data on disk, and improves server performance.
Smart Images

Figure CN115639956B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data management, and in particular to a dirty data transfer method, device, and computer-readable storage medium. Background Art
[0002] Dirty data refers to temporary data generated by the server when performing read and write tasks. It is invalid data after a certain data or file in the server has been modified and has not yet been saved to the disk. In order to make the dirty data valid, after the server performs the read and write task, the dirty data generated by the read and write task needs to be stored in the RAID (Redundant Arrays of Independent Disks) group so that the dirty data can be turned into valid data. However, since the server's storage principle is that the processor needs to pass through the cache first and then through the RAID group, the current dirty data will be stored in the server's cache first, and then transferred to the RAID group according to the instruction. When an abnormality occurs in the RAID group, the dirty data cannot be transferred from the cache to the RAID group, causing the dirty data to occupy the cache space and affect the server performance. Summary of the Invention
[0003] The purpose of the present invention is to provide a method, device and computer-readable storage medium for transferring dirty data, which avoids the cache space from being occupied and thus avoids affecting the server performance, and also ensures that the dirty data to be transferred is stored on disk to facilitate conversion into valid data.
[0004] To solve the above technical problems, the present invention provides a dirty data transfer method, which is applied to a processor in a server and includes:
[0005] When a fault is detected in the current RAID group, dirty data to be transferred corresponding to the current RAID group is determined in the cache of the server;
[0006] The dirty data to be transferred is transferred to a preset RAID group, and the dirty data to be transferred in the cache is deleted.
[0007] Preferably, determining the dirty data to be transferred corresponding to the current RAID group in the cache of the server includes:
[0008] Determining first metadata of the current RAID group;
[0009] Obtaining second metadata corresponding to each dirty data in the cache;
[0010] In each of the second metadata, the dirty data corresponding to all the second metadata that have a corresponding relationship with the first metadata are used as the dirty data to be transferred.
[0011] Preferably, after storing the dirty data to be transferred into a preset RAID group, the method further includes:
[0012] Determining whether there is dirty data corresponding to the second metadata that has a corresponding relationship with the first metadata in the cache;
[0013] If not, determining that the transfer of the dirty data to be transferred is completed;
[0014] If not, re-entering the step of storing the dirty data to be transferred into the preset RAID group.
[0015] Preferably, before storing the dirty data to be transferred into the preset RAID group, the method further includes:
[0016] In each of the other RAID groups, designating the RAID group as the preset RAID group;
[0017] Establishing a mapping relationship between the current RAID group and the preset RAID group;
[0018] Storing the dirty data to be transferred into the preset RAID group includes:
[0019] Storing the dirty data to be transferred into the preset RAID group according to the mapping relationship.
[0020] Preferably, establishing the mapping relationship between the current RAID group and the preset RAID group includes:
[0021] Determining a first physical address where the dirty data to be transferred needs to be stored in the current RAID group;
[0022] Determining a mapping relationship between the first physical address and a free second physical address in the preset RAID group;
[0023] Storing the dirty data to be transferred into the preset RAID group according to the mapping relationship includes:
[0024] Storing the dirty data to be transferred into the second physical address.
[0025] Preferably, before determining the dirty data to be transferred corresponding to the current RAID group in the cache of the server, the method further includes:
[0026] Obtaining an in-position signal of the current RAID group;
[0027] Determining whether the in-position signal of the current RAID group is a signal indicating normal in-position;
[0028] If not, determining that a failure is detected in the current RAID group.
[0029] Preferably, after storing the dirty data to be transferred into the preset RAID group, the method further includes:
[0030] After detecting that the current RAID group returns to normal, storing the dirty data to be transferred stored in the preset RAID group into the current RAID group.
[0031] Preferably, before storing the dirty data to be transferred stored in the preset RAID group into the current RAID group, the method further includes:
[0032] Determining whether the current RAID group returns to normal within a preset time period;
[0033] If yes, entering the step of storing the dirty data to be transferred stored in the preset RAID group into the current RAID group;
[0034] If not, deleting the dirty data to be transferred stored in the preset RAID group.
[0035] The present application further provides a dirty data transfer device, including:
[0036] A memory, configured to store a computer program;
[0037] A processor, configured to implement the steps of the above-mentioned dirty data transfer method when executing the computer program.
[0038] The present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned dirty data transfer method are implemented.
[0039] The present application provides a dirty data transfer method, device and computer-readable storage medium, which relate to the field of data management and are applied to a processor in a server. After detecting a failure in the current RAID group, the dirty data corresponding to the current RAID group is determined in the cache of the server, and the dirty data to be transferred is stored in a preset RAID group. When the current RAID group fails, by using another RAID group to replace the current RAID group to store the dirty data that the current RAID group needs to store, the dirty data can be moved from the cache to the preset RAID group, avoiding the occupation of the cache space, thereby avoiding the impact on the server performance, and also ensuring the disk storage of the dirty data to be transferred, which is convenient for becoming valid data. Description of the Drawings
[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required in the prior art and the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0041] Figure 1 It is a flowchart of a method for transferring dirty data provided by this application;
[0042] Figure 2 It is a flowchart of another method for transferring dirty data provided by this application;
[0043] Figure 3 It is a schematic structural diagram of a device for transferring dirty data provided by this application. Specific Embodiments
[0044] The core of the present invention is to provide a method, device, and computer-readable storage medium for transferring dirty data, which avoids the occupation of cache space, thereby avoiding the impact on server performance, and also ensures the disk storage of the dirty data to be transferred, facilitating it to become valid data.
[0045] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0046] Please refer to Figure 1 , Figure 1 It is a flowchart of a method for transferring dirty data provided by this application, which is applied to a processor in a server and includes:
[0047] S1: When it is detected that there is a failure in the current RAID group, determine the dirty data to be transferred corresponding to the current RAID group in the cache of the server;
[0048] Currently, when the server reads and writes data, in order to respond to user operations more quickly, the Write-back cache policy is usually used. Under this cache policy, read and write tasks will first fall into the cache. If the cache resources are sufficient, the dirty data generated by the read and write tasks will be temporarily stored in the cache, and the user will be immediately notified of successful read and write. When certain conditions are met (such as after a certain period of time or when the total amount of stored dirty data exceeds a threshold), the dirty data stored in the cache will be transferred to the RAID group. If the cache resources are insufficient, the dirty data will be directly transferred to the RAID group, and the user will be notified of successful read and write only after the transfer to the RAID group. Since the read and write speed of the cache itself is much faster than that of the RAID group, the use of the cache can respond to user read and write operations more quickly. It can be seen that the Write-back cache policy is equivalent to temporarily storing the dirty data in the cache after receiving the user instruction, notifying the user of successful read and write first, and then actually storing the dirty data on disk. In practical applications, the RAID group itself may fail, resulting in the dirty data stored in the cache not being able to be stored in the RAID group where it should be stored, but remaining in the cache. At this time, these dirty data can not only not be effectively used by the server, but also occupy the cache space, resulting in less cache resources available for other important data.
[0049] To solve the above technical problems, in this application, it is necessary to detect the status of each RAID group in real time. When it is detected that a certain RAID group fails, it means that the dirty data generated after this moment that should be stored in this RAID group cannot be stored in this RAID group. Specifically, due to the characteristics of the cache itself, it is known which RAID group each data in the cache needs to be stored in finally. Therefore, after detecting that a certain RAID group fails, it is possible to find out from the cache which dirty data belongs to the failed RAID group, and these dirty data are called dirty data to be transferred. For example, if there are a total of three RAID groups, A, B, and C, and each RAID group contains 9 hard disks respectively, and there are two dirty data stored in the cache, according to the characteristics of the cache itself, it can be determined that these two dirty data need to be stored in the 1st hard disk in the A-RAID group and the 3rd hard disk in the B-RAID group respectively. If the A-RAID group fails, it can be determined that the dirty data that needs to be stored in the 1st hard disk in the A-RAID group is the dirty data corresponding to the A-RAID group, and this dirty data is called dirty data to be transferred.
[0050] S2: Transfer the dirty data to be transferred to a preset RAID group, and delete the dirty data to be transferred in the cache.
[0051] After determining the dirty data to be transferred and stored, in order to prevent the dirty data from occupying the cache space, it is necessary to store the dirty data to be transferred and stored in a preset RAID group, and then delete the dirty data to be transferred and stored in the cache to release the cache resources. This is equivalent to storing the dirty data that should have been stored in the failed RAID group in another normal RAID group. Please refer to Figure 2 , Figure 2 , which is a schematic diagram of another method for transferring and storing dirty data provided by this application. The circles in the cache are dirty data, and the cylinders in the RAID group represent the hard disks in the RAID group. When the left RAID group fails and the dirty data that should be stored in the left RAID group in the cache cannot be stored in the left RAID group, it can be transferred and stored in the normal RAID group on the right at this time to release the cache space. For the preset RAID group, a RAID group can be specified in advance in each RAID group as the preset RAID group, which is specially used to store the dirty data that other RAID groups cannot store due to failures; it can also be that after detecting that a RAID group fails, a RAID group adjacent to the physical address of the failed RAID group is used as the preset RAID group. In addition to storing the dirty data that the preset RAID group itself should store, it also stores the dirty data that needs to be stored in the failed RAID group.
[0052] In summary, after detecting that the current RAID group has a failure, determine the dirty data to be transferred and stored corresponding to the current RAID group in the server's cache, and transfer the dirty data to be transferred and stored to the preset RAID group. When the current RAID group fails, by using other RAID groups to replace the current RAID group to store the dirty data that the current RAID group needs to store, the dirty data can be moved from the cache to the preset RAID group, avoiding the occupation of the cache space, thereby preventing the server performance from being affected, and also ensuring the disk storage of the dirty data to be transferred and stored, which is convenient for becoming valid data.
[0053] Based on the above embodiments:
[0054] As a preferred embodiment, determining the dirty data to be transferred and stored corresponding to the current RAID group in the server's cache includes: :
[0055] Determine the first metadata of the current RAID group;
[0056] Obtain the second metadata corresponding to each dirty data in the cache;
[0057] Among all the second metadata, all the dirty data corresponding to the second metadata that has a corresponding relationship with the first metadata are used as the dirty data to be transferred and stored.
[0058] To determine which dirty data in the cache corresponds to the current RAID group, in this application, it can be determined through metadata. Specifically, metadata is a type of data that describes the basic attributes of a device or data; for a RAID group, the metadata of the RAID group at least includes information such as physical address, read / write data record, power-on time, and hardware model; for dirty data, the metadata of the dirty data includes content such as a frame header, checksum, and instructions on which RAID group it needs to be stored in. It can be seen that metadata is a type of data that describes the basic attributes of data or a device, and is equivalent to an identity identifier. Based on this, after obtaining the metadata of the RAID group and the metadata of each dirty data in the cache, since the address of the RAID group is known, and it is also known which RAID group each dirty data needs to be stored in, among the various second metadata, if there is a correspondence between a second metadata and the first metadata, which is equivalent to the storage location of the dirty data pointing to the address of the failed RAID group, it indicates that the dirty data is the dirty data to be transferred. Based on this, it is possible to accurately determine which dirty data in the cache corresponds to the current RAID group according to the first metadata and the second metadata.
[0059] As a preferred embodiment, after transferring the dirty data to be transferred to a preset RAID group, it further includes:
[0060] Determine whether there is dirty data corresponding to the second metadata that has a correspondence with the first metadata in the cache;
[0061] If not, it is determined that the transfer of the dirty data to be transferred is completed;
[0062] If not, re-enter the step of transferring the dirty data to be transferred to a preset RAID group.
[0063] To ensure the normal transfer of dirty data to the preset RAID group, in this application, after a certain RAID group fails, although the dirty data that should be stored in the failed RAID group in the cache is transferred to the preset RAID group, the processor may still generate read and write content pointing to the failed RAID group, thus still generating dirty data that should be stored in the failed RAID group. In addition, during the transfer process, the transfer process is equivalent to copying the dirty data in the cache to the preset RAID group and then deleting the dirty data in the cache after the copy is completed. Both the copy and the deletion may fail due to external interference. For example, during the process of copying dirty data to the preset RAID group, the copy task may be interrupted due to interference, resulting in only a part of the dirty data being successfully copied to the preset RAID group. Similarly, the deletion task may also be interrupted due to interference. It can be seen that both of the above situations will result in the existence of dirty data corresponding to the failed RAID group in the cache after the dirty data is transferred to the preset RAID group. Therefore, after the dirty data to be transferred is transferred to the preset RAID group, it is necessary to determine whether there is still dirty data corresponding to the failed RAID group in the cache. If so, the transfer task needs to be executed again; otherwise, it means that all the dirty data corresponding to the failed RAID group has been normally transferred to the preset RAID group. Based on this, continuing to determine whether there is still dirty data corresponding to the failed RAID group in the cache after the dirty data to be transferred is transferred to the preset RAID group can ensure the normal transfer of dirty data to the preset RAID group.
[0064] As a preferred embodiment, before transferring the dirty data to be transferred to the preset RAID group, it further includes:
[0065] In each of the other RAID groups, designate a pre-specified RAID group as the preset RAID group;
[0066] Establish a mapping relationship between the current RAID group and the preset RAID group;
[0067] Transferring the dirty data to be transferred to the preset RAID group includes:
[0068] Transfer the dirty data to be transferred to the preset RAID group according to the mapping relationship.
[0069] In order to determine a preset RAID group, in this application, to ensure the functional integrity of the RAID group, among all the RAID groups, a RAID group can be specified to specifically store the dirty data that cannot be stored by all other RAID groups due to failures. That is, a RAID group is specified to specifically be used for transferring the dirty data of other RAID groups, and this RAID group is called the preset RAID group. When a RAID group fails, it is necessary to transfer the dirty data corresponding to the failed RAID group that exists in the cache to the preset RAID group. First, it is necessary to establish a mapping relationship between its current RAID group and the preset RAID group. Specifically, the metadata of the current RAID group and the preset RAID group can be obtained respectively, and the metadata of the two RAID groups are written into the mapping table to establish a mapping relationship between the two RAID groups. When transferring the dirty data, according to the mapping relationship of the metadata of the failed RAID group in the mapping table, another RAID group that is related to the failed RAID group can be determined, that is, the preset RAID group is determined, and the dirty data to be transferred is transferred to the preset RAID group according to the mapping table. Based on this, establishing the mapping relationship is equivalent to knowing which RAID group the dirty data of the failed RAID group needs to be stored in, and the preset RAID group can be determined.
[0070] As a preferred embodiment, establishing the mapping relationship between the current RAID group and the preset RAID group includes:
[0071] Determine the first physical address where the dirty data to be transferred needs to be stored in the current RAID group;
[0072] Determine the mapping relationship between the first physical address and the free second physical address in the preset RAID group;
[0073] Transferring the dirty data to be transferred to the preset RAID group according to the mapping relationship includes:
[0074] Transfer the dirty data to be transferred to the second physical address.
[0075] In order to accurately transfer the dirty data to be transferred, in this application, storing the dirty data into the RAID group actually means storing the dirty data into a certain data block on a certain hard disk in the RAID group. Since each data block has its own unique physical address, therefore, determining which RAID group the dirty data to be transferred should be stored in is equivalent to determining which physical address the dirty data to be transferred should be stored in. After knowing that the dirty data to be transferred should be stored in a certain physical address in the failed RAID group, it is necessary to transfer the dirty data to be transferred to another RAID group, which is equivalent to determining which physical address the dirty data to be transferred should be transferred to. Therefore, when establishing the mapping relationship, it is actually to establish the mapping relationship between two physical addresses. According to the mapping relationship of the physical addresses, the dirty data that should have been stored at the first physical address in the failed RAID group is transferred to the second physical address in the preset RAID group, so as to achieve the purpose of transferring the dirty data. Transferring the dirty data through the mapping relationship between the physical addresses can ensure that each transferred dirty data is stored in a different location, avoiding the situation where the dirty data is overwritten, and can accurately transfer the dirty data to be transferred.
[0076] As a preferred embodiment, before determining the dirty data to be transferred corresponding to the current RAID group in the cache of the server, it further includes:
[0077] Obtain the presence signal of the current RAID group;
[0078] Determine whether the presence signal of the current RAID group is a signal indicating normal presence;
[0079] If not, determine that the current RAID group is detected to have a fault.
[0080] To simply determine whether a RAID group has failed, in this application, it can be determined whether the RAID group has failed by detecting whether the RAID group is in a normal in-position state. Specifically, currently, a RAID group usually carries a self-check program to check and diagnose its own status in real time, and each hard disk in the RAID group usually also carries a corresponding self-check program to check its own situation in real time. To ensure data is not lost, when the RAID group detects that it has failed, it usually changes its in-position state to reject responding to the user's read and write instructions and to prompt that it has a failure, that is, after the RAID group fails, the state of the in-position signal will change accordingly. Based on this, it can be judged by detecting the in-position signal of the RAID group. If the in-position signal is a normal in-position signal, it means that the RAID group does not have a failure at this time. If not, whether the in-position signal at this time is a signal indicating a failure, a signal indicating a disconnection, or a signal indicating that there is no RAID group, etc., other signals indicating abnormal in-position, all indicate that the RAID group cannot store data normally at this time, and the dirty data cannot be normally stored in this RAID group. Therefore, when the in-position signal is not a normal in-position signal, it is determined that the current RAID group has a failure, so as to execute the subsequent step of transferring the dirty data. Based on this, by detecting the in-position signal, it is possible to simply determine whether the RAID group has failed.
[0081] As a preferred embodiment, after transferring the dirty data to be transferred to a preset RAID group, it further includes:
[0082] After detecting that the current RAID group has returned to normal, transfer the dirty data to be transferred stored in the preset RAID group to the current RAID group.
[0083] To ensure the response speed of the server, in this application, dirty data is continuously generated along with user operations. Under normal circumstances, the RAID group stores all the dirty data generated during all time periods. In subsequent other user operations, it may still be necessary to call the previously stored dirty data to execute operation tasks. If the RAID group returns to normal, the dirty data generated during the period when the RAID group malfunctioned is still stored in the preset RAID group. When it is necessary to call the dirty data stored in the current RAID group and the dirty data of the current RAID group stored in the preset RAID group, it is equivalent to the participation of two RAID groups. Although the dirty data can be called normally, the participation of multiple RAID groups requires cross-group communication, resulting in a greater response delay compared to the participation of a single RAID group. Therefore, after the current RAID group returns to normal, the dirty data of the current RAID group stored in the preset RAID group is transferred back to the current RAID group. Specifically, to detect whether the current RAID group has returned to normal, it can be determined by the in-position signal. If the in-position signal is a signal indicating normal in-position, it means that the current RAID group has returned to normal. It can also be determined based on the fault repair instruction sent by the user. Transferring the dirty data to be transferred stored in the preset RAID group to the current RAID group is equivalent to first copying the dirty data to be transferred and then pasting it into the current RAID group. After the pasting is completed, the dirty data to be transferred in the preset RAID group is cleared. This process can also be carried out according to the mapping relationship between physical addresses. Since there is a mapping relationship between the first physical address of the current RAID group and the second physical address of the preset RAID group, when transferring the dirty data to be transferred back to the current RAID group, the dirty data to be transferred in the second physical address is transferred back to the first physical address in the current RAID group according to the mapping relationship. Based on this, after detecting that the current RAID group has returned to normal, transferring the dirty data to be transferred stored in the preset RAID group back to the current RAID group can ensure the response speed of the server.
[0084] As a preferred embodiment, before transferring the dirty data to be transferred stored in the preset RAID group to the current RAID group, it further includes:
[0085] Judging whether the current RAID group has returned to normal within a preset time period;
[0086] If so, enter the step of transferring the dirty data to be transferred stored in the preset RAID group to the current RAID group;
[0087] If not, delete the dirty data to be transferred stored in the preset RAID group.
[0088] To save storage resources, in this application, after a current RAID group fails, the dirty data to be transferred and stored in the current RAID group needs to be transferred to a preset RAID group. Although the storage space of the preset RAID group is relatively large compared to the cache, its storage space is still limited, and it needs to be responsible for storing the dirty data to be transferred and stored in multiple RAID groups. Therefore, the preset RAID group cannot store the dirty data to be transferred and stored without limit. Based on this, after the current RAID group fails, in addition to transferring the dirty data to be transferred and stored in the current RAID group to the preset RAID group, it is also necessary to record the duration of the failure of the current RAID group at the same time. When the current RAID group fails, the timing starts, and it is determined in real time whether the duration of the failure of the current RAID group has passed a preset duration, that is, it is determined whether the current RAID group returns to normal within the preset duration. This preset duration can be defined based on the time when the RAID group returned to normal after previous failures; if the current RAID group still does not return to normal after a period of time, it may indicate that the current RAID group has suffered a serious failure, such as physical structure damage or irreversible defects. When this situation occurs, it usually means that the possibility of the RAID group being able to continue to be used in the future is relatively low. Therefore, when it is determined that the current RAID group does not return to normal within the preset duration, it can be determined that the current RAID group is completely damaged, and the dirty data stored in the preset RAID group also becomes invalid data. At this time, the dirty data of the current RAID group stored in the preset RAID group can be flashed to release the storage space of the preset RAID group, achieving the purpose of saving storage resources without affecting the operation of the server.
[0089] Please refer to Figure 3 , Figure 3 which is a schematic structural diagram of a device for transferring and storing dirty data provided by this application, including:
[0090] A memory 21 for storing a computer program;
[0091] A processor 22 for implementing the steps of the method for transferring and storing dirty data as described above when executing the computer program.
[0092] For a detailed introduction to a device for transferring and storing dirty data provided by this application, please refer to the embodiments of the method for transferring and storing dirty data described above. This application will not elaborate here.
[0093] The present application provides a device for transferring dirty data, which relates to the field of data management and is applied to a processor in a server. After detecting a failure in the current RAID group, the device determines the dirty data to be transferred corresponding to the current RAID group in the server cache and transfers the dirty data to be transferred to a preset RAID group. When the current RAID group fails, by using other RAID groups to replace the current RAID group to store the dirty data that the current RAID group needs to store, the dirty data can be moved from the cache to the preset RAID group, avoiding the occupation of the cache space, thereby avoiding the impact on the server performance, and ensuring the disk storage of the dirty data to be transferred, which is convenient for becoming valid data.
[0094] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for transferring dirty data as described above are implemented.
[0095] For a detailed introduction to a computer-readable storage medium provided by the present application, please refer to the embodiments of the method for transferring dirty data as described above, and the present application will not elaborate herein.
[0096] The present application provides a computer-readable storage medium, which relates to the field of data management and is applied to a processor in a server. After detecting a failure in the current RAID group, the device determines the dirty data to be transferred corresponding to the current RAID group in the server cache and transfers the dirty data to be transferred to a preset RAID group. When the current RAID group fails, by using other RAID groups to replace the current RAID group to store the dirty data that the current RAID group needs to store, the dirty data can be moved from the cache to the preset RAID group, avoiding the occupation of the cache space, thereby avoiding the impact on the server performance, and ensuring the disk storage of the dirty data to be transferred, which is convenient for becoming valid data.
[0097] In this specification, the various embodiments are described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. The same or similar parts among the various embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method part.
[0098] It should also be noted that in this specification, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the phrase "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.
[0099] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
Claims
1. A method for transferring and storing dirty data, characterized in that A processor applied to a server, including: During the process of the server executing the Write-back cache policy, when it is detected that a current RAID group has a fault, determine the dirty data to be transferred and stored corresponding to the current RAID group in the cache of the server; Transfer the dirty data to be transferred and stored to a preset RAID group, and delete the dirty data to be transferred and stored in the cache; Among them, determining the dirty data to be transferred and stored corresponding to the current RAID group in the cache of the server includes: Determine the first metadata of the current RAID group; Obtain the second metadata corresponding to each dirty data in the cache; Among all the second metadata, regard all the dirty data corresponding to the second metadata that has a corresponding relationship with the first metadata as the dirty data to be transferred and stored; After transferring the dirty data to be transferred and stored to the preset RAID group, determine whether there is dirty data corresponding to the second metadata that has a corresponding relationship with the first metadata in the cache; If not, it is determined that the transfer of the dirty data to be transferred and stored is completed; If not, re-enter the step of transferring the dirty data to be transferred and stored to the preset RAID group.
2. The method for dumping dirty data according to claim 1, characterized in that, Before transferring the dirty data to be transferred and stored to the preset RAID group, it further includes: Among other RAID groups, regard the preset RAID group as the specified RAID group; Establish a mapping relationship between the current RAID group and the preset RAID group; Transferring the dirty data to be transferred and stored to the preset RAID group includes: Transfer the dirty data to be transferred and stored to the preset RAID group according to the mapping relationship.
3. The method for transferring and storing dirty data according to claim 2, characterized in that, Establishing a mapping relationship between the current RAID group and the preset RAID group includes: Determine the first physical address where the dirty data to be transferred and stored needs to be stored in the current RAID group; Determine the mapping relationship between the first physical address and the free second physical address in the preset RAID group; Transferring the dirty data to be transferred and stored to the preset RAID group according to the mapping relationship includes: Transfer the dirty data to be transferred and stored to the second physical address.
4. The method for dumping dirty data according to claim 1, wherein Before determining the dirty data to be transferred and stored corresponding to the current RAID group in the cache of the server, it further includes: Obtain the presence signal of the current RAID group; Determine whether the presence signal of the current RAID group is a signal indicating normal presence; If not, it is determined that a fault in the current RAID group is detected.
5. The method for dumping dirty data according to any one of claims 1 to 4, characterized in that After transferring the dirty data to be transferred and stored to the preset RAID group, it further includes: When it is detected that the current RAID group returns to normal, transfer the dirty data to be transferred and stored stored in the preset RAID group to the current RAID group.
6. The method for transferring and storing dirty data according to claim 5, wherein, Before transferring the dirty data to be transferred and stored stored in the preset RAID group to the current RAID group, it further includes: Determine whether the current RAID group returns to normal within a preset time period; If so, enter the step of transferring the dirty data to be transferred and stored stored in the preset RAID group to the current RAID group; If not, delete the to-be-transferred dirty data stored in the preset RAID group.
7. A device for transferring and storing dirty data, characterized in that, Including: A memory for storing a computer program; A processor for implementing the steps of the method for transferring dirty data according to any one of claims 1 to 6 when executing the computer program.
8. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for transferring dirty data according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Cache system based on nonvolatile memory and software RAID
CN106528001A
Cache data processing method, device and equipment and readable storage medium
CN109491609A
Method and device for I / O control, and computer readable medium
CN111124251A
Data recovery method and related equipment
CN111240903A