Object recovery method and device, electronic device and storage medium

By simultaneously sending object identification sets to multiple nodes and performing parallel erasure recovery, the problem of long recovery time for erasure blocks in distributed storage systems is solved, and service availability and resource utilization are improved.

CN112860488BActive Publication Date: 2024-09-13BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202110192139.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-19
Publication Date
2024-09-13
Estimated Expiration
2041-02-19

AI Technical Summary

Technical Problem

The long recovery process of erasure blocks in distributed storage systems leads to a decrease in service availability and affects the quality of reading and writing.

Method used

By sending object identification sets to multiple nodes at the same time, receiving and processing multiple shards, using parallel erasure recovery and verification, and writing to disk according to the target write order, the recovery process is optimized.

Benefits of technology

This shortens the erasure block recovery time, improves service availability, and reduces the waste of system resources during the recovery process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112860488B
    Figure CN112860488B
Patent Text Reader

Abstract

The present application provides an object recovery method and device, an electronic device and a storage medium, wherein the method comprises: sending an object identification set to multiple first nodes respectively, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in a target erasure block of a second node, and the multiple object identifications correspond one-to-one to the multiple target objects; receiving a first shard of each target object returned by each first node according to the object identification set, and obtaining a shard set of each target object, wherein the first shard of each target object is a shard of each target object stored on each first node; performing erasure recovery on each target object using the shard set of each target object, and obtaining a second shard of each target object, wherein the second shard of each target object is a shard of each target object in the target erasure block.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a method and device for recovering an object, an electronic device, and a storage medium. Background Art

[0002] EC (Erasure Coding) blocks can be used to store data in distributed storage systems. EC code is a redundant method that can cut data into m data blocks, generate m check blocks for m data blocks, and obtain a total of (m+n) erasure blocks. Each erasure block (can be a data block or a check block) can be stored on a different data node, allowing the system to tolerate the loss of up to n erasure blocks.

[0003] At present, the recovery process of erasure blocks in distributed storage systems is executed at the granularity of objects. The erasure block to be recovered can contain shards (shard data) of multiple objects. Each object reads other shards of the object from all other replicas one by one; then, the erasure method is used to perform local recovery (recover the shard of the object on the local node), verification (verification of the object), and writing (writing the recovered shard to the local storage), and then the next object is recovered until all objects on this erasure block are fully recovered.

[0004] For example, for the 8+4 erasure mode (8 data blocks, 4 check blocks), if you need to recover an object on one of the erasure blocks, you can read the other object data of the object from at least 8 other replicas and use the erasure method to recover, check, and write locally.

[0005] If there are many objects to be restored in the above method of restoring erasure blocks, the entire recovery process will take a long time, the availability of the entire service will decrease during the recovery period, and the low availability time will also increase. In addition, the long recovery time will also affect the read and write quality of the entire service during the recovery period.

[0006] Therefore, the related art method of recovering objects in an erasure block has the problem of reduced service availability during the recovery period due to the long recovery process. Summary of the invention

[0007] The present application provides an object recovery method and device, an electronic device and a storage medium, so as to at least solve the problem in the related art that the way of recovering objects in an erasure block has a reduced service availability during the recovery period due to the long recovery process.

[0008] According to one aspect of an embodiment of the present application, a method for recovering an object is provided, comprising: sending an object identification set to multiple first nodes respectively, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in a target erasure block of a second node, and the multiple object identifications correspond one-to-one to the multiple target objects; receiving a first shard of each target object returned by each of the first nodes according to the object identification set, to obtain a shard set of each target object, wherein the first shard of each target object is a shard of each target object stored on each of the first nodes; performing erasure recovery on each target object using the shard set of each target object, to obtain a second shard of each target object, wherein the second shard of each target object is a shard of each target object in the target erasure block.

[0009] Optionally, receiving the first shard of each target object returned by each of the first nodes according to the object identification set to obtain a shard set of each target object includes: when the number of received first shards of the first target object is greater than or equal to a target number threshold, determining that the shard set of the first target object has been received, wherein the first target object is one of the multiple target objects.

[0010] Optionally, using the shard set of each target object to perform erasure recovery on each target object to obtain the second shard of each target object includes: using the shard set of the second target object to perform erasure recovery on the second target object by a target thread among multiple threads to obtain a candidate shard of the second target object, wherein the second target object is a target object that has received the corresponding shard set, and the multiple threads are used to perform parallel erasure recovery on the target objects that have received the corresponding shard set; verifying the second target object according to the shard set of the second target object and the candidate shards of the second target object; and if the second target object passes the verification, determining the candidate shard of the second target object as the second shard of the second target object.

[0011] Optionally, after performing erasure recovery on each target object using the shard set of each target object to obtain the second shard of each target object, the method further includes: writing the second shard of each target object to the disk of the second node in sequence according to a target write order, wherein the target write order is the order of multiple target objects in the target erasure block.

[0012] Optionally, writing the second slice of each target object to the disk of the second node in sequence according to the target write order includes: determining the object identifier of the third target object according to the target write order, wherein the third target object is the target object to be written currently, and the second slices of the target objects that are before the third target object in the write order have been written to the disk of the second node; searching the target mapping table with the object identifier of the third target object as a keyword, wherein the target mapping table is used to store the second slice of each target object with the object identifier of each target object as a keyword and the second slice of each target object as a value; when the second slice of the third target object is found from the target mapping table, writing the second slice of the third target object to the disk of the second node.

[0013] Optionally, writing the second slice of each target object to the disk of the second node in sequence according to the target write order also includes: after searching the target mapping table with the object identifier of the third target object as a keyword, if the second slice of the third target object is not found in the target mapping table, searching the target mapping table again with the object identifier of the third target object as a keyword at every target time interval until the second slice of the third target object is found; and writing the second slice of the third target object to the disk of the second node.

[0014] According to another aspect of an embodiment of the present application, a method for recovering an object is also provided, comprising: receiving, through a first node, an object identification set sent by a second node, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in a target erasure block of the second node, and the multiple object identifications correspond one-to-one to the multiple target objects; obtaining, according to the object identification set, a first shard of each of the target objects, wherein the first shard of each of the target objects is a shard of each of the target objects stored on the first node; sending the first shard of each of the target objects to the second node to recover a second shard of each of the target objects on the second node, wherein the second shard of each of the target objects is a shard of each of the target objects in the target erasure block.

[0015] Optionally, according to the object identifier set, obtaining the first fragment of each target object includes: adding multiple object identifiers in the object identifier set to a target read queue in sequence according to a target write order, wherein the target write order is the order of the multiple target objects in the target erasure block; obtaining one object identifier from the target read queue in sequence to obtain a first object identifier, wherein the first object identifier is used to identify a first object among the multiple target objects; and reading data according to the first object identifier to obtain a first fragment of the first object.

[0016] Optionally, according to the object identifier set, obtaining the first slice of each of the target objects includes: while sending the first slice of the second object identified by the second object identifier to the second node, obtaining the next object identifier of the second object identifier from the object identifier set to obtain a third object identifier, wherein the second object identifier is one of the multiple object identifiers; reading data according to the third object identifier to obtain the first slice of the third object, wherein the third object is the target object identified by the third object identifier.

[0017] According to another aspect of the embodiment of the present application, there is also provided an object recovery device, comprising: a first sending unit, used to send an object identification set to multiple first nodes respectively, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in a target erasure block of a second node, and the multiple object identifications correspond one-to-one to the multiple target objects; a first receiving unit, used to receive the first shards of each target object returned by each of the first nodes according to the object identification set, to obtain a shard set of each target object, wherein the first shard of each target object is the shard of each target object stored on each of the first nodes; a recovery unit, used to perform erasure recovery on each target object using the shard set of each target object, to obtain a second shard of each target object, wherein the second shard of each target object is the shard of each target object in the target erasure block.

[0018] Optionally, the first receiving unit includes: a determination module, used to determine a set of received fragments of the first target object when the number of received first fragments of the first target object is greater than or equal to a target number threshold, wherein the first target object is one of the multiple target objects.

[0019] Optionally, the recovery unit includes: a recovery module, used to perform erasure recovery on the second target object using the shard set of the second target object through a target thread among multiple threads to obtain candidate shards of the second target object, wherein the second target object is a target object that has received a corresponding shard set, and the multiple threads are used to perform parallel erasure recovery on the target object that has received the corresponding shard set; a verification module, used to verify the second target object according to the shard set of the second target object and the candidate shards of the second target object; and a first determination module, used to determine the candidate shard of the second target object as the second shard of the second target object if the second target object passes the verification.

[0020] Optionally, the device also includes: a writing unit, which is used to perform erasure recovery on each of the target objects using the shard sets of each of the target objects to obtain the second shards of each of the target objects, and then write the second shards of each of the target objects to the disk of the second node in sequence according to a target write order, wherein the target write order is the order of multiple target objects in the target erasure block.

[0021] Optionally, the write unit includes: a second determination module, used to determine the object identifier of the third target object according to the target write order, wherein the third target object is the target object currently to be written, and the second slices of the target objects that are located before the third target object in the write order have been written to the disk of the second node; a first search module, used to search the target mapping table with the object identifier of the third target object as a keyword, wherein the target mapping table is used to store the second slices of each target object with the object identifier of each target object as a keyword and the second slice of each target object as a value; a first write module, used to write the second slice of the third target object to the disk of the second node when the second slice of the third target object is found in the target mapping table.

[0022] Optionally, the write unit also includes: a second search module, used to search the target mapping table using the object identifier of the third target object as a keyword, and if the second fragment of the third target object is not found in the target mapping table, search the target mapping table again using the object identifier of the third target object as a keyword at every target time interval until the second fragment of the third target object is found; and a second write module, used to write the second fragment of the third target object to the disk of the second node.

[0023] According to another aspect of an embodiment of the present application, an object recovery device is also provided, including: a second receiving unit, used to receive an object identification set sent by a second node through a first node, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in a target erasure block of the second node, and the multiple object identifications correspond one-to-one to the multiple target objects; an acquisition unit, used to acquire a first slice of each of the target objects according to the object identification set, wherein the first slice of each of the target objects is a slice of each of the target objects stored on the first node; a second sending unit, used to send the first slice of each of the target objects to the second node, so as to recover the second slice of each of the target objects on the second node, wherein the second slice of each of the target objects is a slice of each of the target objects in the target erasure block.

[0024] Optionally, the acquisition unit includes: an adding module, used to add multiple object identifiers in the object identifier set to a target read queue in sequence according to a target write order, wherein the target write order is the order of multiple target objects in the target erasure block; a first acquisition module, used to acquire one object identifier from the target read queue in sequence to obtain a first object identifier, wherein the first object identifier is used to identify a first object among the multiple target objects; a first reading module, used to read data according to the first object identifier to obtain a first fragment of the first object.

[0025] Optionally, the acquisition unit includes: a second acquisition module, used to obtain the next object identifier of the second object identifier from the object identifier set while sending the first fragment of the second object identified by the second object identifier to the second node, so as to obtain a third object identifier, wherein the second object identifier is one of the multiple object identifiers; a second reading module, used to read data according to the third object identifier, so as to obtain a first fragment of a third object, wherein the third object is the target object identified by the third object identifier.

[0026] According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein the memory is used to store a computer program; and the processor is used to execute the method steps in any of the above embodiments by running the computer program stored in the memory.

[0027] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the method steps in any of the above embodiments when executed.

[0028] In an embodiment of the present application, a destination node sends an object identification set to a source node, and the object identification set is sent to multiple first nodes respectively, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in a target erasure block of a second node, and the multiple object identifications correspond one to one to the multiple target objects; first shards of each target object returned by each first node according to the object identification set are received to obtain a shard set of each target object, wherein the first shard of each target object is a shard of each target object stored on each first node; and erasure recovery is performed on each target object using the shard set of each target object to obtain each target object. The invention provides a second shard of a target object, wherein the second shard of each target object is a shard of each target object in a target erasure block. Since the destination node (second node) sends a set of object identifiers to the source node (first node) instead of sending one at a time, the time required for transmitting the object identifier can be reduced. At the same time, it provides the possibility of concurrently recovering shards of different objects, thereby achieving the purpose of shortening the recovery process of the erasure block, achieving the technical effect of shortening the recovery process time of the erasure block and improving the service availability, and further solving the problem of reduced service availability during recovery due to the long recovery process time in the related art in the way of recovering objects in the erasure block. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0030] In order to more clearly illustrate the embodiments of the present application 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0031] Figure 1 is a schematic diagram of a hardware environment of an optional object recovery method according to an embodiment of the present application;

[0032] Figure 2 is a flowchart of an optional object recovery method according to an embodiment of the present application;

[0033] Figure 3 is a flowchart of another optional object recovery method according to an embodiment of the present application;

[0034] Figure 4 is a flowchart of another optional object recovery method according to an embodiment of the present application;

[0035] Figure 5 is a structural block diagram of an optional object recovery device according to an embodiment of the present application;

[0036] Figure 6 is a structural block diagram of another optional object recovery device according to an embodiment of the present application;

[0037] Figure 7 It is a structural block diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0038] In order to enable those skilled in the art to better understand the solution of the present application, 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 application. Obviously, the described embodiments are only 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 should fall within the scope of protection of the present application.

[0039] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, 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 "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0040] According to one aspect of an embodiment of the present application, a method for restoring an object is provided. Optionally, in this embodiment, the method for restoring an object can be applied to Figure 1 The distributed storage system shown in FIG. 1 includes multiple data nodes (eg, database servers), for example, in a hardware environment including a first node 102 and a second node 104. Figure 1 As shown, the first node 102 is connected to the second node 104 via a network, and can be used to provide services (such as game services, application services, etc.) for the terminal or a client installed on the terminal.

[0041] The network may include but is not limited to at least one of the following: a wired network, a wireless network. The wired network may include but is not limited to at least one of the following: a wide area network, a metropolitan area network, a local area network, and the wireless network may include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal 102 may not be limited to a PC, a mobile phone, a tablet computer, etc.

[0042] The object recovery method of the embodiment of the present application may be executed by the first node 102, or by the second node 104, or by the first node 102 and the second node 104. The first node 102 and / or the second node 104 may execute the object recovery method of the embodiment of the present application, or the client installed thereon.

[0043] Taking the second node 104 as an example, the object recovery method in this embodiment is executed. Figure 2 is a flowchart of an optional object recovery method according to an embodiment of the present application, such as Figure 2 As shown, the process of the method may include the following steps:

[0044] Step S202: sending an object identification set to the multiple first nodes respectively, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in the target erasure block of the second node, and the multiple object identifications correspond one-to-one to the multiple target objects.

[0045] The object recovery method of the embodiment of the present application can be applied to a distributed storage system that includes multiple data nodes and uses objects as data storage units. The data node can be a server, for example, a database server. An object is a basic unit of data storage in a distributed storage system. An object can be a combination of file data and a set of attribute information. These attribute information can have one or more types and can include a check value of the object, which is used to check the object, for example, CRC (Cyclic Redundancy Check). These attribute information can be located at a predetermined position of the file data, for example, before the file data. In this embodiment, the type of attribute information and the positional relationship between the attribute information and the file data are not limited.

[0046] An object can be divided into m data shards (a first number of data shards), and n check shards (a second number of check shards) are generated, where m is a positive integer greater than 1, and n is a positive integer greater than or equal to 1. For an object, a distributed storage system can store (m+n) shards (object shards, check shards) of the object, and different shards are stored on different data nodes, or on different disks of the same data node.

[0047] Optionally, a coding matrix may be used to generate check slices. The number of rows of the coding matrix is ​​the total number of slices (e.g., m+n), and the number of columns of the coding matrix may be the number of data slices (e.g., m). For example, if an object is divided into four data slices, two check slices may be generated according to formula (1):

[0048]

[0049] Among them, D 1 , D 2 , D 3 and D 4 There are 4 data shards, C 1 and C 2 There are 2 check slices. According to any 4 slices of the 4 data slices and the 2 check slices, the other 2 slices can be restored according to the encoding matrix.

[0050] Data can be stored in blocks (check blocks) on data nodes, and each block can store at least one shard data of each object in multiple objects. As can be seen from the encoding matrix, the shards can be in order. The check value of the entire object can be saved in the first data shard (or other shards) for verification during data recovery.

[0051] The shards at the same position of different objects can be stored in the same data node or disk, or in different data nodes or disks. This is not limited in the present embodiment, as long as it can be determined at which position a shard is a shard of an object. For example, for a scenario where each object corresponds to 6 shards (4+2), and the 6 shards are stored in 6 erasure blocks located on different data nodes, the shards at the same position of each object can be stored in the same erasure block (for example, the first shard of each object is stored in the erasure block of the first data node), or they can be stored in the same erasure block without limitation.

[0052] For the second node, the second node may be a data node in a distributed storage system, belonging to a target node cluster including multiple nodes (data nodes), and each of the multiple nodes may store one of multiple erasure blocks with associated relationships, and the above-mentioned associated relationships may be relationships generated based on different shards storing the same object. For example, for multiple shards of a node, the multiple shards may be stored in erasure blocks of multiple nodes respectively.

[0053] The target erasure block on the second node can store shard data of multiple target objects, that is, multiple second shards are stored, and different second shards belong to different target objects. Due to an exception, the target erasure block needs to be restored. A recovery scheme for the erasure block is as follows:

[0054] (1) For the erasure block that needs to be restored, find the set of all object identifiers (e.g., object numbers) that need to be restored, as well as the information of all servers corresponding to the erasure block;

[0055] (2) For each object, first send the read message of this object to all servers. Then, when the number of shard data successfully read is sufficient to complete the recovery of the object, start to perform data erasure recovery, data verification (for example, CRC verification), and data writing locally;

[0056] (3) For each object in the erasure block, perform the recovery process of the above steps in sequence.

[0057] In the above-mentioned recovery method of erasure blocks (objects in erasure blocks), each object is processed completely serially during reading, recovery, and verification, which makes the entire recovery process very long, the availability of the entire service decreases during the recovery period, and the low availability time increases; at the same time, the entire recovery process does not fully utilize the resources of the system, including the network, disk, and CPU are far from reaching the bottleneck, resulting in a waste of resources; in addition, the long recovery time will also affect the reading and writing quality of the entire service during this period.

[0058] Optionally, in this embodiment, the second node may obtain multiple object identifiers of multiple target objects to be recovered in the target erasure block, and the multiple object identifiers correspond one-to-one to the multiple target objects, that is, each object identifier is used to uniquely identify a target object. Here, the object identifiers of different target objects are different, or are different within a certain range, for example, they are different within the target node cluster where the second node is located.

[0059] The second node may also determine a plurality of first nodes corresponding to the target erasure block, each of which stores a first shard of each target object, which may be a data shard or a check shard. The first shard of the target object stored on the first node may be used to restore a second shard of each target object in the target erasure block of the second node, which may be a data shard or a check shard.

[0060] It should be noted that the first shard refers to the shard of the target object stored on the first node, rather than a specific shard, and the second shard refers to the shard of the target object stored on the second node, rather than a specific shard. The first node and the second node can satisfy:

[0061] The first shards of the same target object stored on the same first node may be different (different first shards may be located on different disks);

[0062] The first shards of different target objects stored on the same first node may be different;

[0063] The first shards of the same target object stored on different first nodes may be different;

[0064] The first shards of different target objects stored on different first nodes may be different;

[0065] A second shard of a target object stored on the second node is different from a first shard of the target object stored on the first node.

[0066] For example, for an erasure block that needs to be recovered on a data node, the data node can find the set of all object numbers that need to be recovered, as well as information about all servers corresponding to the erasure block.

[0067] The second node can send a target request message to multiple first nodes respectively, and the target request message carries a set of object identifiers for requesting to obtain the shard data of each target object stored on each first node. For example, when restoring an erasure block, the destination node (second node) responsible for recovery sends all object numbers that need to be restored to the source node (source node server, first node) that needs to be read. Since multiple object identifiers are sent at the same time, it is convenient to read, restore, and verify objects in parallel, providing a basis for improving system resource utilization and shortening recovery time.

[0068] It should also be noted that the multiple first nodes may be all nodes storing other shards of the target object, or may be part of them. For example, in the scenario where shards at the same location of an object are stored on the same data node or disk, an object may correspond to 6 (4+2) shards. If it is necessary to recover the erasure block of a shard of the object on a node, a read message may be sent to the other nodes or to 4 of them.

[0069] Step S204, receiving the first shard of each target object returned by each first node according to the object identification set, and obtaining a shard set of each target object, wherein the first shard of each target object is the shard of each target object stored on each first node.

[0070] After obtaining the object identification set, each first node can read the shard data of each target object stored thereon, that is, the first shard of each target object, and send the obtained first shard of each target object back to the second node in the form of a reply message.

[0071] There are many ways for the first node to read the first fragments of each target object and send them back to the second node. For example, it can read them sequentially and send them back one by one, or it can read all of them and send them back one by one, or it can be other ways, which are not limited in this embodiment. Reading sequentially means: reading multiple target objects one by one according to the order in which they are in the target erasure block.

[0072] The second node may receive the first fragments of each target object returned by each first node from each first node. The time when the second node receives the first fragments of the same target object returned by different first nodes may be different, the time when the second node receives the first fragments of different target objects returned by the same first node may be different, and the time when the second node receives the first fragments of different target objects returned by different first nodes may also be different, which is not limited in this embodiment.

[0073] For a target object, the second node can receive the first shards of the first target object returned by each first node, thereby obtaining a shard set of the target object. A shard set of a target object can include a certain number of first shards that can restore the second shard of the target object, and can include all or part of the first shards of the target object returned by the first node.

[0074] Step S206: Perform erasure recovery on each target object using the shard set of each target object to obtain a second shard of each target object, wherein the second shard of each target object is a shard of each target object in the target erasure block.

[0075] For a target object for which a corresponding shard set has been received, the second node can perform erasure recovery on the target object using the shard set of the target object to obtain a second shard of the target object. By recovering the second shards corresponding to each target one by one, the target erasure block can be recovered on the second node.

[0076] It should be noted that, for a target object, receiving the object set of the target object and performing erasure recovery on the target object can be executed sequentially; for different target objects, receiving the object sets of different target objects and performing erasure recovery on the different target objects can be executed in parallel, that is, if it is determined that an object set of a target object has been received, erasure recovery can be performed on it, without having to wait until the object sets of all target objects are received before performing erasure recovery on each target object.

[0077] In order to ensure the reliability of data, after obtaining the second shard of a target object, the target object can be restored after correction and erasure. For example, the target object can be determined by the shard set of the target object, or the shard set of the target object and the second shard of the target object, and the target object can be verified (for example, CRC verification). If the verification passes, the second shard of the target object is written to the disk of the second node.

[0078] For example, when verifying a target object, the target verification value can be obtained from the first shard of the target object, and then a verification value corresponding to the target object is calculated, and the calculated verification value is compared with the target verification value. If they are consistent, the verification passes, otherwise, the verification fails.

[0079] If the verification fails, a variety of processing methods can be used, such as re-acquiring the shard set of the target object from multiple first nodes, or if there are unused shards in the shard set of the target object, erasure recovery can be performed on the second shard of the target object again. In addition, the failure of the verification may be caused by the presence of abnormal shards in the shard set of the target object, which may also involve the recovery of erasure blocks on other nodes or the recovery of objects on erasure blocks. The process is similar to the above, and will not be repeated in this embodiment.

[0080] Through the above steps S202 to S206, an object identification set is sent to multiple first nodes respectively, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in the target erasure block of the second node, and the multiple object identifications correspond to the multiple target objects one by one; the first shards of each target object returned by each first node according to the object identification set are received to obtain a shard set of each target object, wherein the first shards of each target object are the shards of each target object stored on each first node; and erasure recovery is performed on each target object using the shard set of each target object to obtain a second shard of each target object, wherein the second shards of each target object are the shards of each target object in the target erasure block, thereby solving the problem in the related art that the service availability is reduced during the recovery period due to the long recovery process time in the method of recovering objects in the erasure block, thereby shortening the recovery process time of the erasure block and improving the service availability.

[0081] As an optional embodiment, receiving the first fragment of each target object returned by each first node according to the object identifier set, and obtaining the fragment set of each target object includes:

[0082] S11, when the number of received first fragments of the first target object is greater than or equal to the target number threshold, determine a set of fragments of the first target object that have been received, wherein the first target object is one of the multiple target objects.

[0083] In order to improve the recovery efficiency of the object, for a target object, the second node can determine that the shard set of the target object has been obtained when the number of the first shards of the target object received is sufficient to recover the second shard of the target object. The first shard of the target object received later can also be attributed to the shard set of the target object.

[0084] For the first target object, if the number of received first fragments of the first target object is greater than or equal to the target number threshold, the second node may determine that the fragment set of the first target object has been received. The target number threshold may be the number of data fragments into which the first target object is divided, or may be greater than the number of data fragments into which the first target object is divided and less than or equal to the total number of data fragments and check fragments corresponding to the first target object.

[0085] For example, an object may correspond to 6 (4+2) shards. If 4 shards of the object have been received from the source node, these 4 shards can restore the shards required for the object, and the object set that has received the object can be determined.

[0086] Through this embodiment, by configuring the target quantity threshold to control object recovery, the efficiency of object recovery can be improved, the recovery time can be shortened, and the impact of object recovery on the read and write quality of the entire service can be reduced.

[0087] As an optional embodiment, using the shard set of each target object to perform erasure recovery on each target object to obtain the second shard of each target object includes:

[0088] S21, performing erasure recovery on the second target object by using the shard set of the second target object through a target thread among the multiple threads to obtain candidate shards of the second target object, wherein the second target object is a target object that has received a corresponding shard set, and the multiple threads are used to perform parallel erasure recovery on the target object that has received the corresponding shard set;

[0089] S22, verifying the second target object according to the shard set of the second target object and the candidate shards of the second target object;

[0090] S23: If the second target object passes the verification, determine the candidate slice of the second target object as the second slice of the second target object.

[0091] The erasure recovery process of different target objects can be executed serially. After the erasure recovery process, or the erasure recovery and verification process, of one target object is completed, the erasure recovery process, or the erasure recovery and verification process of the next target object is performed. For example, one thread can be responsible for data recovery and data verification of each target object.

[0092] In order to improve the utilization of system resources, a thread pool can be added on the second node to be responsible for data recovery and data verification. The thread pool can contain multiple threads, and the multiple threads can be used to perform parallel erasure recovery and data verification on the target objects that have received the corresponding shard set. For any of the multiple threads, after completing the erasure recovery and data verification of a target object, if there is a target object that has received the corresponding shard set, it can continue to perform erasure recovery and data verification on it.

[0093] The second target object is a target object that has received a corresponding shard set. The target thread among the multiple threads can use the shard set of the second target object to perform erasure recovery on the second target object, thereby recovering the candidate shards of the second target object. The candidate shards of the second target object are candidate shards of the second shard of the second target object.

[0094] The target thread can also be used to perform the step of data verification. The target thread can verify the second target object based on the shard set of the second target object and the candidate shards of the second target object. For example, the second target object is determined based on the shard set of the second target object and the candidate shards of the second target object, and the verification value corresponding to the second target object is calculated. If the calculated verification value is consistent with the target verification value (which can be obtained from the first data shard of the second target object), it is determined that the verification of the second target object is passed, and the candidate shard of the second target object is determined as the second shard of the second target object.

[0095] Otherwise, if the verification of the second target object fails, the candidate slices of the second target object can be re-acquired in the same manner as described above and verified until the verification passes to obtain the second slice of the second target object.

[0096] Through this embodiment, data recovery and data verification are performed in parallel by multiple threads, which can improve system resource utilization and reduce resource waste.

[0097] As an optional embodiment, after performing erasure recovery on each target object using the shard set of each target object to obtain the second shard of each target object, the method further includes:

[0098] S31, writing the second fragments of each target object to the disk of the second node in sequence according to a target write order, wherein the target write order is the order of multiple target objects in the target erasure block.

[0099] After obtaining the second shards of each target object, they can be written to the disk of the target second node, for example, written to the spatial area where the target erasure block is located in the disk of the target second node. In order to ensure the accuracy of data writing, the second shards of each target object can be written to the disk of the second node in sequence according to the order of multiple target objects (second shards) in the target erasure block, that is, the target writing order.

[0100] For example, the erasure block to be restored stores shard data of three objects in the order of object 1, object 2, and object 3. Therefore, when writing the shard data, you need to write the shard data of object 1 first, then the shard data of object 2, and finally the shard data of object 3.

[0101] It should be noted that restoring the second shard of the target object and writing the second shard of the target object can be executed in parallel, that is, if there is a second shard of the target object that meets the writing conditions, it can be written to the disk without having to wait until all the second shards of the target object are restored before executing the writing process.

[0102] Through this embodiment, the second fragment data of each target object is written in sequence according to the order of multiple target objects in the target erasure block, which can improve the accuracy of data writing.

[0103] As an optional embodiment, writing the second shards of each target object to the disk of the second node in sequence according to the target writing order includes:

[0104] S41, determining an object identifier of a third target object according to a target writing order, wherein the third target object is a target object to be written currently, and second shards of target objects that are before the third target object in a writing order have all been written to a disk of the second node;

[0105] S42, searching a target mapping table using the object identifier of the third target object as a keyword, wherein the target mapping table is used to store the second slice of each target object using the object identifier of each target object as a keyword and the second slice of each target object as a value;

[0106] S43: When the second slice of the third target object is found in the target mapping table, write the second slice of the third target object to the disk of the second node.

[0107] In order to ensure that the second shards of each target object are written to the disk of the second node in the target write order, after recovering all or part of the second shards of the target object, the restored second shards of the target object can be traversed, and the second shards of each target object can be written to the disk of the second node in the target write order.

[0108] Optionally, in this embodiment, the second slice of the target object that has been restored can be stored in a target data structure, and the target data structure can store the corresponding second slice of the target object according to the object identifier, so that by searching the data structure, it can be determined whether the slice data of the target object to be written has been restored. The target data structure can have various forms, such as a mapping table, an array, etc.

[0109] According to the target writing sequence, the second node can determine the object identifier corresponding to the target object (i.e., the third target object) currently to be written into the second slice. According to the target writing sequence, the second slices of the target objects before the third target object have all been written into the disk of the second node.

[0110] The second node may search the target data structure according to the object identifier of the third target object to determine whether the second slice of the third target object has been restored. If the second slice of the third target object is found, the second slice of the third target object may be written to the disk of the second node. If the second slice of the third target object is not found, the target data structure may be searched again according to the object identifier of the third target object at every target time interval until the second slice of the third target object is found.

[0111] As an optional implementation, the target data structure may be: a target mapping table. A mapping table is a data structure that stores data in a key-value manner. In the target mapping table, the second slice of each target object is stored with the object identifier of the target object as the key and the second slice of the target object as the value. If the second slice of a target object has been restored and put into the target mapping table, the second slice of the target object can be found with the object identifier of the target object as the key; otherwise, the second slice of the target object cannot be found with the object identifier of the target object as the key.

[0112] For the third target object, the second node can use the object identifier of the third target object as a keyword to search the target mapping table. If the second slice of the third target object is found in the target mapping table, the second node can write the second slice of the third target object to the disk of the second node.

[0113] For example, to ensure that objects are restored in order, the destination node can add the object number to the map and write the objects to the disk in order when restoring the disk.

[0114] As an optional implementation, the target data structure may be: a target array. The array is written and read according to the subscript. In the target array, the second slice of the target object is stored at a position with the object identifier of the target object (or the hash value of the object identifier of the target object) as the subscript. If the second slice of a target object has been restored and stored in the target array, the second slice of the target object can be found at a position with the object identifier of the target object (or the hash value of the object identifier of the target object) as the subscript in the target array; otherwise, the second slice of the target object cannot be found at a position with the object identifier of the target object (or the hash value of the object identifier of the target object) as the subscript in the target array.

[0115] For the third target object, the second node can search for the target position in the target array with the object identifier of the third target object (or the hash value of the object identifier of the third target object) as the subscript; if the second shard of the third target object is found at the target position, the second node can write the second shard of the third target object to the disk of the second node.

[0116] Through this embodiment, by using a data structure that can store the corresponding second fragment of the target object according to the object identifier to store the second fragment of the target object, it can be ensured that the object is restored in order and the search operation when writing data can be simplified.

[0117] As an optional embodiment, writing the second shards of each target object to the disk of the second node in sequence according to the target writing order further includes:

[0118] S51, after searching the target mapping table with the object identifier of the third target object as a keyword, if the second fragment of the third target object is not found in the target mapping table, searching the target mapping table again with the object identifier of the third target object as a keyword at every target time interval until the second fragment of the third target object is found;

[0119] S52: Write the second slice of the third target object to the disk of the second node.

[0120] If the second shard of the third target object is not found in the target mapping table, the target mapping table can be searched periodically (or by other means, for example, triggered by a target event, where the target event may be data stored in the target mapping table) using the object identifier of the third target object as a keyword until the second shard of the third target object is found.

[0121] The second node may search the target mapping table again with the object identifier of the third target object as the keyword at a target time interval. If found, the second shard of the third target object is written to the disk of the second node. Otherwise, the target mapping table is searched again with the object identifier of the third target object as the keyword at another target time interval until the second shard of the third target object is found.

[0122] Through this embodiment, by periodically searching the target mapping table to write the second fragment data of the target object currently to be written to the disk, the accuracy and timeliness of data writing can be guaranteed.

[0123] It should be noted that if the second node can know the write position of the second slice of each target object in the disk through configuration information (for example, the first address of the target erasure block, the offset of the first address of the second slice of each target object relative to the first address of the target erasure block, etc.), then the restored second slice of the target object can be directly written to the corresponding position on the disk of the second node according to the recovery order of the second slice of each target object.

[0124] For example, after obtaining the second shard of the fourth target object, the second node can determine the write position of the second shard of the fourth target object in the disk of the second node, and write the second shard of the fourth target object to the disk of the second node according to the determined write position.

[0125] Determining the write position of the second slice of the fourth target object in the disk of the second node may include: determining the write position of the second slice of the fourth target object in the disk of the second node based on the target first address and the offset of the first address of the second slice of the fourth target object relative to the target first address, the target first address being the first address of the target erasure block in the disk of the second node.

[0126] According to another aspect of the embodiment of the present application, a method for restoring an object is also provided. Optionally, in this embodiment, the above object restoration method can be applied to Figure 1 The distributed storage system shown including multiple data nodes (eg, database servers) has been described before and will not be described again here.

[0127] Taking the first node 102 as an example, the object recovery method in this embodiment is executed. Figure 3 is a flowchart of another optional object recovery method according to an embodiment of the present application, such as Figure 3 As shown, the process of the method may include the following steps:

[0128] Step S302: receiving, through the first node, an object identification set sent by the second node, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in the target erasure block of the second node, and the multiple object identifications correspond one-to-one to the multiple target objects.

[0129] The object recovery method in this embodiment can be applied to a distributed storage system including multiple data nodes and using objects as data storage units. For example, it can be applied to processing the object identification set sent by the second node in the aforementioned embodiment.

[0130] The first node may receive the aforementioned object identification set sent by the second node. For example, the first node may receive a target request message sent by the second node and extract the object identification set from the target request message. The first node, the second node, the object identification set and the target request message have been explained in the aforementioned embodiment and will not be described in detail here.

[0131] Step S304, obtaining a first slice of each target object according to the object identifier set, wherein the first slice of each target object is a slice of each target object stored on the first node;

[0132] After receiving the object identifier set, the first node can obtain the first slice of each target object respectively. The first node can read the slice data corresponding to each object identifier from the disk in the order of multiple object identifiers (corresponding to the target write order), thereby obtaining the first slice of each target object. The process of obtaining the first slices of different target objects can be executed serially or in parallel, which is not limited in this embodiment.

[0133] Step S306: Send the first shard of each target object to the second node to recover the second shard of each target object on the second node, wherein the second shard of each target object is the shard of each target object in the target erasure block.

[0134] After obtaining the first slice of a target object, the first node may send the obtained first slice of the target object to the second node. The first slices of each target object may be sent in real time, that is, the first slice of the target object is sent to the second node as soon as it is obtained, regardless of whether the first slices of other target objects are obtained.

[0135] Through the above steps S302 to S306, the object identification set sent by the second node is received by the first node, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in the target erasure block of the second node, and the multiple object identifications correspond one-to-one to the multiple target objects; according to the object identification set, a first slice of each target object is obtained, wherein the first slice of each target object is a slice of each target object stored on the first node; the first slice of each target object is sent to the second node to recover the second slice of each target object on the second node, wherein the second slice of each target object is a slice of each target object in the target erasure block, thereby solving the problem of reduced service availability during recovery due to a long recovery process in the method of recovering objects in the erasure block in the related art, shortening the recovery process time of the erasure block, and improving service availability.

[0136] As an optional embodiment, obtaining the first fragment of each target object according to the object identifier set includes:

[0137] S61, adding multiple object identifiers in the object identifier set to the target read queue in sequence according to the target write order, wherein the target write order is the order of the multiple target objects in the target erasure block;

[0138] S62, sequentially acquiring an object identifier from the target read queue to obtain a first object identifier, wherein the first object identifier is used to identify a first object among multiple target objects;

[0139] S63: Read data according to the first object identifier to obtain a first fragment of the first object.

[0140] In order to improve the convenience of obtaining the first shard of the target object, multiple object identifiers in the object identifier set can be saved in a queue. The first node can add the multiple object identifiers in the object identifier set to the target read queue in sequence according to the target write order, that is, according to the order of the multiple target objects in the target erasure block, the corresponding object identifiers are added to the target read queue in sequence.

[0141] If the target read queue is a first-in-first-out queue, the object identifier corresponding to the target object written first can be added to the target read queue first, and the object identifier corresponding to the target object written later can be added to the target read queue later to ensure that the order in which the object identifiers are added is consistent with the order of the target objects (the second shard of the target object) in the target erasure block.

[0142] The first node can sequentially obtain an object identifier from the target read queue to obtain a first object identifier, and the first object identifier is used to identify the first object among the multiple target objects. The first object can read data according to the first object identifier, and read the shard data corresponding to the first object identifier from the disk of the first node, thereby obtaining the first shard of the first object.

[0143] Through this embodiment, multiple object identifiers are saved in a read queue manner, and the object identifiers are read from the read list in sequence to read data, which can improve the orderliness of data reading and thus ensure the rationality of data recovery.

[0144] As an optional embodiment, obtaining the first fragment of each target object according to the object identifier set includes:

[0145] S71, while sending the first fragment of the second object identified by the second object identifier to the second node, obtaining the next object identifier of the second object identifier from the object identifier set to obtain a third object identifier, wherein the second object identifier is one of the plurality of object identifiers;

[0146] S72: Read data according to the third object identifier to obtain a first fragment of the third object, wherein the third object is a target object identified by the third object identifier.

[0147] When obtaining the first shard of each target object, the data result of the last read can be replied while reading the data, so as to achieve concurrent reading and sending.

[0148] After obtaining the first shard of the second object identified by the second object identifier, the first node can send the first shard of the second object to the second node, and at the same time obtain the next object identifier of the second object identifier from the object identifier set, for example, read and write an object identifier from the target message queue to obtain a third object identifier.

[0149] After obtaining the third object identifier, the first node can continue to read data according to the third object identifier to obtain the first fragment of the third object. The reading process is similar to the above and will not be repeated here.

[0150] Through this embodiment, by replying to the data result of the last read while reading data, so as to perform data reading and sending concurrently, the utilization rate of system resources can be improved and the recovery time of the erasure block can be shortened.

[0151] The object recovery method in the embodiment of the present application is explained below in conjunction with an optional example. In this example, the first node is a source node (source server), the second node is a destination node (destination server), and the object identifier is an object number.

[0152] The object recovery method in this example is to overcome the situation that multiple sub-processes cannot be executed concurrently when recovering the erasure blocks of data nodes in the distributed storage system. It can realize the concurrency of reading disks and sending reply messages on the recovered source node; and realize multi-threaded concurrency of data recovery and data verification on the recovered destination node. Through the concurrency of the processes of the recovered source node and destination node, the system resources can be fully utilized and the recovery speed can be improved.

[0153] like Figure 4 As shown, the process of the object recovery method in this optional example may include the following steps:

[0154] Step S402: The destination node responsible for recovery sends all numbers of objects that need to be recovered to the source node that needs to be read.

[0155] When the check block needs to be restored, the destination node responsible for the restoration can send all object numbers that need to be restored in the check block to the source node server that needs to be read through a read message.

[0156] Step S404: the source node puts all object numbers that need to be restored into a read queue, reads the data in sequence, and sends them back one by one through reply messages.

[0157] For a source node, after receiving a read message, it can put all the object numbers that need to be restored into the read queue, and obtain the object numbers from the read queue in sequence, read the shard data corresponding to the object number, and send it back to the destination node through a reply message. On the source node, it can continue to read the next object while sending the reply message, so as to achieve reading and sending concurrency.

[0158] Step S406: When receiving the reply message, the destination node uses the fragment data carried in the reply message to perform object recovery, so as to recover the check block that needs to be recovered on the destination node.

[0159] For each object, the destination node can receive the reply messages sent by each source node, read the shard data in the reply message, and when the number of successful reads is sufficient to complete the recovery of the object, the information to be recovered and the checksum are encapsulated into a context. The checksum here can be the target checksum value in the first data shard.

[0160] In order to recover the object, the destination node can add a thread pool dedicated to data recovery and data verification when starting up, which is used to receive the encapsulated context and use the encapsulated context to recover and verify the data of the object.

[0161] The destination node can add the object number serialization method to the map to ensure that the objects are restored in order and not out of order in the case of concurrency. The destination node can add the object number to the map and write the restored object data (shard data) into the map according to the object number. That is, the map stores object data in a key-value manner, with the keyword being the object number and the corresponding value being the restored object data. When restoring to disk, write to disk in the order of the object number.

[0162] Through this example, the destination node sends all the object numbers that need to be restored to the source node. The source node replies to the previous reading result while reading the data, so that reading and sending are concurrent. The destination node performs data recovery and data verification through multi-threading, and uses the map structure to ensure that the objects are downloaded to the disk in order, so that when the destination node is verifying the data, the source node is reading the data at the same time, and the source node is synchronously sending back the data of the previous object while reading the data. In this way, data reading, sending, recovery, and verification are concurrent, which improves resource utilization and shortens the recovery time of erasure blocks.

[0163] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0164] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM (Read-Only Memory) / RAM (Random Access Memory), a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0165] According to another aspect of an embodiment of the present application, a device for recovering an object for implementing the above-mentioned method for recovering an object is also provided. Figure 5 is a structural block diagram of an optional object recovery device according to an embodiment of the present application, such as Figure 5As shown, the device may include:

[0166] (1) A first sending unit 502 is configured to send an object identifier set to each of the plurality of first nodes, wherein the object identifier set includes a plurality of object identifiers for identifying a plurality of target objects to be recovered in a target erasure block of the second node, and the plurality of object identifiers correspond one-to-one to the plurality of target objects;

[0167] (2) a first receiving unit 504, connected to the first sending unit 502, configured to receive the first shard of each target object returned by each first node according to the object identifier set, and obtain a shard set of each target object, wherein the first shard of each target object is the shard of each target object stored on each first node;

[0168] (3) A recovery unit 506, connected to the first receiving unit 504, configured to perform erasure recovery on each target object using the shard set of each target object to obtain a second shard of each target object, wherein the second shard of each target object is a shard of each target object in the target erasure block.

[0169] It should be noted that the first sending unit 502 in this embodiment can be used to execute the above step S202, the first receiving unit 504 in this embodiment can be used to execute the above step S204, and the recovery unit 506 in this embodiment can be used to execute the above step S206.

[0170] Through the above module, an object identification set is sent to multiple first nodes respectively, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in the target erasure block of the second node, and the multiple object identifications correspond to the multiple target objects one by one; the first shard of each target object returned by each first node according to the object identification set is received, and a shard set of each target object is obtained, wherein the first shard of each target object is the shard of each target object stored on each first node; and each target object is subjected to erasure recovery using the shard set to obtain a second shard of each target object, wherein the second shard of each target object is the shard of each target object in the target erasure block, thereby solving the problem in the related art that the service availability is reduced during the recovery period due to the long recovery process time in the method of recovering objects in the erasure block, shortening the recovery process time of the erasure block, and improving the service availability.

[0171] As an optional embodiment, the first receiving unit 504 includes:

[0172] The determination module is used to determine a set of received fragments of the first target object when the number of received first fragments of the first target object is greater than or equal to a target number threshold, wherein the first target object is one of the multiple target objects.

[0173] As an optional embodiment, the recovery unit 506 includes:

[0174] A recovery module, configured to perform erasure recovery on the second target object by using the shard set of the second target object through a target thread among the multiple threads to obtain candidate shards of the second target object, wherein the second target object is a target object that has received the corresponding shard set, and the multiple threads are configured to perform parallel erasure recovery on the target object that has received the corresponding shard set;

[0175] A verification module, configured to verify the second target object according to the set of fragments of the second target object and the candidate fragments of the second target object;

[0176] The first determination module is configured to determine the candidate slice of the second target object as the second slice of the second target object if the second target object passes the verification.

[0177] As an optional embodiment, the above device also includes:

[0178] A writing unit is used to perform erasure recovery on each target object using the shard set of each target object, and after obtaining the second shard of each target object, write the second shard of each target object into the disk of the second node in sequence according to a target writing order, wherein the target writing order is the order of multiple target objects in the target erasure block.

[0179] As an optional embodiment, the writing unit includes:

[0180] A second determination module is used to determine the object identifier of the third target object according to the target writing order, wherein the third target object is the target object currently to be written, and the second fragments of the target objects that are located before the third target object in the writing order have been written to the disk of the second node;

[0181] A first search module is used to search a target mapping table using the object identifier of the third target object as a keyword, wherein the target mapping table is used to store the second slice of each target object using the object identifier of each target object as a keyword and the second slice of each target object as a value;

[0182] The first writing module is used to write the second slice of the third target object into the disk of the second node when the second slice of the third target object is found in the target mapping table.

[0183] As an optional embodiment, the writing unit further includes:

[0184] A second search module is used for searching the target mapping table by using the object identifier of the third target object as a keyword, and if the second fragment of the third target object is not found in the target mapping table, searching the target mapping table again by using the object identifier of the third target object as a keyword at a target time interval until the second fragment of the third target object is found;

[0185] The second writing module is used to write the second slice of the third target object to the disk of the second node.

[0186] According to another aspect of an embodiment of the present application, a device for recovering an object for implementing the above-mentioned method for recovering an object is also provided. Figure 6 is a structural block diagram of an optional object recovery device according to an embodiment of the present application, such as Figure 6 As shown, the device may include:

[0187] (1) A second receiving unit 602, configured to receive, through the first node, an object identifier set sent by the second node, wherein the object identifier set includes multiple object identifiers for identifying multiple target objects to be recovered in a target erasure block of the second node, and the multiple object identifiers correspond one-to-one to the multiple target objects;

[0188] (2) an acquisition unit 604, connected to the second receiving unit 602, configured to acquire a first slice of each target object according to the object identifier set, wherein the first slice of each target object is a slice of each target object stored on the first node;

[0189] (3) A second sending unit 606, connected to the acquiring unit 604, is used to send the first shard of each target object to the second node, so as to recover the second shard of each target object on the second node, wherein the second shard of each target object is the shard of each target object in the target erasure block.

[0190] It should be noted that the second receiving unit 602 in this embodiment can be used to execute the above step S302, the acquiring unit 604 in this embodiment can be used to execute the above step S304, and the second sending unit 606 in this embodiment can be used to execute the above step S306.

[0191] Through the above module, the object identification set sent by the second node is received by the first node, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in the target erasure block of the second node, and the multiple object identifications correspond one-to-one to the multiple target objects; according to the object identification set, the first slice of each target object is obtained, wherein the first slice of each target object is the slice of each target object stored on the first node; the first slice of each target object is sent to the second node to recover the second slice of each target object on the second node, wherein the second slice of each target object is the slice of each target object in the target erasure block, thereby solving the problem of reduced service availability during recovery due to the long recovery process time in the method of recovering objects in the erasure block in the related art, shortening the recovery process time of the erasure block, and improving service availability.

[0192] As an optional embodiment, the obtaining unit 604 includes:

[0193] An adding module is used to sequentially add multiple object identifiers in the object identifier set to the target read queue according to a target write order, wherein the target write order is the order of the multiple target objects in the target erasure block;

[0194] A first acquisition module, used to sequentially acquire an object identifier from a target reading queue to obtain a first object identifier, wherein the first object identifier is used to identify a first object among multiple target objects;

[0195] The first reading module is used to read data according to the first object identifier to obtain a first fragment of the first object.

[0196] As an optional embodiment, the obtaining unit 604 includes:

[0197] a second acquisition module, configured to acquire a next object identifier of the second object identifier from the object identifier set to obtain a third object identifier while sending the first fragment of the second object identified by the second object identifier to the second node, wherein the second object identifier is one of the plurality of object identifiers;

[0198] The second reading module is used to read data according to the third object identifier to obtain a first slice of the third object, wherein the third object is a target object identified by the third object identifier.

[0199] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules as part of the device can be run in Figure 1 In the hardware environment shown, it can be implemented by software or by hardware, wherein the hardware environment includes a network environment.

[0200] According to another aspect of an embodiment of the present application, an electronic device for implementing the above-mentioned object recovery method is also provided. The electronic device may be a server, a terminal, or a combination thereof.

[0201] Figure 7 is a structural block diagram of an optional electronic device according to an embodiment of the present application, such as Figure 7 As shown, it includes a processor 702, a communication interface 704, a memory 706 and a communication bus 708, wherein the processor 702, the communication interface 704 and the memory 706 communicate with each other through the communication bus 708, wherein,

[0202] Memory 706, used to store computer programs;

[0203] The processor 702 is used to implement the following steps when executing the computer program stored in the memory 706:

[0204] S1. Send an object identification set to multiple first nodes respectively, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in a target erasure block of a second node, and the multiple object identifications correspond one-to-one to the multiple target objects.

[0205] S2, receiving the first shard of each target object returned by each first node according to the object identification set, and obtaining a shard set of each target object, wherein the first shard of each target object is the shard of each target object stored on each first node.

[0206] S3, using the shard set of each target object to perform erasure recovery on each target object to obtain a second shard of each target object, wherein the second shard of each target object is a shard of each target object in the target erasure block.

[0207] Optionally, the processor 702 is configured to implement the following steps when executing the computer program stored in the memory 706:

[0208] S1, receiving, by a first node, an object identification set sent by a second node, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in a target erasure block of the second node, and the multiple object identifications correspond one-to-one to the multiple target objects;

[0209] S2, acquiring a first shard of each target object according to the object identifier set, wherein the first shard of each target object is a shard of each target object stored on the first node;

[0210] S3, sending the first shard of each target object to the second node to recover the second shard of each target object on the second node, wherein the second shard of each target object is the shard of each target object in the target erasure block.

[0211] Optionally, in this embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

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

[0213] The memory may include RAM, or may include non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0214] As an example, the memory 706 may include but is not limited to the first sending unit 502, the first receiving unit 504 and the recovery unit 506 in the recovery device of the object. In addition, it may also include but is not limited to other module units in the recovery device of the object, which will not be repeated in this example.

[0215] As another example, the memory 706 may include but is not limited to the second receiving unit 602, the acquiring unit 604 and the second sending unit 606 in the object recovery device. In addition, it may also include but is not limited to other module units in the object recovery device, which will not be repeated in this example.

[0216] The above-mentioned processor can be a general-purpose processor, which can include but not be limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0217] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.

[0218] It can be understood by those skilled in the art that Figure 7 The structure shown is for illustration only. The device for implementing the recovery method of the above-mentioned object may be a terminal device (the terminal device may be used as a data ground in a distributed storage system), and the terminal device may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Figure 7 The structure of the electronic device is not limited. Figure 7 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 7 Different configurations shown.

[0219] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which can include: a flash drive, ROM, RAM, a magnetic disk or an optical disk, etc.

[0220] According to another aspect of the embodiments of the present application, a storage medium is further provided. Optionally, in this embodiment, the storage medium can be used to execute the program code of any of the above object recovery methods in the embodiments of the present application.

[0221] Optionally, in this embodiment, the storage medium may be located on at least one network device among a plurality of network devices in the network shown in the above embodiment.

[0222] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:

[0223] S1. Send an object identification set to multiple first nodes respectively, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in a target erasure block of a second node, and the multiple object identifications correspond one-to-one to the multiple target objects.

[0224] S2, receiving the first shard of each target object returned by each first node according to the object identification set, and obtaining a shard set of each target object, wherein the first shard of each target object is the shard of each target object stored on each first node.

[0225] S3, using the shard set of each target object to perform erasure recovery on each target object to obtain a second shard of each target object, wherein the second shard of each target object is a shard of each target object in the target erasure block.

[0226] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:

[0227] S1, receiving, by a first node, an object identification set sent by a second node, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in a target erasure block of the second node, and the multiple object identifications correspond one-to-one to the multiple target objects;

[0228] S2, acquiring a first shard of each target object according to the object identifier set, wherein the first shard of each target object is a shard of each target object stored on the first node;

[0229] S3, sending the first shard of each target object to the second node to recover the second shard of each target object on the second node, wherein the second shard of each target object is the shard of each target object in the target erasure block.

[0230] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, which will not be described in detail in this embodiment.

[0231] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a ROM, a RAM, a mobile hard disk, a magnetic disk, or an optical disk.

[0232] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0233] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0234] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0235] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0236] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution provided in this embodiment.

[0237] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

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

Claims

1. A method for recovering an object, characterized in that: include: Sending an object identification set to each of the plurality of first nodes, wherein the object identification set includes a plurality of object identifications for identifying a plurality of target objects to be recovered in a target erasure block of the second node, and the plurality of object identifications correspond one-to-one to the plurality of target objects; Receiving the first shards of each target object returned by each first node according to the object identifier set, and obtaining a shard set of each target object, wherein the first shards of each target object are the shards of each target object stored on each first node; Performing erasure recovery on each of the target objects using the shard sets of each of the target objects to obtain a second shard of each of the target objects, wherein the second shard of each of the target objects is a shard of each of the target objects in the target erasure block; Writing the second slices of each target object to the disk of the second node in sequence according to the target write order includes: determining the object identifier of the third target object according to the target write order, the target write order being the order of the multiple target objects in the target erasure block, the third target object being the target object to be currently written, and the second slices of the target objects that are before the third target object in the write order have all been written to the disk of the second node; searching the target mapping table with the object identifier of the third target object as a keyword, the target mapping table being used to store the second slices of each target object with the object identifier of each target object as a keyword and the second slice of each target object as a value; and writing the second slice of the third target object to the disk of the second node when the second slice of the third target object is found in the target mapping table.

2. The method according to claim 1, characterized in that Receiving the first fragments of the target objects returned by the first nodes according to the object identifier set, and obtaining the fragment sets of the target objects includes: When the number of received first fragments of the first target object is greater than or equal to the target number threshold, it is determined that a set of fragments of the first target object has been received, wherein the first target object is one of the multiple target objects.

3. The method according to claim 1, characterized in that Performing erasure recovery on each of the target objects using the shard sets of each of the target objects to obtain the second shards of each of the target objects includes: Performing erasure recovery on the second target object by using the shard set of the second target object through a target thread among the multiple threads to obtain candidate shards of the second target object, wherein the second target object is a target object that has received a corresponding shard set, and the multiple threads are used to perform parallel erasure recovery on the target object that has received the corresponding shard set; Verifying the second target object according to the shard set of the second target object and the candidate shards of the second target object; In a case where the second target object passes verification, the candidate slice of the second target object is determined as the second slice of the second target object.

4. The method according to claim 1, characterized in that Writing the second shards of each of the target objects sequentially to the disk of the second node according to the target writing order further includes: After searching the target mapping table with the object identifier of the third target object as a keyword, if the second fragment of the third target object is not found in the target mapping table, searching the target mapping table again with the object identifier of the third target object as a keyword at every target time interval until the second fragment of the third target object is found; The second shard of the third target object is written to the disk of the second node.

5. A method for recovering an object, characterized in that: include: Receiving, by the first node, a set of object identifiers sent by the second node, wherein the set of object identifiers includes a plurality of object identifiers for identifying a plurality of target objects to be recovered in a target erasure block of the second node, and the plurality of object identifiers correspond one-to-one to the plurality of target objects; According to the object identifier set, obtain a first shard of each of the target objects, wherein the first shard of each of the target objects is a shard of each of the target objects stored on the first node; Send the first shard of each of the target objects to the second node, so as to recover the second shard of each of the target objects on the second node according to the method described in any one of claims 1 to 4, wherein the second shard of each of the target objects is the shard of each of the target objects in the target erasure block.

6. The object recovery method according to claim 5, characterized in that: According to the object identifier set, obtaining the first fragment of each target object includes: Adding the plurality of object identifiers in the object identifier set to the target read queue in sequence according to a target write order, wherein the target write order is the order of the plurality of target objects in the target erasure block; sequentially acquiring one of the object identifiers from the target read queue to obtain a first object identifier, wherein the first object identifier is used to identify a first object among the plurality of target objects; Data is read according to the first object identifier to obtain a first fragment of the first object.

7. The object recovery method according to claim 5 or 6, characterized in that: According to the object identifier set, obtaining the first fragment of each target object includes: While sending the first fragment of the second object identified by the second object identifier to the second node, obtaining the next object identifier of the second object identifier from the object identifier set to obtain a third object identifier, wherein the second object identifier is one of the plurality of object identifiers; Data is read according to the third object identifier to obtain a first fragment of a third object, wherein the third object is the target object identified by the third object identifier.

8. A device for recovering an object, characterized in that: include: A first sending unit, configured to send an object identification set to each of the plurality of first nodes, wherein the object identification set includes a plurality of object identifications for identifying a plurality of target objects to be recovered in a target erasure block of the second node, and the plurality of object identifications correspond one-to-one to the plurality of target objects; A first receiving unit is configured to receive first shards of each target object returned by each first node according to the object identifier set, and obtain a shard set of each target object, wherein the first shards of each target object are shards of each target object stored on each first node; A recovery unit, configured to perform erasure recovery on each of the target objects using the shard sets of each of the target objects to obtain a second shard of each of the target objects, wherein the second shard of each of the target objects is a shard of each of the target objects in the target erasure block; a writing unit, configured to write the second fragments of each of the target objects to the disk of the second node in sequence according to a target writing order, wherein the target writing order is the order of the multiple target objects in the target erasure block; Wherein, the writing unit comprises: A second determination module is used to determine the object identifier of a third target object according to the target write order, the third target object is the target object currently to be written, and the second fragments of the target objects that are before the third target object in the write order have all been written to the disk of the second node; A first search module, configured to use the object identifier of the third target object as a keyword to search a target mapping table, wherein the target mapping table is configured to use the object identifier of each target object as a keyword and the second slice of each target object as a value to store the second slice of each target object; The first writing module is used to write the second slice of the third target object into the disk of the second node when the second slice of the third target object is found in the target mapping table.

9. A device for recovering an object, characterized in that: include: A second receiving unit is configured to receive, through the first node, an object identification set sent by the second node, wherein the object identification set includes multiple object identifications for identifying multiple target objects to be recovered in the target erasure block of the second node, and the multiple object identifications correspond one-to-one to the multiple target objects; an acquisition unit, configured to acquire, according to the object identifier set, a first slice of each of the target objects, wherein the first slice of each of the target objects is a slice of each of the target objects stored on the first node; A second sending unit is used to send the first fragment of each of the target objects to the second node, so as to run the device described in claim 8 on the second node to recover the second fragment of each of the target objects, wherein the second fragment of each of the target objects is the fragment of each of the target objects in the target erasure block.

10. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein: The processor, the communication interface and the memory communicate with each other via the communication bus, wherein: The memory is used to store computer programs; The processor is configured to execute the method steps of any one of claims 1 to 4 or the method steps of any one of claims 5 to 7 by running the computer program stored in the memory.

11. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method steps described in any one of claims 1 to 4, or execute the method steps described in any one of claims 5 to 7 when running.

Citation Information

Patent Citations

  • Distributive database and management method

    CN106372160A

  • Data synchronization method based on high-bandwidth storage system

    CN107133334A

  • Data recovery method and device

    CN107544869A

  • Method and apparatus for modifying data of erasure code storage mechanism, and medium

    CN107977285A

  • Data storage and reconstruction method and apparatus, and electronic device

    CN109144766A