Data reading method and system

By setting the health level for the strip and reading the data based on the predicted read success of the data block, the problem of low data reading efficiency in the distributed storage system is solved, the reading efficiency is improved and the disk usage is extended. life.

CN112100150BInactive Publication Date: 2024-10-29SHENZHEN IPANEL TECH LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201910537985.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-06-17
Publication Date
2024-10-29
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In a distributed storage system, data reading efficiency is low, especially when reading data from one data block fails, the system will try to resume reading from other data blocks of the same strip, resulting in long reading time and inefficiency. Low.

Method used

By setting the health level for each strip, predict whether each data block can successfully read data based on the stripe's health level, and only read data from data blocks that are predicted to be successfully read to avoid being unhealthy. Read data from the data block, and modify the stripe health to record the results of the last read so that unhealthy data blocks can be avoided during the next read.

Benefits of technology

It improves data reading efficiency, saves the time of reading data from data blocks that cannot be successfully read, avoids unnecessary reading operations, and extends the service life of the disk.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112100150B_ABST
    Figure CN112100150B_ABST
Patent Text Reader

Abstract

The present invention provides a data reading method and system, in which the health of the stripe is set for each stripe, and after a file reading request is generated, the stripe information corresponding to the file is determined, the stripe information includes a stripe identifier and the health of the stripe, and whether the health identifier corresponding to each data block is healthy is determined according to the health of the stripe; for each data block, if the health identifier corresponding to the data block is determined to be healthy, data is read from the data block. It is achieved that whether data can be successfully read from each data block in the stripe can be predicted according to the health of the stripe, and data is only read from the data block predicted to be able to successfully read data, saving the time of reading data from the data block that cannot be successfully read, and before reading data, based on the health of the stripe obtained last time, avoid reading data from the data block that cannot be successfully read, thereby improving the data reading efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of data management, and in particular relates to a data reading method and system. Background Art

[0002] In a distributed storage system, all disks are managed uniformly, and each disk is divided into several data blocks according to a specific size, such as 4M. The data blocks obtained by dividing each disk are numbered starting from 0 to distinguish each data block. At least two data blocks are combined to form a stripe.

[0003] When reading data in a distributed system, after determining the data block storing the data, the data is read from the data block. When it is determined that the reading of data from the data block fails, the data is recovered through other data blocks in the stripe where the data block is located, resulting in a long reading time. And when it is necessary to read data from the data block where the reading failed again, the reading operation is still performed, resulting in low data reading efficiency. Summary of the invention

[0004] In view of this, an object of the present invention is to provide a data reading method and system to solve the problem of low data reading efficiency in the prior art.

[0005] The technical solution is as follows:

[0006] The present invention provides a data reading method, comprising:

[0007] After generating a file read request, determining the stripe information corresponding to the file; the stripe information at least includes a stripe identifier and a stripe health, the stripe identifier is used to uniquely identify the stripe, and the stripe health is composed of a health identifier of each data block constituting the stripe;

[0008] According to the health of the stripe, determine whether the health flag corresponding to each data block is healthy, wherein the health flag indicates whether data was successfully read from the data block last time;

[0009] For each data block, if it is determined that the health identifier corresponding to the data block is healthy, data is read from the data block.

[0010] Preferably, the stripe information also includes: data block information constituting the stripe, the data block information including the disk identifier of the disk where the data block is located, the link address of the disk where the data block is located, the block number of the data block on the disk, and the serial number of the data block in the stripe.

[0011] Preferably, determining whether the health identifier corresponding to each data block is healthy according to the health of the stripe includes:

[0012] For each data block, the binary 1 is moved from the lowest bit to the highest bit by the number of bits corresponding to the sequence number of the data block in the stripe to obtain a binary value;

[0013] The health of the stripe where the data block is located is bitwise ANDed with the obtained binary value to obtain the health identifier of the data block; the health of the stripe is in binary form, and the low bit to the high bit corresponds to the health identifiers of the data blocks from small to large.

[0014] If the binary value obtained after the bitwise AND calculation is 1, the health flag of the data block is determined to be healthy; if the binary value obtained after the bitwise AND calculation is 0, the health flag of the data block is determined to be unhealthy.

[0015] Preferably, reading data from the data block includes:

[0016] Linking the disk where the data block is located according to the disk link address of the disk where the data block is located;

[0017] After the disk is successfully linked, the disk location of the data block is calculated according to the data block number, internal offset address and size of the data to be read;

[0018] Reads data from the disk location.

[0019] Preferably, after reading data from the disk location, the method further comprises:

[0020] Get data reading status;

[0021] Determine whether the data reading status is a data reading failure;

[0022] If it is determined that the data reading status is a data reading failure, the health indicator corresponding to the data block in the health of the stripe is modified to unhealthy according to the stripe indicator of the stripe and the sequence number of the data block in the stripe.

[0023] The present application also provides a data reading system, comprising:

[0024] Data processing module and information management module;

[0025] The data processing module is used to determine the stripe information corresponding to the file from the information management module after generating a file read request; the stripe information at least includes a stripe identifier and a stripe health, the stripe identifier is used to uniquely identify the stripe, and the stripe health is composed of a health identifier of each data block constituting the stripe;

[0026] The data processing module is also used to determine whether the health identifier corresponding to each data block is healthy according to the health of the strip, and the health identifier indicates whether data was successfully read from the data block last time; for each data block, if it is determined that the health identifier corresponding to the data block is healthy, data is read from the data block.

[0027] Preferably, the system further comprises: a disk processing module;

[0028] The stripe information also includes: data block information that constitutes the stripe, the data block information includes the disk identifier of the disk where the data block is located, the link address of the disk where the data block is located, the block number of the data block on the disk, and the serial number of the data block in the stripe; the link address represents the link address used to link the disk processing module.

[0029] Preferably, the data processing module is also used to move the binary 1 from the lowest bit to the highest bit for each data block by the number of bits corresponding to the numerical value of the serial number of the data block in the stripe in which it is located, to obtain a binary value; perform a bitwise AND calculation on the health of the stripe in which the data block is located and the obtained binary value to obtain a health identifier of the data block; the health of the stripe is in binary form, and the data block identifiers from low to high bits correspond to the health identifiers of each data block from small to large; if the binary value obtained after the bitwise AND calculation is 1, the health identifier of the data block is determined to be healthy; if the binary value obtained after the bitwise AND calculation is 0, the health identifier of the data block is determined to be unhealthy.

[0030] Preferably, the data processing module is further used to, when determining that the health identifier corresponding to the data block is healthy, link the disk where the data block is located according to the disk connection address of the disk where the data block is located, and link to the disk processing module corresponding to the disk; and after successfully linking the disk, send the data block number, internal offset address and size of the data to be read of the data block to the disk processing module;

[0031] The disk processing module is used to calculate the disk position of the data block according to the data block number, internal offset address and size of the data to be read, and read data from the disk position.

[0032] Preferably, the disk processing module is further used to obtain the data reading status after reading the data from the disk position, and determine whether the data reading status is a data reading failure; if it is determined that the data reading status is a data reading failure, send the stripe identifier of the stripe, the sequence number of the data block in the stripe, and the data reading failure status to the information management module;

[0033] The information management module is used to modify the health indicator corresponding to the data block in the health of the stripe to unhealthy according to the stripe indicator of the stripe and the sequence number of the data block in the stripe.

[0034] Compared with the prior art, the technical solution provided by the present invention has the following advantages:

[0035] It can be seen from the above technical solution that the health of the stripe is set for each stripe in the present application. According to the health of the stripe, it can be predicted whether data can be successfully read from each data block in the stripe, and data is only read from the data blocks predicted to be able to be successfully read, saving the time of reading data from the data blocks that cannot be successfully read. Before reading the data, the health of the stripe obtained last time is used to avoid reading data from the data blocks that cannot be successfully read, thereby improving the data reading efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] 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 described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 It is a flow chart of a data reading method disclosed in the present invention;

[0038] Figure 2 is a flow chart of another data reading method disclosed in the present invention;

[0039] Figure 3 It is a structural schematic diagram of a data reading system disclosed in the present invention;

[0040] Figure 4 It is a structural schematic diagram of another data reading system disclosed in the present invention. DETAILED DESCRIPTION

[0041] In order to facilitate the understanding of this application, the technical terms are explained accordingly:

[0042] Distributed File System: The physical storage resources managed by the file system are not necessarily directly connected to the local node, but are connected to the node through a computer network. The design of the distributed file system is based on the client / server model. A typical network may include multiple servers for multiple users to access.

[0043] Disk: A device similar to tape is also used in the external storage of the computer. A commonly used one is called a disk, which is a round magnetic disk placed in a square sealed box. The purpose of this is to prevent scratches on the disk surface, which may lead to data loss.

[0044] Stripe: In a distributed system, all disks in a server cluster are managed uniformly, and each disk is identified by a diskid. Then these disks are grouped, generally in the mode of 4+2 / 6+3 / 8+4. For example, in the mode of 8+4, 8 means 8 disks are used to store the original data of the file, and 4 means 4 disks are used to store the encoded data. There are 12 disks in total. All disks in the distributed system are grouped in this way into several groups. Then the disks in each group are divided into stripes. That is, each disk is divided into several data blocks according to a certain size, such as 4M as a data block. In the disk, except for management information and other necessary information, the remaining disk space is all divided into data blocks. That is, assuming that a disk has 4T of storage space, in addition to management and other necessary space, there is 3T of space left, then this 3T of space is all divided into data space. The number of blocks obtained by dividing the data space by 4M is the number of all data blocks on this disk. Data blocks are numbered starting from 0, and the largest number is the number of data blocks minus 1. Each data block number is also called blockid. Get a data block from a group of disks and combine them together, which is 4 data blocks. This group of data blocks is called a stripe. A group of disks contains several such stripes.

[0045] Data block: A data block is a group of records arranged in sequence. It is a data unit transmitted between the main memory and the input, output device or external memory. It is a physical record of data. There are three ways of corresponding relationship between the logical record of data (a data unit that is logically connected and occupies a group of adjacent units in the memory): ① A block is a record; ② A block contains several logical records; ③ A logical record occupies several blocks. The size of a data block can be fixed or variable, and there are gaps between data blocks. The design of the data block size is affected by many factors, including input and output efficiency, storage space cost, and computer application characteristics. Each data block has a corresponding index node, which stores the index number of the data block. The system reads the data of the data block according to the index number.

[0046] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0047] Specifically, Figure 1 As shown, the data reading method provided in the embodiment of the present application may include the following steps:

[0048] S101. After generating a file read request, determine the stripe information corresponding to the file; the stripe information at least includes a stripe identifier and a stripe health, the stripe identifier is used to uniquely identify the stripe, and the stripe health is composed of a health identifier of each data block constituting the stripe.

[0049] A file is stored on at least one stripe, each stripe includes at least two data blocks, and each data block stores part of the data information of the file. Data blocks refer to data blocks obtained by dividing the disk into specific sizes, where the data blocks included in each stripe can be located on different disks.

[0050] After receiving a file read request, the stripe information corresponding to the file is determined according to the pre-established correspondence between the file and the stripe information. The stripe information includes at least a stripe identifier and a stripe health. The stripe identifier is used to uniquely identify the stripe, and the stripe health is used to indicate whether data can be successfully read from each data block in the stripe.

[0051] Each data block in the stripe has a health identifier corresponding to the data block, and the health identifiers of all data blocks in the stripe together constitute the health of the stripe.

[0052] For example, a stripe consists of four data blocks, and a four-bit binary number is used to represent the health of the stripe. Each binary bit represents a health flag corresponding to a data block. If the health flag is healthy, it is represented by binary 1, and if the health flag is unhealthy, it is represented by binary 0.

[0053] Each data block has a sequence number in the stripe, which corresponds to sequence numbers 0, 1, 2, and 3 from the low bit to the high bit. Sequence number 0 corresponds to data block 0, sequence number 1 corresponds to data block 1, sequence number 2 corresponds to data block 2, and sequence number 3 corresponds to data block 3.

[0054] For example, if the health of the stripe is 1111, it means that the four data blocks of the stripe are all healthy and data can be read from the data blocks; if the health of the stripe is 0000, it means that the four data blocks of the stripe are all unhealthy and data cannot be read from the data blocks; if the health of the stripe is 1011, it means that the health identifier of data block 0 in the stripe is 1, the health identifier of data block 1 is 1, the health identifier of data block 2 is 0, and the health identifier of data block 3 is 1, that is, data block 2 corresponding to sequence number 2 in the stripe is unhealthy, while the other three data blocks are healthy, and data cannot be read from the data block with sequence number 2 in the stripe.

[0055] S102: Determine whether a health indicator corresponding to each data block is healthy according to the health of the stripe, wherein the health indicator indicates whether data was successfully read from the data block last time.

[0056] For each data block, if it is determined that the health identifier corresponding to the data block is healthy, step S103 is executed;

[0057] For each data block, if it is determined that the health identifier corresponding to the data block is unhealthy, the operation of reading data from the data block is not performed, but the data is directly restored and read from other data blocks in the stripe where the data block is located.

[0058] Still taking a stripe including four data blocks as an example, the initial value of the stripe health can be set to 1111. In actual application, the health of the stripe is changed according to whether data is successfully read from the data blocks of the stripe.

[0059] For example, when reading data from four data blocks, data block 0, data block 1, data block 2, and data block 3, respectively according to the initial value 1111 of the health of the stripe, if reading data from data block 2 fails, but reading data from data blocks 0, 1, and 3 succeeds, the health 1111 of the stripe is modified to 1011. Next time when data is read from the stripe, whether the health flag corresponding to each data block in the stripe is healthy is determined based on the health 1011 of the stripe.

[0060] The operation of reading data from the data block is performed only when the health flag corresponding to the data block is 1. When the health flag corresponding to the data block is 0, the operation of reading data from the data block is not performed, but the data is directly recovered from other data blocks of the stripe, which saves the time required for reading data from the data blocks that cannot be successfully read, and improves the reading efficiency of reading data from the stripe.

[0061] S103: Read data from the data block.

[0062] Through the above technical solution, in this embodiment, the health of the stripe is set for each stripe. According to the health of the stripe, it can be predicted whether data can be successfully read from each data block in the stripe, and data is only read from the data blocks predicted to be able to be successfully read, saving the time of reading data from the data blocks that cannot be successfully read. Before reading the data, based on the health of the stripe obtained last time, avoid reading data from the data blocks that cannot be successfully read, thereby improving the data reading efficiency.

[0063] In other embodiments, the stripe information includes not only the stripe identifier and the health of the stripe, but also the information of the data blocks that make up the stripe, such as the disk identifier of the disk where the data block is located, the link address of the disk where the data block is located, the block number of the data block on the disk, and the serial number of the data block in the stripe.

[0064] Each stripe consists of at least two data blocks. All the data blocks included in each stripe are an ordered list. The information corresponding to each data block includes the disk identifier of the disk where the data block is located, the link address of the disk where the data block is located, the block number of the data block on the disk, and the serial number of the data block in the stripe.

[0065] The disk ID is used to uniquely identify the disk to determine which disk the data block comes from.

[0066] The link address refers to the link address used to link to the disk processor.

[0067] The block number refers to the number of the data block among all the data blocks in the disk where the data block is located. It is used to distinguish different data blocks in a disk, and the block number can be used to determine the location where the data is stored in the disk.

[0068] The sequence number in the stripe refers to the sequence number of the data block in the stripe.

[0069] For each file to be read, the stripe corresponding to the file and all data blocks included in each stripe can be determined according to the correspondence between the file and the stripe information.

[0070] The following is a detailed description of the method for reading data from a data block based on stripe information. Figure 2 As shown, the data reading method may include the following steps:

[0071] S201. After generating a file read request, determine the stripe information corresponding to the file; the stripe information includes the stripe identifier, the health of the stripe, and the data block list of the stripe; the data block list includes the disk identifier of the disk where each data block of the stripe is located, the disk link address, the block number on the disk, and the sequence number of each data block in the stripe.

[0072] The health of a stripe is composed of the health flags of each data block that makes up the stripe.

[0073] When storing files based on a distributed system, a correspondence between files and stripe information is established. After generating a file read request, based on the pre-established correspondence between files and stripe information, the stripe identifier corresponding to the file can be determined. The stripe identifier is used to uniquely identify the stripe, and then the stripe corresponding to the file can be determined. One file corresponds to at least one stripe.

[0074] Each stripe is provided with the health of the stripe, wherein the health of the stripe is composed of the health identifier of each data block constituting the stripe.

[0075] Corresponding to each stripe, the stripe information includes information about all data blocks that make up the stripe. For each data block, the stripe information includes the disk identifier of the disk where the data block is located, the link address of the disk where the data block is located, the block number of the data block on the disk, and the serial number of the data block in the stripe.

[0076] S202: For each data block, move the binary 1 from the lowest bit to the highest bit by the number of bits corresponding to the sequence number of the data block in the stripe to obtain a binary value.

[0077] After determining the health of the stripe, it is necessary to further determine the health flag of each data block in the stripe based on the health of the stripe to determine whether data can be read from the data block.

[0078] In this embodiment, the health of the stripe is in binary form, and the number of bits in the binary form is the same as the number of data blocks included in the stripe. The health of the stripe corresponds to the health identifiers of the data blocks in the stripe from small to large in sequence number from low to high.

[0079] For example, a stripe includes four data blocks, namely data block 0, data block 1, data block 2, and data block 3. The sequence number of data block 0 in the stripe is 0, the sequence number of data block 1 in the stripe is 1, the sequence number of data block 2 in the stripe is 2, and the sequence number of data block 3 in the stripe is 3.

[0080] The health flag of data block 0 is 1, the health flag of data block 1 is 1, the health flag of data block 2 is 0, and the health flag of data block 3 is 1, so the health of the stripe is 1011.

[0081] For a data block, after determining the serial number of the data block in the stripe, in order to determine the health indicator of the data block from the health of the stripe, the binary 1 is moved from the lowest bit to the highest bit by the number of bits corresponding to the serial number of the data block in the stripe.

[0082] For example, the serial number of data block 0 in the stripe is 0, so the binary 1 is moved from the lowest bit to the highest bit by 0 bits, and the resulting binary value is 0001.

[0083] The serial number of data block 1 in the stripe is 1, so the binary 1 is shifted by 0 bits from the lowest bit to the highest bit, and the resulting binary value is 0010.

[0084] The serial number of data block 2 in the stripe is 2, so the binary 1 is moved from the lowest bit to the highest bit by 0 bits, and the resulting binary value is 0100.

[0085] The serial number of data block 3 in the stripe is 3, so the binary 1 is moved from the lowest bit to the highest bit by 0 bits, and the resulting binary value is 1000.

[0086] It should be noted that the number of bits of the shifted binary value is the same as the number of all data blocks included in the stripe.

[0087] S203, performing bitwise AND calculation on the health of the stripe where the data block is located and the obtained binary value to obtain a health identifier of the data block; the health of the stripe is in binary form, and the low bit to the high bit corresponds to the health identifiers of the data blocks from small to large.

[0088] If the binary value obtained after the bitwise AND calculation is 1, the health flag of the data block is determined to be healthy; if the binary value obtained after the bitwise AND calculation is 0, the health flag of the data block is determined to be unhealthy.

[0089] Taking the stripe health of 1111 as an example, the health flag of data block 0 is determined by performing bitwise AND calculation on the stripe health 1111 and the binary value 0001 to obtain 0001. Then the health flag of data block 0 is 1, and the health flag of data block 0 is healthy.

[0090] Similarly, the health flag of data block 1 is determined by performing bitwise AND calculation on the health of the stripe 1111 and the binary value 0010 to obtain 0010. Then the health flag of data block 1 is 1, and the health flag of data block 1 is healthy.

[0091] The health flag of data block 2 is determined by performing bitwise AND calculation on the health of the stripe 1111 and the binary value 0100 to obtain 0100. Then the health flag of data block 2 is 1, and the health flag of data block 2 is healthy.

[0092] The health flag of data block 3 is determined by performing bitwise AND calculation on the health of the stripe 1111 and the binary value 1000 to obtain 1000. Then the health flag of data block 3 is 1, and the health flag of data block 3 is healthy.

[0093] Taking the stripe health of 1110 as an example, the health flag of data block 0 is determined by performing bitwise AND calculation on the stripe health 1110 and the binary value 0001 to obtain 0000. Then the health flag of data block 0 is 0, and the health flag of data block 0 is unhealthy.

[0094] Similarly, the health flag of data block 1 is determined by performing bitwise AND calculation on the health of the stripe 1110 and the binary value 0010 to obtain 0010. Then the health flag of data block 1 is 1, and the health flag of data block 1 is healthy.

[0095] The health flag of data block 2 is determined by performing bitwise AND calculation on the health of the stripe 1110 and the binary value 0100 to obtain 0100. Then the health flag of data block 2 is 1, and the health flag of data block 2 is healthy.

[0096] The health flag of data block 3 is determined by performing bitwise AND calculation on the health degree 1110 of the stripe and the binary value 1000 to obtain 1000. Then the health flag of data block 3 is 1, and the health flag of data block 3 is healthy.

[0097] S204: For each data block, if it is determined that the health identifier of the data block is healthy, link the disk where the data block is located according to the disk link address of the disk where the data block is located.

[0098] S205: After the disk is successfully linked, the disk location of the data block is calculated according to the data block number, the internal offset address and the size of the data to be read.

[0099] The calculation method is: calculate the product of the data block number and the data block size, then calculate the sum of the product result and the internal offset address to calculate the starting position. Finally, calculate the sum of the starting position and the size of the data to be read to get the end position.

[0100] For example, a stripe includes 4 data blocks, each of which is 4M in size. Data is read from data block 0 of which serial number is 0 in the stripe, and the internal offset address is 0, that is, data is read from the initial position of data block 0, and data of 4M in size is read, thereby completing the reading of data in data block 0. The internal offset address is greater than or equal to 0 and less than the size of the data block 4M, and the sum of the size of the read data and the internal offset address cannot exceed the size of a data block 4M.

[0101] S206: Read data from the disk location.

[0102] Data is read starting from the beginning of the disk and ending at the end of the disk.

[0103] After performing the operation of reading data from a disk location, there are two cases. One case is that the data is successfully read, and the other case is that the data reading fails.

[0104] To save the time required for the next data reading, it is necessary to update the health of the stripe according to the result of the data reading. Therefore, after reading data from the disk location, the following steps are also included:

[0105] S207. Obtain the data reading status.

[0106] The data reading status includes successful data reading and failed data reading.

[0107] S208. Determine whether the data reading status is failed data reading;

[0108] If it is determined that the data reading status is failed data reading, then step S209 is executed;

[0109] If it is determined that the data reading status is successful data reading, then the read data is output.

[0110] S209. According to the stripe identifier of the stripe and the sequence number of the data block in the stripe where it is located, modify the health identifier corresponding to the data block in the health of the stripe to unhealthy.

[0111] One implementation of modifying the health of the stripe is to modify the health of the stripe based on the formula: health = health & ~(1 << i).

[0112] Among them, health represents the health of the stripe. 1 << i represents that the binary 1 moves i bits from the low bit to the high bit. & represents bitwise AND calculation. ~ represents bitwise NOT calculation.

[0113] For example, if the health of the stripe is 0110, then the health identifier of data block 0 with sequence number 0 in the stripe is 0, the health identifier of data block 1 with sequence number 1 is 1, the health identifier of data block 2 with sequence number 2 is 1, the health identifier of data block 3 with sequence number 3 is 0. After only performing the data reading operation from data block 1 and data block 2, the data is successfully read from data block 1, and the data reading fails from data block 2. Then, it is necessary to modify the health identifier corresponding to data block 2 in the health of the stripe to 0 to avoid the problem of long data reading time caused by reading data from data block 2 next time.

[0114] Modify based on the formula health = 0110 & ~(1 << 2). The result of 1 << 2 is 0100, the result of ~(1 << 2) is 1011, and finally calculate the bitwise AND of 0110 and 1011, getting health = 0010, which realizes modifying the health flag of data block 2 corresponding to serial number 2 to 0, obtaining the health degree of the modified stripe as 0010. Based on the health degree of this stripe, data can only be read from data block 1 with serial number 1.

[0115] It should be noted that in the actual application process, there is also a situation where after processing the data block from which data cannot be successfully read, data can be successfully read from this data block again. For this kind of situation, it is necessary to modify the health flag corresponding to the data block in the health degree of the stripe to 1.

[0116] Modify the health flag corresponding to the data block based on the formula health = health | (1 << i). Among them, 1 << i means that the binary 1 moves i bits from the low bit to the high bit. | represents an OR operation.

[0117] For example, if the health degree of the stripe is 0010, then the health flag of data block 0 with serial number 0 in the stripe is 0, the health flag of data block 1 with serial number 1 is 1, the health flag of data block 2 with serial number 2 is 0, and the health flag of data block 3 with serial number 3 is 0. If it is determined at this time that data can be successfully read from data block 2, it is necessary to modify the health flag of data block 2 to 1.

[0118] Modify based on the formula health = 0010 | (1 << 2). The result of 1 << 2 is 0100, and then perform a bitwise OR operation on 0010 and 0100, getting health = 0110, which realizes modifying the health flag of data block 2 corresponding to serial number 2 to 1, obtaining the health degree of the modified stripe as 0110. Based on the health degree of this stripe, data can be read from data block 1 with serial number 1 and data block 2 with serial number 2.

[0119] Through the above technical solution, in this embodiment, the health degree of each stripe is set. According to the health degree of the stripe, it can be predicted whether data can be successfully read from each data block in this stripe, and data is only read from the data blocks that are predicted to be able to successfully read data, saving the time for reading data from the data blocks from which data cannot be successfully read, and before reading data, based on the health degree of the stripe obtained last time, avoiding reading data from the data blocks from which data cannot be successfully read, improving the data reading efficiency.

[0120] Corresponding to the data reading method disclosed in the above embodiment, this embodiment provides a data reading system. Refer to Figure 3 As shown, this system may include:

[0121] Data processing module 301 and information management module 302.

[0122] The data processing module 301 is used to determine the stripe information corresponding to the file from the information management module 302 after generating a file read request; the stripe information at least includes a stripe identifier and a stripe health, the stripe identifier is used to uniquely identify the stripe, and the stripe health is composed of a health identifier of each data block constituting the stripe;

[0123] The data processing module 301 is also used to determine whether the health identifier corresponding to each data block is healthy according to the health of the strip, and the health identifier indicates whether the data was successfully read from the data block last time; for each data block, if it is determined that the health identifier corresponding to the data block is healthy, the data is read from the data block.

[0124] Through the above technical solution, in this embodiment, the health of the stripe is set for each stripe. According to the health of the stripe, it can be predicted whether data can be successfully read from each data block in the stripe, and data is only read from the data blocks predicted to be able to be successfully read, saving the time of reading data from the data blocks that cannot be successfully read. Before reading the data, based on the health of the stripe obtained last time, avoid reading data from the data blocks that cannot be successfully read, thereby improving the data reading efficiency.

[0125] exist Figure 3 Based on the system shown in FIG. 1 , this embodiment discloses another data reading system, see Figure 4 As shown, it also includes: a disk processing module 401.

[0126] In this embodiment, the stripe information includes not only the stripe identification and the health of the stripe, but also the data block information that constitutes the stripe, the data block information includes the disk identification of the disk where the data block is located, the link address of the disk where the data block is located, the block number of the data block on the disk, and the serial number of the data block in the stripe; the link address represents the link address used to link the disk processing module.

[0127] The data processing module 301 is also used to move the binary 1 from the lowest bit to the highest bit for each data block by the number of bits corresponding to the numerical value of the serial number of the data block in the stripe where it is located, to obtain a binary value; perform a bitwise AND calculation on the health of the stripe where the data block is located and the obtained binary value to obtain a health identifier of the data block; the health of the stripe is in binary form, and the data block identifiers from low to high bits correspond to the health identifiers of each data block from small to large; if the binary value obtained after the bitwise AND calculation is 1, the health identifier of the data block is determined to be healthy; if the binary value obtained after the bitwise AND calculation is 0, the health identifier of the data block is determined to be unhealthy.

[0128] The data processing module 301 is further used to, when determining that the health identifier corresponding to the data block is healthy, link the disk where the data block is located according to the disk connection address of the disk where the data block is located, and link to the disk processing module 401 corresponding to the disk; and after successfully linking the disk, send the data block number, internal offset address and size of the data to be read of the data block to the disk processing module 401;

[0129] The disk processing module 401 is used to calculate the disk position of the data block according to the data block number, internal offset address and size of the data to be read, and read the data from the disk position.

[0130] The disk processing module 401 is further used to obtain a data reading status after reading data from the disk position, and determine whether the data reading status is a data reading failure;

[0131] If it is determined that the data reading status is that the data reading is successful, the data reading success status is returned to the data processing module 301 , and the read data is returned to the data processing module 301 .

[0132] If it is determined that the data reading status is a data reading failure, the stripe identifier of the stripe, the serial number of the data block in the stripe, and the data reading failure status are sent to the information management module 302; at the same time, the disk processing module 401 also returns the data reading failure status to the data processing module 301, so that the data processing module 301 performs data recovery reading through other data blocks in the stripe (data blocks whose health identifier is 1).

[0133] The information management module 302 is used to modify the health indicator corresponding to the data block in the health of the stripe to unhealthy according to the stripe indicator of the stripe and the sequence number of the data block in the stripe.

[0134] When the data processing module 301 reads data from the same data block in the stripe again, the health of the stripe is first obtained from the information management module 302. Since the health flag of the data block that could not be successfully read was set to 0 when reading data from the data block last time, it avoids reading data from the data block with the health flag of 0, and directly recovers and reads the data in the data block that could not be successfully read from the data block with the health flag of 1 in the stripe. The number of times the data blocks that have been read for the disk with bad blocks is greatly reduced, not only the efficiency of data reading in the distributed system is improved, but also because it avoids reading data from the data blocks with bad blocks on the disk multiple times, it avoids the problem of the disk temperature rising due to the disk increasing the voltage to read data from the bad blocks, thereby avoiding the problem of accelerated aging of the disk and improving the service life of the disk.

[0135] For the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the order of the actions described, because according to the present invention, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0136] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0137] Finally, 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 presence of other identical elements in the process, method, article or device including the elements.

[0138] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0139] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A data reading method, It is characterized in that include: After generating a file read request, determining the stripe information corresponding to the file; the stripe information at least includes a stripe identifier and a stripe health, the stripe identifier is used to uniquely identify the stripe, and the stripe health is composed of a health identifier of each data block constituting the stripe; According to the health of the stripe, determine whether the health flag corresponding to each data block is healthy, wherein the health flag indicates whether data was successfully read from the data block last time; For each data block, if it is determined that the health identifier corresponding to the data block is healthy, then data is read from the data block; The stripe information also includes: data block information constituting the stripe, the data block information includes the disk identifier of the disk where the data block is located, the link address of the disk where the data block is located, the block number of the data block on the disk, and the serial number of the data block in the stripe; The step of determining whether the health identifier corresponding to each data block is healthy according to the health of the stripe includes: For each data block, the binary 1 is moved from the lowest bit to the highest bit by the number of bits corresponding to the sequence number of the data block in the stripe to obtain a binary value; The health of the stripe where the data block is located is bitwise ANDed with the obtained binary value to obtain the health identifier of the data block; the health of the stripe is in binary form, and the low bit to the high bit corresponds to the health identifiers of the data blocks from small to large. If the binary value obtained after the bitwise AND calculation is 1, the health flag of the data block is determined to be healthy; if the binary value obtained after the bitwise AND calculation is 0, the health flag of the data block is determined to be unhealthy.

2. The method according to claim 1, It is characterized in that The reading of data from the data block comprises: Linking the disk where the data block is located according to the disk link address of the disk where the data block is located; After the disk is successfully linked, the disk location of the data block is calculated according to the data block number, internal offset address and size of the data to be read; Reads data from the disk location.

3. The method according to claim 2, It is characterized in that After reading data from the disk location, the method further includes: Get data reading status; Determine whether the data reading status is a data reading failure; If it is determined that the data reading status is a data reading failure, the health indicator corresponding to the data block in the health of the stripe is modified to unhealthy according to the stripe indicator of the stripe and the sequence number of the data block in the stripe.

4. A data reading system, It is characterized in that include: Data processing module and information management module; The data processing module is used to determine the stripe information corresponding to the file from the information management module after generating a file read request; the stripe information at least includes a stripe identifier and a stripe health, the stripe identifier is used to uniquely identify the stripe, and the stripe health is composed of a health identifier of each data block constituting the stripe; The data processing module is further used to determine whether the health identifier corresponding to each data block is healthy according to the health of the stripe, and the health identifier indicates whether data was successfully read from the data block last time; for each data block, if it is determined that the health identifier corresponding to the data block is healthy, then read the data from the data block; Wherein, the system further comprises: a disk processing module; The stripe information also includes: data block information constituting the stripe, the data block information including the disk identifier of the disk where the data block is located, the link address of the disk where the data block is located, the block number of the data block on the disk, and the serial number of the data block in the stripe; Among them, the data processing module is also used to move the binary 1 from the lowest bit to the highest bit for each data block by the number of bits corresponding to the numerical value of the serial number of the data block in the stripe where it is located, to obtain a binary value; perform a bitwise AND calculation on the health of the stripe where the data block is located and the obtained binary value to obtain a health identifier of the data block; the health of the stripe is in binary form, and the data block identifiers from low to high bits correspond to the health identifiers of each data block from small to large; if the binary value obtained after the bitwise AND calculation is 1, the health identifier of the data block is determined to be healthy; if the binary value obtained after the bitwise AND calculation is 0, the health identifier of the data block is determined to be unhealthy.

5. The system according to claim 4, It is characterized in that The data processing module is further configured to, when determining that the health identifier corresponding to the data block is healthy, link the disk where the data block is located according to the disk connection address of the disk where the data block is located, and link to the disk processing module corresponding to the disk; and after successfully linking the disk, send the data block number, internal offset address and size of the data to be read of the data block to the disk processing module; The disk processing module is used to calculate the disk position of the data block according to the data block number, internal offset address and size of the data to be read, and read data from the disk position.

6. The system according to claim 5, It is characterized in that The disk processing module is further used to obtain the data reading status after reading the data from the disk position, and determine whether the data reading status is a data reading failure; if it is determined that the data reading status is a data reading failure, send the stripe identifier of the stripe, the sequence number of the data block in the stripe, and the data reading failure status to the information management module; The information management module is used to modify the health indicator corresponding to the data block in the health of the stripe to unhealthy according to the stripe indicator of the stripe and the sequence number of the data block in the stripe.

Citation Information

Patent Citations

  • Video data storage method and system

    CN105404469A

  • Prioritizing data reconstruction in distributed storage systems

    CN105960639A