A data reconstruction method and system based on distributed log differences
By using distributed objects and log objects in distributed storage for data block slicing and differential data recovery, the problem of inefficiency and log negotiation complexity during transient failures is solved, and efficient data recovery and storage upgrades are achieved.
Patent Information
- Application Number
- CN202311365356.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-19
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2043-10-19
AI Technical Summary
In the process of data recovery in distributed storage, the existing technology requires a full scan during a short-term failure, resulting in inefficiency, affecting the efficiency of storage upgrade and maintenance, and the local log negotiation is complicated, making it difficult to achieve efficient data reconstruction.
By slicing data blocks into logical shards and setting distributed objects and distributed log objects based on hard disk pool parameters, distributed logs are used to obtain differential data for recovery, simplifying log multi-copy consistency processing and recording only differential data blocks. name, reduce the amount of logs, and transform replica transactions to ensure data and log consistency.
It achieves second-level hard disk switching in the event of a brief failure, reduces the performance impact of writing log records to record differential data, improves data recovery efficiency, simplifies log reading and consistency processing, and reduces the complexity of storage upgrade and maintenance.
Smart Images

Figure CN118132297B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data reconstruction, and in particular to a data reconstruction method and system based on distributed log differences. Background Art
[0002] Distributed storage has multiple nodes. When a node fails, the data will be written to other nodes. When the failed node recovers, the data will be migrated back to the current node. This process is called data recovery and reconstruction. In actual applications, in order to reduce the amount of data migration, the data that already exists on the recovery node is generally identified. For the existing data, data migration is no longer performed. Only the missing data on the recovery node needs to be restored. This process is what the industry calls incremental reconstruction.
[0003] By scanning all the data, it is possible to identify which data is newly written during the failure period. However, in the case of a short failure, only some difference data exists, but all data needs to be scanned, which affects the efficiency of reconstruction. The most typical scenario is that during the upgrade process, just restarting the process requires a full scan of the data, which seriously affects the speed of data reconstruction and reduces the efficiency of storage upgrade maintenance.
[0004] The existing method to reduce data recovery is to recover data by recording log differences. In actual applications, since the recorded logs are local logs, the data consistency of each local log also needs to be negotiated during the data reconstruction process, and the data recovery process is complicated.
[0005] Therefore, how to provide a more efficient data reconstruction method has become a technical problem that needs to be solved urgently. Summary of the invention
[0006] In view of this, in order to overcome the deficiencies of the prior art, the present invention aims to provide a data reconstruction method and system based on distributed log differences.
[0007] According to a first aspect of the present invention, a data reconstruction method based on distributed log differences is provided, characterized by comprising:
[0008] Slice the data block into multiple logical shards, and set corresponding distributed objects and distributed log objects for each logical shard;
[0009] According to the hard disk pool parameters, the data of each logical shard is stored in the corresponding hard disk. During the data storage process, the distributed log object is written to the high-speed storage medium to generate a distributed log;
[0010] The differential data of the data block to be recovered is obtained through the distributed log, and data recovery is performed on the obtained differential data.
[0011] Preferably, in the data reconstruction method based on distributed log differences of the present invention, the data block is sliced into multiple logical shards, and corresponding distributed objects and distributed log objects are set for each logical shard, including: slicing the data block into multiple logical shards according to a naming rule, setting multiple distributed objects for each logical shard, hashing the set multiple distributed objects to the logical shards according to the naming rule, and setting a distributed log object on each logical shard where a distributed object is set.
[0012] Preferably, in the data reconstruction method based on distributed log differences of the present invention, the data of each logical shard is stored in the corresponding hard disk according to the hard disk pool parameters, and the distributed log object is written into the high-speed storage medium to generate the distributed log during the data storage process, including:
[0013] Select a storage hard disk for the data of the logical slice according to the hard disk status and topology parameters of the hard disk pool, and use one IO write request to store the data and distributed objects on the same logical slice to the same storage hard disk;
[0014] In the same IO write request, the distributed log object on the logical shard is written to the corresponding high-speed medium, and the written distributed log object is written to the distributed log in chronological order. The distributed log records the write records of the data on the logical shard, and the write records include the log operation type, the name of the written data block, and the time point of writing the data.
[0015] Preferably, in the data reconstruction method based on distributed log differences of the present invention, the data of each logical shard is stored in the corresponding hard disk according to the hard disk pool parameters, and the distributed log object is written to the high-speed storage medium to generate a distributed log during the data storage process, including: in a three-copy transaction, a write request is sent to the master of the three copies through the client, and after the master receives the write request, the writing of the data of the logical shard to the local hard disk of the master and the local hard disk of the slave node is initiated, and the writing of the distributed log object of the logical shard to the high-speed medium of the master and the high-speed medium of the slave node is initiated.
[0016] Preferably, in the data reconstruction method based on distributed log differences of the present invention, the data of each logical shard is stored in the corresponding hard disk according to the hard disk pool parameters, and the distributed log object is written to the high-speed storage medium to generate a distributed log during the data storage process, including: in a three-copy transaction, after each copy is successfully written to the local hard disk of the master and the slave node, the write status of the copy is set to the ready-to-write status, and when the master receives that the write status of the three copies are all in the ready-to-write status, the distributed log object of the logical shard is initiated to write to the high-speed medium of the master and the high-speed medium of the slave node, and after completing the writing of the distributed log object of the logical shard, a message of successful writing of the data and the distributed log object is sent to the client.
[0017] Preferably, in the data reconstruction method based on distributed log differences of the present invention, the data of each logical shard is stored in the corresponding hard disk according to the hard disk pool parameters, and the distributed log object is written into the high-speed storage medium to generate the distributed log during the data storage process, including:
[0018] Write the data and the distributed log object in a local transaction, and set the data write and the distributed log object write in the same transaction by updating the metadata in the local transaction;
[0019] When data writing fails or distributed log object writing fails, the replica returns the write failure information to the master, and the master initiates the termination of the write operation of all replicas and generates a null operation in the high-speed medium to create logical space by terminating the write operation of all replicas.
[0020] Preferably, in the data reconstruction method based on distributed log differences of the present invention, the data of each logical shard is stored in the corresponding hard disk according to the hard disk pool parameters, and the distributed log object is written to the high-speed storage medium to generate a distributed log during the data storage process, including: configuring the allocation strategy, and allocating the write address for the distributed log object according to the allocation strategy through the master copy.
[0021] Preferably, in the data reconstruction method based on distributed log differences of the present invention, the allocation strategy includes:
[0022] A write address of the current distributed log object is maintained through memory, and the memory is incremented each time according to the length of the current distributed log object. When the storage hard disk fails, the current write address of the distributed log object is recalculated by scanning the persistent data of the distributed log object;
[0023] An infinite logical address space is used as the logical address space of the distributed log object. For failed distributed log objects, only the physical space is reclaimed, and the logical address space is not reclaimed.
[0024] Preferably, in the data reconstruction method based on distributed log differences of the present invention, differential data of the data block to be recovered is obtained through the distributed log, and data recovery is performed on the obtained differential data, including:
[0025] When the storage hard disk recovers from a failure, all logical slices are traversed to determine whether the data of the current logical slice needs to be restored to the hard disk to be restored. If the data of the current logical slice does not need to be restored to the hard disk to be restored, the current logical slice is skipped and the traversal and determination of the next logical slice are continued;
[0026] If the data of the current logical shard needs to be restored to the hard disk to be restored, read the distributed log of the current logical shard and the local log of the current shard in the hard disk to be restored, and obtain the minimum time point of the data to be restored and the name of the difference data block by comparing the read distributed log and local log;
[0027] According to the obtained minimum time point and difference data block name, read the difference data of the corresponding data block within the minimum time point to the current time range, write the read difference data to the hard disk to be recovered, and write the corresponding difference distributed log to the local log in the hard disk of data recovery;
[0028] After all differential distributed logs of the current logical shard are recovered, the next logical shard is recovered. After all logical shards are recovered, the data reconstruction of the hard disk to be recovered is completed.
[0029] According to a second aspect of the present invention, a data reconstruction system based on distributed log differences is provided, the system comprising a data reconstruction server, the data reconstruction server being used to slice a data block into a plurality of logical slices, and setting a corresponding distributed object and a distributed log object for each logical slice; storing the data of each logical slice in a corresponding hard disk according to hard disk pool parameters, and writing the distributed log object to a high-speed storage medium to generate a distributed log during the data storage process; obtaining differential data of a data block to be recovered through the distributed log, and performing data recovery on the obtained differential data.
[0030] According to a third aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect of the present invention when executing the program.
[0031] The data reconstruction method and system based on distributed log differences of the present invention have the following beneficial technical effects:
[0032] 1. By using distributed objects as distributed logs, the processing flow of ensuring the consistency of multiple copies of logs is simplified compared to local logs. At the same time, log information can be read directly using the distributed object client interface at any node, which facilitates log reading;
[0033] 2. Distributed logs are recorded for each data shard, which can be completed in one IO with data writing, reducing the performance impact caused by writing log records with different data. At the same time, the consistency of data and logs between replicas is guaranteed by transforming the original replica transactions.
[0034] 3. Distributed logs only record the names of modified data blocks, without recording the details of the modifications within the data blocks. This reduces the amount of logs and allows for later deduplication of logs of modifications to the same data block, allowing for more logs to be recorded.
[0035] 4. The present invention can ensure that the faulty hard disk is switched within seconds in the case of a short process restart or a network outage. Even in the case of a long-term failure, the faulty hard disk can be efficiently restored by restoring only the differential data. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 is a schematic diagram of a system applicable to the data reconstruction method based on distributed log differences in an embodiment of the present invention;
[0038] Figure 2 A flowchart of a method for data reconstruction based on distributed log differences according to an embodiment of the present invention;
[0039] Figure 3 A logical schematic diagram of distributed logs in a data reconstruction method based on distributed log differences according to an embodiment of the present invention;
[0040] Figure 4 A schematic diagram of a process of recovering data through distributed logs in a data reconstruction method based on distributed log differences according to an embodiment of the present invention;
[0041] Figure 5 A schematic diagram of the structure of the device provided by the present invention. DETAILED DESCRIPTION
[0042] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0043] It should be noted that the following embodiments and features in the embodiments may be combined with each other in the absence of conflict; and, based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making any creative work are within the scope of protection of the present disclosure.
[0044] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.
[0045] Figure 1 An exemplary system of a data reconstruction method based on distributed log differences applicable to an embodiment of the present invention is shown. Figure 1 As shown, the system may include a data reconstruction server 101, a communication network 102 and / or one or more data reconstruction clients 103. Figure 1 The example shown is a plurality of data reconstruction clients 103 .
[0046] The data reconstruction server 101 can be any appropriate server for storing information, data, programs and / or any other suitable type of content. In some embodiments, the data reconstruction server 101 can perform appropriate functions. For example, in some embodiments, the data reconstruction server 101 can be used for high-speed access to ORC external tables. As an optional example, in some embodiments, the data reconstruction server 101 can be used to achieve differential data reconstruction through distributed logs. For example, the data reconstruction server 101 can be used to slice a data block into multiple logical shards, set corresponding distributed objects and distributed log objects for each logical shard; store the data of each logical shard in the corresponding hard disk according to the hard disk pool parameters, and write the distributed log object to the high-speed storage medium to generate a distributed log during the data storage process; obtain the differential data of the data block to be recovered through the distributed log, and perform data recovery on the obtained differential data.
[0047] As another example, in some embodiments, the data reconstruction server 101 may send the data reconstruction method based on distributed log differences to the data reconstruction client 103 for the user to use according to the request of the data reconstruction client 103 .
[0048] As an optional example, in some embodiments, the data reconstruction client 103 is used to provide a visual data reconstruction interface, which is used to receive a user's selection input operation for data reconstruction based on distributed log differences, and, in response to the selection input operation, obtain from the data reconstruction server 101 a data reconstruction interface corresponding to the option selected by the selection input operation and display the data reconstruction interface, wherein the data reconstruction interface at least displays information on data reconstruction based on distributed log differences and operation options for the information on data reconstruction based on distributed log differences.
[0049] In some embodiments, the communication network 102 can be any suitable combination of one or more wired and / or wireless networks. For example, the communication network 102 can include any one or more of the following: the Internet, an intranet, a wide area network (WAN), a local area network (LAN), a wireless network, a digital subscriber line (DSL) network, a frame relay network, an asynchronous transfer mode (ATM) network, a virtual private network (VPN), and / or any other suitable communication network. The data reconstruction client 103 can be connected to the communication network 102 via one or more communication links (e.g., communication link 104), and the communication network 102 can be linked to the data reconstruction server 101 via one or more communication links (e.g., communication link 105). The communication link can be any communication link suitable for transmitting data between the data reconstruction client 103 and the data reconstruction server 101, such as a network link, a dial-up link, a wireless link, a hard-wired link, any other suitable communication link, or any suitable combination of such links.
[0050] The data reconstruction client 103 may include any one or more clients that present an interface related to data reconstruction based on distributed log differences in an appropriate form for use and operation by a user. In some embodiments, the data reconstruction client 103 may include any suitable type of device. For example, in some embodiments, the data reconstruction client 103 may include a mobile device, a tablet computer, a laptop computer, a desktop computer, and / or any other suitable type of client device.
[0051] Although the data reconstruction server 101 is illustrated as one device, in some embodiments, any appropriate number of devices may be used to perform the functions performed by the data reconstruction server 101. For example, in some embodiments, multiple devices may be used to implement the functions performed by the data reconstruction server 101. Alternatively, a cloud service may be used to implement the functions of the data reconstruction server 101.
[0052] Based on the above system, an embodiment of the present invention provides a data reconstruction method based on distributed log differences, which is described below through the following embodiments.
[0053] Reference Figure 2 , shows a step flow chart of a data reconstruction method based on distributed log differences according to an embodiment of the present application.
[0054] The data reconstruction method based on distributed log differences of this embodiment can be executed on the data reconstruction server. The data reconstruction method based on distributed log differences includes the following steps:
[0055] Step S201: Slice the data block into multiple logical slices, and set a corresponding distributed object and distributed log object for each logical slice.
[0056] The method of the embodiment of the present invention slices the data block into multiple logical slices according to the naming rules, sets multiple distributed objects for each logical slice, hashes the set multiple distributed objects to the logical slices according to the naming rules, and sets a distributed log object on each logical slice where the distributed object is set. In the method of this embodiment, hashing is to transform an input of any length (also called a pre-image) into an output of a fixed length through a hash algorithm, and the output is the hash value. This conversion is a compression mapping, and the space of hash values is usually much smaller than the space of inputs. Different inputs may hash to the same output, that is, a function that compresses a message of any length to a message digest of a fixed length.
[0057] Step S202: storing the data of each logical slice in the corresponding hard disk according to the hard disk pool parameters, and writing the distributed log object into the high-speed storage medium to generate a distributed log during the data storage process.
[0058] As an optional example, the method of this embodiment selects a hard disk for storing the data of the logical shard according to the hard disk status and topological structure parameters of the hard disk pool, and uses an IO write request to store the data and distributed objects on the same logical shard to the same storage hard disk; in the same IO write request, the distributed log object on the logical shard is written to the corresponding high-speed medium, and the written distributed log object is written to the distributed log in chronological order. The distributed log records the write records of the data on the logical shard, and the write records include the log operation type, the name of the written data block, and the time point of writing the data. The time point of writing the data in the method of the embodiment of the present invention uses the cluster global logical time. Figure 3 FIG. 4 is a logical diagram of distributed logs in a data reconstruction method based on distributed log differences according to an embodiment of the present invention. Figure 3As shown, each dotted box represents a logical shard. The logical shard combines the hard disk status and topology of the hard disk pool to determine which hard disks the data of this logical shard is stored in through a disk selection algorithm. The data of logical shard 1 is stored in three copies of disk 1, disk 2, and disk 3. The data of logical shard 2 is stored in three copies of disk 2, disk 3, and disk 4. The data of logical shard 3 is stored in three copies of disk 3, disk 4, and disk 5. Each logical shard has its own distributed objects 1, 2, and 3, etc. These distributed objects are hashed to the logical shards in a fixed hashing manner according to the naming rules of the objects. In the method of the embodiment of the present invention, a special distributed object is added to each logical shard as the distributed log of the logical shard. The special object in the method of the embodiment of the present invention is consistent with the hard disk selected by all other objects in the shard, but it is stored in high-speed media, including but not limited to SCM high-speed media. SCM (Storage Class Memory) high-speed media is a physical computer memory that combines dynamic random access memory (DRAM), NAND flash memory, and data persistence power, treating non-volatile memory as DRAM and including it in the server's memory space with excellent access speed.
[0059] In the method of the present invention, the distributed log object follows the data and is written to the SCM high-speed medium in an IO write request. As an optional example, in a transaction of three copies, the method of this embodiment sends a write request to the master of the three copies through the client. After receiving the write request, the master initiates the writing of the data of the logical shard to the local hard disk of the master and the local hard disk of the slave node, and initiates the writing of the distributed log object of the logical shard to the high-speed medium of the master and the high-speed medium of the slave node. It should be noted that in the method of the embodiment of the present invention, in the transaction of three copies, the transaction of the three copies must ensure that the data of the three copies are written successfully before the write success is returned to the client. The transaction is submitted in two stages. In the first stage, after each copy is successfully written to the local hard disk of the master and the slave node, the write status of the copy is set to the ready-to-write state. When the master receives the write status of the three copies, it starts the second stage, initiates the writing of the distributed log object of the logical shard to the high-speed medium of the master and the high-speed medium of the slave node, and after completing the writing of the distributed log object of the logical shard, sends a message to the client that the data and the distributed log object are written successfully.
[0060] In order to ensure that the writing of distributed logs and the writing of data can share a transaction, it is necessary to put the new distributed log writing and the writing of data into the local space into a local transaction. However, since data is written to the hard disk space and the distributed log is written to the high-speed media space, it is difficult to ensure that they are in one transaction. The method of the embodiment of the present invention writes data and distributed log objects into a local transaction, and sets the writing of data and the writing of distributed log objects into the same transaction by updating metadata in the local transaction, thereby ensuring that the writing of distributed logs and data is in one transaction.
[0061] When data writing fails or distributed log object writing fails, the replica returns the write failure information to the master, and the master initiates the termination of the write operation of all replicas, and generates a null operation of the logical space generated by the termination of the write operation of all replicas in the high-speed medium. In order to simplify the maintenance of log space, null operations of the logical space generated by the termination operation are allowed in the log space, and the null operations are skipped and treated as invalid during the log reading process.
[0062] In order to ensure the global order of the distributed log when each client writes to the distributed log at the same time, the present invention configures an allocation strategy, and allocates a write address for the distributed log object through the master copy according to the allocation strategy. Specifically, the method of this embodiment maintains a write address of the current distributed log object through memory, and the memory is incremented each time according to the length of the current distributed log object. When the storage hard disk fails, the current write address of the distributed log object is recalculated by scanning the persistent data of the distributed log object; an infinite logical address space is used as the logical address space of the distributed log object, and for failed distributed log objects, only the physical space is reclaimed, and the logical address space is not reclaimed. Therefore, in the method of this embodiment, there is no need to maintain the log write position, and writing is performed only according to the write logical address allocated by the master copy.
[0063] Step S203: obtaining differential data of the data block to be recovered through the distributed log, and performing data recovery on the obtained differential data.
[0064] It should be noted that in the method of this embodiment, the write record in the distributed log does not include the offset and length of the written data block. The main purpose is to reduce the log size and ensure that more write logs can be stored given the same size of log space. The reason why the present invention can not record the offset and length of the complete data block is that when the data block is written, it is written in multiple versions according to the time point. When it is known that the specified data block has been modified within a certain time period, the data block name and the time period for reading the difference can be directly specified to read the difference data of the data block.
[0065] Therefore, when a hard disk is in a faulty state in a cluster for a certain period of time due to an upgrade restart, software failure, or network failure, the process of incremental data recovery on the hard disk after waiting for the hard disk status to recover is as follows: Figure 4 shown. Figure 4 FIG. 1 is a flow chart of data recovery through distributed logs in a data reconstruction method based on distributed log differences according to an embodiment of the present invention. Figure 4 As shown, after the storage hard disk is recovered from a failure, the method of the embodiment of the present invention traverses all logical slices to determine whether the data of the current logical slice needs to be restored to the hard disk to be restored. If the data of the current logical slice does not need to be restored to the hard disk to be restored, the current logical slice is skipped, and the traversal and determination of the next logical slice are continued; if the data of the current logical slice needs to be restored to the hard disk to be restored, the distributed log of the current logical slice and the local log of the current slice in the hard disk to be restored are read, and the minimum time point and the name of the difference data block to be restored are obtained by comparing the read distributed log and the local log; according to the obtained minimum time point and the name of the difference data block, the difference data of the corresponding data block within the minimum time point to the current time range is read, the read difference data is written to the hard disk to be restored, and the corresponding difference distributed log is written to the local log of the hard disk to be restored; after all the difference distributed logs of the current logical slice are restored, the next logical slice is restored, and after all the logical slices are restored, the data reconstruction of the hard disk to be restored is ended.
[0066] Since the distributed log is only used for data recovery of the faulty hard disk and records the data information written during the hard disk failure, the distributed log only needs to be recorded after the hard disk fails. In addition, since the log space is recorded on the high-speed medium, the space is limited. When the failure time is relatively long and the log space is insufficient, the method of the present invention can transfer the log to the main memory space. When the data is recovered, the log is processed in the order of time, and the log information transferred to the main memory is restored to the high-speed medium.
[0067] The data reconstruction method and system based on distributed log differences of the present invention have the following beneficial technical effects:
[0068] 1. By using distributed objects as distributed logs, the processing flow of ensuring the consistency of multiple copies of logs is simplified compared to local logs. At the same time, log information can be read directly using the distributed object client interface at any node, which facilitates log reading;
[0069] 2. Distributed logs are recorded for each data shard, which can be completed in one IO with data writing, reducing the performance impact caused by writing log records with different data. At the same time, the consistency of data and logs between replicas is guaranteed by transforming the original replica transactions.
[0070] 3. Distributed logs only record the names of modified data blocks, without recording the details of the modifications within the data blocks. This reduces the amount of logs and allows for later deduplication of logs of modifications to the same data block, allowing for more logs to be recorded.
[0071] 4. The present invention can ensure that the faulty hard disk is switched within seconds in the case of a short process restart or a network outage. Even in the case of a long-term failure, the faulty hard disk can be efficiently restored by restoring only the differential data.
[0072] like Figure 5 As shown, the present invention also provides a device, including a processor 310, a communication interface 320, a memory 330 for storing a computer program executable by the processor, and a communication bus 340. The processor 310, the communication interface 320, and the memory 330 communicate with each other through the communication bus 340. The processor 310 implements the above-mentioned method of high-speed access to an ORC external table by running an executable computer program.
[0073] Among them, the computer program in the memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0074] The system embodiments described above are merely illustrative, wherein 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, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected based on actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0075] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.
[0076] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A data reconstruction method based on distributed log differences, characterized in that: The method comprises: Slice the data block into multiple logical shards, and set corresponding distributed objects and distributed log objects for each logical shard; According to the hard disk pool parameters, the data of each logical shard is stored in the corresponding hard disk. During the data storage process, the distributed log object is written to the high-speed storage medium to generate a distributed log; Obtain differential data of the data block to be recovered through the distributed log, and perform data recovery on the obtained differential data; Slicing the data block into multiple logical shards, and setting corresponding distributed objects and distributed log objects for each logical shard, including: slicing the data block into multiple logical shards according to a naming rule, setting multiple distributed objects for each logical shard, hashing the set multiple distributed objects to the logical shards according to the naming rule, and setting a distributed log object on each logical shard where the distributed object is set; According to the disk pool parameters, the data of each logical shard is stored in the corresponding hard disk. During the data storage process, the distributed log object is written to the high-speed storage medium to generate a distributed log, including: Select a storage hard disk for the data of the logical slice according to the hard disk status and topology parameters of the hard disk pool, and use one IO write request to store the data and distributed objects on the same logical slice to the same storage hard disk; In the same IO write request, the distributed log object on the logical shard is written to the corresponding high-speed medium, and the written distributed log object is written to the distributed log in chronological order. The distributed log records the write records of the data on the logical shard, and the write records include the log operation type, the name of the written data block, and the time point of writing the data; According to the disk pool parameters, the data of each logical shard is stored in the corresponding hard disk. During the data storage process, the distributed log object is written to the high-speed storage medium to generate a distributed log, including: Write the data and the distributed log object in a local transaction, and set the data write and the distributed log object write in the same transaction by updating the metadata in the local transaction; When data writing fails or distributed log object writing fails, the replica returns the write failure information to the master, and the master initiates the termination of the write operation of all replicas and generates a null operation in the high-speed medium to create logical space by terminating the write operation of all replicas; The differential data of the data block to be recovered is obtained through the distributed log, and data recovery is performed on the obtained differential data, including: When the storage hard disk recovers from a failure, all logical slices are traversed to determine whether the data of the current logical slice needs to be restored to the hard disk to be restored. If the data of the current logical slice does not need to be restored to the hard disk to be restored, the current logical slice is skipped and the traversal and determination of the next logical slice are continued; If the data of the current logical shard needs to be restored to the hard disk to be restored, read the distributed log of the current logical shard and the local log of the current shard in the hard disk to be restored, and obtain the minimum time point of the data to be restored and the name of the difference data block by comparing the read distributed log and local log; According to the obtained minimum time point and difference data block name, read the difference data of the corresponding data block within the minimum time point to the current time range, write the read difference data to the hard disk to be recovered, and write the corresponding difference distributed log to the local log in the hard disk of data recovery; After all differential distributed logs of the current logical shard are recovered, the next logical shard is recovered. After all logical shards are recovered, the data reconstruction of the hard disk to be recovered is completed.
2. The data reconstruction method based on distributed log differences according to claim 1 is characterized in that: The data of each logical shard is stored in the corresponding hard disk according to the hard disk pool parameters. During the data storage process, the distributed log object is written to the high-speed storage medium to generate a distributed log, including: in a three-copy transaction, a write request is sent to the master of the three copies through the client, and after the master receives the write request, the data of the logical shard is initiated to be written to the local hard disk of the master and the local hard disk of the slave node, and the distributed log object of the logical shard is initiated to be written to the high-speed medium of the master and the high-speed medium of the slave node.
3. The data reconstruction method based on distributed log differences according to claim 1 is characterized in that: The data of each logical shard is stored in the corresponding hard disk according to the hard disk pool parameters. During the data storage process, the distributed log object is written to the high-speed storage medium to generate a distributed log, including: in a three-copy transaction, after each copy is successfully written to the local hard disk of the master and the slave node, the write status of the copy is set to the ready-to-write status. When the master receives that the write status of the three copies is all in the ready-to-write status, the distributed log object of the logical shard is initiated to write to the high-speed medium of the master and the high-speed medium of the slave node. After completing the writing of the distributed log object of the logical shard, a message of successful writing of the data and the distributed log object is sent to the client.
4. The data reconstruction method based on distributed log differences according to claim 1 is characterized in that: According to the hard disk pool parameters, the data of each logical shard is stored in the corresponding hard disk. During the data storage process, the distributed log object is written to the high-speed storage medium to generate a distributed log, including: configuring the allocation strategy, and allocating the write address for the distributed log object according to the allocation strategy through the master copy.
5. The data reconstruction method based on distributed log differences according to claim 4 is characterized in that: Allocation strategies include: A write address of the current distributed log object is maintained through memory, and the memory is incremented each time according to the length of the current distributed log object. When the storage hard disk fails, the current write address of the distributed log object is recalculated by scanning the persistent data of the distributed log object; An infinite logical address space is used as the logical address space of the distributed log object. For failed distributed log objects, only the physical space is reclaimed, and the logical address space is not reclaimed.
6. A data reconstruction system based on distributed log differences, characterized in that: The system executes the data reconstruction method based on distributed log differences as described in any one of claims 1 to 5.
