[go: up one dir, main page]

CN104090729B - The method and device of mirror image synchronization is repaired by business write operation - Google Patents

The method and device of mirror image synchronization is repaired by business write operation Download PDF

Info

Publication number
CN104090729B
CN104090729B CN201410317976.1A CN201410317976A CN104090729B CN 104090729 B CN104090729 B CN 104090729B CN 201410317976 A CN201410317976 A CN 201410317976A CN 104090729 B CN104090729 B CN 104090729B
Authority
CN
China
Prior art keywords
resource
mirror
faulty
writing
business
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410317976.1A
Other languages
Chinese (zh)
Other versions
CN104090729A (en
Inventor
石岩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN201410317976.1A priority Critical patent/CN104090729B/en
Publication of CN104090729A publication Critical patent/CN104090729A/en
Application granted granted Critical
Publication of CN104090729B publication Critical patent/CN104090729B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Hardware Redundancy (AREA)

Abstract

本发明提供通过业务写操作修复镜像同步的方法及装置,该方法包括:在执行将主资源数据同步到镜像资源的同步任务时,将故障区域的故障资源地址记录到缓存资源,并标记主资源与镜像资源的镜像状态为未同步,故障资源地址包括主资源读不成功导致镜像资源无法写入,或主资源读成功而镜像资源写不成功的故障区域的故障资源地址;当写入业务数据时,如果镜像资源写成功,且写成功区域属于故障区域,则清除写成功区域对应的故障资源地址;当同步任务完成,且缓存资源中没有故障资源地址时,将镜像状态标记为已同步。应用本发明在镜像状态为未同步时,只要镜像资源写业务数据成功,就可以替换主资源,为业务提供镜像保护,从而最大化镜像资源的利用率。

The present invention provides a method and device for repairing mirror synchronization through business write operations. The method includes: when executing the synchronization task of synchronizing the data of the main resource to the mirror resource, recording the address of the faulty resource in the faulty area to the cache resource, and marking the master resource The mirroring status of the mirroring resource is not synchronized, and the address of the faulty resource includes the address of the faulty resource in the faulty area where the mirroring resource cannot be written because the primary resource is not read successfully, or the primary resource is read successfully but the mirroring resource is not written successfully; when writing business data , if the mirror resource is successfully written, and the successfully written area belongs to the faulty area, clear the faulty resource address corresponding to the successfully written area; when the synchronization task is completed and there is no faulty resource address in the cache resource, the mirroring status is marked as synchronized. When the mirroring state is not synchronized by applying the present invention, as long as the mirroring resource writes business data successfully, the main resource can be replaced to provide mirroring protection for the business, thereby maximizing the utilization rate of the mirroring resource.

Description

通过业务写操作修复镜像同步的方法及装置Method and device for repairing mirror synchronization through business write operations

技术领域technical field

本发明涉及存储技术领域,尤其涉及一种通过业务写操作修复镜像同步的方法及装置。The invention relates to the field of storage technologies, in particular to a method and device for repairing mirror synchronization through business write operations.

背景技术Background technique

镜像技术是将数据同时写入两份独立的磁盘中,如RAID1(Redundant Array ofIndependent Disks1,独立磁盘冗余阵列1),或是写入建立在多个物理资源上的卷资源中。其中,一个资源称为主资源,另一个资源作为主资源的副本,称为镜像资源,当主资源故障时,可以将业务切换至镜像资源,以保证业务不中断。在建立主资源与镜像资源的镜像关系时,通过执行同步任务将主资源的所有数据完全同步到镜像资源,在写入业务数据时,将业务数据同时写入主资源和镜像资源,以保证二者的数据一致。Mirroring technology is to write data into two independent disks at the same time, such as RAID1 (Redundant Array of Independent Disks1, Redundant Array of Independent Disks 1), or write data into volume resources established on multiple physical resources. Among them, one resource is called the main resource, and the other resource is called a mirror resource as a copy of the main resource. When the main resource fails, the business can be switched to the mirror resource to ensure that the business is not interrupted. When establishing the mirror relationship between the primary resource and the mirror resource, all the data of the primary resource is fully synchronized to the mirror resource by executing the synchronization task. When writing business data, the business data is written to the primary resource and the mirror resource simultaneously to ensure The data are consistent.

现有技术中,在执行同步任务时,如果从主资源读取数据失败导致镜像资源无法写入数据,或者将从主资源读取的数据写入镜像资源失败时,则认为两个资源的镜像状态为未同步;在未同步状态下,即使镜像资源能够写业务数据成功,也会因为未同步状态,而无法在主资源故障时提供镜像保护,从而导致业务中断。In the prior art, when performing a synchronization task, if the mirror resource cannot write data due to failure to read data from the primary resource, or fails to write data read from the primary resource to the mirror resource, the mirroring of the two resources is considered The state is unsynchronized; in the unsynchronized state, even if the mirror resource can successfully write business data, it will not be able to provide mirror protection when the primary resource fails because of the unsynchronized state, resulting in business interruption.

发明内容Contents of the invention

本发明提供一种通过业务写操作修复镜像同步的方法及装置,以解决现有技术中在未同步状态下,写业务数据成功的镜像资源无法提供镜像保护的问题。The present invention provides a method and device for repairing mirror synchronization through business writing operations, so as to solve the problem in the prior art that mirror resources that successfully write business data cannot provide mirror protection in an unsynchronized state.

根据本发明实施例的第一方面,提供一种通过业务写操作修复镜像同步的方法,所述方法应用于存储设备上,所述存储设备上设置缓存资源,所述方法包括:According to the first aspect of the embodiments of the present invention, there is provided a method for repairing mirror synchronization through a business write operation, the method is applied to a storage device, and a cache resource is set on the storage device, and the method includes:

在执行将主资源数据同步到镜像资源的同步任务时,将故障区域的故障资源地址记录到所述缓存资源,并标记主资源与镜像资源的镜像状态为未同步,其中,所述故障资源地址包括主资源读不成功导致镜像资源无法写入的故障区域的故障资源地址,和/或,主资源读成功而镜像资源写不成功的故障区域的故障资源地址;When executing the synchronization task of synchronizing the data of the primary resource to the mirror resource, record the address of the faulty resource in the faulty area to the cache resource, and mark the mirror state of the primary resource and the mirror resource as unsynchronized, wherein the address of the faulty resource Including the address of the faulty resource in the faulty area where the mirror resource cannot be written due to the unsuccessful read of the primary resource, and/or the faulty resource address of the faulty area where the read of the primary resource is successful but the writing of the mirror resource is unsuccessful;

当写入业务数据时,判断镜像资源是否写成功,如果镜像资源写成功,且写成功区域属于所述故障区域,则清除所述写成功区域对应的故障资源地址;When writing business data, it is judged whether the mirror resource is successfully written, if the mirror resource is successfully written, and the successfully written area belongs to the faulty area, then clear the faulty resource address corresponding to the successfully written area;

当所述同步任务完成,且所述缓存资源中没有故障资源地址时,将所述镜像状态标记为已同步。When the synchronization task is completed and there is no faulty resource address in the cache resource, mark the mirror state as synchronized.

根据本发明实施例的第二方面,提供一种通过业务写操作修复镜像同步的装置,所述装置应用于存储设备上,所述存储设备上设置缓存资源,所述装置包括:According to the second aspect of the embodiments of the present invention, there is provided an apparatus for repairing mirror synchronization through a business write operation, the apparatus is applied to a storage device, and cache resources are set on the storage device, and the apparatus includes:

同步任务执行单元,用于在执行将主资源数据同步到镜像资源的同步任务时,将故障区域的故障资源地址记录到所述缓存资源,并标记主资源与镜像资源的镜像状态为未同步,其中,所述故障资源地址包括主资源读不成功导致镜像资源无法写入的故障区域的故障资源地址,和/或,主资源读成功而镜像资源写不成功的故障区域的故障资源地址;The synchronization task execution unit is used to record the address of the faulty resource in the fault area to the cache resource when executing the synchronization task of synchronizing the data of the primary resource to the mirror resource, and mark the mirror state of the primary resource and the mirror resource as unsynchronized, Wherein, the address of the faulty resource includes the address of the faulty resource in the faulty area where the mirror resource cannot be written because the primary resource is unsuccessfully read, and/or, the faulty resource address of the faulty area where the primary resource is successfully read but the mirror resource is unsuccessfully written;

业务写维护单元,用于当写入业务数据时,判断镜像资源是否写成功,如果镜像资源写成功,且写成功区域属于所述故障区域,则清除所述写成功区域对应的故障资源地址;The business writing maintenance unit is used to judge whether the mirroring resource is written successfully when writing business data, and if the mirroring resource is written successfully, and the successfully written area belongs to the faulty area, then clear the faulty resource address corresponding to the successfully written area;

镜像同步修复单元,用于当所述同步任务完成,且所述缓存资源中没有故障资源地址时,将所述镜像状态标记为已同步。The mirror synchronization repair unit is configured to mark the mirror state as synchronized when the synchronization task is completed and there is no faulty resource address in the cache resource.

应用本发明实施例,通过缓存资源记录执行同步任务时主资源上读不成功导致镜像资源无法写入,或主资源读成功而镜像资源写不成功的故障区域的故障资源地址,当主资源和镜像资源的镜像状态为未同步时,只要业务写入镜像资源成功,就清除对应故障区域的故障资源地址,并在同步任务完成且缓存资源中没有故障资源地址时可以将镜像状态更新为已同步,从而保证只要镜像资源写业务数据成功,就可以替换主资源,为业务提供镜像保护,从而最大化镜像资源的利用率。Applying the embodiment of the present invention, when the synchronization task is executed through the buffer resource record, the mirror resource cannot be written due to the unsuccessful read of the master resource, or the failure resource address of the fault area where the master resource is successfully read but the mirror resource is not written successfully. When the mirroring status of the resource is not synchronized, as long as the business is successfully written to the mirroring resource, the faulty resource address in the corresponding faulty area will be cleared, and the mirroring status can be updated to synchronized when the synchronization task is completed and there is no faulty resource address in the cache resource. This ensures that as long as the mirror resource writes business data successfully, it can replace the primary resource and provide mirror protection for the business, thereby maximizing the utilization of mirror resources.

附图说明Description of drawings

此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本发明的实施例,并与说明书一起用于解释本发明的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description serve to explain the principles of the invention.

图1为本发明实施例的应用场景示意图;FIG. 1 is a schematic diagram of an application scenario of an embodiment of the present invention;

图2为本发明一种实施方式中镜像资源执行同步任务的流程图;FIG. 2 is a flow chart of mirror resource execution synchronization tasks in an embodiment of the present invention;

图3是本发明一种实施方式中恢复镜像资源同步状态的方法流程图;FIG. 3 is a flow chart of a method for restoring the synchronization status of mirrored resources in an embodiment of the present invention;

图4是本发明一种实施方式中恢复镜像资源同步状态的装置运行的硬件环境架构图;Fig. 4 is a hardware environment architecture diagram of the operation of the device for restoring the mirror resource synchronization state in an embodiment of the present invention;

图5是本发明一种实施方式中恢复镜像资源同步状态的装置框图。Fig. 5 is a block diagram of an apparatus for restoring the synchronization status of mirrored resources in an embodiment of the present invention.

具体实施方式detailed description

本发明中的镜像技术是将数据同时写入两份独立的磁盘中,如RAID1,或是写入建立在多个物理资源上的卷资源中。参见图1,为本发明实施例的应用场景示意图:The mirror technology in the present invention is to write data into two independent disks at the same time, such as RAID1, or write data into volume resources established on multiple physical resources. Referring to Figure 1, it is a schematic diagram of an application scenario of an embodiment of the present invention:

图1中,客户端设备通过网络与存储设备通信,存储设备上为两个独立的资源建立镜像关系,其中一个资源为主资源,另一个资源为镜像资源,主资源和镜像资源上的存储空间按照资源所在阵列的条带(block)划分,每个条带具有对应的资源地址。当客户端设备上产生业务数据时,由存储设备将业务数据写入主资源和镜像资源中。写业务数据时,可以采用同步镜像写入方式,即同时将业务数据写入主资源和镜像资源;也可以采用异步镜像写入方式,即将业务数据先写入专用cache(缓存),然后再将业务数据从专用cache中分别写入主资源和镜像资源。本发明中对业务数据的写入方式不进行限制。In Figure 1, the client device communicates with the storage device through the network, and the storage device establishes a mirror relationship for two independent resources, one of which is the main resource and the other is the mirror resource, and the storage space on the main resource and the mirror resource According to the stripe (block) division of the array where the resources are located, each stripe has a corresponding resource address. When service data is generated on the client device, the storage device writes the service data into the primary resource and the mirror resource. When writing business data, you can use the synchronous mirroring writing method, that is, write the business data into the main resource and the mirroring resource at the same time; you can also use the asynchronous mirroring writing method, that is, write the business data into the dedicated cache (cache) first, and then write it to the Business data is written to the main resource and the mirror resource respectively from the dedicated cache. In the present invention, there is no limitation on the way of writing service data.

本发明中存储设备上设置有缓存资源,用来记录主资源与镜像资源执行同步任务时,从主资源读取数据失败导致镜像资源无法写入的故障区域的故障资源地址。优选的,可以为该缓存资源提供UPS(Uninterruptible Power Supply,不间断电源)支持,以保证该缓存资源中记录的故障资源地址不会因为存储设备掉电而丢失。基于缓存资源所记录的故障资源地址,在写业务数据时,只要业务写入镜像资源成功,就清除对应故障区域的故障资源地址,并在同步任务完成且缓存资源中没有故障资源地址时可以将镜像状态更新为已同步,从而保证只要镜像资源写业务数据成功就能够为业务提供镜像保护。下面通过具体实施例对本发明方案进行详细说明。In the present invention, a cache resource is provided on the storage device to record the address of the faulty resource in the faulty area where the mirror resource cannot be written due to the failure to read data from the primary resource when the primary resource and the mirror resource perform a synchronization task. Preferably, UPS (Uninterruptible Power Supply, uninterruptible power supply) support may be provided for the cache resource, so as to ensure that the address of the faulty resource recorded in the cache resource will not be lost due to power failure of the storage device. Based on the address of the faulty resource recorded in the cache resource, when writing business data, as long as the business is successfully written to the mirror resource, the address of the faulty resource in the corresponding faulty area will be cleared, and when the synchronization task is completed and there is no faulty resource address in the cache resource, the The mirroring status is updated to synchronized, so as to ensure that as long as the mirroring resource writes business data successfully, mirroring protection can be provided for the business. The solution of the present invention will be described in detail below through specific examples.

参见图2,为本发明一种实施方式中镜像资源执行同步任务的流程图:Referring to Fig. 2, it is a flow chart of mirror resource execution synchronization task in one embodiment of the present invention:

步骤200:开始执行将主资源同步到镜像资源的同步任务。Step 200: Start to execute the synchronization task of synchronizing the main resource to the mirror resource.

步骤201:顺序将主资源阵列上一个条带的数据同步到镜像资源所在阵列的对应条带上。Step 201: sequentially synchronizing the data of a stripe on the primary resource array to the corresponding stripe of the array where the mirror resource is located.

在为主资源和镜像资源建立镜像关系时,通过执行同步任务,将主资源数据同步到镜像资源。在执行同步任务时,将在线主资源对应阵列每个条带的数据逐个同步到镜像资源所在阵列的对应条带上,该同步过程包括从主资源上读取数据,并将数据写入镜像资源。When establishing a mirror relationship between the primary resource and the mirror resource, the data of the primary resource is synchronized to the mirror resource by executing a synchronization task. When executing the synchronization task, the data of each stripe of the array corresponding to the online primary resource is synchronized one by one to the corresponding stripe of the array where the mirror resource is located. The synchronization process includes reading data from the primary resource and writing data to the mirror resource .

步骤202:判断主资源是否在线,若是,则执行步骤203;否则,执行步骤208。Step 202: Determine whether the main resource is online, if yes, execute step 203; otherwise, execute step 208.

步骤203:判断主资源数据是否读成功,若是,则执行步骤204;否则,执行步骤207。Step 203: Judging whether the master resource data is successfully read, if yes, go to step 204; otherwise, go to step 207.

步骤204:判断镜像资源是否在线,若是,则执行步骤205;否则,执行步骤208。Step 204: Determine whether the mirror resource is online, if yes, execute step 205; otherwise, execute step 208.

步骤205:判断从主资源读出的数据往镜像资源写时是否写成功,若是,则执行步骤206;否则,执行步骤207。Step 205: Judging whether the data read from the primary resource is successfully written to the mirror resource, if yes, go to step 206; otherwise, go to step 207.

步骤206:判断同步任务是否执行完,若是,则结束当前流程;否则,返回步骤201。Step 206: Determine whether the synchronization task has been executed, if yes, end the current process; otherwise, return to step 201.

步骤207:将主资源读不成功导致镜像资源无法写入或镜像资源写不成功的故障区域的故障资源地址记录到缓存资源,并标记主资源与镜像资源的镜像状态为未同步,返回步骤206。Step 207: Record the address of the faulty resource in the fault area where the mirror resource cannot be written or the mirror resource is written unsuccessfully due to the failure to read the primary resource to the cache resource, and mark the mirror status of the primary resource and the mirror resource as unsynchronized, and return to step 206 .

本发明中存储设备上设置了缓存空间,在主资源数据读不成功,或者镜像资源数据写不成功时,在缓存资源中记录不成功的故障资源地址。在记录故障资源地址时,可以将组合计算得到的故障资源所对应的LUN(Logical Unit Number,逻辑单元号)标识和实际物理布局的扇区位置作为故障资源地址。In the present invention, a cache space is set on the storage device, and when the reading of the main resource data or the writing of the mirror resource data fails, the address of the failed fault resource is recorded in the cache resource. When recording the address of the faulty resource, the LUN (Logical Unit Number, Logical Unit Number) identifier corresponding to the faulty resource obtained through combination calculation and the sector location of the actual physical layout may be used as the faulty resource address.

步骤208:暂停同步任务,结束当前流程。Step 208: Suspend the synchronization task and end the current process.

参见图3,是本发明一种实施方式中通过业务写操作修复镜像同步的方法流程图,该实施例基于图2所示同步执行过程,假设镜像状态为未同步且缓存资源中记录了故障资源地址:Referring to FIG. 3 , it is a flow chart of a method for repairing mirror synchronization through business write operations in an embodiment of the present invention. This embodiment is based on the synchronization execution process shown in FIG. 2 , assuming that the mirror status is not synchronized and the cache resource records the fault resource address:

步骤301:写入业务数据。Step 301: Write business data.

本发明中写入业务数据可以采用同步写入方式,也可以采用异步写入方式。无论采用何种写入方式,均根据主资源和镜像资源最终是否写入成功的结果执行相应的操作。作为一种示例,本实施例描述的业务写入逻辑过程从镜像资源是否写成功开始判断,即先判断镜像资源的写结果,再判断主资源的写结果;类似的,业务写入逻辑过程也可以从主资源是否写成功开始判断,即先判断主资源的写结果,再判断镜像资源的写结果,对此本实施例不再赘述。In the present invention, the business data can be written in a synchronous writing manner or an asynchronous writing manner. No matter which writing method is used, the corresponding operation is performed according to the result of whether the main resource and the mirror resource are finally successfully written. As an example, the business writing logic process described in this embodiment starts to judge whether the mirror resource is successfully written, that is, first judges the writing result of the mirror resource, and then judges the writing result of the main resource; similarly, the business writing logic process also It can be judged from whether the writing of the main resource is successful, that is, the writing result of the main resource is judged first, and then the writing result of the mirror resource is judged, which will not be repeated in this embodiment.

步骤302:判断镜像资源是否写成功,若是,则执行步骤303;否则,执行步骤309。Step 302: Determine whether the image resource is written successfully, if yes, execute step 303; otherwise, execute step 309.

步骤303:当写成功区域属于故障区域时,清除缓存中该写成功区域对应的故障资源地址。Step 303: When the successfully written area belongs to the faulty area, clear the faulty resource address corresponding to the successfully written area in the cache.

在图2示出的同步任务执行过程中,缓存资源记录了因为主资源读数据不成功导致镜像资源无法写入的故障资源地址,或者是主资源读成功但镜像资源未写成功的故障资源地址。在业务写入过程中,当业务数据写入到某个故障资源地址对应的故障区域时,如果镜像资源写成功,则可以清除缓存资源中记录的该故障区域的故障资源地址。During the execution of the synchronization task shown in Figure 2, the cache resource records the address of the faulty resource that cannot be written to the mirror resource because the primary resource fails to read data, or the address of the faulty resource that the primary resource reads successfully but the mirror resource fails to write . During the business writing process, when the business data is written to the fault area corresponding to a fault resource address, if the mirror resource is successfully written, the fault resource address of the fault area recorded in the cache resource can be cleared.

步骤304:同步任务完成且缓存资源中没有故障资源地址,将镜像状态标记为已同步。Step 304: the synchronization task is completed and there is no faulty resource address in the cache resource, and the mirror status is marked as synchronized.

本发明中业务写入可以发生在执行同步任务过程中,或者执行同步任务完成后。其中,在同步任务完成且缓存资源中没有故障资源地址时,说明经过多次写业务数据操作,镜像资源上的所有区域均写成功了正确数据,此时将镜像状态从“未同步”修改为“已同步”。In the present invention, service writing can occur during the execution of the synchronization task, or after the execution of the synchronization task is completed. Among them, when the synchronization task is completed and there is no faulty resource address in the cache resource, it means that after multiple operations of writing business data, all areas on the mirror resource have successfully written the correct data. At this time, the mirror status is changed from "unsynchronized" to "Synced".

步骤305:判断主资源是否写成功,若是,则执行步骤308;否则,执行步骤306。Step 305: Judging whether the main resource is written successfully, if yes, go to step 308; otherwise, go to step 306.

步骤306:将镜像资源替换主资源,并返回业务成功。Step 306: Replace the mirror resource with the main resource, and return the business success.

本实施例中,在镜像资源写成功,而主资源写不成功时,由于镜像状态已经标记为“已同步”,因此镜像资源可以立刻替换主资源,为业务提供镜像保护。In this embodiment, when the writing of the mirror resource is successful but the writing of the main resource is unsuccessful, since the mirror status has been marked as "synchronized", the mirror resource can immediately replace the master resource to provide mirror protection for the business.

步骤307:将主资源写不成功的故障区域的故障资源地址记录到缓存资源,并标记镜像状态为未同步,结束当前流程。Step 307: Record the address of the faulty resource in the faulty area where the primary resource fails to be written to the cache resource, and mark the mirror status as unsynchronized, and end the current process.

步骤306中镜像资源替换主资源后,原镜像资源成为新的主资源,而原主资源成为新的镜像资源,此时新的镜像资源由于业务写不成功,需要将故障资源地址记录到缓存资源,由于新的镜像资源无法提供镜像保护,因此将镜像状态从“已同步”再次修改为“未同步”,后续可以根据现有同步机制,重新开始执行镜像同步任务。After the mirror resource replaces the primary resource in step 306, the original mirror resource becomes the new primary resource, and the original primary resource becomes the new mirror resource. At this time, the new mirror resource needs to record the address of the faulty resource to the cache resource because the business write fails. Since the new mirror resource cannot provide mirror protection, the mirror status is changed from "synchronized" to "not synchronized" again, and the mirror synchronization task can be restarted according to the existing synchronization mechanism.

步骤308:返回业务成功,结束当前流程。Step 308: return business success, and end the current process.

步骤309:将镜像资源写不成功的故障区域的故障资源地址记录到缓存资源,并等待执行下次同步任务,结束当前流程。Step 309: Record the address of the faulty resource in the faulty area where the mirroring resource fails to be written to the cache resource, and wait for the execution of the next synchronization task, ending the current process.

由于镜像资源写不成功,因此镜像资源无法为业务提供镜像保护,需要等待执行下次同步任务时,对镜像资源进行修复。Since the mirror resource cannot be written successfully, the mirror resource cannot provide mirror protection for the business, and the mirror resource needs to be repaired when the next synchronization task is executed.

步骤310:判断主资源是否写成功,若是,则执行步骤308;否则,执行步骤311。Step 310: Judging whether the main resource is written successfully, if yes, go to step 308; otherwise, go to step 311.

步骤311:返回业务失败,结束当前流程。Step 311: return business failure, end the current process.

结合图2和图3所示的实施例可知,本发明通过缓存资源记录执行同步任务时主资源上读不成功导致镜像资源无法写入或主资源读成功但镜像资源未写成功的故障区域的故障资源地址,当主资源和镜像资源的镜像状态为未同步时,只要业务写入镜像资源成功,就清除对应故障区域的故障资源地址,并在同步任务完成且缓存资源中没有故障资源地址时可以将镜像状态更新为已同步,从而保证只要镜像资源写业务数据成功,就可以替换主资源,为业务提供镜像保护,从而可以最大化镜像资源的利用率。Combining the embodiments shown in Fig. 2 and Fig. 3, it can be known that the present invention records the fault area where the mirror resource cannot be written because the primary resource fails to be read when the synchronization task is executed through the cache resource record, or the primary resource is successfully read but the mirror resource is not successfully written. Faulty resource address. When the mirror status of the primary resource and the mirror resource is not synchronized, as long as the business is successfully written to the mirror resource, the faulty resource address corresponding to the faulty area will be cleared, and when the synchronization task is completed and there is no faulty resource address in the cache resource, you can Update the mirror status to synchronized to ensure that as long as the mirror resource writes business data successfully, the primary resource can be replaced to provide mirror protection for the business, thereby maximizing the utilization of mirror resources.

参见图4,为本发明一种实施方式中恢复镜像资源同步状态的装置运行的硬件环境架构图:Referring to Fig. 4, it is a hardware environment architecture diagram of the operation of the device for restoring the mirror resource synchronization state in an embodiment of the present invention:

本发明通过业务写操作修复镜像同步的装置的实施例可以应用在存储设备上。装置实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。以软件实现为例,作为一个逻辑意义上的装置,是通过其所在设备的CPU将非易失性存储器中对应的计算机程序指令读取到内存中运行形成的。从硬件层面而言,如图4所示,为本发明通过业务写操作修复镜像同步的装置所在设备的一种硬件结构图,除了图4所示的CPU、内存、网络接口、以及非易失性存储器之外,实施例中装置所在的设备通常还可以包括其他硬件。The embodiment of the device for repairing mirror synchronization through service write operation of the present invention can be applied to storage devices. The device embodiments can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by reading the corresponding computer program instructions in the non-volatile memory into the memory for operation by the CPU of the device where it is located. From the hardware level, as shown in Figure 4, it is a hardware structure diagram of the device where the device for repairing mirror synchronization through business write operations in the present invention is located, except for the CPU, memory, network interface, and non-volatile memory shown in Figure 4 In addition to the non-volatile memory, the device where the device in the embodiment is located may generally include other hardware.

参见图5,是本发明一种实施方式中通过业务写操作修复镜像同步的装置框图。Referring to FIG. 5 , it is a block diagram of an apparatus for repairing mirror synchronization through business write operations in an embodiment of the present invention.

所述装置包括:同步任务执行单元510、业务写维护单元520和镜像同步修复单元530。The device includes: a synchronization task execution unit 510 , a business write maintenance unit 520 and a mirror synchronization repair unit 530 .

其中,同步任务执行单元510,用于在执行将主资源数据同步到镜像资源的同步任务时,将故障区域的故障资源地址记录到所述缓存资源,并标记主资源与镜像资源的镜像状态为未同步,其中,所述故障资源地址包括主资源读不成功导致镜像资源无法写入的故障区域的故障资源地址,或主资源读成功而镜像资源写不成功的故障区域的故障资源地址;Wherein, the synchronization task execution unit 510 is configured to record the address of the faulty resource in the faulty area into the cache resource when executing the synchronization task of synchronizing the data of the primary resource to the mirror resource, and mark the mirror status of the primary resource and the mirror resource as Not synchronized, wherein the address of the faulty resource includes the address of the faulty resource in the faulty area where the mirror resource cannot be written because the primary resource is unsuccessfully read, or the faulty resource address of the faulty area where the primary resource is read successfully but the mirror resource is unsuccessfully written;

业务写维护单元520,用于当写入业务数据时,判断镜像资源是否写成功,如果镜像资源写成功,且写成功区域属于所述故障区域,则清除所述写成功区域对应的故障资源地址;The business writing maintenance unit 520 is used to judge whether the mirroring resource is written successfully when writing business data, if the mirroring resource is written successfully, and the successfully written area belongs to the faulty area, then clear the faulty resource address corresponding to the successfully written area ;

镜像同步修复单元530,用于当所述同步任务完成,且所述缓存资源中没有故障资源地址时,将所述镜像状态标记为已同步。The mirror synchronization repair unit 530 is configured to mark the mirror state as synchronized when the synchronization task is completed and there is no faulty resource address in the cache resource.

可选的,所述业务写维护单元520,还可以用于在写入业务数据时,如果镜像资源写成功,且所述镜像状态为已同步,判断主资源是否写成功,如果主资源写不成功,将所述镜像资源替换所述主资源,并返回业务成功,以及将所述主资源写不成功的故障区域的故障资源地址记录到所述缓存资源,并标记所述镜像状态为未同步;如果主资源写成功,则返回业务成功。Optionally, the business writing maintenance unit 520 can also be used to determine whether the writing of the main resource is successful if the writing of the mirror resource is successful and the mirror status is synchronized when writing business data, and if the writing of the main resource is not If successful, replace the mirror resource with the primary resource, and return the business success, and record the address of the faulty resource in the fault area where the primary resource failed to be written to the cache resource, and mark the mirror status as unsynchronized ; If the main resource is successfully written, it returns business success.

可选的,所述业务写维护单元520,还可以用于在写入业务数据时,如果镜像资源写不成功,则将写不成功的故障资源地址记录到所述缓存资源,并等待所述同步任务执行单元执行下次同步任务。Optionally, the business write maintenance unit 520 may also be configured to record the failed resource address of the failed write in the cache resource when writing business data, if the write of the mirror resource is unsuccessful, and wait for the The synchronization task execution unit executes the next synchronization task.

可选的,所述业务写维护单元520,还可以用于在写入业务数据时,如果镜像资源写不成功,判断所述主资源是否写成功,如果写成功,返回业务成功,如果写不成功,返回业务失败。Optionally, the business writing maintenance unit 520 can also be used to judge whether the writing of the primary resource is successful if the writing of the mirror resource is unsuccessful when writing the business data, and if the writing is successful, return the business success; Success, return business failure.

上述装置中各个单元的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。For the implementation process of the functions and effects of each unit in the above device, please refer to the implementation process of the corresponding steps in the above method for details, and will not be repeated here.

本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本发明的其它实施方案。本申请旨在涵盖本发明的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本发明的一般性原理并包括本发明未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本发明的真正范围和精神由下面的权利要求指出。Other embodiments of the invention will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present invention, these modifications, uses or adaptations follow the general principles of the present invention and include common knowledge or conventional technical means in the technical field not disclosed in the present invention . The specification and examples are to be considered exemplary only, with a true scope and spirit of the invention being indicated by the following claims.

应当理解的是,本发明并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本发明的范围仅由所附的权利要求来限制。It should be understood that the present invention is not limited to the precise constructions which have been described above and shown in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

Claims (10)

1.一种通过业务写操作修复镜像同步的方法,其特征在于,所述方法应用于存储设备上,所述存储设备上设置缓存资源,所述方法包括:1. A method for repairing mirror synchronization by business write operations, characterized in that, the method is applied to a storage device, and cache resources are set on the storage device, and the method includes: 在执行将主资源数据同步到镜像资源的同步任务时,将故障区域的故障资源地址记录到所述缓存资源,并标记主资源与镜像资源的镜像状态为未同步,其中,所述故障资源地址包括主资源读不成功导致镜像资源无法写入的故障区域的故障资源地址,或主资源读成功而镜像资源写不成功的故障区域的故障资源地址;When executing the synchronization task of synchronizing the data of the primary resource to the mirror resource, record the address of the faulty resource in the faulty area to the cache resource, and mark the mirror state of the primary resource and the mirror resource as unsynchronized, wherein the address of the faulty resource Including the address of the faulty resource in the faulty area where the mirror resource cannot be written due to the unsuccessful read of the primary resource, or the faulty resource address of the faulty area where the read of the primary resource is successful but the writing of the mirror resource is unsuccessful; 当写入业务数据时,判断镜像资源是否写成功,如果镜像资源写成功,且写成功区域属于所述故障区域,则清除所述写成功区域对应的故障资源地址;其中,写入业务数据时采用同步写入方式或异步写入方式;When writing business data, it is judged whether the mirroring resource is written successfully, if the mirroring resource is written successfully, and the successfully written area belongs to the faulty area, then clear the faulty resource address corresponding to the successfully written area; wherein, when writing business data Use synchronous writing method or asynchronous writing method; 当所述同步任务完成,且所述缓存资源中没有故障资源地址时,将所述镜像状态标记为已同步。When the synchronization task is completed and there is no faulty resource address in the cache resource, mark the mirror state as synchronized. 2.根据权利要求1所述的方法,其特征在于,所述方法还包括:2. The method according to claim 1, characterized in that the method further comprises: 在写入业务数据时,如果镜像资源写成功,且所述镜像状态为已同步,判断主资源是否写成功,如果主资源写不成功,将所述镜像资源替换所述主资源,并返回业务成功;When writing business data, if the mirror resource is successfully written and the mirror status is synchronized, judge whether the master resource is successfully written; if the master resource is not successfully written, replace the master resource with the mirror resource and return to the business success; 将所述主资源写不成功的故障区域的故障资源地址记录到所述缓存资源,并标记所述镜像状态为未同步。Recording the address of the faulty resource in the faulty area where the primary resource fails to be written to the cache resource, and marking the mirror state as unsynchronized. 3.根据权利要求2所述的方法,其特征在于,所述方法还包括:3. The method according to claim 2, wherein the method further comprises: 在写入业务数据时,如果主资源写成功,则返回业务成功。When writing business data, if the main resource is successfully written, it will return business success. 4.根据权利要求1所述的方法,其特征在于,所述方法还包括:4. The method according to claim 1, wherein the method further comprises: 在写入业务数据时,如果镜像资源写不成功,则将写不成功的故障资源地址记录到所述缓存资源,并等待执行下次同步任务。When writing business data, if the writing of the mirror resource is unsuccessful, record the address of the failed resource to the cache resource, and wait for the execution of the next synchronization task. 5.根据权利要求4所述的方法,其特征在于,所述方法还包括:5. method according to claim 4, is characterized in that, described method also comprises: 在写入业务数据时,如果镜像资源写不成功,判断所述主资源是否写成 功,如果写成功,返回业务成功,如果写不成功,返回业务失败。When writing business data, if the mirror resource is not written successfully, it is judged whether the main resource is written successfully. If the writing is successful, the business is returned successfully. If the writing is not successful, the business is returned as failed. 6.一种通过业务写操作修复镜像同步的装置,其特征在于,所述装置应用于存储设备上,所述存储设备上设置缓存资源,所述装置包括:6. A device for repairing mirror synchronization through a business write operation, characterized in that the device is applied to a storage device, and cache resources are set on the storage device, and the device includes: 同步任务执行单元,用于在执行将主资源数据同步到镜像资源的同步任务时,将故障区域的故障资源地址记录到所述缓存资源,并标记主资源与镜像资源的镜像状态为未同步,其中,所述故障资源地址包括主资源读不成功导致镜像资源无法写入的故障区域的故障资源地址,或主资源读成功而镜像资源写不成功的故障区域的故障资源地址;The synchronization task execution unit is used to record the address of the faulty resource in the fault area to the cache resource when executing the synchronization task of synchronizing the data of the primary resource to the mirror resource, and mark the mirror state of the primary resource and the mirror resource as unsynchronized, Wherein, the address of the faulty resource includes the faulty resource address of the faulty area where the mirror resource cannot be written due to the unsuccessful reading of the primary resource, or the faulty resource address of the faulty area where the primary resource is successfully read but the mirroring resource is unsuccessfully written; 业务写维护单元,用于当写入业务数据时,判断镜像资源是否写成功,如果镜像资源写成功,且写成功区域属于所述故障区域,则清除所述写成功区域对应的故障资源地址;其中,写入业务数据时采用同步写入方式或异步写入方式;The business writing maintenance unit is used to judge whether the mirroring resource is written successfully when writing business data, and if the mirroring resource is written successfully, and the successfully written area belongs to the faulty area, then clear the faulty resource address corresponding to the successfully written area; Among them, when writing business data, adopt synchronous writing method or asynchronous writing method; 镜像同步修复单元,用于当所述同步任务完成,且所述缓存资源中没有故障资源地址时,将所述镜像状态标记为已同步。The mirror synchronization repair unit is configured to mark the mirror state as synchronized when the synchronization task is completed and there is no faulty resource address in the cache resource. 7.根据权利要求6所述的装置,其特征在于,7. The device of claim 6, wherein: 所述业务写维护单元,还用于在写入业务数据时,如果镜像资源写成功,且所述镜像状态为已同步,判断主资源是否写成功,如果主资源写不成功,将所述镜像资源替换所述主资源,并返回业务成功,以及将所述主资源写不成功的故障区域的故障资源地址记录到所述缓存资源,并标记所述镜像状态为未同步。The business write maintenance unit is also used to judge whether the writing of the main resource is successful if the writing of the mirror resource is successful and the mirror state is synchronized when writing business data, and if the writing of the main resource is unsuccessful, write the mirror image The resource replaces the primary resource, and returns the business success, and records the address of the faulty resource in the faulty area where the primary resource fails to be written to the cache resource, and marks the mirror status as unsynchronized. 8.根据权利要求7所述的装置,其特征在于,8. The device of claim 7, wherein: 所述业务写维护单元,还用于在写入业务数据时,如果主资源写成功,则返回业务成功。The business write maintenance unit is further configured to return business success if the main resource is successfully written when writing business data. 9.根据权利要求6所述的装置,其特征在于,9. The apparatus of claim 6, wherein: 所述业务写维护单元,还用于在写入业务数据时,如果镜像资源写不成功,则将写不成功的故障资源地址记录到所述缓存资源,并等待所述同步任务执行单元执行下次同步任务。The business write maintenance unit is also used to record the failed resource address of the failed write in the buffer resource when writing the business data, and wait for the synchronization task execution unit to execute the next step. synchronization tasks. 10.根据权利要求9所述的装置,其特征在于,10. The apparatus of claim 9, wherein: 所述业务写维护单元,还用于在写入业务数据时,如果镜像资源写不成功,判断所述主资源是否写成功,如果写成功,返回业务成功,如果写不成功,返回业务失败。The business write maintenance unit is also used for judging whether the master resource is successfully written when writing business data, if the writing of the mirror resource is unsuccessful, and if the writing is successful, return the business success, and if the writing is unsuccessful, return the business failure.
CN201410317976.1A 2014-07-04 2014-07-04 The method and device of mirror image synchronization is repaired by business write operation Active CN104090729B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410317976.1A CN104090729B (en) 2014-07-04 2014-07-04 The method and device of mirror image synchronization is repaired by business write operation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410317976.1A CN104090729B (en) 2014-07-04 2014-07-04 The method and device of mirror image synchronization is repaired by business write operation

Publications (2)

Publication Number Publication Date
CN104090729A CN104090729A (en) 2014-10-08
CN104090729B true CN104090729B (en) 2017-08-15

Family

ID=51638449

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410317976.1A Active CN104090729B (en) 2014-07-04 2014-07-04 The method and device of mirror image synchronization is repaired by business write operation

Country Status (1)

Country Link
CN (1) CN104090729B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104915152B (en) * 2015-06-05 2018-09-14 浙江宇视科技有限公司 Ensure the method and apparatus of business validity when a kind of data image
CN106708960B (en) * 2016-11-30 2021-05-28 浙江宇视科技有限公司 A method for repairing a file system of a NAS device and a NAS device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1995000906A1 (en) * 1993-06-23 1995-01-05 Vinca Corporation Method for improving disk mirroring error recovery in a computer system including an alternate communication path
CN1773443A (en) * 2004-11-08 2006-05-17 富士通株式会社 Disk array device, data recovery method and computer product
CN102096615A (en) * 2011-01-25 2011-06-15 上海爱数软件有限公司 Remote incremental backup method and system
CN102662800A (en) * 2012-04-20 2012-09-12 浪潮电子信息产业股份有限公司 Method for ensuring interrupted remote asynchronous mirroring service

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040162926A1 (en) * 2003-02-14 2004-08-19 Itzhak Levy Serial advanced technology attachment interface

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1995000906A1 (en) * 1993-06-23 1995-01-05 Vinca Corporation Method for improving disk mirroring error recovery in a computer system including an alternate communication path
CN1773443A (en) * 2004-11-08 2006-05-17 富士通株式会社 Disk array device, data recovery method and computer product
CN102096615A (en) * 2011-01-25 2011-06-15 上海爱数软件有限公司 Remote incremental backup method and system
CN102662800A (en) * 2012-04-20 2012-09-12 浪潮电子信息产业股份有限公司 Method for ensuring interrupted remote asynchronous mirroring service

Also Published As

Publication number Publication date
CN104090729A (en) 2014-10-08

Similar Documents

Publication Publication Date Title
US9400611B1 (en) Data migration in cluster environment using host copy and changed block tracking
US9588856B2 (en) Restoring redundancy in a storage group when a storage device in the storage group fails
CN106776130B (en) A log recovery method, storage device and storage node
US10983874B2 (en) Processing a recover state input/output request
CN103513942B (en) The reconstructing method of raid-array and device
US9471449B2 (en) Performing mirroring of a logical storage unit
JP5286212B2 (en) Remote copy control method and system in storage cluster environment
US9361213B2 (en) Method and apparatus for efficient remote copy
WO2020103512A1 (en) Data reconstruction method and device in storage system
CN105302667A (en) Cluster architecture based high-reliability data backup and recovery method
JP4491330B2 (en) Disk array device, data recovery method and data recovery program
JP6540334B2 (en) SYSTEM, INFORMATION PROCESSING DEVICE, AND INFORMATION PROCESSING METHOD
US8639968B2 (en) Computing system reliability
WO2024113685A1 (en) Data recovery method for raid array and related apparatus
US9430485B2 (en) Information processor and backup method
CN102609223B (en) Redundant array of independent disk system and initializing method thereof
TW200532449A (en) Efficient media scan operations for storage systems
US20090177916A1 (en) Storage system, controller of storage system, control method of storage system
CN118708130B (en) Remote replication method and device for data volume, computer equipment and storage medium
CN104090729B (en) The method and device of mirror image synchronization is repaired by business write operation
CN110990191A (en) A data recovery method and system based on image storage
CN110704239B (en) Data copying method and device and electronic equipment
CN104317678B (en) Method and device for repairing RAID array without interrupting data storage service
JP5644795B2 (en) Storage device, data recovery method and program
CN107544868B (en) Data recovery method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant