Bad block processing method and device, computer equipment and storage medium
Through multi-node concurrent scanning and reporting adjustment, the scope of influence and processing strategies of bad blocks in distributed block storage systems are determined, which solves the problem of bad block processing and improves system performance and data recovery efficiency.
Patent Information
- Application Number
- CN202411232862.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-12-27
AI Technical Summary
There are difficulties in identifying and processing bad blocks in distributed block storage systems, resulting in data corruption or loss. Existing scan reports cannot accurately evaluate whether the bad block sector has data and influence, and it is difficult to choose appropriate repair measures, which leads to the emergence of the system. Fault.
By performing bad block scanning operations concurrently by multiple nodes, an initial scan report is generated, and the report is traversed step by step, the processing strategy is adjusted according to the degree of replica corruption, and the bad block processing scheme is determined, which improves the accuracy and efficiency of bad block processing.
By determining the scope of influence of bad blocks and processing strategies, the efficiency of bad block processing is improved, the performance of distributed block storage system is improved, and data reliability and system stability are ensured.
Smart Images

Figure CN119200973A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a bad block processing method, device, computer equipment and storage medium. Background Art
[0002] For the distributed block storage system, its main component is the block. In actual production, blocks may be damaged due to various factors, that is, bad blocks may be generated. For example, physical factors such as hardware failure, scratches or damage to the disk surface may cause bad blocks. As time goes by and the number of uses increases, the storage device may age, resulting in some areas being unable to read or write data correctly. Unstable power supply or sudden voltage fluctuations may damage the data in the storage device. Long-term use of storage devices in extreme temperature, humidity or vibration environments may increase the risk of bad blocks. When bad blocks appear in storage devices, data may be damaged or lost. Therefore, in order to ensure the normal use of the system and to recover customer data as much as possible, a bad block scanning tool will be used to scan, identify and process repairable bad blocks. However, the scan report only shows the bad block sector, and it is not known whether the bad block sector has data and the impact of the data, so it is impossible to accurately select the corresponding repair measures, which makes the distributed block storage system prone to failure.
[0003] Therefore, there is an urgent need to propose a bad block processing method, device, computer equipment and storage medium that can improve the performance of a distributed block storage system. Summary of the invention
[0004] Based on this, it is necessary to provide a bad block processing method, device, computer equipment and storage medium that can improve the performance of a distributed block storage system in response to the above technical problems.
[0005] In a first aspect, a bad block processing method is provided, the method comprising:
[0006] In response to detecting a bad block scan request, performing a bad block scan operation on multiple nodes concurrently, obtaining a bad block scan result of each node, and initializing the bad block scan result to obtain a first bad block scan report;
[0007] Traversing the bad block scanning results line by line, and adjusting the first bad block scanning report based on the traversal results to obtain a second bad block scanning report, wherein the second bad block scanning report includes at least one processing strategy;
[0008] According to the real-time damage degree of the replica, the target processing strategy in the second bad block scanning report is adjusted to obtain a third bad block scanning report;
[0009] A bad block processing solution is determined according to the processing strategy in the third bad block scanning report.
[0010] Optionally, initializing the bad block scan result to obtain a first bad block scan report includes:
[0011] Obtaining a bad block scan result of each node, wherein the bad block scan result includes at least one row of scan results corresponding to a first target parameter, wherein the first target parameter includes at least a drive letter name, a bad block sector, and whether the bad block can be reset and whether it has been processed;
[0012] The bad block scan result is initialized to obtain a first bad block scan report, wherein the first bad block scan report includes at least one line of results corresponding to the second target parameter, and the second target parameter includes at least: node, drive letter name, bad block sector, whether the bad block can be reset, pid value, number of copies, number of damaged copies and processing strategy.
[0013] Optionally, traversing the bad block scan results line by line, and adjusting the first bad block scan report based on the traversal results to obtain the second bad block scan report includes:
[0014] In response to detecting that the scan result of whether the bad block in the target row can be reset is that it cannot be reset, determining the number of replicas, the pid value, and the number of damaged replicas based on the scan result of the bad block sector in the target row;
[0015] Determine a result corresponding to the target processing strategy based on the number of replicas, the pid value, and the number of damaged replicas;
[0016] Add the number of replicas, pid value, number of damaged replicas, and the result corresponding to the target processing strategy corresponding to the target row to the corresponding row of the first bad block scan report, and traverse the next target row until the traversal operation on any row in the bad block scan result is completed;
[0017] In response to detecting that any row in the bad block scan result has been traversed, an end mark row is added to the first bad block scan report to generate the second bad block scan report.
[0018] Optionally, according to the real-time damage degree of the replica, the target processing strategy in the second bad block scanning report is adjusted to obtain the third bad block scanning report including:
[0019] Reading a second bad block scan report and a value of a first element in the second bad block scan report, wherein the element is used to describe a row including a processing strategy;
[0020] Sort the rows of the second bad block scan report in ascending order based on the pid value in each row, and mark each row;
[0021] In response to detecting that the tag value of the current row is less than the first element value, obtaining the processing strategy field value in the current row;
[0022] In response to detecting that the processing strategy field value is greater than or equal to the first preset value, reading the processing strategy field value in the next row and processing it;
[0023] In response to detecting that the processing strategy field value is less than a first preset value, obtaining a first pid value of the current row, and comparing the first pid value with a second preset value;
[0024] In response to detecting that the first pid value is less than or equal to a second preset value, reading a processing strategy field value in a next line and performing processing;
[0025] In response to detecting that the first pid value is greater than a second preset value, obtaining a traversal record initial value, and when the traversal record initial value is a null value, defining the result corresponding to the current row as the traversal record initial value;
[0026] When the traversal record initial value is not a null value, the second pid value in the traversal record initial value is obtained, and when the first pid value is greater than the second pid value, the result corresponding to the current row is defined as the traversal record initial value;
[0027] When the first pid value is less than or equal to the second pid value, the number of damaged copies corresponding to the first pid value is increased by one;
[0028] In response to detecting that the number of damaged copies corresponding to the first pid value is greater than or equal to a third preset value, the processing strategy of the row corresponding to the number of damaged copies is updated, and the number of damaged copies of the row corresponding to the number of damaged copies is updated, the result corresponding to the current row is defined as the initial value of the traversal record, the processing strategy field value in the next row is read, and processing is performed.
[0029] Optionally, the method further includes:
[0030] In response to detecting that the mark value of the current row is greater than or equal to the first element value, reacquiring the second element value in the second bad block scan report;
[0031] In response to detecting that the value of the second element is less than or equal to the value of the first element, detecting whether there is an end mark in the second bad block scan report;
[0032] If there is no end mark, then after a preset time interval, the value of the second element in the second bad block scan report is obtained, and a processing strategy adjustment step is performed;
[0033] If there is an end mark, output the third bad block scan report.
[0034] Optionally, determining a bad block processing solution according to the processing strategy in the third bad block scanning report includes:
[0035] In response to detecting that the third bad block scan report contains a first target processing strategy, reading the first target processing strategy;
[0036] Based on the first target processing strategy, determining a target node;
[0037] Detect whether the storage service of the target node can be started normally;
[0038] If the storage service of the target node cannot be started normally, the storage service is rebuilt.
[0039] Optionally, the method further includes:
[0040] In response to detecting that the third bad block scan report does not contain the first target processing strategy and / or the storage service of the target node can be started normally, detecting whether the third bad block scan report contains the second target processing strategy;
[0041] If the second target processing strategy is detected, then checking whether the business virtual machine can be started normally;
[0042] If the business virtual machine cannot be started normally, rebuild the business virtual machine and restore the business of the business virtual machine based on the historical backup;
[0043] If the business virtual machine can be started normally or the second target processing strategy is not detected, the bad block is reset to recover the data.
[0044] In a second aspect, a bad block processing device is provided, the device comprising:
[0045] A scanning module, configured to concurrently perform bad block scanning operations on multiple nodes when a bad block scanning request is detected, obtain bad block scanning results of each node, and initialize the bad block scanning results to obtain a first bad block scanning report;
[0046] A traversal module, configured to traverse the bad block scan result line by line, and adjust the first bad block scan report based on the traversal result to obtain a second bad block scan report, wherein the second bad block scan report includes at least one processing strategy;
[0047] An adjustment module, configured to adjust the target processing strategy in the second bad block scanning report according to the real-time damage degree of the replica, to obtain a third bad block scanning report;
[0048] The processing module is used to determine a bad block processing solution according to the processing strategy in the third bad block scanning report.
[0049] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:
[0050] In response to detecting a bad block scan request, performing a bad block scan operation on multiple nodes concurrently, obtaining a bad block scan result of each node, and initializing the bad block scan result to obtain a first bad block scan report;
[0051] Traversing the bad block scanning results line by line, and adjusting the first bad block scanning report based on the traversal results to obtain a second bad block scanning report, wherein the second bad block scanning report includes at least one processing strategy;
[0052] According to the real-time damage degree of the replica, the target processing strategy in the second bad block scanning report is adjusted to obtain a third bad block scanning report;
[0053] A bad block processing solution is determined according to the processing strategy in the third bad block scanning report.
[0054] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0055] In response to detecting a bad block scan request, performing a bad block scan operation on multiple nodes concurrently, obtaining a bad block scan result of each node, and initializing the bad block scan result to obtain a first bad block scan report;
[0056] Traversing the bad block scanning results line by line, and adjusting the first bad block scanning report based on the traversal results to obtain a second bad block scanning report, wherein the second bad block scanning report includes at least one processing strategy;
[0057] According to the real-time damage degree of the replica, the target processing strategy in the second bad block scanning report is adjusted to obtain a third bad block scanning report;
[0058] A bad block processing solution is determined according to the processing strategy in the third bad block scanning report.
[0059] In a fifth aspect, a computer program product is provided, the computer program product comprising a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0060] In response to detecting a bad block scan request, performing a bad block scan operation on multiple nodes concurrently, obtaining a bad block scan result of each node, and initializing the bad block scan result to obtain a first bad block scan report;
[0061] Traversing the bad block scanning results line by line, and adjusting the first bad block scanning report based on the traversal results to obtain a second bad block scanning report, wherein the second bad block scanning report includes at least one processing strategy;
[0062] According to the real-time damage degree of the replica, the target processing strategy in the second bad block scanning report is adjusted to obtain a third bad block scanning report;
[0063] A bad block processing solution is determined according to the processing strategy in the third bad block scanning report.
[0064] The above-mentioned bad block processing method, device, computer equipment and storage medium, the method includes: in response to detecting a bad block scan request, performing a bad block scan operation on multiple nodes concurrently, obtaining the bad block scan results of each node, and initializing the bad block scan results to obtain a first bad block scan report; traversing the bad block scan results line by line, and adjusting the first bad block scan report based on the traversal results to obtain a second bad block scan report, the second bad block scan report including at least one processing strategy; adjusting the target processing strategy in the second bad block scan report according to the real-time damage degree of the replica to obtain a third bad block scan report; determining the bad block processing plan according to the processing strategy in the third bad block scan report. The present application is based on multi-node concurrent scanning of bad blocks, and determining the bad block impact range and processing strategy according to the scanning results to determine the data recovery plan, thereby improving the bad block processing efficiency and thereby improving the performance of the distributed block storage system. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 A diagram showing an application environment of a bad block processing method in an embodiment;
[0066] Figure 2 A schematic diagram of a bad block processing method in one embodiment;
[0067] Figure 3 A schematic diagram of a second bad block scan report generation process of a bad block processing method in one embodiment;
[0068] Figure 4 A schematic diagram of a third bad block scan report generation process of a bad block processing method in one embodiment;
[0069] Figure 5 A schematic diagram of a bad block processing scheme determination process of a bad block processing method in one embodiment;
[0070] Figure 6 is a structural block diagram of a bad block processing device in one embodiment;
[0071] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0072] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0073] It should be understood that in the description of the present application, unless the context clearly requires otherwise, words such as "include", "comprises", and the like throughout the specification should be interpreted as including rather than being exclusive or exhaustive; that is, as including but not limited to.
[0074] It should also be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, "plurality" means two or more.
[0075] It should be noted that the terms "S1", "S2", etc. are only used for the purpose of describing the steps, and do not specifically refer to the order or sequence, nor are they used to limit the present application. They are only for the convenience of describing the method of the present application, and cannot be understood as indicating the order of the steps. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present application.
[0076] A hyper-converged platform is a server virtualization solution that transforms a static and complex IT (Internet technology) environment into a more dynamic and easy-to-manage virtual data center by integrating, allocating and managing underlying physical resources, thereby improving the agility, flexibility and efficiency of resource delivery, helping enterprises create a high-performance, scalable, manageable and flexible server virtualization infrastructure, and providing high-quality virtual data center services. The storage core of a hyper-converged platform is a distributed block storage system, which has the characteristics of high performance and high reliability. It is designed specifically for virtualization architecture and makes full use of the characteristics of the virtualization platform and the characteristics of SSD (Solid State Drives) disks. It has been deeply optimized and integrated, making it highly advantageous in large-scale virtualization scenarios. According to background technology, bad blocks may be generated due to a variety of factors. When bad blocks appear in storage devices, data may be damaged or lost. Therefore, each manufacturer will manage bad blocks in advance to reduce the impact of bad blocks in production. In bad block management, the following three types of bad blocks are defined: factory bad blocks, which are blocks that do not meet the manufacturer's standards or cannot meet the manufacturer's published standards after random testing by the manufacturer. Some factory bad blocks can be erased, but some cannot; new bad blocks or used bad blocks caused by wear during use; false bad blocks that are misjudged by the main control due to abnormal power failure and other reasons.
[0077] Not all new bad blocks are caused by wear and tear. If the SSD does not have abnormal power-off protection, abnormal power-off may cause the main control to misjudge bad blocks or real new bad blocks to be generated. In the absence of abnormal power-off protection, if the Lower page (fast page) has been programmed successfully, and there is a sudden power failure during the programming of the Upper page (slow page), it will inevitably cause data transmission errors in the Lower page. If the number of data errors exceeds the SSD ECC (Error Checking and Correction) error correction capability, errors will occur during reading, and the block will be judged as a "Bad Block" by the main control and marked in the bad block table.
[0078] Some of the newly added bad blocks can be erased. Moreover, after the newly added bad blocks are erased, the data reading, writing and erasing operations may not cause errors again, because errors are related to the pattern of the written data (the pattern after the regular expression is compiled). If an error occurs when using a certain pattern, it may not occur when using another pattern.
[0079] Factory bad blocks will be separated on the bitline, so they will not affect the erase speed of other blocks. However, if the number of new bad blocks in the entire SSD is large enough, the number of available blocks in the entire disk will decrease, which will increase the number of garbage collection times. At the same time, the OP (Over Provisioning) capacity will decrease, which will seriously affect the garbage collection efficiency. Therefore, when the bad blocks increase to a certain level, the performance stability of the SSD will be affected, especially when the SSD is continuously written. Because the system performs garbage collection, the performance will be degraded and the SSD performance curve will fluctuate greatly. When applied to actual products such as hyper-convergence, once a large number of non-factory bad blocks are generated, data loss may occur at the least, and the disk may be unmounted and unusable, or even the system may crash.
[0080] As mentioned above, not all bad blocks are irreparable. In order to ensure the normal use of the system and recover customer data as much as possible in the hyper-converged platform, bad block scanning tools such as badblocks (a tool used to detect bad blocks on hard disks or storage devices) will be used to scan and identify repairable bad blocks and process them. The badblocks scan report only shows the bad block sector, and it is not known whether the bad block sector has data and the impact of the data.
[0081] To solve the above technical problems, the present application provides a bad block processing method, device, equipment and storage medium, which determines the corresponding bad block processing solution by determining the impact range of the bad block, improves the bad block processing efficiency, and further improves the performance of the distributed block storage system.
[0082] The bad block processing method provided in this application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the data processing platform set on the server 104 through the network, wherein the terminal 102 can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0083] In one embodiment, Figure 2 As shown, a bad block processing method is provided, which is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:
[0084] S1: In response to detecting a bad block scan request, performing a bad block scan operation on multiple nodes concurrently, obtaining a bad block scan result of each node, and initializing the bad block scan result to obtain a first bad block scan report.
[0085] It should be noted that bad blocks can be scanned by bad block scanning tools, such as badblocks; nodes refer to server nodes in a distributed block storage system; concurrent execution refers to the process of alternating execution of multiple tasks in the same time period; the bad block scanning result of each node refers to the result of each node, and its content includes the drive letter name, bad block sector, whether the bad block can be reset and whether it has been processed, and its format is [drive letter name, bad block sector, whether the bad block can be reset, whether it has been processed]. For example, the bad block scanning result is as follows: [
[0087] ["sda",10000,false,true],
[0088] ["sdb",10008,false,true],
[0089] ["sdc",11111,false,true],
[0090] ["sda",20000,true,true],
[0091] ["sda",20038,true,true],
[0092] ["sdx",21111,true,true],
[0093] … ]
[0095] Among them, sda, sdb, etc. indicate drive letter names, 10000, 10008, etc. indicate bad block sectors, false in the Bad Block Can Be Reset column indicates that the bad block cannot be reset, true indicates that the bad block can be reset, and true in the Processed column indicates that the bad block has been processed.
[0096] In some specific implementations, initializing the bad block scan result to obtain a first bad block scan report includes:
[0097] Obtaining the bad block scanning results of each node, wherein the bad block scanning results include at least one line of scanning results corresponding to the first target parameter, wherein the first target parameter includes at least the drive letter name, the bad block sector, whether the bad block can be reset and whether it has been processed, wherein one line of scanning results corresponding to the first target parameter is as shown in the above example, such as ["sda", 10000, false, true], etc.;
[0098] The bad block scan result is initialized to obtain a first bad block scan report, wherein the first bad block scan report includes at least one line of results corresponding to the second target parameter, and the second target parameter includes at least: node, drive letter name, bad block sector, whether the bad block can be reset, pid value, number of copies, number of damaged copies and processing strategy, wherein the first bad block scan report refers to the initialization processing result dealResult, and the processing strategy is determined by the impact range of the bad block sector, specifically including: processing strategy 1: metadata damage; processing strategy 2: copy damage exists; processing strategy 3: all copies are damaged; the pid value refers to the sds (virtualized storage) copy data block id (identity document, unique identifier) to which the scanned sector belongs.
[0099] In the above implementation, the bad block processing efficiency can be improved by concurrently scanning the bad blocks by multiple nodes and initializing the scanning results to generate the first bad block scanning report.
[0100] S2: traverse the bad block scan results line by line, and adjust the first bad block scan report based on the traversal results to obtain a second bad block scan report, wherein the second bad block scan report includes at least one processing strategy.
[0101] It should be noted that the content adjusted for the first bad block scan report mainly includes parameter information added after the initialization process, such as pid value, number of copies, number of damaged copies, processing strategy and node, etc.
[0102] In some specific implementations, traversing the bad block scan results row by row, and adjusting the first bad block scan report based on the traversal results to obtain the second bad block scan report includes:
[0103] In response to detecting that the scan result of whether the bad block in the target row can be reset is that it cannot be reset, determining the number of replicas, the pid value, and the number of damaged replicas based on the scan result of the bad block sector in the target row;
[0104] Determine a result corresponding to the target processing strategy based on the number of replicas, the pid value, and the number of damaged replicas;
[0105] Add the number of replicas, pid value, number of damaged replicas, and the result corresponding to the target processing strategy corresponding to the target row to the corresponding row of the first bad block scan report, and traverse the next target row until the traversal operation on any row in the bad block scan result is completed;
[0106] In response to detecting that any row in the bad block scan result has been traversed, an end mark row is added to the first bad block scan report to generate the second bad block scan report.
[0107] Specifically, Figure 3 As shown, the result of each node is traversed line by line. If the [Bad Block Can Be Reset] of the current line is false, that is, it cannot be reset, then the [Bad Block Sector] recorded in the line is obtained, and its specific impact range is confirmed through disk_analysis.py. The execution command is: python disk_analysis.py -d / dev / drive name – s bad block sector location, and the command return format is as follows:
[0108] [root@scvm_100_18_21_24210:57:41~]$python disk analysis.py-d / dev / nvme0n1-s 20971600Hit metad partition.
[0109] [root@scvm_100_18_21_24214:48:46~]$python disk analysis.py-d / dev / sdd-s 30000000
[0110] pid:17
[0111] iscsi name:iscsi303030
[0112] lun name:cfs-datastore
[0113] lun stripe num:4
[0114] lun id:92408be4-b213-4db3-83e6-f3639b45eb61
[0115] scsiid:33d4d312bd4eb8042
[0116] pid offset in lun:1048576KB
[0117] The specific impact range refers to the damage range, which corresponds to the processing strategy one by one. For example, if the impact range is metadata damage, it corresponds to processing strategy 1, if there is copy damage, it corresponds to processing strategy 2, and if all copies are damaged, it corresponds to processing strategy 3. For the first bad block scan report, the result assignment of each row is determined by result_info and the exemplary relationship in the following table:
[0118] Table 1: Parameter assignment table.
[0119]
[0120] Among them, for the "pid:***" format, the lun id is additionally obtained, and the zbs lun id command is executed through the lun id to query the number of copies and record the value. When the number of copies is 2 and the number of damaged copies is 1, it means that there is copy damage, and the corresponding processing strategy is 2, and so on, which will not be repeated here.
[0121] The [drive name, bad block sector, whether the bad block can be reset] in result and the [pid value, number of copies, number of damaged copies, processing strategy] newly generated in the above steps and the current node information are added as a line of data to the newly defined variable dealResult, that is, the first bad block scan report. At the same time, continue to read the next line and repeat the above operation until all the data in result are traversed. When the traversal is completed, add an end mark line, which is: ["final", "sdx", 9999999, false, 0, 0, 0, 0] to dealResult. The final dealResult, that is, the second bad block scan report, has the following content format: [
[0123] ["node1","sda",10000,false,0,1,1,1],
[0124] ["node1","sdb",10008,false,0,1,1,1],
[0125] ["node2","sdc",11111,false,99,2,1,2],
[0126] ["node3","sda",20000,false,78,3,1,2],
[0127] ["node3","sda",20038,false,89,2,1,2],
[0128] ["noden","sdx",21111,true,0,1,1,1],
[0129] …
[0130] ["final","sdx",99999999,false,99999999,0,0,0] ]
[0132] In the above implementation, the first bad block scan report is updated and adjusted according to the scan result in combination with the bad block sector, so as to preliminarily update the impact range and processing strategy based on the corresponding physical disk space for subsequent processing of the bad blocks.
[0133] S3: According to the real-time damage degree of the replica, the target processing strategy in the second bad block scanning report is adjusted to obtain a third bad block scanning report.
[0134] It should be noted that the real-time damage level of the replica is determined based on the number of damaged replicas.
[0135] In some specific implementations, according to the real-time damage degree of the replica, the target processing strategy in the second bad block scanning report is adjusted to obtain the third bad block scanning report including:
[0136] like Figure 4 As shown, the second bad block scan report and the first element value len1 in the second bad block scan report are read, wherein the element is used to describe the row including the processing strategy, that is, the record added by the second bad block scan report, such as ["node 1", "sda", 10000, false, 0, 1, 1, 1] represents one element, ["node 1", "sda", 10000, false, 0, 1, 1, 1], ["node 1", "sdb", 10008, false, 0, 1, 1, 1] represents two elements, and so on. The number of the first element refers to the number of rows, wherein each row contains a corresponding processing strategy;
[0137] Based on the pid value in each row, the rows of the second bad block scan report are sorted in ascending order and each row is marked, that is, the dealResult is reordered in ascending order according to the value of the pid column in the position of the second bad block scan report and marked with numbers, such as the first row is marked as 1, the second row is marked as 2, and so on;
[0138] In response to detecting that the tag value of the current row is less than the first element value, the processing strategy field value in the current row is obtained, wherein the dealResult reading position is defined as n, the initial value of n is 0, and the position represents the tag information of the currently read row in the second bad block scan report. If the second row is read, n is 2, that is, the tag value of the current row is 2; the processing strategy field value refers to a value among 1, 2, and 3, such as the field value corresponding to processing strategy 2 is 2;
[0139] In response to detecting that the processing strategy field value is greater than or equal to the first preset value, the processing strategy field value in the next row is read and processed, wherein the first preset value is set according to the number of copies, such as when the number of copies is 3, the first preset value is 3. When the processing strategy field value is greater than or equal to the first preset value, it indicates that all copies have been damaged and the final state has been reached. There is no need to update the [processing strategy], and the value in the next row in dealResult is continued to be read, that is, n=n+1;
[0140] In response to detecting that the processing strategy field value is less than the first preset value, obtaining the first pid value of the current row, and comparing the first pid value with the second preset value, that is, when the processing strategy field value is less than the first preset value, it means that not all copies are damaged, and there is a possibility that other copies are damaged, and it is necessary to continue to find whether other copies are damaged. At this time, the pid field value of the current row, that is, the first pid value, is obtained;
[0141] In response to detecting that the first pid value is less than or equal to the second preset value, the processing strategy field value in the next line is read and processed, wherein the second preset value can be set according to actual needs. For example, the second preset value is 0, which means that when the first pid value is less than or equal to 0, it indicates that it is a metadata area, and its [processing strategy] is already in the final state, and the value in the next line of dealResult is continued to be read, that is, n=n+1;
[0142] In response to detecting that the first pid value is greater than the second preset value, the traversal record initial value is obtained. When the traversal record initial value is a null value, the result corresponding to the current row is defined as the traversal record initial value. The traversal record initial value refers to lastRow, that is, the traversal processing record of the previous row, whose initial value is a null value. When the data processed by the previous row and the data processed by the current row are not the same data, its initial value is a null value. When the initial value is a null value, the assignment of the current row is defined as the lastRow value, that is, when the first pid value is greater than 0, it indicates that it is a data area. If lastRow is null, it indicates that this is a data that meets the above requirements. At this time, the current row is assigned to lastRow, and the next value in dealResult is read continuously, that is, n=n+1;
[0143] When the traversal record initial value is not a null value, the second pid value in the traversal record initial value is obtained. When the first pid value is greater than the second pid value, the result corresponding to the current row is defined as the traversal record initial value. If lastRow is not null, it means that it is the first data not processed. Then the first pid value of the current row and the second pid value lastPid in lastRow are obtained.
[0144] If the first pid value is greater than the second pid value, it means that the current row and the previous row are not copies of the same pid. At this time, the current value is assigned to lastRow, lastRow updates the latest record, and continues to read the next value in dealResult, that is, n=n+1;
[0145] When the first pid value is less than or equal to the second pid value, the number of damaged copies corresponding to the first pid value is increased by one. That is, when the first pid value is less than or equal to lastPid, it means that the current row and the previous row are copies of the same pid, and the number of damaged copies of this pid is increased by 1.
[0146] In response to detecting that the number of damaged copies corresponding to the first pid value is greater than or equal to the third preset value, the processing strategy of the row corresponding to the number of damaged copies is updated, and the number of damaged copies of the row corresponding to the number of damaged copies is updated. The processing strategy is updated to 3, that is, when the number of damaged copies has reached the expected number of copies, it means that all copies of the pid are damaged. At this time, the processing strategy of the current row and the row with the previous number of copies-1 is updated to 3. Exemplarily, the expected number of copies is 3. When the number of damaged copies is 3, the processing strategy of the current row and the previous 2 (number of damaged copies-1) rows is set to 3. Regardless of whether the number of damaged copies reaches the expected number of copies, the number of damaged copies of the current row to the current row-lnum+1 row is updated to lnum, that is, the number of damaged copies of the row corresponding to the number of damaged copies is updated. After that, the result corresponding to the current row is defined as the initial value of the traversal record, the processing strategy field value in the next row is read, and processing is performed, that is, the current row is assigned to lastRow, lastRow updates the latest record, and continues to read the next value in dealResult, that is, n=n+1, wherein the third preset value can be set according to actual needs.
[0147] In some embodiments, the method further comprises:
[0148] In response to detecting that the mark value of the current row is greater than or equal to the first element value, re-obtaining the second element value in the second bad block scan report, that is, when n is greater than or equal to len1, re-obtaining the dealResult element number len2;
[0149] In response to detecting that the value of the second element is less than or equal to the value of the first element, checking whether there is an end mark in the second bad block scan report, that is, when len2 is less than or equal to len1, checking whether there is an end mark final in dealResult;
[0150] If there is no end mark, then after a preset time interval, obtain the value of the second element in the second bad block scan report, and execute the processing strategy adjustment step, wherein the preset time interval can be set according to actual needs, such as 300s, that is, when there is no end mark, sleep 300s (reduce the comparison frequency), re-obtain the number of dealResult elements len2, and continue the judgment of the above steps;
[0151] If there is an end mark, the third bad block scan report is output, that is, when there is an end mark final, the process ends and dealResult is output. The final processing results of all bad block sectors are output to dealResult, and its content is as follows: [
[0153] ["node1","sda",10000,false,0,1,1,1],
[0154] [“Node 1”, “sdb”, 10008, false, 0, 1, 1, 1],
[0155] [“Node 3”, “sda”, 20000, false, 78, 3, 2, 3],
[0156] [“Node 2”, “sda”, 20007, false, 78, 3, 3, 3],
[0157] [“Node 1”, “sda”, 20008, false, 78, 3, 3, 3],
[0158] [“Node 3”, “sda”, 20038, false, 89, 2, 1, 2],
[0159] [“Node 2”, “sdc”, 11111, false, 99, 2, 2, 3],
[0160] ["node3","sdc",11118,false,99,2,2,3],
[0161] ["final","sdx",99999999,false,99999999,0,0,0] ]
[0163] In the above implementation, by sorting and dynamically comparing adjacent records, the impact of bad blocks is refined in real time to determine the degree of damage to the data copy and synchronously update the impact range and processing strategy, further improving the accuracy and real-time performance of bad block processing.
[0164] S4: Determine a bad block processing solution according to the processing strategy in the third bad block scanning report.
[0165] It should be noted that the corresponding processing solutions for bad blocks include rebuilding storage, rebuilding virtual machines, and resetting bad blocks.
[0166] In some specific implementations, determining a bad block processing solution according to the processing strategy in the third bad block scan report includes:
[0167] In response to detecting that the third bad block scan report has a first target processing strategy, reading the first target processing strategy, that is, processing strategy 1;
[0168] Based on the first target processing strategy, determining a target node;
[0169] Detect whether the storage service of the target node can be started normally;
[0170] If the storage service of the target node cannot be started normally, the storage service is rebuilt.
[0171] In some embodiments, the method further comprises:
[0172] In response to detecting that the third bad block scan report does not contain the first target processing strategy and / or the storage service of the target node can be started normally, detecting whether the third bad block scan report contains the second target processing strategy, wherein the second target processing strategy refers to processing strategy 3;
[0173] If the second target processing strategy is detected, then checking whether the business virtual machine can be started normally;
[0174] If the business virtual machine cannot be started normally, rebuild the business virtual machine and restore the business of the business virtual machine based on the historical backup;
[0175] If the business virtual machine can be started normally or the second target processing strategy is not detected, the bad block is reset to recover the data.
[0176] Specifically, Figure 5 As shown in the figure, if the record has a processing strategy of 1, all records with a processing strategy of 1 are filtered out to determine the affected nodes and check whether the storage service of the node can be started normally. If it cannot be started normally, it means that the bad block has affected the cluster and the environment needs to be rebuilt.
[0177] If it can be started normally, it means that this part of the bad blocks has not affected the service. The bad blocks can be reset. At this time, determine whether there is processing strategy 3 in the record. If not, it means that not all copies are lost, but only some copies are lost. Reset the bad blocks and perform normal data recovery. If 3 exists, it means that all copies of the data are lost. Determine whether it affects the business system by whether the business virtual machine can be started normally. If the virtual machine cannot be started, it means that the bad blocks have affected the business virtual machine. Rebuild the virtual machine and restore the virtual machine business according to the historical backup. If the virtual machine can start normally, it means that it does not affect the virtual machine. Reset the bad blocks and perform normal data recovery.
[0178] In the above implementation, a solution is dynamically determined from high to low according to the impact scope combined with the actual business impact, and the solution and implementation report are output, thereby improving the efficiency and accuracy of bad block repair.
[0179] In some specific implementations, in response to detecting that the data recovery operation corresponding to the target bad block has been completed, a recovery result, such as successful recovery, recovery failure, etc., is obtained, and the corresponding bad block processing scheme is processed to obtain key information, and a corresponding mapping relationship is formed between the key information, the recovery result, and the target bad block, wherein the key information may include keywords such as reconstruction, virtual machine, storage service, etc.;
[0180] Get the number of successful hits and time of the target bad block within a preset time period, where the preset time period can be set according to actual needs, such as the working time period from 9:00 to 18:00 from Monday to Friday, and the rest of the time is the non-working time period, etc.;
[0181] In response to detecting that the number of successes within the target time is greater than a first preset threshold, marking the mapping relationship, wherein the first preset threshold can be set according to actual needs, such as 30 times;
[0182] In response to detecting the target bad block again in the next operation cycle, comparing the detection time with the time value in the mapping relationship, wherein the next operation cycle may refer to a working time period from 9:00 to 18:00 from Monday to Friday of the next week or other time period;
[0183] In response to detecting that the time difference between the two is less than a second preset threshold, a keyword in the mapping relationship is extracted, a corresponding bad block processing solution is matched based on the keyword, and a data recovery operation is performed, wherein the second preset threshold can be set according to actual needs, such as 1s.
[0184] In the above implementation, the mapping relationship corresponding to the time value that meets the standard can be used for marking, so that when a bad block is detected within the time range corresponding to the time value, the data repair solution is directly executed, thereby further improving the bad block processing efficiency.
[0185] In the above-mentioned bad block processing method, the method includes: in response to detecting a bad block scan request, performing a bad block scan operation on multiple nodes concurrently, obtaining the bad block scan results of each node, and initializing the bad block scan results to obtain a first bad block scan report; traversing the bad block scan results line by line, and adjusting the first bad block scan report based on the traversal results to obtain a second bad block scan report, wherein the second bad block scan report includes at least one processing strategy; adjusting the target processing strategy in the second bad block scan report according to the real-time damage degree of the copy to obtain a third bad block scan report; determining the bad block processing solution according to the processing strategy in the third bad block scan report, the present application is based on multi-node concurrent scanning of bad blocks, preliminarily updating the impact range and processing strategy according to the scan results combined with the corresponding physical disk space of the bad block sector, refining the bad block impact in real time, determining the damage degree of the data copy and synchronously updating the impact range and processing strategy by sorting and dynamically comparing adjacent records, and dynamically determining the solution from high to low according to the impact range combined with the actual business impact to reply to the data, thereby improving the bad block processing efficiency and thus improving the performance of the distributed block storage system.
[0186] It should be understood that although Figure 2-Figure 5 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-Figure 5 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0187] In one embodiment, Figure 6 As shown, a bad block processing device is provided, comprising: a scanning module, a traversal module, an adjustment module and a processing module, wherein:
[0188] A scanning module, configured to concurrently perform bad block scanning operations on multiple nodes when a bad block scanning request is detected, obtain bad block scanning results of each node, and initialize the bad block scanning results to obtain a first bad block scanning report;
[0189] A traversal module, configured to traverse the bad block scan result line by line, and adjust the first bad block scan report based on the traversal result to obtain a second bad block scan report, wherein the second bad block scan report includes at least one processing strategy;
[0190] An adjustment module, configured to adjust the target processing strategy in the second bad block scanning report according to the real-time damage degree of the replica, to obtain a third bad block scanning report;
[0191] A processing module is used to determine a bad block processing solution according to the processing strategy in the third bad block scanning report.
[0192] As a preferred implementation mode, in an embodiment of the present invention, the scanning module is specifically used to: obtain bad block scanning results of each node, the bad block scanning results include at least one line of scanning results corresponding to a first target parameter, and the first target parameter includes at least a drive letter name, a bad block sector, whether the bad block can be reset, and whether it has been processed; initialize the bad block scanning results to obtain a first bad block scanning report, and the first bad block scanning report includes at least one line of results corresponding to a second target parameter, and the second target parameter includes at least: node, drive letter name, bad block sector, whether the bad block can be reset, pid value, number of copies, number of damaged copies, and processing strategy.
[0193] As a preferred implementation mode, in an embodiment of the present invention, the traversal module is specifically used for: in response to detecting that the scan result of whether the bad block in the target row can be reset is that it cannot be reset, determining the number of copies, pid values and the number of damaged copies based on the scan result of the bad block sector in the target row; determining the result corresponding to the target processing strategy based on the number of copies, pid values and the number of damaged copies; adding the number of copies, pid values, the number of damaged copies and the result corresponding to the target processing strategy corresponding to the target row to the corresponding row of the first bad block scan report, and traversing the next target row until the traversal operation of any row in the bad block scan result is completed; in response to detecting that any row in the bad block scan result has been traversed, adding an end identification row to the first bad block scan report to generate the second bad block scan report.
[0194] As a preferred implementation mode, in an embodiment of the present invention, the adjustment module is specifically used to: read the second bad block scan report and the first element values in the second bad block scan report, wherein the elements are used to describe the rows including the processing strategy; based on the pid value in each row, sort the rows of the second bad block scan report according to the ascending sorting strategy, and mark each row; in response to detecting that the mark value of the current row is less than the first element values, obtain the processing strategy field value in the current row; in response to detecting that the processing strategy field value is greater than or equal to the first preset value, read the processing strategy field value in the next row and process it; in response to detecting that the processing strategy field value is less than the first preset value, obtain the first pid value of the current row, and compare the first pid value with the second preset value; in response to detecting that the first pid value is less than or equal to the second preset value, read the processing strategy field value in the next row. field value, and process it; in response to detecting that the first pid value is greater than the second preset value, obtain the traversal record initial value, and when the traversal record initial value is a null value, define the result corresponding to the current row as the traversal record initial value; when the traversal record initial value is not a null value, obtain the second pid value in the traversal record initial value, and when the first pid value is greater than the second pid value, define the result corresponding to the current row as the traversal record initial value; when the first pid value is less than or equal to the second pid value, add one to the number of damaged copies corresponding to the first pid value; in response to detecting that the number of damaged copies corresponding to the first pid value is greater than or equal to the third preset value, update the processing strategy of the row corresponding to the number of damaged copies, and update the number of damaged copies of the row corresponding to the number of damaged copies, define the result corresponding to the current row as the traversal record initial value, read the processing strategy field value in the next row, and process it.
[0195] As a preferred implementation mode, in an embodiment of the present invention, the adjustment module is specifically used to: in response to detecting that the mark value of the current row is greater than or equal to the value of the first element, re-obtain the value of the second element in the second bad block scan report; in response to detecting that the value of the second element is less than or equal to the value of the first element, detect whether there is an end mark in the second bad block scan report; if there is no end mark, then after a preset time interval, obtain the value of the second element in the second bad block scan report and execute the processing strategy adjustment step; if there is an end mark, output a third bad block scan report.
[0196] As a preferred implementation mode, in an embodiment of the present invention, the processing module is specifically used to: in response to detecting that the third bad block scan report contains a first target processing strategy, read the first target processing strategy; determine the target node based on the first target processing strategy; detect whether the storage service of the target node can be started normally; if the storage service of the target node cannot be started normally, rebuild the storage service.
[0197] As a preferred implementation manner, in an embodiment of the present invention, the processing module is specifically further used for: in response to detecting that the third bad block scan report does not have the first target processing strategy and / or the storage service of the target node can be started normally, detecting whether the third bad block scan report has the second target processing strategy; if the second target processing strategy is detected, detecting whether the business virtual machine can be started normally; if the business virtual machine cannot be started normally, rebuilding the business virtual machine and restoring the business of the business virtual machine based on the historical backup; if the business virtual machine can be started normally or the second target processing strategy is not detected, resetting the bad block to recover the data.
[0198] For the specific definition of the bad block processing device, please refer to the definition of the bad block processing method above, which will not be repeated here. Each module in the above bad block processing device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0199] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a bad block processing method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0200] Those skilled in the art will understand that Figure 7The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0201] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: S1: in response to detecting a bad block scan request, concurrently performing bad block scan operations on multiple nodes, obtaining bad block scan results of each node, and initializing the bad block scan results to obtain a first bad block scan report; S2: traversing the bad block scan results row by row, and adjusting the first bad block scan report based on the traversal results to obtain a second bad block scan report, wherein the second bad block scan report includes at least one processing strategy; S3: adjusting the target processing strategy in the second bad block scan report according to the real-time damage degree of the replica to obtain a third bad block scan report; S4: determining a bad block processing scheme according to the processing strategy in the third bad block scan report.
[0202] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the bad block scanning results of each node, the bad block scanning results including at least one line of scanning results corresponding to the first target parameter, the first target parameter including at least the drive letter name, the bad block sector, whether the bad block can be reset and whether it has been processed; initializing the bad block scanning results to obtain a first bad block scanning report, the first bad block scanning report including at least one line of results corresponding to the second target parameter, the second target parameter including at least: node, drive letter name, bad block sector, whether the bad block can be reset, pid value, number of copies, number of damaged copies and processing strategy.
[0203] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0204] In response to detecting that the scan result of whether the bad block in the target row can be reset is that it cannot be reset, determine the number of copies, pid values and the number of damaged copies based on the scan result of the bad block sector in the target row; determine the result corresponding to the target processing strategy based on the number of copies, pid values and the number of damaged copies; add the number of copies, pid values, the number of damaged copies and the result corresponding to the target processing strategy corresponding to the target row to the corresponding row of the first bad block scan report, and traverse the next target row until the traversal operation of any row in the bad block scan result is completed; in response to detecting that any row in the bad block scan result has been traversed, add an end identification row to the first bad block scan report to generate the second bad block scan report.
[0205] In one embodiment, when the processor executes the computer program, the following steps are also implemented: reading the second bad block scan report and the first element values in the second bad block scan report, wherein the elements are used to describe the rows including the processing strategy; sorting the rows of the second bad block scan report according to the ascending sorting strategy based on the pid value in each row, and marking each row; in response to detecting that the mark value of the current row is less than the first element values, obtaining the processing strategy field value in the current row; in response to detecting that the processing strategy field value is greater than or equal to a first preset value, reading the processing strategy field value in the next row and processing it; in response to detecting that the processing strategy field value is less than the first preset value, obtaining the first pid value of the current row, and comparing the first pid value with the second preset value; in response to detecting that the first pid value is less than or equal to the second preset value, reading the processing strategy field in the next row. value, and process it; in response to detecting that the first pid value is greater than the second preset value, obtain the traversal record initial value, and when the traversal record initial value is a null value, define the result corresponding to the current row as the traversal record initial value; when the traversal record initial value is not a null value, obtain the second pid value in the traversal record initial value, and when the first pid value is greater than the second pid value, define the result corresponding to the current row as the traversal record initial value; when the first pid value is less than or equal to the second pid value, add one to the number of damaged copies corresponding to the first pid value; in response to detecting that the number of damaged copies corresponding to the first pid value is greater than or equal to a third preset value, update the processing strategy of the row corresponding to the number of damaged copies, and update the number of damaged copies of the row corresponding to the number of damaged copies, define the result corresponding to the current row as the traversal record initial value, read the processing strategy field value in the next row, and process it.
[0206] In one embodiment, the processor also implements the following steps when executing the computer program: in response to detecting that the mark value of the current row is greater than or equal to the value of the first element, re-obtaining the value of the second element in the second bad block scan report; in response to detecting that the value of the second element is less than or equal to the value of the first element, detecting whether there is an end mark in the second bad block scan report; if there is no end mark, then after a preset time interval, obtaining the value of the second element in the second bad block scan report and executing the processing strategy adjustment step; if there is an end mark, outputting a third bad block scan report.
[0207] In one embodiment, the processor also implements the following steps when executing the computer program: in response to detecting that the third bad block scan report contains a first target processing strategy, reading the first target processing strategy; determining a target node based on the first target processing strategy; detecting whether the storage service of the target node can be started normally; and rebuilding the storage service if the storage service of the target node cannot be started normally.
[0208] In one embodiment, the processor also implements the following steps when executing the computer program: in response to detecting that the third bad block scan report does not contain the first target processing strategy and / or the storage service of the target node can be started normally, detecting whether the third bad block scan report contains the second target processing strategy; if the second target processing strategy is detected, detecting whether the business virtual machine can be started normally; if the business virtual machine cannot be started normally, rebuilding the business virtual machine and restoring the business of the business virtual machine based on the historical backup; if the business virtual machine can be started normally or the second target processing strategy is not detected, resetting the bad block to recover the data.
[0209] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: S1: in response to detecting a bad block scan request, concurrently performing bad block scan operations on multiple nodes, obtaining bad block scan results of each node, and initializing the bad block scan results to obtain a first bad block scan report; S2: traversing the bad block scan results line by line, and adjusting the first bad block scan report based on the traversal results to obtain a second bad block scan report, wherein the second bad block scan report includes at least one processing strategy; S3: adjusting the target processing strategy in the second bad block scan report according to the real-time damage degree of the replica to obtain a third bad block scan report; S4: determining a bad block processing solution according to the processing strategy in the third bad block scan report.
[0210] In one embodiment, a computer program product is provided, which includes a computer program, and when the computer program is executed by a processor, the following steps are implemented: S1: in response to detecting a bad block scan request, concurrently performing bad block scan operations on multiple nodes, obtaining bad block scan results of each node, and initializing the bad block scan results to obtain a first bad block scan report; S2: traversing the bad block scan results line by line, and adjusting the first bad block scan report based on the traversal results to obtain a second bad block scan report, wherein the second bad block scan report includes at least one processing strategy; S3: adjusting the target processing strategy in the second bad block scan report according to the real-time damage degree of the replica to obtain a third bad block scan report; S4: determining a bad block processing solution according to the processing strategy in the third bad block scan report.
[0211] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0212] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0213] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application.
Claims
1. A bad block processing method, characterized in that: The method comprises: In response to detecting a bad block scan request, performing a bad block scan operation on multiple nodes concurrently, obtaining a bad block scan result of each node, and initializing the bad block scan result to obtain a first bad block scan report; Traversing the bad block scanning results line by line, and adjusting the first bad block scanning report based on the traversal results to obtain a second bad block scanning report, wherein the second bad block scanning report includes at least one processing strategy; According to the real-time damage degree of the replica, the target processing strategy in the second bad block scanning report is adjusted to obtain a third bad block scanning report; A bad block processing solution is determined according to the processing strategy in the third bad block scanning report.
2. The bad block processing method according to claim 1, characterized in that: Initializing the bad block scan result to obtain a first bad block scan report includes: Obtaining a bad block scan result of each node, wherein the bad block scan result includes at least one row of scan results corresponding to a first target parameter, wherein the first target parameter includes at least a drive letter name, a bad block sector, and whether the bad block can be reset and whether it has been processed; The bad block scan result is initialized to obtain a first bad block scan report, wherein the first bad block scan report includes at least one line of results corresponding to the second target parameter, and the second target parameter includes at least: node, drive letter name, bad block sector, whether the bad block can be reset, pid value, number of copies, number of damaged copies and processing strategy.
3. The bad block processing method according to claim 1, characterized in that: Traversing the bad block scan results line by line, and adjusting the first bad block scan report based on the traversal results to obtain a second bad block scan report including: In response to detecting that the scan result of whether the bad block in the target row can be reset is that it cannot be reset, determining the number of replicas, the pid value, and the number of damaged replicas based on the scan result of the bad block sector in the target row; Determine a result corresponding to the target processing strategy based on the number of replicas, the pid value, and the number of damaged replicas; Add the number of replicas, pid value, number of damaged replicas, and the result corresponding to the target processing strategy corresponding to the target row to the corresponding row of the first bad block scan report, and traverse the next target row until the traversal operation on any row in the bad block scan result is completed; In response to detecting that any row in the bad block scan result has been traversed, an end mark row is added to the first bad block scan report to generate the second bad block scan report.
4. The bad block processing method according to claim 1, characterized in that: According to the real-time damage degree of the replica, the target processing strategy in the second bad block scanning report is adjusted, and the third bad block scanning report is obtained including: Reading a second bad block scan report and a value of a first element in the second bad block scan report, wherein the element is used to describe a row including a processing strategy; Sort the rows of the second bad block scan report in ascending order based on the pid value in each row, and mark each row; In response to detecting that the tag value of the current row is less than the first element value, obtaining the processing strategy field value in the current row; In response to detecting that the processing strategy field value is greater than or equal to the first preset value, reading the processing strategy field value in the next row and processing it; In response to detecting that the processing strategy field value is less than a first preset value, obtaining a first pid value of the current row, and comparing the first pid value with a second preset value; In response to detecting that the first pid value is less than or equal to a second preset value, reading a processing strategy field value in a next line and performing processing; In response to detecting that the first pid value is greater than a second preset value, obtaining a traversal record initial value, and when the traversal record initial value is a null value, defining the result corresponding to the current row as the traversal record initial value; When the traversal record initial value is not a null value, the second pid value in the traversal record initial value is obtained, and when the first pid value is greater than the second pid value, the result corresponding to the current row is defined as the traversal record initial value; When the first pid value is less than or equal to the second pid value, the number of damaged copies corresponding to the first pid value is increased by one; In response to detecting that the number of damaged copies corresponding to the first pid value is greater than or equal to a third preset value, the processing strategy of the row corresponding to the number of damaged copies is updated, and the number of damaged copies of the row corresponding to the number of damaged copies is updated, the result corresponding to the current row is defined as the initial value of the traversal record, the processing strategy field value in the next row is read, and processing is performed.
5. The bad block processing method according to claim 4, characterized in that: The method further comprises: In response to detecting that the mark value of the current row is greater than or equal to the first element value, reacquiring the second element value in the second bad block scan report; In response to detecting that the value of the second element is less than or equal to the value of the first element, detecting whether there is an end mark in the second bad block scan report; If there is no end mark, then after a preset time interval, the value of the second element in the second bad block scan report is obtained, and a processing strategy adjustment step is performed; If there is an end mark, output the third bad block scan report.
6. The bad block processing method according to claim 1, characterized in that: Determining a bad block processing solution according to the processing strategy in the third bad block scanning report includes: In response to detecting that the third bad block scan report contains a first target processing strategy, reading the first target processing strategy; Based on the first target processing strategy, determining a target node; Detect whether the storage service of the target node can be started normally; If the storage service of the target node cannot be started normally, the storage service is rebuilt.
7. The bad block processing method according to claim 6, characterized in that: The method further comprises: In response to detecting that the third bad block scan report does not contain the first target processing strategy and / or the storage service of the target node can be started normally, detecting whether the third bad block scan report contains the second target processing strategy; If the second target processing strategy is detected, then checking whether the business virtual machine can be started normally; If the business virtual machine cannot be started normally, rebuild the business virtual machine and restore the business of the business virtual machine based on the historical backup; If the business virtual machine can be started normally or the second target processing strategy is not detected, the bad block is reset to recover the data.
8. A bad block processing device, characterized in that: The device comprises: A scanning module, configured to concurrently perform bad block scanning operations on multiple nodes when a bad block scanning request is detected, obtain bad block scanning results of each node, and initialize the bad block scanning results to obtain a first bad block scanning report; A traversal module, configured to traverse the bad block scan result line by line, and adjust the first bad block scan report based on the traversal result to obtain a second bad block scan report, wherein the second bad block scan report includes at least one processing strategy; An adjustment module, configured to adjust the target processing strategy in the second bad block scanning report according to the real-time damage degree of the replica, to obtain a third bad block scanning report; The processing module is used to determine a bad block processing solution according to the processing strategy in the third bad block scanning report.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Solid state disk scanning method and device and related equipment
CN119883125A
