Fault handling method, device and distributed storage system

By using the management server to perform small-grained data recovery in the distributed storage system, the problem of low data recovery efficiency when the storage disk fails is solved, and efficient data recovery and cost savings are achieved.

CN113485872BActive Publication Date: 2024-10-01BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110796910.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-14
Publication Date
2024-10-01
Estimated Expiration
2041-07-14

AI Technical Summary

Technical Problem

In a distributed storage system, when a storage disk fails, the faulty storage disk is directly removed, resulting in low data recovery efficiency and a large amount of data that needs to be restored, affecting system performance and cost.

Method used

By introducing a management server into the distributed storage system, small-grained data recovery can be performed separately for failures in reading and writing file data and file system metadata, reducing the amount of recovered data and extending the storage disk time without stopping the operation of the storage disk. length of use.

Benefits of technology

It improves the efficiency of data recovery, reduces the amount of recovered data, extends the running time of the storage disk, saves costs, and ensures the stability of the distributed storage system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113485872B_ABST
    Figure CN113485872B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a fault handling method, device and distributed storage system, which are applied to the field of data storage technology. The method is applied to a storage node in a distributed storage system, in which a storage disk is deployed, and the distributed storage system also includes a management server, and the method includes: receiving an operation request for data stored in the storage disk; when responding to the operation request fails, determining the operation type of the operation request; if the operation type is a type of reading and writing file data, determining the file data targeted by the operation request as invalid data, and using the management server to recover the invalid data; if the operation type is a type of reading and writing file system metadata, using the management server to recover the file data stored in the storage disk. Through this solution, the efficiency of data recovery can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data storage, and in particular to a fault handling method, device and distributed storage system. Background Art

[0002] When a common distributed storage system encounters a storage disk failure such as a read or write failure, most of the time the faulty storage disk is directly removed, and then the file data in the faulty storage disk is restored in other storage disks in the distributed storage system based on the pre-backed-up file data.

[0003] With the increase in storage capacity of storage disks, directly choosing to remove the failed storage disk when a storage disk fails will result in a large amount of file data to be restored each time, resulting in low efficiency of each restoration. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a fault handling method, device and distributed storage system to improve the efficiency of data recovery. The specific technical solution is as follows:

[0005] In a first aspect, an embodiment of the present invention provides a fault handling method, which is applied to a storage node in a distributed storage system, wherein a storage disk is deployed in the storage node, and the distributed storage system further includes a management server, wherein the method includes:

[0006] receiving an operation request for data stored in the storage disk;

[0007] When responding to the operation request fails, determining an operation type of the operation request;

[0008] If the operation type is a type of reading and writing file data, determining the file data targeted by the operation request as invalid data, and using the management server to restore the invalid data;

[0009] If the operation type is a type of reading and writing file system metadata, the management server is used to restore the file data stored in the storage disk.

[0010] Optionally, after determining the file data targeted by the operation request as invalid data, the method further includes:

[0011] Moving the invalid data to a preset storage location in the storage disk;

[0012] Based on the failure data in the preset storage location, determining whether the storage disk meets a preset storage disk failure condition;

[0013] If the conditions are met, the management server is used to restore the file data stored in the storage disk.

[0014] Optionally, the using the management server to recover the file data stored in the storage disk includes:

[0015] A fault flag is set for the storage disk; wherein the fault flag is used to recover the file data stored in the storage disk after being detected by the management server.

[0016] Optionally, judging whether the storage disk meets a preset storage disk failure condition based on the failure data in the preset storage location includes:

[0017] If the failed data in the preset storage location meets any of the following conditions, it is determined that the storage disk meets the preset storage disk failure condition:

[0018] The storage capacity occupied by the failed data in the preset storage location is greater than a preset capacity threshold;

[0019] The amount of failed data in the preset storage location is greater than a preset amount threshold.

[0020] Optionally, the preset storage location is: a preset storage directory under the file system in the storage disk.

[0021] Optionally, the determining the file data targeted by the operation request as invalid data includes:

[0022] Determining the file data to be operated by the operation request as pre-selected data;

[0023] Determine the file data in the storage disk that belongs to the same logical unit as the pre-selected data, and use the pre-selected data and the determined file data as invalid data.

[0024] Optionally, the recovering the invalid data by using the management server includes:

[0025] A recovery notification for the invalid data is sent to the management server, so that the management server deletes the metadata of the invalid data and recovers the invalid data.

[0026] In a second aspect, an embodiment of the present invention provides a distributed storage system, the distributed storage system comprising: a storage node and a management server, wherein a storage disk is deployed in the storage node;

[0027] The storage node is used to receive an operation request for data stored in the storage disk; when responding to the operation request fails, determine the operation type of the operation request; if the operation type is a type of reading and writing file data, determine the file data targeted by the operation request as invalid data;

[0028] The management server is used to recover the failed data after the storage node determines the failed data; or, when the operation type is a type of reading and writing file system metadata, recover the file data stored in the storage disk.

[0029] Optionally, the storage node is further configured to, after determining that the file data targeted by the operation request is invalid data, move the invalid data to a preset storage location in the storage disk; and determine whether the storage disk meets a preset storage disk failure condition based on the invalid data in the preset storage location;

[0030] The management server is used to recover the file data stored in the storage disk when the storage disk meets the storage disk failure condition.

[0031] Optionally, the storage node is specifically configured to set a fault flag for the storage disk when the operation type is a type of reading and writing file system metadata, or when the storage disk meets the storage disk fault condition;

[0032] The management server is specifically configured to restore the file data stored in the storage disk when it is detected that the storage disk is provided with the fault identifier.

[0033] In a third aspect, an embodiment of the present invention provides a fault handling device, which is applied to a storage node in a distributed storage system, wherein a storage disk is deployed in the storage node, and the distributed storage system further includes a management server, wherein the device includes:

[0034] A request receiving module, used for receiving an operation request for data stored in the storage disk;

[0035] A type determination module, configured to determine the operation type of the operation request when responding to the operation request fails;

[0036] A first data recovery module, configured to, if the operation type is a type of reading and writing file data, determine the file data targeted by the operation request as invalid data, and use the management server to recover the invalid data;

[0037] The second data recovery module is used to use the management server to recover the file data stored in the storage disk if the operation type is the type of reading and writing file system metadata.

[0038] In a fourth aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus;

[0039] Memory, used to store computer programs;

[0040] The processor is used to implement any method step described in the first aspect when executing a program stored in the memory.

[0041] In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any method step described in the first aspect is implemented.

[0042] Beneficial effects of the embodiments of the present invention:

[0043] In the fault handling method, device and distributed storage system provided by the embodiment of the present invention, after the storage node in the distributed storage system fails to respond to the received operation request, if the operation type of the operation request is the type of reading and writing file data, the file data targeted by the operation request is determined as invalid data, and the invalid data is recovered using the management server, and if the operation type is the type of reading and writing file system metadata, the file data stored in the storage disk is recovered using the management server. Because when the operation type of the operation request is the type of reading and writing file data, the storage node only uses the management server to recover the invalid data targeted by the operation request, and does not need to recover the data in the storage disk other than the invalid data, thereby reducing the amount of data that needs to be recovered. It can be seen that the scheme provided by the present invention can improve the efficiency of data recovery.

[0044] On the other hand, since the storage node fails to respond to the operation request, and when the operation type is the type of reading and writing file data, only the management server is used to recover the failed data, and small-grained data recovery can be achieved without the help of external tools. At the same time, the solution of the present invention does not need to stop the operation of the storage disk before the management server is used to recover the file data stored in the storage disk. Compared with the existing method of directly selecting and removing the failed storage disk, the operation time of the storage disk is extended and the cost is saved.

[0045] Of course, it is not necessary to achieve all of the advantages described above at the same time to implement any product or method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0047] Figure 1 A flowchart of a fault handling method provided by an embodiment of the present invention from the perspective of a storage node in a distributed storage system;

[0048] Figure 2 Another flow chart of a fault handling method provided by an embodiment of the present invention from the perspective of a storage node in a distributed storage system;

[0049] Figure 3 A schematic diagram of the structure of a distributed storage system provided by an embodiment of the present invention;

[0050] Figure 4 A schematic diagram of the structure of a fault handling device provided by an embodiment of the present invention from the perspective of a storage node in a distributed storage system;

[0051] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field based on the present invention belong to the scope of protection of the present invention.

[0053] In order to more clearly illustrate the technical solution of the embodiment of the present invention, the distributed storage system provided by the embodiment of the present invention is first briefly introduced.

[0054] The distributed storage system includes a management server and multiple storage nodes, and at least one storage disk is deployed in each storage node. The management server contains metadata of file data in the storage disks deployed in each storage node, and the metadata includes information such as location information indicating the storage disk where the file data is located. The storage node is used to manage the read and write data of the deployed storage disks. When the distributed storage system receives an operation request for file data, the management server first determines the storage disk of the storage node where the file data to be operated on by the operation request is located, and then forwards the operation request to the storage node, and then the storage node executes the operation request, such as reading the file data to be operated from the storage disk.

[0055] It should be noted that the above-mentioned operation requests can be divided into two categories according to their types, including the types of reading and writing file data and the types of reading and writing file system metadata. Among them, the above-mentioned operation requests of the types of reading and writing file data can include read (read), write (write), fsync (synchronization) and other requests, wherein the file data can be data stored in the form of files, objects or data blocks. And the above-mentioned operation requests of the types of reading and writing file system metadata can include statfs (get file system information), stat (statistics), create (create) and other requests. The above-mentioned file system metadata is metadata generated by the file system based on the file data stored in the storage disk, for example: the storage location of the file data, access rights, etc. It should be noted that the file system metadata can be data stored in the form of super blocks, inodes (index nodes), etc. in the storage disk. When the file data in the storage disk is changed, the file system can adaptively change the corresponding file system metadata.

[0056] In a distributed storage system, in order to ensure the security of file data, each file data will have corresponding backup file data. For example, when a distributed storage system stores file data 1, it can store file data 11 in storage disk 1, file data 12 in storage disk 2, and file data 13 in storage disk 3. Among them, the data content of file data 11, file data 12 and file data 13 is exactly the same as file data 1. File data 11, file data 12 and file data 13 are backup data for each other. It should be noted that the data content of the file data in the distributed storage system may also be different from the data content of each backup file data of the file data. It is only necessary to ensure that the data content of the file data can be obtained from all backup file data of the file data.

[0057] In the process of processing operation requests in a distributed storage system, various reasons, such as file data corruption, often cause storage nodes to make errors when responding to processing requests. In the related art, when encountering a storage disk failure such as a read or write failure, most people choose to directly remove the failed storage disk, and then restore the file data in the failed storage disk in other storage disks in the distributed storage system based on the pre-backed-up file data. Specifically, when a storage disk fails, the management server needs to delete the metadata of the file data stored in the failed storage disk, and in another new storage disk, based on the backup file data of the file data stored in the failed storage disk, regenerate the file data with the same data content as the file data stored in the storage disk that needs to be removed. For example, if the storage disk where file data 11 is located is a failed storage disk, then the management server will notify a storage node to generate new backup file data based on file data 12 or 13, that is, restore file data 11.

[0058] However, with the increase in storage capacity of storage disks, directly choosing to remove the failed storage disk when a storage disk fails will result in a large amount of file data to be restored each time, resulting in low efficiency of each restoration.

[0059] In order to solve the technical problems existing in the related art, an embodiment of the present invention provides a fault handling method, which is applied to a storage node in a distributed storage system, wherein a storage disk is deployed in the storage node, and the distributed storage system further includes a management server. The method may include:

[0060] Receiving an operation request for data stored in a storage disk;

[0061] When responding to the operation request fails, determining an operation type of the operation request;

[0062] If the operation type is a type of reading and writing file data, the file data targeted by the operation request is determined as invalid data, and the invalid data is restored using the management server;

[0063] If the operation type is a type of reading and writing file system metadata, the management server is used to restore the file data stored in the storage disk.

[0064] In the fault handling method provided by the embodiment of the present invention, when the operation type of the operation request is the type of reading and writing file data, the storage node only uses the management server to recover the invalid data targeted by the operation request, and does not need to recover the data other than the invalid data in the storage disk, thereby reducing the amount of data that needs to be recovered. It can be seen that the efficiency of data recovery can be improved through the embodiment of the present invention.

[0065] On the other hand, since the storage node fails to respond to the operation request, and when the operation type is the type of reading and writing file data, only the management server is used to recover the failed data, and small-grained data recovery can be achieved without the help of external tools. At the same time, the solution of the present invention does not need to stop the operation of the storage disk before the management server is used to recover the file data stored in the storage disk. Compared with the existing method of directly selecting and removing the failed storage disk, the operation time of the storage disk is extended and the cost is saved.

[0066] It should be noted that the fault handling method provided in the embodiment of the present invention is applied to a storage node in a distributed storage system. The storage node can be any computing device with data processing capabilities. In addition, the fault handling method provided in the embodiment of the present invention can be implemented by software, hardware, or a combination of software and hardware. For example, it can be implemented by a storage service program in a storage node.

[0067] The following describes a fault handling method, a fault handling device, and a distributed storage system provided by embodiments of the present invention in conjunction with the accompanying drawings.

[0068] like Figure 1 As shown, a fault handling method provided by an embodiment of the present invention is applied to a storage node in a distributed storage system, where a storage disk is deployed in the storage node, and the distributed storage system further includes a management server, including steps S101-S104:

[0069] S101: receiving an operation request for storing data in a storage disk.

[0070] Among them, it can be seen from the above content that the operation request for storing data in the storage disk can be an operation request of the type of reading and writing file data, such as read, write, fsync, etc., or an operation request of the type of reading and writing file system metadata, such as statfs, stat, create, etc.

[0071] In a distributed storage system, the operation request received by the storage node may be forwarded by the management server. When the business party needs to obtain data in the distributed storage system, it can send an operation request for the stored data to the management server in the distributed storage system. After receiving the operation request, the management server determines the storage node that stores the file data to be operated by the operation request, and then forwards the operation request to the determined storage node.

[0072] S102: When responding to the operation request fails, determining the operation type of the operation request.

[0073] Among them, after the storage node receives the operation request, if the storage disk is normal, the storage node can obtain the data to be operated from the storage disk based on the operation request, so as to respond to the operation request. However, when the storage disk fails, when the storage node reads the data to be operated from the storage disk, when the return value received from the storage disk is IO Error (input output error), it means that the storage node cannot obtain the data to be operated, and at this time, it will be unable to complete the response to the operation request, that is, the response to the operation request fails.

[0074] It can be seen from the above process that when the response to the operation request fails, it indicates that the storage disk has a fault. In the embodiment of the present invention, when the storage disk fails, it is necessary to determine the impact of the fault on the storage disk. If the error on the storage disk is an error in the file system metadata in the storage disk, since the error in the file system metadata can easily lead to storage confusion on the storage disk and abnormal access to large pieces of data, the impact of this type of fault is relatively large. If the error on the storage disk is an error in the file data in the storage disk, since the error in the file data only affects the storage disk itself, the impact of this type of fault is relatively small.

[0075] According to the embodiment of the present invention, for a storage disk with a serious fault, the storage disk needs to be removed to ensure the stability of the distributed storage system. For a storage disk with a minor fault, only the file data with the fault needs to be processed in order to avoid restoring all the file data in the storage disk.

[0076] When the response to the operation request fails, in order to determine the impact of the failure of the storage disk, the operation type of the operation request can be determined. Optionally, since the functions called by operation requests of different operation types are different, the operation type of the operation request can be determined by the function called by the operation request. As can be seen from the foregoing content, the operation type of the operation request includes the type of reading and writing file data and the type of reading and writing file system metadata.

[0077] Optionally, when it is determined that the operation type of the operation request is a type of reading and writing file data, step S103 is executed. When it is determined that the operation type of the operation request is a type of reading and writing file system metadata, step S104 is executed.

[0078] S103: Determine the file data targeted by the operation request as invalid data, and use the management server to restore the invalid data.

[0079] Since the operation type of the operation request is the type of reading and writing file data, it means that when the storage node fails to respond, the file data with less impact in the storage disk that causes the storage disk failure. At this time, in order to avoid restoring all file data in the storage disk, the file data targeted by the operation request can be determined as failed data.

[0080] According to different scenarios and requirements, there are many ways to determine the file data targeted by the operation request. For example, the file data to be operated by the operation request can be directly used as the file data targeted by the operation request. Of course, the file data targeted by the operation request can also be determined by other methods, which will be described in the embodiments of the present invention later and will not be repeated here.

[0081] After the invalid data is determined, the invalid data will no longer be accessed. Although the invalid data is still stored in the storage disk, the metadata of the invalid data will no longer be recorded in the management server. This means that when the distributed storage system receives the same operation request later, it will no longer access the storage disk storing the invalid data.

[0082] In one implementation, after the invalid data is determined, the above-mentioned use of the management server to recover the invalid data may include:

[0083] A recovery notification for the invalid data is sent to the management server, so that the management server deletes the metadata of the invalid data and recovers the invalid data.

[0084] As can be seen from the above content, the management server stores metadata of each file data, and the metadata can indicate the storage location of the file data. Therefore, after the invalid data is determined, the metadata of the invalid data in the management server needs to be deleted. Therefore, when the storage node determines the invalid data, it can first send a recovery notification for the invalid data to the management server. After receiving the recovery notification, the management server will delete the metadata of the invalid data from the metadata of each file data, and then recover the invalid data, that is, first determine the backup file data of the invalid data, and then generate file data with the same data content as the invalid data in another storage disk based on the backup file data, thereby completing the recovery of the invalid data.

[0085] S104: Using the management server, recover the file data stored in the storage disk.

[0086] Since the operation type of the operation request is the type of reading and writing file system metadata, it means that when the storage node fails to respond, the storage disk failure is caused by the file data with a greater impact in the storage disk. At this time, in order to ensure the stability of the distributed storage system, the failed storage disk needs to be removed. Therefore, it is necessary to use the management server to recover the file data stored in the storage disk. This step is the same as the process of removing the storage disk and recovering data in the related art, and will not be repeated here.

[0087] In the fault handling method provided by the embodiment of the present invention, when the operation type of the operation request is the type of reading and writing file data, the storage node only uses the management server to recover the invalid data targeted by the operation request, and does not need to recover the data other than the invalid data in the storage disk, thereby reducing the amount of data that needs to be recovered. It can be seen that the efficiency of data recovery can be improved through the embodiment of the present invention.

[0088] On the other hand, since the storage node fails to respond to the operation request, and when the operation type is the type of reading and writing file data, only the management server is used to recover the failed data, and small-grained data recovery can be achieved without the help of external tools. At the same time, the solution of the present invention does not need to stop the operation of the storage disk before the management server is used to recover the file data stored in the storage disk. Compared with the existing method of directly selecting and removing the failed storage disk, the operation time of the storage disk is extended and the cost is saved.

[0089] based on Figure 1 The embodiment shown, as Figure 2As shown, another embodiment of the present invention further provides a fault handling method, which, after step S103, further includes steps S105-S107:

[0090] S105: Move the invalid data to a preset storage location in the storage disk.

[0091] After determining the failed data, the failed data may also be moved to a preset storage location in the storage disk. The preset storage location may be set according to demand and experience, for example, the preset storage location may be a specified sector. In one implementation, since the storage disk has a file system, the preset storage location may be a preset storage directory under the file system in the storage disk, for example, X:\badblocks. At this point, after determining the failed data, the failed data may be moved to the preset storage directory.

[0092] S106: Based on the failure data in the preset storage location, determine whether the storage disk meets the preset storage disk failure condition.

[0093] When there is a lot of failed data stored in the storage disk, it means that the storage disk is no longer suitable for continued use and needs to be replaced with a new storage disk. Therefore, a storage disk failure condition related to the failed data in the preset storage position can be preset to determine whether the storage disk is faulty.

[0094] Optionally, in one implementation, if the failed data in the preset storage location meets any of the following conditions, it is determined that the storage disk meets the preset storage disk failure condition:

[0095] Condition 1: The storage capacity occupied by the failed data in the preset storage location is greater than the preset capacity threshold.

[0096] The preset capacity threshold may be determined according to actual scenarios and experience. The larger the storage capacity of the storage disk, the larger the preset capacity threshold. Conversely, the smaller the storage capacity of the storage disk, the smaller the preset capacity threshold.

[0097] The storage node may monitor the storage capacity occupied by the failed data in the preset storage location in real time, or may obtain the storage capacity occupied by the failed data in the preset storage location after each movement of the failed data to the preset storage location. Both are possible.

[0098] After determining the storage capacity occupied by the failed data in the preset storage location, the determined storage capacity can be compared with the preset capacity threshold to determine whether the determined storage capacity is greater than the preset capacity threshold. When the determined storage capacity is greater than the preset capacity threshold, condition 1 is satisfied.

[0099] Condition 2: The amount of invalid data in the preset storage location is greater than a preset amount threshold.

[0100] Similar to the preset storage capacity, the preset number threshold can also be determined based on actual scenarios and experience. The larger the storage capacity of the storage disk, the larger the preset number threshold. Conversely, the smaller the storage capacity of the storage disk, the smaller the preset number threshold.

[0101] The storage node may monitor the amount of invalid data in the preset storage location in real time, or may update the amount of invalid data in the preset storage location according to the amount of moved file data each time the invalid data is moved to the preset storage location. Both are possible.

[0102] After determining the amount of invalid data in the preset storage location, the determined amount can be compared with the preset amount threshold to determine whether the determined amount is greater than the preset amount threshold. When the determined amount is greater than the preset amount threshold, condition 2 is satisfied.

[0103] If the storage disk meets the preset storage disk failure condition, step S107 is executed; if the storage disk meets the non-preset storage disk failure condition, the process ends.

[0104] S107: Using the management server, recover the file data stored in the storage disk.

[0105] When the storage disk meets the storage disk failure condition, it means that the storage disk needs to be removed, so the management server needs to be used to restore the file data stored in the storage disk. The specific implementation method is the same or similar to step S104, and will not be repeated here.

[0106] The fault handling method provided in the embodiment of the present invention can improve the efficiency of data recovery and achieve small-granularity data recovery without the aid of external tools. At the same time, it extends the operating time of the storage disk, saves costs and ensures the normal operation of the distributed storage system.

[0107] Furthermore, the failed data can be moved to a preset storage location, and then when the storage disk is judged to meet the storage disk failure condition based on the failed data in the preset storage location, the management server can be used to restore the file data stored in the storage disk, thereby avoiding excessive failed data in the storage disk, thereby improving the operating efficiency of the storage node.

[0108] Optionally, in a fault handling method provided in another embodiment of the present invention, the above-mentioned use of the management server to recover the file data stored in the storage disk may include:

[0109] Set a fault flag for the storage disk.

[0110] The fault identifier may be a pre-agreed identifier, which is not specifically limited in the embodiment of the present invention.

[0111] In one implementation, the above fault identifier is used to recover the file data stored in the storage disk after being detected by the management server. That is, the management server can detect the storage disk in each storage node according to a preset detection method, and when the management server detects a storage disk with a fault identifier, the management server can recover the file data stored in the storage disk.

[0112] In one implementation, the above fault identification is only used to indicate that the storage disk has a read / write fault. In order to reduce the number of times each storage node replaces the storage disk, the storage node can perform the detection. At this time, the management node can perform the following steps:

[0113] When the identification detection condition is met, it is detected whether the storage disk is set with a fault identification; if it is detected that the storage disk is set with a fault identification, the management server is used to restore the file data stored in the storage disk.

[0114] The identification detection condition may be receiving an agreed detection instruction, or entering each detection cycle (i.e., periodic detection). Optionally, after detecting the existence of a storage disk with a specified mark, the administrator may be notified to remove the storage disk.

[0115] It should be noted that when the fault identifier is only used to indicate that a read or write fault exists on the storage disk, the detection process can also be performed by the management server. At this time, the management server executes the same process as the aforementioned fault identifier for recovering the file data stored on the storage disk after being detected by the management server, which will not be repeated here.

[0116] The fault handling method provided in the embodiment of the present invention can improve the efficiency of data recovery and achieve small-granularity data recovery without the aid of external tools. At the same time, it extends the operating time of the storage disk, saves costs and ensures the normal operation of the distributed storage system.

[0117] Furthermore, by setting a fault identifier for the storage disk, it is possible to clearly identify which storage disks are operable storage disks and which storage disks need to be removed, thereby ensuring the normal operation of the storage node.

[0118] Optionally, in a fault handling method provided in another embodiment of the present invention, the above-mentioned determination of the file data targeted by the operation request as invalid data may include steps 1 and 2:

[0119] Step 1: Determine the file data to be operated by the operation request as pre-selected data.

[0120] In this step, the file data indicated by the relevant information, that is, the file data to be operated by the operation request, can be determined based on the relevant information carried in the operation request. The relevant information may be data identification information or the like.

[0121] Step 2: Determine the file data in the storage disk that belongs to the same logical unit as the pre-selected data, and use the pre-selected data and the determined file data as invalid data.

[0122] It should be noted that in this distributed storage system, the file data of the same logical unit is often stored in the same storage disk. The logical unit is a single file for the business party. For example, when the business party stores a movie in the distributed storage system, the movie is a logical unit, but in the distributed storage system, the movie will be divided into 4 file data, and the 4 file data are the file data belonging to the same logical unit.

[0123] Since the file data of the same logical unit are often stored in the same storage disk, when an erroneous file data appears in multiple copies of the file data of the same logical unit, according to the above scheme, it is necessary to restore the erroneous file data in other storage disks. If the other file data of the logical unit are not processed at this time, the file data of the same logical unit will be scattered in different storage disks, which is not conducive to the reading of file data. Therefore, in order to avoid the above problem, after determining the pre-selected data, the file data belonging to the same logical unit as the pre-selected data can be used together with the expected data as invalid data. Therefore, multiple copies of the file data of the same logical unit can be restored in other storage disks to avoid the file data of the same logical unit being scattered in different storage disks.

[0124] The fault handling method provided in the embodiment of the present invention can improve the efficiency of data recovery and achieve small-granularity data recovery without the aid of external tools. At the same time, it extends the operating time of the storage disk, saves costs and ensures the normal operation of the distributed storage system.

[0125] Furthermore, it can prevent the file data of the same logical unit from being dispersed in different storage disks, thereby improving the reading efficiency of the file data.

[0126] According to the fault handling method provided in the embodiment of the present invention, Figure 3 As shown, an embodiment of the present invention further provides a distributed storage system, the distributed storage system comprising: a storage node 301 and a management server 302, a storage disk is deployed in the storage node 301;

[0127] The storage node 301 is used to receive an operation request for data stored in a storage disk; when responding to the operation request fails, determine the operation type of the operation request; if the operation type is a type of reading or writing file data, determine the file data targeted by the operation request as invalid data;

[0128] The management server 302 is used to recover the failed data after the storage node determines the failed data; or, when the operation type is the type of reading and writing file system metadata, recover the file data stored in the storage disk.

[0129] Optionally, the storage node is further configured to, after determining that the file data targeted by the operation request is invalid data, move the invalid data to a preset storage location in the storage disk; and determine whether the storage disk meets a preset storage disk failure condition based on the invalid data in the preset storage location;

[0130] The management server is used to recover the file data stored in the storage disk when the storage disk meets the storage disk failure condition.

[0131] Optionally, a storage node is specifically used to set a fault flag for the storage disk when the operation type is a type of reading and writing file system metadata, or the storage disk meets a storage disk fault condition;

[0132] The management server is specifically used to restore the file data stored in the storage disk when it is detected that the storage disk is set with a fault mark.

[0133] Optionally, judging whether the storage disk meets a preset storage disk failure condition based on the failure data in the preset storage location includes:

[0134] If the failed data in the preset storage location meets any of the following conditions, it is determined that the storage disk meets the preset storage disk failure condition:

[0135] The storage capacity occupied by the failed data in the preset storage location is greater than the preset capacity threshold;

[0136] The amount of failed data in the preset storage location is greater than a preset amount threshold.

[0137] Optionally, the preset storage location is: a preset storage directory under the file system in the storage disk.

[0138] Optionally, the storage node is specifically used to determine the file data to be operated by the operation request as pre-selected data; determine the file data in the storage disk that belongs to the same logical unit as the pre-selected data, and use the pre-selected data and the determined file data as invalid data.

[0139] Optionally, a storage node, specifically used to send a recovery notification for the invalid data to the management server;

[0140] The management server is specifically used to delete the metadata of the invalid data and restore the invalid data after receiving the recovery notification.

[0141] In the above solution provided by the embodiment of the present invention, when the operation type of the operation request is the type of reading and writing file data, the storage node only uses the management server to recover the invalid data targeted by the operation request, and does not need to recover the data other than the invalid data in the storage disk, thereby reducing the amount of data that needs to be recovered. It can be seen that the efficiency of data recovery can be improved through the embodiment of the present invention.

[0142] On the other hand, since the storage node fails to respond to the operation request, and when the operation type is the type of reading and writing file data, only the management server is used to recover the failed data, and small-grained data recovery can be achieved without the help of external tools. At the same time, the solution of the present invention does not need to stop the operation of the storage disk before the management server is used to recover the file data stored in the storage disk. Compared with the existing method of directly selecting and removing the failed storage disk, the operation time of the storage disk is extended and the cost is saved.

[0143] As the distributed storage system of the embodiment of the present invention corresponds to the above-mentioned fault handling method, the description is relatively simple, and the relevant parts may refer to the description of the fault handling method.

[0144] According to the fault handling method provided in the embodiment of the present invention, Figure 4 As shown, an embodiment of the present invention further provides a fault handling device, which is applied to a storage node in a distributed storage system, wherein a storage disk is deployed in the storage node, and the distributed storage system further includes a management server, and the device includes:

[0145] A request receiving module 401 is used to receive an operation request for data stored in a storage disk;

[0146] A type determination module 402, configured to determine the operation type of the operation request when the response to the operation request fails;

[0147] The first data recovery module 403 is used to determine the file data targeted by the operation request as invalid data if the operation type is a type of reading and writing file data, and to recover the invalid data using the management server;

[0148] The second data recovery module 404 is used to recover the file data stored in the storage disk by using the management server if the operation type is the type of reading and writing file system metadata.

[0149] Optionally, the first data recovery module is further used to, after determining that the file data targeted by the operation request is invalid data, move the invalid data to a preset storage location in the storage disk; based on the invalid data in the preset storage location, determine whether the storage disk meets the preset storage disk failure condition; if so, use the management server to recover the file data stored in the storage disk.

[0150] Optionally, the first data recovery module is specifically used to set a fault identifier for the storage disk; wherein the fault identifier is used to recover the file data stored in the storage disk after being detected by the management server.

[0151] Optionally, the first data recovery module is specifically used to determine that the storage disk meets the preset storage disk failure condition if the failed data in the preset storage location meets any of the following conditions: the storage capacity occupied by the failed data in the preset storage location is greater than a preset capacity threshold; the number of failed data in the preset storage location is greater than a preset number threshold.

[0152] Optionally, the preset storage location is: a preset storage directory under the file system in the storage disk.

[0153] Optionally, the first data recovery module is specifically used to determine the file data to be operated by the operation request as pre-selected data; determine the file data in the storage disk that belongs to the same logical unit as the pre-selected data, and use the pre-selected data and the determined file data as invalid data.

[0154] Optionally, the first data recovery module is specifically used to send a recovery notification for the invalid data to the management server, so that the management server deletes the metadata of the invalid data and recovers the invalid data.

[0155] In the above solution provided by the embodiment of the present invention, when the operation type of the operation request is the type of reading and writing file data, the storage node only uses the management server to recover the invalid data targeted by the operation request, and does not need to recover the data other than the invalid data in the storage disk, thereby reducing the amount of data that needs to be recovered. It can be seen that the efficiency of data recovery can be improved through the embodiment of the present invention.

[0156] On the other hand, since the storage node fails to respond to the operation request, and when the operation type is the type of reading and writing file data, only the management server is used to recover the failed data, and small-grained data recovery can be achieved without the help of external tools. At the same time, the solution of the present invention does not need to stop the operation of the storage disk before the management server is used to recover the file data stored in the storage disk. Compared with the existing method of directly selecting and removing the failed storage disk, the operation time of the storage disk is extended and the cost is saved.

[0157] The embodiment of the present invention further provides an electronic device, such as Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.

[0158] Memory 503, used for storing computer programs;

[0159] The processor 501 is used to implement the steps of the fault handling method of the embodiment of the present invention when executing the program stored in the memory 503.

[0160] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0161] The communication interface is used for communication between the above electronic device and other devices.

[0162] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0163] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0164] In another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned fault handling methods are implemented.

[0165] In another embodiment provided by the present invention, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any fault handling method in the above embodiments.

[0166] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape) or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)) and the like.

[0167] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0168] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, distributed storage system, electronic device, computer-readable storage medium, computer program, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0169] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A fault handling method, characterized in that: Applied to a storage node in a distributed storage system, the storage node is deployed with a storage disk, the distributed storage system further includes a management server, and the method includes: receiving an operation request for data stored in the storage disk; When responding to the operation request fails, determining an operation type of the operation request; If the operation type is a type of reading and writing file data, determining the file data targeted by the operation request as invalid data, and using the management server to restore the invalid data; If the operation type is a type of reading and writing file system metadata, using the management server to restore the file data stored in the storage disk; The step of determining the file data targeted by the operation request as invalid data includes: Determine the file data to be operated by the operation request as pre-selected data; determine the file data in the storage disk that belongs to the same logical unit as the pre-selected data, and use the pre-selected data and the determined file data as invalid data; Alternatively, the file data to be operated by the operation request is regarded as invalid data; The utilizing the management server to recover the failed data includes: A recovery notification for the invalid data is sent to the management server, so that the management server deletes the metadata of the invalid data and recovers the invalid data.

2. The method according to claim 1, characterized in that After determining the file data targeted by the operation request as invalid data, the method further includes: Moving the invalid data to a preset storage location in the storage disk; Based on the failure data in the preset storage location, determining whether the storage disk meets a preset storage disk failure condition; If the conditions are met, the management server is used to restore the file data stored in the storage disk.

3. The method according to claim 1 or 2, characterized in that: The method of utilizing the management server to recover the file data stored in the storage disk includes: A fault flag is set for the storage disk; wherein the fault flag is used to recover the file data stored in the storage disk after being detected by the management server.

4. The method according to claim 2, characterized in that: The determining, based on the failure data in the preset storage location, whether the storage disk meets a preset storage disk failure condition includes: If the failed data in the preset storage location meets any of the following conditions, it is determined that the storage disk meets the preset storage disk failure condition: The storage capacity occupied by the failed data in the preset storage location is greater than a preset capacity threshold; The amount of failed data in the preset storage location is greater than a preset amount threshold.

5. The method according to claim 2, characterized in that: The preset storage location is: a preset storage directory under the file system in the storage disk.

6. A distributed storage system, characterized in that: The distributed storage system includes: storage nodes and management servers, wherein storage disks are deployed in the storage nodes; The storage node is used to receive an operation request for data stored in the storage disk; when responding to the operation request fails, determine the operation type of the operation request; if the operation type is a type of reading and writing file data, determine the file data targeted by the operation request as invalid data; The management server is configured to recover the failed data after the storage node determines the failed data; or, when the operation type is a type of reading and writing file system metadata, recover the file data stored in the storage disk; The storage node is specifically used to determine the file data to be operated by the operation request as pre-selected data; determine the file data in the storage disk that belongs to the same logical unit as the pre-selected data, and use the pre-selected data and the determined file data as invalid data; or use the file data to be operated by the operation request as invalid data; and, when the operation type is a type of reading and writing file system metadata, send a recovery notification for the invalid data to the management server; The management server is further configured to delete the metadata of the invalid data and restore the invalid data upon receiving a restoration notification for the invalid data.

7. The system according to claim 6, characterized in that The storage node is further configured to move the file data targeted by the operation request to a preset storage location in the storage disk after determining the file data targeted by the operation request as invalid data; Based on the failure data in the preset storage location, determining whether the storage disk meets a preset storage disk failure condition; The management server is used to recover the file data stored in the storage disk when the storage disk meets the storage disk failure condition.

8. The system according to claim 6 or 7, characterized in that: The storage node is specifically used to set a fault flag for the storage disk when the operation type is a type of reading and writing file system metadata, or the storage disk meets the storage disk fault condition; The management server is specifically configured to restore the file data stored in the storage disk when it is detected that the storage disk is provided with the fault identifier.

9. A fault handling device, characterized in that: Applied to a storage node in a distributed storage system, wherein a storage disk is deployed in the storage node, and the distributed storage system further includes a management server, the device includes: A request receiving module, used for receiving an operation request for data stored in the storage disk; A type determination module, configured to determine the operation type of the operation request when responding to the operation request fails; A first data recovery module, configured to, if the operation type is a type of reading and writing file data, determine the file data targeted by the operation request as invalid data, and use the management server to recover the invalid data; A second data recovery module, configured to recover the file data stored in the storage disk by using the management server if the operation type is a type of reading and writing file system metadata; The first data recovery module is specifically used to determine the file data to be operated by the operation request as pre-selected data; determine the file data in the storage disk that belongs to the same logical unit as the pre-selected data, and use the pre-selected data and the determined file data as invalid data; or use the file data to be operated by the operation request as invalid data; The second data recovery module is specifically configured to send a recovery notification for the invalid data to the management server, so that the management server deletes the metadata of the invalid data and recovers the invalid data.

10. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 5 when executing a program stored in a memory.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 5 are implemented.