Cache disk data recombination method and apparatus, and device, medium and program product
By generating cache master copies and incremental copies and establishing a redundant backup mechanism, the problem of cluster performance degradation after cache disk failure is solved, and rapid data recovery and transparent switching of read and write operations are achieved, ensuring the high availability of the cluster.
Patent Information
- Application Number
- PCT/CN2024/137119
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-03-27
- Filing Date
- 2024-12-05
- Publication Date
- 2025-10-02
AI Technical Summary
When a cache disk fails in a disk group, existing technologies require manual removal of the failed disk, rebuilding the disk group, and performing full data synchronization, resulting in degraded cluster performance and prolonged synchronization time.
By generating a cache master copy and a cache master incremental copy, establishing a cache copy synchronization group, and switching to other cache disks when a cache disk fails, data redundancy backup and rapid recovery are achieved, avoiding additional hardware costs.
After the cache disk fails, data can be quickly recovered and read and write operations can be transparently switched, ensuring the stability of cluster performance and high data availability, and avoiding long synchronization delays.
Smart Images

Figure CN2024137119_02102025_PF_FP_ABST
Abstract
Description
Method, device, equipment, medium and program product for cache disk data reorganization
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on March 27, 2024, with application number 202410355942.5 and application name “Method, device, equipment, medium and program product for cache disk data reorganization”, all contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of computer technology, and in particular to a method, apparatus, device, medium, and program product for cache disk data reorganization. Background Art
[0004] A hyperconverged system typically consists of multiple physical server nodes, each of which contains at least one disk group. Each disk group consists of one cache disk (used for reading and writing cached data) and multiple capacity disks (used for storing data). If a cache disk in a disk group fails, the disk group containing the cache disk becomes unavailable, causing all disks in the disk group (cache disks and capacity disks) to become unavailable. The cache data and capacity data in the disk group become inaccessible, and I / O reading and writing in the disk group ceases.
[0005] Because the cache disk in this disk group fails, the corresponding disk group is also inaccessible. The current solution is to manually remove the failed disk, delete the disk group it belongs to, remove the failed disk, add a new disk, and rebuild the disk group. After the disk group is rebuilt, a data resynchronization process occurs. This means that all backup data in other disk groups associated with the failed disk group will be synchronized to this disk group. This results in a large amount of read / write I / O (Input / Output), potentially severely degrading cluster performance. Because this disk group requires full data synchronization, if the disk group contains a large amount of data, synchronization may take a long time, significantly impacting cluster performance.
[0006] Therefore, in the related technology, when a cache disk failure occurs in a disk group, if a large amount of data is rewritten and synchronized, there is a problem of long synchronization time, which has a continuous impact on cluster performance. Summary of the Invention
[0007] In view of this, some embodiments of the present application provide a method, device, equipment, medium and program product for cache disk data reorganization to solve the problem in related technologies that after a cache disk failure occurs in a disk group, if there is a large amount of data rewriting and synchronization, there is a long synchronization time, which has a continuous impact on cluster performance.
[0008] In a first aspect, some embodiments of the present application provide a method for reorganizing cache disk data, the method comprising:
[0009] Obtain cache information in the first cache disk in the first disk group, and generate a cache master copy and a cache master incremental copy;
[0010] Obtaining, according to the cache master copy and the cache master incremental copy, a cache slave copy and a cache slave incremental copy generated in the second cache disk in the second disk group;
[0011] The cache replica and the cache replica incremental copy are created as a first cache replica synchronization group. When an indication of a failure of the first cache disk is received, a new cache replica and a new cache replica incremental copy generated in a third cache disk in a third disk group are obtained based on the cache replica and the cache replica incremental copy, and the new cache replica and the new cache replica incremental copy are created as a second cache replica synchronization group.
[0012] Obtain the situation where the second cache disk fails, and establish a replication relationship with the target cache disk of the first disk group according to the first cache copy synchronization group or the second cache copy synchronization group, so that the first disk group can resume normal read and write status, wherein the target cache disk is the new cache disk after replacing the first cache disk in the first disk group.
[0013] In some embodiments of the present application, by obtaining the cache information in the first cache disk in the first disk group, a cache master copy and a cache master incremental copy are generated, and at the same time, a cache replica and a cache replica incremental copy of the second cache disk in the second disk group are established to generate a first cache replica synchronization group. If the first cache disk fails, it is necessary to obtain a new cache replica and a new cache replica incremental of the third cache disk in the third disk group based on the cache replica and the cache replica incremental copy to generate a second cache replica synchronization group. Then, based on the failure of the second cache disk, it is determined whether to synchronize the first cache replica synchronization group to the target cache disk of the first disk group or to synchronize the second cache replica synchronization group to the target cache disk of the first disk group. This ensures the high availability of the cache disk without increasing user costs (no need to invest in additional hardware costs), and ensures that the disk group can still provide read and write operations after a problem occurs in the cache disk. After replacing the bad disk, the synchronization group is rebuilt to achieve data rebalancing with minimal data synchronization cost.
[0014] In some embodiments of the present application, obtaining cache information in a first cache disk in a first disk group and generating a cache master copy and a cache master incremental copy include:
[0015] Cache back up the information in the first cache disk to generate a cache master copy;
[0016] Based on the data changes in the cache master copy, the changed data is backed up and a cache master incremental copy is generated.
[0017] In some embodiments of the present application, obtaining, based on the cached primary copy and the cached primary incremental copy, the cached secondary copy and the cached secondary incremental copy generated in the second cache disk in the second disk group includes:
[0018] Copy the data in the cache master copy to the second cache disk, and generate a corresponding cache replica in the second cache disk;
[0019] The data in the cache primary incremental copy is copied to the second cache disk, and a corresponding cache secondary incremental copy is generated in the second cache disk.
[0020] In some embodiments of the present application, obtaining a new cache replica and a new cache replica generated in a third cache disk in a third disk group based on the cache replica and the cache replica incremental copy includes:
[0021] Replace the cached secondary copy in the second cache disk with the new cached primary copy, and replace the cached secondary incremental copy in the second cache disk with the new cached primary incremental copy;
[0022] Copy the new cache master copy to the third cache disk, and generate a new cache slave copy in the third cache disk;
[0023] The new cache primary incremental copy is copied to the third cache disk, and a new cache secondary incremental copy is correspondingly generated in the third cache disk.
[0024] In some embodiments of the present application, by replicating data and establishing synchronization groups, all cached data is ensured to be in a redundant backup state, ensuring that data is not lost.
[0025] In some embodiments of the present application, obtaining a failure of the second cache disk and establishing a replication relationship with a target cache disk of the first disk group according to the first cache replica synchronization group or the second cache replica synchronization group so that the first disk group recovers to a normal read and write state includes:
[0026] If the second cache disk does not fail, establish a replication relationship between the first cache copy synchronization group and the target cache disk, so that the first disk group can resume normal read and write status; or
[0027] In the event of a failure of the second cache disk, a replication relationship is established between the second cache replica synchronization group and the target cache disk, so that the first disk group can recover to a normal read and write state.
[0028] In some embodiments of the present application, by setting up incremental copies and a redundant fault mechanism of synchronization groups for cache blocks in the cache disk, data read and write operations and new read and write applications of the failed cache disk can be transparently switched to other cache disks, and after the failed disk is repaired or replaced, it is ensured that the cache data and changed data previously stored on the cache disk can be quickly restored to the new disk without affecting the cluster performance.
[0029] In some embodiments of the present application, when the second cache disk is not faulty, establishing a replication relationship between the first cache replica synchronization group and the target cache disk so that the first disk group can resume normal read and write status includes:
[0030] Merging the data in the cached secondary incremental copy into the cached secondary copy to obtain merged first data;
[0031] The first data is copied to the target cache disk, so that the first disk group recovers to a normal read and write state.
[0032] In some embodiments of the present application, when a second cache disk fails, establishing a replication relationship between the second cache replica synchronization group and the target cache disk so that the first disk group can resume normal read and write status includes:
[0033] Merging the data in the new cached secondary incremental copy into the new cached secondary copy to obtain merged second data;
[0034] The second data is copied to the target cache disk, so that the first disk group returns to a normal read and write state.
[0035] In some embodiments of the present application, merging data in the cached secondary incremental copy into the cached secondary copy to obtain merged first data includes:
[0036] When merging the data in the cached sub-incremental copy into the cached sub-incremental copy, if the remaining space of the cached sub-incremental copy cannot accommodate the data in the cached sub-incremental copy, the data in the cached sub-incremental copy is split, and a first preset number of data is cached in the remaining space, and a second preset number of data is used to generate a reference cached sub-copy, wherein the first preset number of data and the second preset number of data constitute the data in the cached sub-incremental copy;
[0037] The first data is obtained according to the data in the remaining space of the cache replica and the data in the reference cache replica.
[0038] In some embodiments of the present application, when merging data in the cached sub-incremental copy into the cached sub-replica, it can be determined whether to split the data in the cached sub-incremental copy based on the remaining space of the cached sub-replica and the accommodation result of the data in the cached sub-incremental copy, thereby ensuring the high efficiency of reading and writing the cached data.
[0039] In some embodiments of the present application, obtaining the first data based on the data in the remaining space of the cache replica and the data in the reference cache replica includes:
[0040] Establishing a sequential link pointer in the first cache block identification bit of the cache replica and the second cache block identification bit of the reference cache replica to obtain an association relationship;
[0041] First data is obtained according to the association relationship.
[0042] In some embodiments of the present application, the split data is merged based on the sequential link pointers established between the cache replica and the reference cache replica to ensure the integrity of the merged data.
[0043] In some embodiments of the present application, after splitting the data in the cached secondary incremental copy, caching the first preset number of data in the remaining space, and generating the reference cached secondary copy from the second preset number of data, the method further includes:
[0044] If the cache space of the reference cache replica exceeds the cache replica preset space, the cache space of the reference cache replica is split until the cache space of the split reference cache replica is lower than the cache replica preset space.
[0045] In some embodiments of the present application, after receiving the indication information indicating that the first cache disk has failed, the method further includes:
[0046] Obtaining data information in the first capacity disk in the first disk group and generating a master copy of the data;
[0047] According to the primary copy of the data, a corresponding secondary copy of the data generated in the second capacity disk of the second disk group is obtained;
[0048] Set the primary copy of the data to the default mode and perform read and write operations from the secondary copy of the data.
[0049] In some embodiments of the present application, by setting anti-affinity in the capacity disk, when a bad disk is replaced, data rebalancing can be achieved with minimal data synchronization cost, so that the capacity disk in the disk group where the failed disk is located can still provide data reading and writing normally without interrupting the normal reading and writing of data in the capacity disk.
[0050] In a second aspect, some embodiments of the present application provide a device for reorganizing cache disk data, the device comprising:
[0051] A first acquisition module is configured to acquire cache information in a first cache disk in a first disk group and generate a cache master copy and a cache master incremental copy;
[0052] A first obtaining module is configured to obtain, based on the cache master copy and the cache master incremental copy, the cache slave copy and the cache slave incremental copy generated in the second cache disk in the second disk group;
[0053] A creation module is used to create the cache replica and the cache replica incremental copy as a first cache replica synchronization group, and when receiving indication information that the first cache disk has failed, obtain a new cache replica and a new cache replica incremental copy generated in a third cache disk in a third disk group based on the cache replica and the cache replica incremental copy, and create the new cache replica and the new cache replica incremental copy as a second cache replica synchronization group;
[0054] A module is established to obtain the situation where the second cache disk fails, and establish a replication relationship with the target cache disk of the first disk group according to the first cache copy synchronization group or the second cache copy synchronization group, so that the first disk group can restore to a normal read and write state, wherein the target cache disk is a new cache disk after replacing the first cache disk in the first disk group.
[0055] On the third aspect, some embodiments of the present application provide a computer device, including: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the cache disk data reorganization method of some of the above-mentioned embodiments by executing the computer instructions.
[0056] In a fourth aspect, some embodiments of the present application provide a computer non-volatile readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the cache disk data reorganization method of some of the above-mentioned embodiments.
[0057] In a fifth aspect, some embodiments of the present application provide a computer program product including computer instructions, where the computer instructions are used to enable a computer to execute the cache disk data reorganization method of some of the above embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the specific implementation methods of this application or the technical solutions in related technologies, the following is a brief introduction to the drawings required for use in the specific implementation methods or related technical descriptions. Obviously, the drawings described below are some implementation methods of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0059] FIG1 is a flow chart of a method for reorganizing cache disk data according to some embodiments of the present application;
[0060] FIG2 is an architectural diagram of cache disk data reorganization according to some embodiments of the present application;
[0061] FIG3 is a flowchart related to cache disk data reorganization according to some embodiments of the present application;
[0062] FIG4 is a structural block diagram of an apparatus for reorganizing cache disk data according to some embodiments of the present application;
[0063] FIG5 is a schematic diagram of the hardware structure of a computer device according to some embodiments of the present application. DETAILED DESCRIPTION
[0064] To make the purpose, technical solutions, and advantages of the embodiments of the present application more clear, the technical solutions in some embodiments of the present application will be clearly and completely described below in conjunction with the drawings in some embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of this application.
[0065] In related technologies, when a cache disk in a disk group fails, the disk group containing the failed disk becomes completely unavailable because the cache disk lacks a replication mechanism. This requires rebuilding the disk group and performing data synchronization. This results in a high volume of I / O reads and writes to the cluster, potentially severely degrading cluster performance. Because full data synchronization is required for a large disk group, synchronization can take a long time, significantly impacting cluster performance.
[0066] In order to solve the above problems, according to some embodiments of the present application, a method embodiment of cache disk data reorganization is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that here.
[0067] In some embodiments of the present application, a method for reorganizing cache disk data is provided. FIG1 is a flow chart of the method for reorganizing cache disk data according to some embodiments of the present application. As shown in FIG1 , the method can be applied to a hyper-converged system. The method flow includes the following steps:
[0068] Step S101: Obtain cache information in the first cache disk in the first disk group, and generate a cache master copy and a cache master incremental copy;
[0069] Step S102: obtaining a cached secondary copy and a cached secondary incremental copy generated in a second cache disk in a second disk group according to the cached primary copy and the cached primary incremental copy;
[0070] Step S103: Create the cache replica and the cache replica incremental copy as a first cache replica synchronization group. When receiving indication information that the first cache disk has failed, obtain a new cache replica and a new cache replica incremental copy generated in the third cache disk in the third disk group based on the cache replica and the cache replica incremental copy, and create the new cache replica and the new cache replica incremental copy as a second cache replica synchronization group.
[0071] Step S104, obtain the situation where the second cache disk fails, and establish a replication relationship with the target cache disk of the first disk group according to the first cache copy synchronization group or the second cache copy synchronization group, so that the first disk group can restore to a normal read and write state, wherein the target cache disk is a new cache disk after replacing the first cache disk in the first disk group.
[0072] Optionally, as shown in Figure 2, disk group A in Figure 2 is referred to as a first disk group, and cache disk A in disk group A is referred to as a first cache disk. In some embodiments of the present application, the hyper-converged system obtains cache information in the first cache disk and generates a cache master copy and a cache master incremental copy of the first cache disk based on the cache information.
[0073] Since a hyper-converged system typically consists of multiple physical server nodes, each physical server node contains at least one disk group. Each disk group consists of one cache disk (used for reading and writing cache data) and multiple capacity disks (used for storing data). Therefore, in addition to the first disk group, a hyper-converged system can also contain N other disk groups.
[0074] As shown in Figure 2, disk group B in Figure 2 is referred to as the second disk group, and cache disk B within disk group B is referred to as the second cache disk. After obtaining the cached primary copy and cached primary incremental copy generated for the first cache disk, the cached secondary copy and cached secondary incremental copy generated for the second cache disk in the second disk group can be obtained based on the cached primary copy and cached primary incremental copy.
[0075] In some embodiments of the present application, it is necessary to create a cache replica synchronization group to ensure that all cached data is in a backup (i.e., redundant) state. At this time, the cache replica and the cache replica incremental copy are created as a first cache replica synchronization group. Then, if the first cache disk fails, the hyper-converged system will receive an indication that the first cache disk has failed, and then generate other disk groups based on the cache replica and cache replica incremental copy of the second disk group, such as a new cache replica and a new cache replica incremental of disk group C (currently called the third disk group), and at the same time, create the new cache replica and the new cache replica incremental copy as a second cache replica synchronization group, so that all cached data in the second cache disk of the second disk group is backed up in the second cache replica synchronization group.
[0076] Since the first cache disk of the first disk group has failed, the first cache disk needs to be replaced. In this case, a new cache disk (i.e., the target cache disk) is used to replace the first cache disk. Then, depending on the failure of the second cache disk in the second disk group, the first cache copy synchronization group is used to establish a replication relationship with the target cache disk of the first disk group, or the second cache copy synchronization group is used to establish a replication relationship with the target cache disk of the first disk group. This achieves the purpose of synchronizing all cached data and changed data to the target cache disk. When the replication is completed, the first cache disk will replace the second cache disk and restore to the previous synchronization group, so that the first disk group can return to normal read and write status.
[0077] In some embodiments of the present application, by obtaining the cache information in the first cache disk in the first disk group, a cache master copy and a cache master incremental copy are generated, and at the same time, a cache replica and a cache replica incremental copy of the second cache disk in the second disk group are established to generate a first cache replica synchronization group. If the first cache disk fails, it is necessary to obtain a new cache replica and a new cache replica incremental of the third cache disk in the third disk group based on the cache replica and the cache replica incremental copy to generate a second cache replica synchronization group. Then, based on the failure of the second cache disk, it is determined whether to synchronize the first cache replica synchronization group to the target cache disk of the first disk group or to synchronize the second cache replica synchronization group to the target cache disk of the first disk group. This ensures the high availability of the cache disk without increasing user costs (no need to invest in additional hardware costs), and ensures that the disk group can still provide read and write operations after a problem occurs in the cache disk. After replacing the bad disk, the synchronization group is rebuilt to achieve data rebalancing with minimal data synchronization cost.
[0078] In some embodiments of the present application, obtaining cache information in a first cache disk in a first disk group and generating a cache master copy and a cache master incremental copy include:
[0079] Cache back up the information in the first cache disk to generate a cache master copy;
[0080] Based on the data changes in the cache master copy, the changed data is backed up and a cache master incremental copy is generated.
[0081] Optionally, calculate the number of used cache blocks M of the first cache disk. Assuming that there are N cache disks in the hyper-converged system, split the number of used cache blocks M of the first cache disk into N-1 parts, each of which is M / N-1 in size (if the result is less than 1 part, it is calculated as 1 part), and copy them to (N-1) cache disks to obtain the cache master copy in the first cache disk.
[0082] Capture the cache master copy being read and written in the first cache disk, modify the cache block header flag being read and written, mark it as an active copy, and write the changed content of the active copy into the new cache block of the first cache disk for backup, and mark the new cache block as the cache master incremental copy.
[0083] In some embodiments of the present application, obtaining, based on the cached primary copy and the cached primary incremental copy, the cached secondary copy and the cached secondary incremental copy generated in the second cache disk in the second disk group includes:
[0084] Copy the data in the cache master copy to the second cache disk, and generate a corresponding cache replica in the second cache disk;
[0085] The data in the cache primary incremental copy is copied to the second cache disk, and a corresponding cache secondary incremental copy is generated in the second cache disk.
[0086] Optionally, as shown in Figure 2, the data of the cache master copy can be copied to the cache block in the second cache disk to obtain the cache secondary copy; the data of the cache master incremental copy can be copied to the incremental cache block in the second cache disk to obtain the cache secondary incremental copy.
[0087] In some embodiments of the present application, obtaining a new cache replica and a new cache replica generated in a third cache disk in a third disk group based on the cache replica and the cache replica incremental copy includes:
[0088] Replace the cached secondary copy in the second cache disk with the new cached primary copy, and replace the cached secondary incremental copy in the second cache disk with the new cached primary incremental copy;
[0089] Copy the new cache master copy to the third cache disk, and generate a new cache slave copy in the third cache disk;
[0090] The new cache primary incremental copy is copied to the third cache disk, and a new cache secondary incremental copy is correspondingly generated in the third cache disk.
[0091] Optionally, in some embodiments of the present application, after the hyper-converged system receives an indication that the first cache disk has failed, it will adjust the cache replica of the second cache disk in the second disk group to a new cache master copy, and adjust the cache replica incremental copy of the second cache disk to a new cache master incremental copy.
[0092] Because each physical server node in a hyper-converged system includes at least one disk group, some embodiments of the present application also include a third disk group and a third cache disk within the third disk group. In this case, the new cache master copy is copied to the third cache disk, and a new cache replica is generated within the third cache disk. The new cache master incremental copy is copied to the third cache disk, and a new cache replica incremental copy is generated within the third cache disk.
[0093] After a new cache replica and a new cache replica incremental copy are generated in the third cache disk, the new cache replica and the new cache replica incremental copy need to be created as a second cache replica synchronization group.
[0094] The specific process is as follows: Calculate the number of used cache blocks on the second cache disk (M). If there are N-1 healthy cache disks in the hyper-converged system, split the number of used cache blocks on the second cache disk (M) into N-2 parts, each of size M / N-2 (if the result is less than 1 part, it will be calculated as 1 part). Copy the blocks to the (N-2) cache disks. Generate a corresponding cache replica for each of these copied cache blocks (i.e., a new cache replica on the third cache disk), and a new cache master replica on the second cache disk. A second cache synchronization group relationship is established between the second cache disk and the third cache disk, and all synchronization groups with the first cache replica on the first cache disk are deleted to ensure cache replica redundancy.
[0095] In some embodiments of the present application, by replicating data and establishing synchronization groups, all cached data is ensured to be in a redundant backup state, ensuring that data is not lost.
[0096] In some embodiments of the present application, obtaining a failure of the second cache disk and establishing a replication relationship with a target cache disk of the first disk group according to the first cache replica synchronization group or the second cache replica synchronization group so that the first disk group recovers to a normal read and write state includes:
[0097] If the second cache disk does not fail, establish a replication relationship between the first cache copy synchronization group and the target cache disk, so that the first disk group can resume normal read and write status; or
[0098] In the event of a failure of the second cache disk, a replication relationship is established between the second cache replica synchronization group and the target cache disk, so that the first disk group can recover to a normal read and write state.
[0099] Optionally, for some embodiments of the present application, whether to synchronize the data of the first cache copy synchronization group to the target cache disk of the first disk group or to synchronize the data of the second cache copy synchronization group to the target cache disk of the first disk group depends on the failure condition of the second cache disk.
[0100] Specifically, if the second cache disk has not failed, a replication relationship is established between the first cache copy synchronization group and the target cache disk so that the first disk group can resume normal read and write status; or, if the second cache disk has failed, a replication relationship is established between the second cache copy synchronization group and the target cache disk so that the first disk group can resume normal read and write status.
[0101] In some embodiments of the present application, by setting up incremental copies and a redundant fault mechanism of synchronization groups for cache blocks in the cache disk, data read and write operations and new read and write applications of the failed cache disk can be transparently switched to other cache disks, and after the failed disk is repaired or replaced, it is ensured that the cache data and changed data previously stored on the cache disk can be quickly restored to the new disk without affecting the cluster performance.
[0102] In some embodiments of the present application, when the second cache disk is not faulty, establishing a replication relationship between the first cache replica synchronization group and the target cache disk so that the first disk group can resume normal read and write status includes:
[0103] Merging the data in the cached secondary incremental copy into the cached secondary copy to obtain merged first data;
[0104] The first data is copied to the target cache disk, so that the first disk group recovers to a normal read and write state.
[0105] Optionally, since incremental data are all changed data, such as new data, modified data, deleted data, etc., when establishing a replication relationship between the first cache copy synchronization group and the target cache disk, the data in the cache sub-incremental copy is actually merged into the cache sub-copy first to obtain the merged first data, and then the first data is copied to the target cache disk, so that the first disk group returns to normal read and write status.
[0106] In some embodiments of the present application, when a second cache disk fails, establishing a replication relationship between the second cache replica synchronization group and the target cache disk so that the first disk group can resume normal read and write status includes:
[0107] Merging the data in the new cached secondary incremental copy into the new cached secondary copy to obtain merged second data;
[0108] The second data is copied to the target cache disk, so that the first disk group returns to a normal read and write state.
[0109] Optionally, as in the above embodiment, when establishing a replication relationship between the second cache copy synchronization group and the target cache disk, the data in the new cache replica incremental copy is also merged into the new cache replica to obtain the merged second data, and then the second data is copied to the target cache disk, so that the first disk group returns to normal read and write status.
[0110] In some embodiments of the present application, merging data in the cached secondary incremental copy into the cached secondary copy to obtain merged first data includes:
[0111] When merging the data in the cached sub-incremental copy into the cached sub-incremental copy, if the remaining space of the cached sub-incremental copy cannot accommodate the data in the cached sub-incremental copy, the data in the cached sub-incremental copy is split, and a first preset number of data is cached in the remaining space, and a second preset number of data is used to generate a reference cached sub-copy, wherein the first preset number of data and the second preset number of data constitute the data in the cached sub-incremental copy;
[0112] The first data is obtained according to the data in the remaining space of the cache replica and the data in the reference cache replica.
[0113] Optionally, when performing data merging, if the remaining space of the cached secondary copy cannot accommodate the data in the cached secondary incremental copy, the data in the cached secondary incremental copy is split, and a part of it is merged into the remaining space of the cached primary copy, and the remaining content is used to generate another new cached primary copy. For example, the first preset number of data is cached in the remaining space, and the second preset number of data is used to generate a new cached primary copy, such as referring to the cached secondary copy.
[0114] If the cache space of the reference cache replica exceeds the cache replica preset space, continue to split the reference cache replica until the last newly generated reference cache replica is no larger than the cache replica preset space, then stop splitting.
[0115] Then, the data in the remaining space of the cache replica and the data in the reference cache replica are combined to obtain the first data.
[0116] It should be noted that the idea of data merging in some embodiments of the present application is also applicable to the scenario of merging data in a new cached secondary incremental copy into a new cached secondary copy to obtain merged second data.
[0117] In some embodiments of the present application, when merging data in the cached sub-incremental copy into the cached sub-replica, it can be determined whether to split the data in the cached sub-incremental copy based on the remaining space of the cached sub-replica and the accommodation result of the data in the cached sub-incremental copy, thereby ensuring the high efficiency of reading and writing the cached data.
[0118] In some embodiments of the present application, obtaining the first data based on the data in the remaining space of the cache replica and the data in the reference cache replica includes:
[0119] Establishing a sequential link pointer in the first cache block identification bit of the cache replica and the second cache block identification bit of the reference cache replica to obtain an association relationship;
[0120] First data is obtained according to the association relationship.
[0121] Optionally, since the data in the cache sub-incremental copy is split when the data of the cache sub-incremental copy is merged into the cache sub-copy, and placed in the remaining space of the cache sub-copy and the reference cache sub-copy respectively, in order to ensure the high efficiency of reading and writing of cached data, a sequential link pointer is established in the first cache block identification bit of the cache sub-copy and the second cache block identification bit of the reference cache sub-copy to obtain the association relationship of the cache copies. In this way, according to the sequential link pointer, it is possible to know which data currently needs to be merged, and then obtain the first data after the merge.
[0122] It should be noted that the idea of establishing sequential link pointers in some embodiments of the present application is also applicable to the scenario of merging data in a new cached secondary incremental copy into a new cached secondary copy to obtain merged second data.
[0123] In some embodiments of the present application, the split data is merged based on the sequential link pointers established between the cache replica and the reference cache replica to ensure the integrity of the merged data.
[0124] In some embodiments of the present application, after receiving the indication information indicating that the first cache disk has failed, the method further includes:
[0125] Obtaining data information in the first capacity disk in the first disk group and generating a master copy of the data;
[0126] According to the primary copy of the data, a corresponding secondary copy of the data generated in the second capacity disk of the second disk group is obtained;
[0127] Set the primary copy of the data to the default mode and perform read and write operations from the secondary copy of the data.
[0128] Optionally, as shown in Figure 2, each disk group consists of one cache disk (used for reading and writing cache data) and multiple capacity disks (used for storing data). Disk group A (i.e., the first disk group) and disk group B (i.e., the second disk group) both contain multiple capacity disks.
[0129] The data information in the first capacity disk in the first disk group is obtained to generate the data master copy in Figure 2; then, based on the data master copy, the corresponding data replica generated in the second capacity disk in the second disk group is obtained.
[0130] Before the cache disk fails, the primary copy of the capacity disk data of the first disk group and the secondary copy of the capacity disk data of the corresponding second disk group are set to the local priority read and write policy; when a cache failure occurs, the primary copy of the capacity disk data of the first disk group is set to a preset mode, such as anti-affinity, and priority is given to reading and writing from the secondary copy of the capacity disk data of the second disk group. That is, when there is a new read and write request for the primary copy of the capacity disk data in the first disk group, the IO is redirected to the secondary copy of the capacity disk data of the second disk group, and the incremental data of the capacity disk of the second disk group is asynchronously copied back to the capacity disk of the first disk group where the failed disk is located. After replacing the failed disk, the cache secondary copy and the cache secondary incremental copy on the cache disk are copied to the new disk (i.e., the target cache disk). After the copying is completed, the read and write anti-affinity configuration becomes invalid, and the first disk group returns to normal read and write status.
[0131] In some embodiments of the present application, by setting anti-affinity in the capacity disk, when a bad disk is replaced, data rebalancing can be achieved with minimal data synchronization cost, so that the capacity disk in the disk group where the failed disk is located can still provide data reading and writing normally without interrupting the normal reading and writing of data in the capacity disk.
[0132] In some embodiments of the present application, as shown in FIG3 , FIG3 includes a cache disk redundancy setting process and a cache disk failure handling process.
[0133] In the cache disk redundancy configuration process, a cache replica is generated, a cache incremental replica is generated from the cache replica, and a cache synchronization group is created based on the cache replica and the cache incremental replica.
[0134] In the cache disk failure handling process, cache read and write IO is redirected, then a new synchronization group is created, and then anti-affinity is set on the capacity disk of the failed disk group, and finally the synchronization group is restored.
[0135] This embodiment also provides a cache disk data reorganization device, which is used to implement the above-mentioned embodiments and preferred implementations. Details already described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0136] This embodiment provides a cache disk data reorganization device, as shown in FIG4 , including:
[0137] A first acquisition module is configured to acquire cache information in a first cache disk in a first disk group and generate a cache master copy and a cache master incremental copy;
[0138] A first obtaining module is configured to obtain, based on the cache primary copy and the cache primary incremental copy, the cache secondary copy and the cache secondary incremental copy generated in the second cache disk in the second disk group;
[0139] A creation module is used to create the cache replica and the cache replica incremental copy as a first cache replica synchronization group, and when receiving indication information that the first cache disk has failed, obtain a new cache replica and a new cache replica incremental copy generated in a third cache disk in a third disk group based on the cache replica and the cache replica incremental copy, and create the new cache replica and the new cache replica incremental copy as a second cache replica synchronization group;
[0140] A module is established to obtain the situation where the second cache disk fails, and establish a replication relationship with the target cache disk of the first disk group according to the first cache copy synchronization group or the second cache copy synchronization group, so that the first disk group can restore to a normal read and write state, wherein the target cache disk is a new cache disk after replacing the first cache disk in the first disk group.
[0141] In some embodiments of the present application, the first acquisition module includes:
[0142] A first generation submodule is used to cache and back up the information in the first cache disk to generate a cache master copy;
[0143] The second generation submodule is used to back up the changed data according to the data changes in the cache master copy and generate a cache master incremental copy.
[0144] In some embodiments of the present application, the first obtaining module includes:
[0145] A third generation submodule is used to copy the data in the cache master copy to the second cache disk, and generate a corresponding cache replica in the second cache disk;
[0146] The fourth generation submodule is used to copy the data in the cache primary incremental copy to the second cache disk, and to generate a corresponding cache secondary incremental copy in the second cache disk.
[0147] In some embodiments of the present application, creating a module includes:
[0148] A replacement submodule is used to replace the cached secondary copy in the second cache disk with a new cached primary copy, and replace the cached secondary incremental copy in the second cache disk with a new cached primary incremental copy;
[0149] a fifth generation submodule, configured to copy the new cache master copy to the third cache disk, and correspondingly generate a new cache slave copy in the third cache disk;
[0150] The sixth generation submodule is used to copy the new cache primary incremental copy to the third cache disk, and correspondingly generate a new cache secondary incremental copy in the third cache disk.
[0151] In some embodiments of the present application, a module is established, including:
[0152] The first establishing submodule is configured to establish a replication relationship between the first cache copy synchronization group and the target cache disk when the second cache disk does not fail, so that the first disk group can resume normal read and write status; or
[0153] The second establishing submodule is used to establish a replication relationship between the second cache copy synchronization group and the target cache disk when a failure occurs in the second cache disk, so that the first disk group can recover to a normal read and write state.
[0154] In some embodiments of the present application, the first establishment submodule includes:
[0155] a first merging unit, configured to merge data in the cached secondary incremental copy into the cached secondary copy to obtain merged first data;
[0156] The first copying unit is configured to copy the first data to a target cache disk, so that the first disk group recovers to a normal read and write state.
[0157] In some embodiments of the present application, the second establishing submodule includes:
[0158] A second merging unit, configured to merge the data in the new cached secondary incremental copy into the new cached secondary copy to obtain merged second data;
[0159] The second copying unit is used to copy the second data to the target cache disk, so that the first disk group recovers to a normal read and write state.
[0160] In some embodiments of the present application, the first merging unit includes:
[0161] A first splitting sub-unit is configured to split the data in the cached sub-incremental copy, caching a first preset number of data in the remaining space and generating a reference cached sub-copy with a second preset number of data when merging the data in the cached sub-incremental copy into the cached sub-incremental copy, if the remaining space of the cached sub-incremental copy cannot accommodate the data in the cached sub-incremental copy, wherein the first preset number of data and the second preset number of data constitute the data in the cached sub-incremental copy;
[0162] The obtaining subunit is configured to obtain first data based on the data in the remaining space of the cache replica and the data in the reference cache replica.
[0163] In some embodiments of the present application, a sub-unit is obtained, which is specifically used to establish a sequential link pointer in the first cache block identification bit of the cache replica and the second cache block identification bit of the reference cache replica to obtain an association relationship; and the first data is obtained according to the association relationship.
[0164] In some embodiments of the present application, the device further comprises:
[0165] The second splitting sub-unit is used to split the data in the cached sub-incremental copy, cache the first preset number of data in the remaining space, and generate a reference cached sub-copy with the second preset number of data. If the cache space of the reference cached sub-copy exceeds the cached copy preset space, the cache space of the reference cached sub-copy is split until the cache space of the reference cached sub-copy after the split is lower than the cached copy preset space.
[0166] In some embodiments of the present application, the device further comprises:
[0167] A second acquisition module is configured to, after receiving indication information indicating a failure of the first cache disk, acquire data information in the first capacity disk in the first disk group and generate a master copy of the data;
[0168] A second obtaining module is used to obtain a corresponding data replica generated in a second capacity disk in a second disk group according to the data master replica;
[0169] The setting module is used to set the primary copy of the data to a preset mode and operate from the secondary copy of the data when performing read and write operations.
[0170] The cache disk data reorganization device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0171] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0172] Some embodiments of the present application further provide a computer device having the cache disk data reorganization device shown in FIG. 4 .
[0173] Please refer to Figure 5, which is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present application. As shown in Figure 5, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses and can be installed on a common motherboard or installed in other ways as needed. The processor can process instructions executed within the computer device, including instructions stored in or on the memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to the interface). In some embodiments of the present application, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 takes a processor 10 as an example.
[0174] The processor 10 may be a central processing unit, a network processor, or a combination thereof. The processor 10 may further include a hardware processor. The hardware processor may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CPLD), a field programmable gate array (FPGA), a general purpose array logic (GAL), or any combination thereof.
[0175] The memory 20 stores instructions that can be executed by at least one processor 10, so as to enable at least one processor 10 to execute the method shown in the above embodiment.
[0176] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created based on the use of a computer device for displaying a small program landing page, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments of the present application, the memory 20 may optionally include a memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0177] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0178] The computer device further includes a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0179] Some embodiments of the present application also provide a computer non-volatile readable storage medium. The above-mentioned methods according to some embodiments of the present application can be implemented in hardware, firmware, or implemented as computer code that can be recorded in a storage medium, or implemented as computer code that is originally stored in a remote storage medium or a non-transitory machine non-volatile readable storage medium and downloaded via a network and will be stored in a local storage medium, so that the methods described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.
[0180] Part of the present application may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present application through the operation of the computer. Those skilled in the art should understand that the form in which the computer program instruction exists in a computer-readable medium includes but is not limited to a source file, an executable file, an installation package file, etc. Accordingly, the way in which the computer program instruction is executed by the computer includes but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable non-volatile storage medium or communication medium that can be accessed by the computer.
[0181] Although some embodiments of the present application have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present application, and such modifications and variations shall fall within the scope defined by the appended claims.
Claims
1. A method for reorganizing cache disk data, characterized in that: The method comprises: Obtain cache information in the first cache disk in the first disk group, and generate a cache master copy and a cache master incremental copy; Obtaining, according to the cache master copy and the cache master incremental copy, a cache slave copy and a cache slave incremental copy generated in a second cache disk in a second disk group; The cache replica and the cache replica incremental replica are created as a first cache replica synchronization group. Upon receiving indication information that the first cache disk has failed, a new cache replica and a new cache replica incremental replica generated in a third cache disk in a third disk group are obtained based on the cache replica and the cache replica incremental replica, and the new cache replica and the new cache replica incremental replica are created as a second cache replica synchronization group. Obtain the situation where the second cache disk fails, and establish a replication relationship with the target cache disk of the first disk group according to the first cache copy synchronization group or the second cache copy synchronization group, so that the first disk group can restore to a normal read and write state, wherein the target cache disk is a new cache disk in the first disk group after replacing the first cache disk.
2. The method according to claim 1, characterized in that The step of obtaining cache information in the first cache disk in the first disk group and generating a cache master copy and a cache master incremental copy includes: Performing cache backup on the information in the first cache disk to generate the cache master copy; According to the data changes in the cache master copy, the changed data is backed up to generate the cache master incremental copy.
3. The method according to claim 2, characterized in that The step of backing up the changed data according to the data changes in the cache master copy and generating the cache master incremental copy includes: Obtaining the cache master copy currently being read and written in the first cache disk; Modify the cache block header flag of the cache master copy to mark the cache master copy as an active copy; Acquire the changed content of the active copy, and write the changed content of the active copy into the target cache block of the first cache disk; The target cache block is marked as the cache master incremental copy.
4. The method according to claim 1, wherein The step of obtaining, based on the cache master copy and the cache master incremental copy, a cache slave copy and a cache slave incremental copy generated in a second cache disk in the second disk group includes: Copy the data in the cache master copy to the second cache disk, and generate the cache slave copy in the second cache disk accordingly; The data in the cache primary incremental copy is copied to the second cache disk, and the cache secondary incremental copy is correspondingly generated in the second cache disk.
5. The method according to claim 4, characterized in that The step of copying the data in the cache master copy to the second cache disk and correspondingly generating the cache slave copy in the second cache disk includes: The data in the cache master copy is copied to the cache block in the second cache disk, and the cache slave copy is correspondingly generated in the second cache disk.
6. The method according to claim 4, characterized in that The step of copying the data in the cache primary incremental copy to the second cache disk and correspondingly generating the cache secondary incremental copy in the second cache disk includes: The data in the cache primary incremental copy is copied to the incremental cache block in the second cache disk, and the cache secondary incremental copy is correspondingly generated in the second cache disk.
7. The method according to claim 1, characterized in that The step of obtaining a new cache replica and a new cache replica increment generated in a third cache disk in a third disk group according to the cache replica and the cache replica increment copy includes: Replacing the cached secondary copy in the second cache disk with a new cached primary copy, and replacing the cached secondary incremental copy in the second cache disk with a new cached primary incremental copy; Copying the new cache master copy to the third cache disk, and generating the new cache slave copy correspondingly in the third cache disk; The new cache primary incremental copy is copied to the third cache disk, and the new cache secondary incremental copy is correspondingly generated in the third cache disk.
8. The method according to claim 1, characterized in that The obtaining of a failure of the second cache disk and establishing a replication relationship with a target cache disk of the first disk group according to the first cache replica synchronization group or the second cache replica synchronization group so that the first disk group recovers to a normal read and write state includes: In the case that the second cache disk does not fail, establishing a replication relationship between the first cache replica synchronization group and the target cache disk, so that the first disk group recovers to a normal read and write state; or In the event that the second cache disk fails, a replication relationship is established between the second cache replica synchronization group and the target cache disk, so that the first disk group recovers to a normal read and write state.
9. The method according to claim 8, characterized in that The step of establishing a replication relationship between the first cache replica synchronization group and the target cache disk when the second cache disk is not faulty, so that the first disk group recovers to a normal read / write state, includes: Merging the data in the cached secondary incremental copy into the cached secondary copy to obtain merged first data; The first data is copied to the target cache disk, so that the first disk group recovers to a normal read and write state.
10. The method according to claim 8, characterized in that The method of establishing a replication relationship between the second cache replica synchronization group and the target cache disk in the event that the second cache disk fails, so that the first disk group recovers to a normal read and write state, includes: Merging the data in the new cached secondary incremental copy into the new cached secondary copy to obtain merged second data; The second data is copied to the target cache disk, so that the first disk group recovers to a normal read and write state.
11. The method according to claim 9, characterized in that Merging the data in the cached secondary incremental copy into the cached secondary copy to obtain merged first data includes: When merging the data in the cached sub-incremental copy into the cached sub-incremental copy, if the remaining space of the cached sub-incremental copy cannot accommodate the data in the cached sub-incremental copy, the data in the cached sub-incremental copy is split, a first preset number of data are cached in the remaining space, and a second preset number of data are used to generate a reference cached sub-copy, wherein the first preset number of data and the second preset number of data constitute the data in the cached sub-incremental copy; The first data is obtained according to the data in the remaining space of the cache replica and the data in the reference cache replica.
12. The method according to claim 11, characterized in that The obtaining of the first data according to the data in the remaining space of the cache replica and the data in the reference cache replica includes: Establishing a sequential link pointer in the first cache block identification bit of the cache replica and the second cache block identification bit of the reference cache replica to obtain an association relationship; The first data is obtained according to the association relationship.
13. The method according to claim 11, characterized in that After splitting the data in the cached secondary incremental copy, caching a first preset number of data in the remaining space, and generating a reference cached secondary copy from a second preset number of data, the method further includes: If the cache space of the reference cache replica exceeds the cache replica preset space, the cache space of the reference cache replica is split until the cache space of the split reference cache replica is lower than the cache replica preset space.
14. The method according to claim 1, wherein After receiving indication information indicating that the first cache disk has failed, the method further includes: Obtaining data information in the first capacity disk in the first disk group and generating a master copy of the data; According to the primary copy of the data, a corresponding secondary copy of the data generated in the second capacity disk in the second disk group is obtained; The primary data copy is set to a preset mode, and operations are performed from within the secondary data copy when performing read and write operations.
15. The method according to claim 14, characterized in that Before receiving the indication information that the first cache disk has failed, the primary data copy and the secondary data copy are set to a local priority read and write policy.
16. The method according to claim 1, wherein The method is applied to the hyper-convergence system side.
17. A device for reorganizing cache disk data, characterized in that: The device comprises: A first acquisition module is configured to acquire cache information in a first cache disk in a first disk group and generate a cache master copy and a cache master incremental copy; A first obtaining module is configured to obtain a cached secondary copy and a cached secondary incremental copy generated in a second cache disk in a second disk group according to the cached primary copy and the cached primary incremental copy; a creation module configured to create the cache replica and the cache replica incremental replica as a first cache replica synchronization group, and upon receiving indication information that the first cache disk has failed, obtain a new cache replica and the new cache replica incremental generated in a third cache disk in a third disk group based on the cache replica and the cache replica incremental replica, and create the new cache replica and the new cache replica incremental replica as a second cache replica synchronization group; An establishment module is configured to obtain a situation in which the second cache disk fails, and establish a replication relationship with the target cache disk of the first disk group according to the first cache copy synchronization group or the second cache copy synchronization group, so that the first disk group can restore to a normal read and write state, wherein the target cache disk is a new cache disk in the first disk group after replacing the first cache disk.
18. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for cache disk data reorganization according to any one of claims 1 to 16 by executing the computer instructions.
19. A computer-readable non-volatile storage medium, characterized in that: The computer non-volatile readable storage medium stores computer instructions, and the computer instructions are configured to enable a computer to execute the cache disk data reorganization method according to any one of claims 1 to 11.
20. A computer program product, characterized in that The method comprises computer instructions configured to cause a computer to execute the cache disk data reorganization method according to any one of claims 1 to 16.
Citation Information
Patent Citations
A disaster recovery platform and a disaster recovery method
CN109597718A
Data recovery method and backup system
CN115686944A
Cache disk data recombination method, device, equipment, medium and program product
CN117950905A
Synchronized flashcopy backup restore of a raid protected array
US20160203055A1