A data reading method, apparatus, electronic device, and storage medium
By pre-reading metadata and replica data to locations with faster processing speeds in the storage system, the problem of slow read speeds when logical disks are damaged is solved, thus improving repair efficiency.
Patent Information
- Application Number
- CN202310180718.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-28
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2043-02-28
AI Technical Summary
In a storage system, when a logical disk fails, the repair process involves reading normal replica data from other nodes. However, the large amount of data stored in a location with slow processing speed results in low repair efficiency.
By identifying the target node associated with the logical disk to be repaired, the initial metadata is pre-read to the target node's fast memory or solid-state drive location, and the initial copy data is pre-read to the solid-state drive based on the current metadata, thereby improving data reading speed.
It improves the speed of reading normal replica data from the target node and enhances the efficiency of logical disk repair, especially the data reading efficiency when repairing multiple objects in batches.
Smart Images

Figure CN116126249B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to computer technology, and in particular, to a data reading method and device, electronic equipment and storage medium. BACKGROUND
[0002] For a storage system, in order to guarantee the availability of data, a node copy mode can be used for data storage, for example, setting different nodes to store the same copy data in the storage system.
[0003] If a logical disk is damaged, the damaged logical disk is usually repaired by reading normal copy data of other nodes. Since the amount of copy data required for repairing the logical disk is large and is usually stored in a location with slow processing speed, the reading speed is slow when reading the normal copy data, which reduces the subsequent logical disk repair efficiency. SUMMARY
[0004] The present application provides a data reading method, device, electronic equipment and storage medium to improve the efficiency of data reading.
[0005] According to an aspect of the present application, a data reading method is provided, which comprises:
[0006] In response to a logical disk repair request for a to-be-repaired logical disk, a target node associated with the to-be-repaired logical disk is determined, and initial metadata in the target node is pre-read to a first target position of the target node to obtain current metadata; wherein the first target position comprises a target memory of the target node; the target node is a normal node associated with the to-be-repaired logical disk in a preset storage system;
[0007] According to the current metadata, initial copy data in the target node is pre-read to a second target position of the target node to obtain current copy data; wherein the second target position comprises a target solid state disk of the target node;
[0008] According to the logical disk repair request, the current copy data is read to write the current copy data into the to-be-repaired logical disk.
[0009] Optionally, pre-reading the initial metadata in the target node to the first target position of the target node comprises:
[0010] Obtaining candidate disk position information of the initial metadata, and determining target disk position information from the candidate disk position information;
[0011] transmit the target disk location information to the memory management module, so that the memory management module calls the solid state disk management module to read the target metadata in the initial metadata according to the target disk location information;
[0012] store the target metadata to the first target location according to the preset storage mode.
[0013] The advantages of such settings are that candidate disk location information of the initial metadata is obtained, and the target disk location information is determined from the candidate disk location information; the target disk location information is transmitted to the memory management module, so that the memory management module calls the solid state disk management module to read the target metadata in the initial metadata according to the target disk location information, so that the initial metadata that needs to be read can be obtained. The target metadata is stored to the first target location with faster processing speed according to the preset storage mode, and the current metadata is obtained, which facilitates subsequent pre-reading of the initial copy data according to the current metadata to improve the data reading speed.
[0014] Optionally, after the target metadata is stored to the first target location according to the preset storage mode, the method further includes:
[0015] determining target index information according to the preset storage mode;
[0016] storing the target index information to a first storage structure of the first target location.
[0017] The advantages of such settings are that subsequent target metadata located in the first target location can be quickly found according to the first storage structure, and the searching efficiency of the target metadata is improved.
[0018] Optionally, the initial copy data in the target node is pre-read to a second target location of the target node according to the current metadata, including:
[0019] determining storage location information of the initial copy data according to the current metadata in response to a copy data reading request;
[0020] pre-reading data of a preset size in the initial copy data to the second target location through the storage location information.
[0021] The advantages of such settings are that the storage location information of the initial copy data is determined according to the current metadata in the position with faster processing speed, the acquisition efficiency of the storage location information is improved, and the subsequent reading efficiency of the initial copy data is improved. And the data of a preset size in the initial copy data is pre-read to the second target location through the storage location information, so that the initial copy data can be read in the case that the storage space of the second target location is limited.
[0022] Optionally, after obtaining the copy data read request, the method further comprises:
[0023] determining whether the to-be-read copy data is located at the second target position;
[0024] if not, reading the to-be-read copy data from a third target position of the target node; wherein the third target position comprises a target mechanical hard disk of the target node.
[0025] In this way, when the initial copy data does not exist in the second target position, reading is performed from the third target position, avoiding the problem that when the initial copy data originally exists in the second target position, directly reading from the third target position may cause reading failure and reduce data reading efficiency. When the initial copy data exists in the second target position, reading operation on the third target position is not required, improving data reading efficiency.
[0026] Optionally, after reading the to-be-read copy data from the third target position of the target node, the method further comprises:
[0027] updating a data mapping relationship between the second target position and the third target position in a second storage structure of the second target position.
[0028] In this way, after reading the to-be-read copy data from the third target position of the target node to the second target position, the data mapping relationship between the second target position and the third target position is updated in time, facilitating direct acquisition of the to-be-read copy data in the second target position in subsequent searching, without the need for searching through other manners, improving searching efficiency.
[0029] According to another aspect of the present application, a data reading device is provided, which comprises:
[0030] a metadata pre-reading module configured to, in response to a logical disk repair request for a to-be-repaired logical disk, determine a target node associated with the to-be-repaired logical disk, and pre-read initial metadata in the target node to a first target position of the target node to obtain current metadata; wherein the first target position comprises a target memory of the target node; and the target node is a normal node in a preset storage system associated with the to-be-repaired logical disk;
[0031] a copy data pre-reading module configured to, according to the current metadata, pre-read initial copy data in the target node to a second target position of the target node to obtain current copy data; wherein the second target position comprises a target solid state disk of the target node.
[0032] A copy data reading module is configured to read the current copy data according to the logical disk repair request, and write the current copy data into the logical disk to be repaired.
[0033] According to another aspect of the present application, there is provided an electronic device, comprising:
[0034] at least one processor; and
[0035] a memory in communication with the at least one processor; wherein
[0036] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the data reading method according to any one of the embodiments of the present application.
[0037] According to another aspect of the present application, there is provided a computer readable storage medium storing computer instructions for enabling a processor to implement the data reading method according to any one of the embodiments of the present application when executed by the processor.
[0038] The technical solution of the embodiments of the present application, by responding to the logical disk repair request for the logical disk to be repaired, determining the target node associated with the logical disk to be repaired, and pre-reading the initial metadata in the target node to the first target position of the target node, obtaining the current metadata, improving the speed of subsequent initial copy data pre-reading, according to the current metadata, pre-reading the initial copy data in the target node to the second target position of the target node, obtaining the current copy data, improving the speed of reading normal copy data from the target node of the logical disk to be repaired. If the logical disk is damaged, the normal copy data of other nodes is usually read to repair the damaged logical disk, and the repaired logical disk is usually batch repaired for multiple objects in the logical disk, so the amount of data read from the normal node is correspondingly larger. And because the normal copy data itself has a large amount of data, it is usually stored in a position with slow processing speed, so the reading speed of the logical disk to be repaired is slow when reading the normal copy data, which reduces the efficiency of subsequent damaged logical disk repair. The beneficial effect of improving the reading efficiency of normal copy data is achieved.
[0039] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0040] Figure 1 A flowchart of a data reading method provided for Embodiment One of the present application;
[0041] Figure 2 A node schematic diagram is provided for the first embodiment of the present application;
[0042] Figure 3 A flow chart of a data reading method is provided for the second embodiment of the present application;
[0043] Figure 4 A flow chart of a data reading method is provided for the third embodiment of the present application;
[0044] Fig. 5(a) is a schematic diagram of an application scenario of data reading without the technical solution of the present application;
[0045] Fig. 5(b) is a schematic diagram of an application scenario of data reading with the technical solution of the present application;
[0046] Figure 6 A structural schematic diagram of a data reading device is provided for the fourth embodiment of the present application;
[0047] Figure 7 A structural schematic diagram of an electronic device for implementing the embodiments of the present application. DETAILED DESCRIPTION
[0048] In order to make the person skilled in the art better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by the person skilled in the art without creative labor should be within the protection scope of the present application.
[0049] It should be noted that the terms "first", "second", "target" and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0050] Embodiment one
[0051] Figure 1A flow chart of a data reading method provided by the embodiment one of the present application, the embodiment can be applied to the case of repairing a logical disk, the method can be executed by the data reading device provided by the embodiment of the present application, and the device can be realized by software and / or hardware. Referring to Figure 1 , the data reading method provided by the embodiment includes:
[0052] Step 110, in response to a logical disk repair request for a logical disk to be repaired, determining a target node associated with the logical disk to be repaired, and pre-reading initial metadata in the target node to a first target position of the target node to obtain current metadata; wherein the first target position includes a target memory of the target node; and the target node is a normal node associated with the logical disk to be repaired in a preset storage system.
[0053] The logical disk to be repaired is a logical disk with damaged copy data in a node of a preset storage system; the logical disk is a virtual disk divided from a physical disk in the node; the copy data is data of an object stored in a copy mode in the virtual disk, that is, multiple copies of the data of the same object exist in different positions; the object is a saved form of a file in the preset storage system, and multiple objects exist in each logical disk; the preset storage system is a system capable of storing data redundantly in a copy mode, for example, a distributed storage system, and the embodiment does not limit this.
[0054] The target node is a normal node having an associated relationship with the logical disk to be repaired, and can be one or more; the normal node is a node that has not been damaged and is working normally. The associated relationship can be that the logical disk in the target node stores the same copy data as the logical disk to be repaired, or the copy data of the logical disk to be repaired can be calculated from the copy data stored in the logical disk in the target node, and the embodiment does not limit this.
[0055] Figure 2 A node schematic diagram is provided for the embodiment one of the present application. As shown in Figure 2 , node 1 is a node where a logical disk to be repaired is located, node 1 and node 2 are nodes storing the same copy data, and each includes copy A and copy B; copy A and copy B in node 1 are damaged, and copy A and copy B in node 2 are normal. Each node data storage position includes memory, solid state disk and mechanical hard disk. The processing speeds of the memory, the solid state disk and the mechanical hard disk are different, the processing speed of the memory is the fastest and the space is the smallest, the processing speed of the mechanical hard disk is the slowest and the space is the largest, and the processing speed of the solid state disk is between the two. Since the data amount of the metadata is usually small and the data amount of the copy data is usually large, the metadata is usually stored in the solid state disk and the copy data is usually stored in the mechanical hard disk. The data frequently or recently used is stored in the memory.
[0056] The logical disk repair request of the logical disk to be repaired is a request for repairing the damaged logical disk, which can be manually issued or automatically issued when any logical disk meets a preset damage condition, such as a condition that a copy data or metadata damage rate in the logical disk exceeds a preset threshold, and the embodiment does not limit this.
[0057] The initial metadata in the target node is metadata that has not been pre-read, and is usually stored in a target solid state disk of the target node, or can be stored in other locations of the target node, and the embodiment does not limit this. The metadata is data required for management of an object.
[0058] The initial metadata is pre-read and stored in a first target location of the target node to obtain current metadata, wherein the pre-reading is an operation of reading data that can be used in advance and storing the data, and the initial metadata read at this time can remain in the original location, and the embodiment does not limit this.
[0059] The first target location includes a target memory of the target node, and the target memory is a memory of the target node. The first target location can also include other locations that have a faster processing speed than the location of the initial metadata. For example, if the initial metadata is located in the target solid state disk, the initial metadata can be read to the target memory. If the initial metadata is located in the target mechanical hard disk, the initial metadata can be read to the target solid state disk.
[0060] In step 120, the initial copy data in the target node is pre-read to a second target location of the target node according to the current metadata to obtain current copy data, and the second target location includes a target solid state disk of the target node.
[0061] Since the current metadata includes the copy data location of the initial copy data in the target node, the initial copy data in the target node can be pre-read to the second target location of the target node according to the copy data location to obtain the current copy data, and the first copy metadata read at this time can remain in the original location, and the embodiment does not limit this. The initial copy data is copy data in the target node that has not been pre-read, and is usually stored in a target mechanical hard disk of the target node, or can be stored in other locations of the target node, and the embodiment does not limit this.
[0062] The second target location includes a target solid state disk of the target node, and the target solid state disk is a solid state disk of the target node. The second target location can also include other locations that have a faster processing speed than the location of the initial copy data. For example, if the initial copy data is located in the target mechanical hard disk, the initial copy data can be read to the target solid state disk. If the initial copy data is located in the target solid state disk, the initial copy data can be read to the target memory.
[0063] In step 130, the current copy data is read according to the logical disk repair request to write the current copy data to the logical disk to be repaired.
[0064] According to the logical disk repair request, the data writing position can be determined, so that the current copy data is read to the data writing position of the logical disk to be repaired, for example, the position of the damaged copy data in the logical disk to be repaired. The reading method of the current copy data can be reading all the current copy data to the logical disk to be repaired, or reading the corresponding current copy data in the request according to the logical disk repair request. The present embodiment does not limit this.
[0065] The technical solution provided by the present embodiment, in response to the logical disk repair request for the logical disk to be repaired, determines the target node associated with the logical disk to be repaired, and pre-reads the initial metadata in the target node to the first target position of the target node to obtain the current metadata, which improves the speed of subsequent initial copy data pre-reading. According to the current metadata, the initial copy data in the target node is pre-read to the second target position of the target node to obtain the current copy data, which improves the speed of reading normal copy data from the target node by the logical disk to be repaired.
[0066] If the logical disk is damaged, the normal copy data of other nodes is usually read to repair the damaged logical disk. The repaired logical disk is usually a batch repair of multiple objects in the logical disk, so the amount of data read from the normal node is correspondingly large. And because the normal copy data itself has a large data volume, it is usually stored in a position with slow processing speed, so the reading speed of the logical disk to be repaired is slow when reading the normal copy data, which reduces the efficiency of subsequent damaged logical disk repair. The beneficial effect of improving the reading efficiency of normal copy data is achieved.
[0067] Embodiment two
[0068] Figure 3 The flowchart of the data reading method provided by the second embodiment of the present application is a supplementary description of the process of pre-reading the initial metadata in the target node to the first target position of the target node. Compared with the above-mentioned solution, the present solution is specifically optimized as follows:
[0069] Obtain the candidate disk position information of the initial metadata, and determine the target disk position information from the candidate disk position information;
[0070] The target disk position information is transmitted to the memory management module, so that the memory management module calls the solid state disk management module to read the target metadata in the initial metadata according to the target disk position information;
[0071] The target metadata is stored into a first target position according to a preset storage mode. Specifically, a flowchart of the data reading method is as shown in Figure 3
[0072] Step 310, in response to a logical disk repair request for a to-be-repaired logical disk, determining a target node associated with the to-be-repaired logical disk, obtaining candidate disk position information of initial metadata, and determining target disk position information from the candidate disk position information; wherein the target node is a normal node in a preset storage system associated with the to-be-repaired logical disk.
[0073] The candidate disk position information is disk position information of all initial metadata, and the target disk position information can be disk position information corresponding to initial metadata that needs to be read. The disk position information can include a specific disk number, an offset position, and other information indicating the position of the initial metadata. Determining the target disk position information from the candidate disk position information can mean determining all candidate disk position information as the target disk position information, i.e., reading all initial metadata subsequently. Alternatively, it can mean determining initial metadata associated with current copy data that needs to be read according to the logical disk repair request, and then determining disk position information corresponding to the initial metadata as the target disk position information. The present embodiment does not limit this.
[0074] Step 320, transmitting the target disk position information to a memory management module, so that the memory management module calls a solid state disk management module to read target metadata in the initial metadata according to the target disk position information.
[0075] The memory management module is used for managing a target memory, and the solid state disk management module is used for managing a target solid state disk. After the target disk position information is transmitted to the memory management module, the memory management module calls the solid state disk management module according to the target disk position information, so that the memory management module reads the target metadata in the initial metadata from the target disk position information of the target solid state disk. The target metadata corresponds to the target disk position information. When the target disk position information is all candidate disk position information, the target metadata is all initial metadata. When the target disk position information is part of the candidate disk position information, the target metadata is part of the initial metadata.
[0076] Step 330, storing the target metadata into a first target position according to a preset storage mode, to obtain current metadata; wherein the first target position includes a target memory of the target node.
[0077] The read target metadata is stored in the first target position according to a preset storage mode. The preset storage mode can be storage according to a read order or storage according to mapping of target disk position information corresponding to the target metadata to the first target position. The embodiment is not limited in this regard.
[0078] Optionally, after storing the target metadata in the first target position according to the preset storage mode, the method further includes:
[0079] Determining target index information according to the preset storage mode.
[0080] Storing the target index information in a first storage structure of the first target position.
[0081] The target index information can be disk ID and disk position information obtained after the target metadata is stored in the first target position. The embodiment is not limited in this regard. The first storage structure is used for storing the target index information in the first target position and can be a radix tree. The embodiment is not limited in this regard.
[0082] The advantage of this arrangement is that subsequent target metadata in the first target position can be quickly found according to the first storage structure, and the efficiency of finding the target metadata is improved.
[0083] Step 340: reading initial copy data in the target node to a second target position of the target node according to the current metadata to obtain current copy data. The second target position includes a target solid state disk of the target node.
[0084] Step 350: reading the current copy data according to a logical disk repair request to write the current copy data into a to-be-repaired logical disk.
[0085] The embodiment of the application obtains candidate disk position information of initial metadata and determines target disk position information from the candidate disk position information. The target disk position information is transmitted to a memory management module, so that the memory management module calls a solid state disk management module to read target metadata in the initial metadata according to the target disk position information, thereby obtaining initial metadata that needs to be read. The target metadata is stored in a first target position with high processing speed according to a preset storage mode to obtain current metadata, which facilitates subsequent pre-reading of initial copy data according to the current metadata to improve the speed of data reading.
[0086] Embodiment three
[0087] Figure 4A flowchart of a data reading method provided for embodiment three of the present application, the technical solution is supplementary to the process of pre-reading the initial copy data in the target node to the second target position of the target node according to the current metadata. Compared with the above-mentioned solution, the specific optimization of the present solution is to pre-read the initial copy data in the target node to the second target position of the target node according to the current metadata, which includes:
[0088] In response to the copy data reading request, the storage location information of the initial copy data is determined according to the current metadata;
[0089] The data of the preset size in the initial copy data is pre-read to the second target position through the storage location information.
[0090] Specifically, the flowchart of the data reading method is as shown in Figure 4 .
[0091] Step 410, in response to a logical disk repair request for a to-be-repaired logical disk, a target node associated with the to-be-repaired logical disk is determined, and the initial metadata in the target node is pre-read to a first target position of the target node to obtain current metadata; wherein the first target position includes a target memory of the target node; the target node is a normal node associated with the to-be-repaired logical disk in a preset storage system.
[0092] Step 420, in response to a copy data reading request, the storage location information of the initial copy data is determined according to the current metadata.
[0093] The copy data reading request is used to request to read the initial copy data, which can be issued by human or automatically issued after the current metadata is pre-read, and the present embodiment does not limit this. The storage location information is information related to the storage location of the initial copy data, such as the disk number where the initial copy data is stored, and the present embodiment does not limit this. The storage location information of the initial copy data is determined according to the current metadata, that is, the position information of the initial copy data is obtained from the current metadata.
[0094] Step 430, pre-read data of a preset size in the initial copy data to a second target position through the storage location information to obtain current copy data; wherein the second target position includes a target solid state disk of the target node.
[0095] The preset size can be determined according to the storage space size of the second target position. For example, if the data amount corresponding to a single object is large, the second target position can store copy data corresponding to two objects, and the preset size can be the copy data of two objects, that is, two objects of copy data are read at a time.
[0096] Optionally, after obtaining the copy data reading request, it further includes:
[0097] determining whether the to-be-read copy data is located in the second target position;
[0098] If not, reading the to-be-read copy data from a third target position of the target node; wherein the third target position comprises a target mechanical hard disk of the target node.
[0099] The to-be-read copy data is initial copy data that needs to be read, and can be determined according to a copy data reading request.
[0100] The third target position is a position where the initial copy data is located, and comprises a target mechanical hard disk of the target node. The target mechanical hard disk is a mechanical hard disk of the target node, and the third target position can also comprise other positions with a processing speed less than that of the second target position. For example, if the second target position is a memory, the third target position can be a solid state disk.
[0101] Before reading from the third target position, it can be determined whether the to-be-read copy data is located in the second target position. If yes, the subsequent reading operation is not needed to be performed. If not, the to-be-read copy data is read from the third target position.
[0102] The advantage of such an arrangement is that when the initial copy data does not exist in the second target position, reading is performed from the third target position, avoiding the problem that when the initial copy data originally exists in the second target position, reading from the third target position directly can cause reading failure and reduce data reading efficiency. When the initial copy data exists in the second target position, the reading operation on the third target position is not needed to be performed, improving data reading efficiency.
[0103] Optionally, after reading the to-be-read copy data from the third target position of the target node, the method further comprises:
[0104] updating, in a second storage structure of the second target position, a data mapping relationship between the second target position and the third target position.
[0105] The second storage structure is located in the second target position, and is used to store the data mapping relationship between the second target position and the third target position. The second storage structure can be a b+tree, and the present embodiment does not limit this. The data mapping relationship is a corresponding relationship of the same copy data. For example, the to-be-read data read from the third target position is initial copy data A, and current copy data A is obtained in the second target position. The initial copy data A and the current copy data A are copy data corresponding to the same object, and thus the initial copy data A and the current copy data A have a data mapping relationship.
[0106] The advantage of the arrangement is that after reading the to-be-read copy data from the third target position of the target node to the second target position, the data mapping relationship between the second target position and the third target position is updated in time, so that the to-be-read copy data can be directly obtained when the to-be-read copy data is subsequently searched in the second target position, without the need of searching through other ways, thereby improving the searching efficiency.
[0107] Step 440, reading the current copy data according to the logical disk repair request to write the current copy data to the to-be-repaired logical disk.
[0108] According to the logical disk repair request, the current copy data currently existing in the second target position can be read, the current copy data is deleted after reading, and the data of the preset size in the initial copy data is continuously read to the second target position until the to-be-repaired logical disk completely reads the current copy data.
[0109] According to the embodiment of the application, the storage position information of the initial copy data is determined according to the current metadata in the position with a faster processing speed, the acquisition efficiency of the storage position information is improved, and the subsequent reading efficiency of the initial copy data is improved. The data of the preset size in the initial copy data is read to the second target position through the storage position information, so that the reading of the initial copy data is realized in the case that the storage space of the second target position is limited.
[0110] Specific application scenarios
[0111] An application scenario diagram in which the technical solution of the embodiment of the application is not used for data reading is shown in FIG. 5(a). As shown in FIG. 5(a), node 1 is a node in which a to-be-repaired logical disk is located, node 1 and node 2 are nodes in which the same copy data is stored, the copy data in node 1 is partially or completely damaged, the copy data in node 2 is not damaged, the damaged copy data in node 1 can be deleted first, and after receiving a logical disk repair request, because the to-be-read data amount is large, the metadata in node 2 located in a solid state disk is read according to the logical disk repair request, at this time, the read metadata is scattered small data. Then, the copy data in node 2 located in a mechanical hard disk is read according to the metadata in node 2, and because no data pre-reading is performed, the position of the copy data cannot be known, and the copy data needs to be searched from each storage position of node 2.
[0112] An application scenario diagram of data reading by using the technical solution of the embodiment of the present application is shown in Fig. 5(b). As shown in Fig. 5(b), node 1 is a node where a logical disk to be repaired is located, node 1 and node 2 are nodes storing the same copy data, the copy data in node 1 is partially or totally damaged, and the copy data in node 2 is not damaged. The damaged copy data in node 1 can be deleted first. After receiving a logical disk repair request, the metadata in node 2 can be read into the memory in bulk due to the small amount of metadata. The read metadata is large data. The storage location information of the copy data is analyzed by using the metadata read in advance, and the copy data is read into the solid state disk in bulk. Subsequently, the copy data in node 2 can be directly read from the solid state disk.
[0113] Reading data in bulk from a location with a slow processing speed to a location with a fast processing speed facilitates accurate reading of required data from the location with the fast processing speed, and greatly improves the efficiency of data reading relative to directly accurately reading required data from the location with the slow processing speed.
[0114] Embodiment Four
[0115] Figure 6 A structural diagram of a data reading device provided by the fourth embodiment of the present application is shown. The device can be realized by hardware and / or software, and can execute the data reading method provided by any embodiment of the present application, and has the corresponding function modules and beneficial effects of the execution method. As shown in the figure, the device includes: Figure 6
[0116] The metadata pre-reading module 610 is configured to determine a target node associated with the logical disk to be repaired in response to a logical disk repair request for the logical disk to be repaired, and pre-read initial metadata in the target node to a first target position of the target node to obtain current metadata. The first target position includes a target memory of the target node. The target node is a normal node associated with the logical disk to be repaired in a preset storage system.
[0117] The copy data pre-reading module 620 is configured to pre-read initial copy data in the target node to a second target position of the target node according to the current metadata to obtain current copy data. The second target position includes a target solid state disk of the target node.
[0118] The copy data reading module 630 is configured to read the current copy data according to the logical disk repair request, and write the current copy data into the logical disk to be repaired.
[0119] On the basis of the above technical solutions, the metadata pre-reading module can include:
[0120] a disk position information determination unit, configured to acquire candidate disk position information of the initial metadata, and determine target disk position information from the candidate disk position information;
[0121] a metadata reading unit, configured to transmit the target disk position information to a memory management module, so that the memory management module calls a solid state disk management module to read target metadata in the initial metadata according to the target disk position information;
[0122] a metadata storage unit, configured to store the target metadata to the first target position according to a preset storage mode.
[0123] On the basis of each of the above technical solutions, optionally, the apparatus further comprises:
[0124] an index information determination unit, configured to determine target index information according to the preset storage mode after the metadata storage unit;
[0125] an index information storage unit, configured to store the target index information to a first storage structure of the first target position.
[0126] On the basis of each of the above technical solutions, optionally, the copy data pre-reading module comprises:
[0127] a storage position information determination unit, configured to determine storage position information of the initial copy data according to the current metadata in response to a copy data reading request;
[0128] a copy data pre-reading unit, configured to pre-read data of a preset size in the initial copy data to the second target position through the storage position information.
[0129] On the basis of each of the above technical solutions, optionally, the apparatus further comprises:
[0130] a data position judgment unit, configured to judge whether to-be-read copy data is located at the second target position after the copy data reading request is acquired;
[0131] a copy data reading unit, configured to read the to-be-read copy data from a third target position of the target node if the data position judgment unit judges that the to-be-read copy data is not located at the second target position; wherein the third target position comprises a target mechanical hard disk of the target node.
[0132] On the basis of each of the above technical solutions, optionally, the apparatus further comprises:
[0133] A mapping relationship updating unit is configured to update, after the copy data reading unit, a data mapping relationship between the second target position and the third target position in the second storage structure of the second target position.
[0134] Embodiment Five
[0135] Figure 7 A structural schematic diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application described and / or claimed in this document.
[0136] As shown in Figure 6 The electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., connected to the at least one processor 11 in communication, where the memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer programs stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0137] A plurality of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunications networks.
[0138] The processor 11 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, and the like. The processor 11 performs various methods and processes described above, such as the data reading method.
[0139] In some embodiments, the data reading method can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded onto the RAM 13 and executed by the processor 11, one or more steps of the data reading method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the data reading method by any other suitable means, such as by means of firmware.
[0140] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0141] Computer programs used to implement the methods of the present application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the computer program, when executed by the processor, implements the functions / acts specified in the flowcharts and / or block diagrams. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as a stand-alone software package, partially on a machine and partially on a remote machine or entirely on a remote machine or server.
[0142] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer-readable storage medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of a machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0143] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0144] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0145] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.
[0146] It should be understood that the various forms of flow shown above can be reordered, added to, or have steps deleted. For example, the steps described in the present application can be performed in parallel, in series, or in a different order, as long as the desired results of the technical solutions of the present application can be achieved, which are not limited herein.
[0147] The above detailed description does not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A data reading method characterized by, The method comprises the following steps: In response to a logical disk repair request for a logical disk to be repaired, a target node associated with the logical disk to be repaired is determined, and initial metadata in the target node is pre-read to a first target position of the target node to obtain current metadata; if the initial metadata is located in a target solid state disk, the initial metadata is read to a target memory; if the initial metadata is located in a target mechanical hard disk, the initial metadata is read to a target solid state disk; the target node is a normal node associated with the logical disk to be repaired in a preset storage system; According to the current metadata, initial copy data in the target node is pre-read to a second target position of the target node to obtain current copy data; if the initial copy data is located in a target mechanical hard disk, the initial copy data is read to a target solid state disk; if the initial copy data is located in a target solid state disk, the initial copy data is read to a target memory; The current copy data is read according to the logical disk repair request, and the current copy data is written into the logical disk to be repaired; The method further comprises the following steps: Candidate disk position information of the initial metadata is obtained, and target disk position information is determined from the candidate disk position information; the candidate disk position information is disk position information of all initial metadata; The target disk position information is transmitted to a memory management module, so that the memory management module calls a solid state disk management module to read target metadata in the initial metadata according to the target disk position information; The target metadata is stored in the first target position according to a preset storage mode; The method further comprises the following steps: In response to a copy data read request, storage position information of the initial copy data is determined according to the current metadata; the copy data position of the initial copy data in the target node is contained in the current metadata; The initial copy data is pre-read to the second target position through the storage position information.
2. The method of claim 1, wherein, After the target metadata is stored in the first target position according to the preset storage mode, the method further comprises the following steps: Target index information is determined according to the preset storage mode; The target index information is stored in a first storage structure of the first target position.
3. The method of claim 1, wherein, After the copy data read request is obtained, the method further comprises the following steps: It is judged whether the to-be-read copy data is located in the second target position; If not, the to-be-read copy data is read from a third target position of the target node; the third target position comprises a target mechanical hard disk of the target node.
4. The method of claim 3, wherein, After the to-be-read copy data is read from the third target position of the target node, the method further comprises the following steps: A data mapping relationship between the second target position and the third target position in a second storage structure of the second target position is updated.
5. A data reading device, characterized by The method comprises the following steps: The metadata pre-reading module is configured to, in response to a logical disk repair request for a to-be-repaired logical disk, determine a target node associated with the to-be-repaired logical disk, and pre-read initial metadata in the target node to a first target position of the target node to obtain current metadata; wherein if the initial metadata is located in a target solid state disk, the initial metadata is read to a target memory; if the initial metadata is located in a target mechanical hard disk, the initial metadata is read to a target solid state disk; the target node is a normal node associated with the to-be-repaired logical disk in a preset storage system. The copy data pre-reading module is configured to, according to the current metadata, pre-read initial copy data in the target node to a second target position of the target node to obtain current copy data; wherein if the initial copy data is located in a target mechanical hard disk, the initial copy data is read to a target solid state disk; if the initial copy data is located in a target solid state disk, the initial copy data is read to a target memory. The copy data reading module is configured to read the current copy data according to the logical disk repair request, and write the current copy data to the to-be-repaired logical disk. The metadata pre-reading module includes: The disk position information determination unit is configured to obtain candidate disk position information of the initial metadata, and determine target disk position information from the candidate disk position information; wherein the candidate disk position information is disk position information of all initial metadata. The metadata reading unit is configured to transmit the target disk position information to a memory management module, so that the memory management module calls a solid state disk management module to read target metadata in the initial metadata according to the target disk position information. The metadata storage unit is configured to store the target metadata to the first target position according to a preset storage mode. The copy data pre-reading module includes: The storage position information determination unit is configured to, in response to a copy data reading request, determine storage position information of the initial copy data according to the current metadata; wherein a copy data position of the initial copy data in the target node is contained in the current metadata. The copy data pre-reading unit is configured to pre-read data of a preset size in the initial copy data to the second target position through the storage position information.
6. An electronic device, comprising: The electronic device includes: at least one processor; and a memory connected with the at least one processor in communication; wherein The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the data reading method of any one of claims 1-4.
7. A computer readable storage medium characterized in that, The computer readable storage medium stores computer instructions for enabling the processor to execute the data reading method of any one of claims 1-4 when executed.
Citation Information
Patent Citations
Data recovery method and device, computer equipment and storage medium
CN116048869A