CN104407814A - Method and device for data double writing - Google Patents
Method and device for data double writing Download PDFInfo
- Publication number
- CN104407814A CN104407814A CN201410676570.2A CN201410676570A CN104407814A CN 104407814 A CN104407814 A CN 104407814A CN 201410676570 A CN201410676570 A CN 201410676570A CN 104407814 A CN104407814 A CN 104407814A
- Authority
- CN
- China
- Prior art keywords
- data
- storage device
- write
- host
- written
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0614—Improving the reliability of storage systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/062—Securing storage systems
- G06F3/0622—Securing storage systems in relation to access
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0655—Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
- G06F3/0659—Command handling arrangements, e.g. command buffers, queues, command scheduling
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Communication Control (AREA)
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
Description
技术领域technical field
本发明实施例涉及数据备份技术,尤其涉及一种双写数据的方法和装置。The embodiments of the present invention relate to data backup technology, and in particular to a method and device for double writing data.
背景技术Background technique
双写数据是将主机写入主存储系统中的主逻辑单元号(Logical UnitNumber;简称LUN)对应的主存储设备上的数据,实时地写到从存储系统中的从LUN对应的从存储设备中,以保证主存储系统与从存储系统的数据相一致,在容灾、镜像或迁移等应用中,双写数据是否可靠对系统的影响非常大。Double-write data is the data written by the host to the primary storage device corresponding to the main logical unit number (Logical UnitNumber; LUN for short) in the primary storage system, and written to the secondary storage device corresponding to the secondary LUN in the secondary storage system in real time , to ensure that the data in the primary storage system is consistent with the data in the secondary storage system. In applications such as disaster recovery, mirroring, or migration, the reliability of double-write data has a great impact on the system.
目前,在双写数据时,若主机接收到返回重试指令,说明主存储系统写数据超时,此时,在从存储系统写数据成功的情况下会出现主从存储系统的数据不一致的情况。为解决上述问题,现有技术中主要采用以下两种方式:第一种,将重试指令当作写错误处理,断开阵列间的数据复制关系,此类异常可以通过启动同步操作,将主存储系统的数据复制到从端存储系统,来保证主从端数据的一致。第二种:忽略主存储系统返回的写操作结果,将重试的写结果返回主机,主机重新发送双写数据请求,使主存储系统和从存储系统重新执行双写操作,来保证主从存储系统数据的一致。At present, when double writing data, if the host receives a return retry command, it means that the primary storage system has timed out writing data. At this time, if the secondary storage system writes data successfully, the data in the primary and secondary storage systems will be inconsistent. In order to solve the above problems, the following two methods are mainly adopted in the prior art: the first method treats the retry instruction as a write error and breaks the data replication relationship between the arrays. The data of the storage system is copied to the secondary storage system to ensure the consistency of the master and slave data. The second method: Ignore the write operation result returned by the primary storage system, return the retried write result to the host, and the host resends the double-write data request, so that the primary storage system and the secondary storage system re-execute the double-write operation to ensure the master-slave storage Consistency of system data.
然而,第一种方式中当主存储系统读写数据很大时,会出现频繁断开阵列间复制业务,主从存储系统的数据一致性通过启动同步保证;第二种方式中若由于主机自身的读写压力或主机与阵列链路的链接等问题,导致主机重试数据写失败,此时,主存储系统感知不到写错误,且双写操作正常,但主从存储系统数据并未真正处于一致的状态,因而存在丢失数据的风险。因此,现有技术的两种方案都存在存储系统可靠性较低的问题。However, in the first method, when the master storage system reads and writes a large amount of data, there will be frequent disconnection of the inter-array replication business, and the data consistency of the master-slave storage system is guaranteed by starting synchronization; The read/write pressure or the connection between the host and the array link cause the host to fail to retry data writing. Consistent state, so there is a risk of losing data. Therefore, both solutions in the prior art have the problem of low reliability of the storage system.
发明内容Contents of the invention
本发明实施例提供一种双写数据的方法和装置,用以提高存储系统的可靠性。Embodiments of the present invention provide a method and device for double writing data, so as to improve the reliability of a storage system.
第一方面,本发明实施例提供一种双写数据的方法,包括:In the first aspect, the embodiment of the present invention provides a method for double writing data, including:
接收主机发送的双写数据请求,并同时向主逻辑单元号LUN对应的主存储设备和从LUN对应的从存储设备中分别进行写数据操作;Receive the double-write data request sent by the host, and simultaneously write data to the primary storage device corresponding to the primary logical unit number LUN and the secondary storage device corresponding to the secondary LUN;
若接收所述主存储设备发送的写数据重试消息,并在接收所述从存储设备返回的写数据响应消息后,则向所述主机发送写超时消息,以使所述主机向所述主存储系统发送未完成写操作的数据;If the write data retry message sent by the primary storage device is received, and after receiving the write data response message returned from the secondary storage device, then send a write timeout message to the host, so that the host can send a write timeout message to the host The storage system sends the data of the unfinished write operation;
若在预设时间段内未接收所述主机发送的未完成写操作的数据,则使用所述主存储设备中上一次写成功的数据覆盖所述从存储设备中最后一次写成功的数据。If the data of the incomplete write operation sent by the host is not received within the preset time period, the last successfully written data in the master storage device is used to overwrite the last successfully written data in the slave storage device.
结合第一方面,在第一方面的第一种可能的实现方式中,所述方法还包括:With reference to the first aspect, in a first possible implementation manner of the first aspect, the method further includes:
若在预设时间段内接收所述主机发送的未完成写操作的数据,则将重新向所述主存储设备和所述从存储设备进行写数据操作。If the data of the incomplete write operation sent by the host is received within the preset time period, the data write operation will be performed again on the master storage device and the slave storage device.
结合第一方面、第一方面的第一种可能的实现方式,在第一方面的第二种可能的实现方式中,所述双写数据请求中携带待写数据的相关信息,所述相关信息包括所述待写数据的位置和大小;In combination with the first aspect and the first possible implementation of the first aspect, in the second possible implementation of the first aspect, the double-write data request carries relevant information about the data to be written, and the relevant information including the location and size of the data to be written;
所述同时向主逻辑单元号LUN对应的主存储设备和从LUN对应的从存储设备中分别进行写数据操作,具体包括:The simultaneous writing of data to the master storage device corresponding to the master logical unit number LUN and the slave storage device corresponding to the slave LUN respectively includes:
根据所述待写数据的位置和大小,向所述主存储设备和所述从存储设备分别进行写数据操作。According to the location and size of the data to be written, write data to the master storage device and the slave storage device respectively.
结合第一方面,第一方面的第二种可能的实现方式,在第一方面的第三种可能的实现方式中,所述写数据重试消息中携带未完成写操作的数据的信息;With reference to the first aspect, the second possible implementation of the first aspect, in the third possible implementation of the first aspect, the write data retry message carries data information of unfinished write operations;
所述使用所述主存储设备中上一次写成功的数据覆盖所述从存储设备中最后一次写成功的数据,具体包括:The use of the last successfully written data in the master storage device to overwrite the last successfully written data in the slave storage device specifically includes:
根据未完成写操作的数据的信息获取所述主存储设备中上一次写成功的数据,并使用所述主存储设备中上一次写成功的数据覆盖所述从存储设备中最后一次写成功的数据。Obtain the last successfully written data in the primary storage device according to the information of the unfinished write data, and use the last successfully written data in the primary storage device to overwrite the last successfully written data in the secondary storage device .
结合第一方面的第二种可能的实现方式,在第一方面的第四种可能的实现方式中,所述同时向主逻辑单元号LUN对应的主存储设备和从LUN对应的从存储设备中分别进行写数据操作之后,还包括:With reference to the second possible implementation of the first aspect, in the fourth possible implementation of the first aspect, at the same time, the primary storage device corresponding to the primary logical unit number LUN and the secondary storage device corresponding to the secondary LUN After writing data operations separately, it also includes:
若分别接收所述主存储设备和所述从存储设备发送的写数据成功消息,则向所述主机发送写数据成功指令,并删除所述待写数据的相关信息;或者,If the write data success messages sent by the master storage device and the slave storage device are respectively received, then send a write data success instruction to the host, and delete the relevant information of the data to be written; or,
若接收所述主存储设备发送的写数据成功消息,且接收所述从存储设备发送的写数据失败消息,则中断向所述从存储设备进行的写数据操作,并向主机发送写数据成功指令。If the write data success message sent by the master storage device is received, and the write data failure message sent by the slave storage device is received, the write data operation to the slave storage device is interrupted, and the write data success instruction is sent to the host .
结合第一方面的第二种或第一方面的第四种任一种可能的实现方式,在第一方面的第五种可能的实现方式中,所述将重新向所述主存储设备和所述从存储设备进行写数据操作之后,还包括:With reference to the second possible implementation manner of the first aspect or any of the fourth possible implementation manners of the first aspect, in a fifth possible implementation manner of the first aspect, the redistribution to the main storage device and the After the operation of writing data from the storage device, it also includes:
若在所述预设时间段内接收所述主存储设备发送的完成重写操作消息,则删除所述待写数据的相关信息。If a rewrite operation completion message sent by the main storage device is received within the preset time period, then delete the information related to the data to be written.
结合第一方面的第二种或第一方面的第四种至第五种任一种可能的实现方式,在第一方面的第六种可能的实现方式中,所述使用所述主存储设备中上一次写成功的数据覆盖所述从存储设备中最后一次写成功的数据之后,还包括:With reference to the second aspect of the first aspect or any of the fourth to fifth possible implementation manners of the first aspect, in a sixth possible implementation manner of the first aspect, the use of the main storage device After the data written successfully in the last time overwrites the data written successfully in the storage device last time, it also includes:
若接收所述从存储设备发送的写数据成功消息,则删除所述待写数据的相关信息;If the write data success message sent from the storage device is received, then delete the relevant information of the data to be written;
否则,中断重新向所述主存储设备和所述从存储设备进行写数据的操作。Otherwise, interrupt the operation of writing data to the master storage device and the slave storage device again.
第二方面,本发明实施例提供一种双写数据的装置,包括:In a second aspect, an embodiment of the present invention provides a device for double writing data, including:
接收模块,用于接收主机发送的双写数据请求;The receiving module is used to receive the double-write data request sent by the host;
处理模块,用于同时向主逻辑单元号LUN对应的主存储设备和从LUN对应的从存储设备中分别进行写数据操作;A processing module, configured to simultaneously write data to the primary storage device corresponding to the primary logical unit number LUN and the secondary storage device corresponding to the secondary LUN;
发送模块,用于在所述接收模块接收所述主存储设备发送的写数据重试消息,并在接收所述从存储设备返回的写数据响应消息后,向所述主机发送写超时消息,以使所述主机向所述主存储系统发送未完成写操作的数据;The sending module is configured to receive, after the receiving module receives the write data retry message sent by the primary storage device, and after receiving the write data response message returned from the secondary storage device, send a write timeout message to the host, to causing the host to send unfinished write operation data to the primary storage system;
所述处理模块,还用于若所述接收模块在预设时间段内未接收所述主机发送的未完成写操作的数据,则使用所述主存储设备中上一次写成功的数据覆盖所述从存储设备中最后一次写成功的数据。The processing module is further configured to, if the receiving module does not receive the data of the unfinished write operation sent by the host within a preset time period, use the last successfully written data in the main storage device to overwrite the The last successfully written data from the storage device.
结合第二方面,在第二方面的第一种可能的实现方式中,所述处理模块,还用于若所述接收模块在预设时间段内接收所述主机发送的未完成写操作的数据,则将重新向所述主存储设备和所述从存储设备进行写数据操作。With reference to the second aspect, in the first possible implementation manner of the second aspect, the processing module is further configured to: if the receiving module receives the data of the unfinished write operation sent by the host within a preset time period , then the operation of writing data to the master storage device and the slave storage device will be performed again.
结合第二方面,第二方面的第一种可能的实现方式,在第二方面的第二种可能的实现方式中,所述双写数据请求中携带待写数据的相关信息,所述相关信息包括所述待写数据的位置和大小;With reference to the second aspect, the first possible implementation of the second aspect, in the second possible implementation of the second aspect, the double-write data request carries relevant information about the data to be written, and the relevant information including the location and size of the data to be written;
所述处理模块还用于:The processing module is also used to:
根据所述待写数据的位置和大小,向所述主存储设备和所述从存储设备分别进行写数据操作。According to the location and size of the data to be written, write data to the master storage device and the slave storage device respectively.
结合第二方面,第二方面的第二种可能的实现方式,在第二方面的第三种可能的实现方式中,所述写数据重试消息中携带未完成写操作的数据的信息;With reference to the second aspect, the second possible implementation of the second aspect, in the third possible implementation of the second aspect, the write data retry message carries data information of unfinished write operations;
所述处理模块还用于:The processing module is also used to:
根据未完成写操作的数据的信息获取所述主存储设备中上一次写成功的数据,并使用所述主存储设备中上一次写成功的数据覆盖所述从存储设备中最后一次写成功的数据。Obtain the last successfully written data in the primary storage device according to the information of the unfinished write data, and use the last successfully written data in the primary storage device to overwrite the last successfully written data in the secondary storage device .
结合第二方面的第二种可能的实现方式,在第二方面的第四种可能的实现方式中,所述发送模块还用于若所述接收模块分别接收所述主存储设备和所述从存储设备发送的写数据成功消息,则向所述主机发送写数据成功指令,所述处理模块用于删除所述待写数据的相关信息;With reference to the second possible implementation of the second aspect, in a fourth possible implementation of the second aspect, the sending module is further configured to if the receiving module respectively receives the The write data success message sent by the storage device sends a write data success instruction to the host, and the processing module is used to delete the relevant information of the data to be written;
所述处理模块还用于若所述接收模块接收所述主存储设备发送的写数据成功消息,且接收所述从存储设备发送的写数据失败消息,则中断向所述从存储设备进行的写数据操作,所述发送模块用于向主机发送写数据成功指令。The processing module is further configured to interrupt writing to the slave storage device if the receiving module receives the write data success message sent by the master storage device and receives the write data failure message sent by the slave storage device For data operation, the sending module is used to send a data write success instruction to the host.
结合第二方面的第二种或第四种任一种可能的实现方式,在第二方面的第五种可能的实现方式中,所述处理模块还用于:In combination with any of the second or fourth possible implementation manners of the second aspect, in a fifth possible implementation manner of the second aspect, the processing module is further configured to:
若所述接收模块在所述预设时间段内接收所述主存储设备发送的完成重写操作消息,则删除所述待写数据的相关信息。If the receiving module receives the rewriting operation completion message sent by the main storage device within the preset time period, then delete the information related to the data to be written.
结合第二方面的第二种或第二方面的第四种至第五种任一种可能的实现方式,在第二方面的第六种可能的实现方式中,处理模块还用于:In combination with the second aspect of the second aspect or any of the fourth to fifth possible implementation manners of the second aspect, in a sixth possible implementation manner of the second aspect, the processing module is further configured to:
若所述接收模块接收所述从存储设备发送的写数据成功消息则删除所述待写数据的相关信息;否则,中断重新向所述主存储设备和所述从存储设备进行写数据的操作。If the receiving module receives the write data success message sent by the slave storage device, then delete the relevant information of the data to be written; otherwise, interrupt the operation of writing data to the master storage device and the slave storage device again.
本发明提供的双写数据的方法和装置,通过接收主机发送的双写数据请求,并同时向主LUN对应的主存储设备和从LUN对应的从存储设备中分别进行写数据操作;若主存储系统接收主存储设备发送的写数据重试消息,且接收从存储设备返回的写数据响应消息,则向主机发送写超时消息,以使主机向主存储系统发送未完成写操作的数据,若主存储系统在预设时间段内未接收到主机发送的未完成写操作的数据,则使用主存储设备中上一次写成功的数据覆盖从存储设备中最后一次写成功的数据。通过确定主存储系统在预设时间段内未接收到未完成写操作的数据,从而使用主存储设备中上一次写成功的数据覆盖从存储设备中最后一次写成功的数据,来保证主存储设备和从存储设备数据的一致,避免了通过频繁断开双写数据的业务来启动同步保证的情况,降低了丢失数据的风险,提高了存储系统的可靠性。The method and device for double-writing data provided by the present invention, by receiving the double-writing data request sent by the host, and simultaneously writing data to the primary storage device corresponding to the primary LUN and the secondary storage device corresponding to the secondary LUN; The system receives the write data retry message sent by the main storage device, and receives the write data response message returned from the storage device, and then sends a write timeout message to the host, so that the host sends unfinished data to the main storage system. If the storage system does not receive the uncompleted write operation data sent by the host within the preset time period, it uses the last successfully written data in the primary storage device to overwrite the last successfully written data in the secondary storage device. By determining that the primary storage system has not received unfinished write operation data within a preset period of time, the data that was successfully written last time in the primary storage device is used to overwrite the data that was successfully written last time in the secondary storage device to ensure that the primary storage device Consistency with the data of the slave storage device avoids the situation of starting synchronization guarantee by frequently disconnecting the business of double-writing data, reduces the risk of data loss, and improves the reliability of the storage system.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description These are some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained according to these drawings without any creative effort.
图1为本发明双写数据的方法实施例一的流程示意图;FIG. 1 is a schematic flow diagram of Embodiment 1 of a method for double-writing data in the present invention;
图2为本发明双写数据的方法实施例二的流程示意图;FIG. 2 is a schematic flow diagram of Embodiment 2 of the method for double writing data in the present invention;
图3为本发明双写数据的装置实施例一的结构示意图;3 is a schematic structural diagram of Embodiment 1 of a device for double writing data according to the present invention;
图4为本发明存储设备实施例一的结构示意图。FIG. 4 is a schematic structural diagram of Embodiment 1 of a storage device according to the present invention.
具体实施方式Detailed ways
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
本发明实施例提供的双写数据的方法可以适用于附加在业务存储空间上的镜像、容灾系统、迁移或复制数据等场景中。其中,镜像是冗余的一种类型,是将主存储设备上的数据在从存储设备上保存一份完全相同的副本。容灾系统是指在相隔较远的异地,建立两套或多套功能相同的IT系统,互相之间可以进行正常状态监视和功能切换,当主端系统因意外(如火灾、地震等)停止工作时,整个应用系统可以切换到从端,使得该系统功能可以继续正常工作。迁移或复制数据包括通过网络将主存储设备中的数据复制到从存储设备中或创建文件系统的备份等形式。由此可见,在镜像、容灾系统、迁移或复制数据等场景中,如何在保证主存储设备和从存储设备中的数据相一致的情况下,提高存储系统的可靠性,是一个非常重要的问题。The method for double-writing data provided by the embodiments of the present invention can be applied to scenarios such as mirroring attached to a business storage space, a disaster recovery system, migration or replication of data, and the like. Among them, mirroring is a type of redundancy, which is to save an identical copy of data on the primary storage device on the secondary storage device. The disaster recovery system refers to the establishment of two or more sets of IT systems with the same functions in remote places far apart, which can perform normal state monitoring and function switching between each other. When the main end system stops working due to accidents (such as fire, earthquake, etc. At this time, the entire application system can be switched to the slave end, so that the system function can continue to work normally. Migrating or copying data includes copying data from a primary storage device to a secondary storage device or creating a file system backup through a network. It can be seen that in scenarios such as mirroring, disaster recovery systems, migration or copying data, how to improve the reliability of the storage system while ensuring that the data in the primary storage device and the secondary storage device are consistent is a very important question.
图1为本发明双写数据的方法实施例一的流程示意图。本发明实施例提供了一种双写数据的方法,该方法可以由任意的存储系统来执行,例如:存储设备、虚拟化机头或备份软件等,具体可以通过软件和/或硬件实现。如图1所示,本实施例的方法可以包括:FIG. 1 is a schematic flowchart of Embodiment 1 of a method for double writing data in the present invention. An embodiment of the present invention provides a method for double-writing data, which can be executed by any storage system, such as a storage device, a virtualization head, or backup software, and can be specifically implemented by software and/or hardware. As shown in Figure 1, the method of this embodiment may include:
步骤101:接收主机发送的双写数据请求,并同时向主LUN对应的主存储设备和从LUN对应的从存储设备中分别进行写数据操作。Step 101: Receive a double-write data request sent by the host, and simultaneously perform data write operations on the primary storage device corresponding to the primary LUN and the secondary storage device corresponding to the secondary LUN.
在本实施例中,主存储系统接收到主机发送的双写数据的请求之后,同时将该双写数据请求发送给主LUN对应的主存储设备和从LUN对应的从存储设备,以使主存储系统向主存储设备和从存储设备写数据。其中,存储设备例如可以是存储器、硬盘等。对于存储设备的具体类型,本发明并不加以限制。In this embodiment, after receiving the double-write data request sent by the host, the primary storage system simultaneously sends the double-write data request to the primary storage device corresponding to the primary LUN and the secondary storage device corresponding to the secondary LUN, so that the primary storage system The system writes data to the primary storage device and the secondary storage device. Wherein, the storage device may be, for example, a memory, a hard disk, and the like. The present invention is not limited to specific types of storage devices.
步骤102、若接收主存储设备发送的写数据重试消息,并在接收从存储设备返回的写数据响应消息后,则向主机发送写超时消息,以使主机向主存储系统发送未完成写操作的数据。Step 102, if the write data retry message sent by the main storage device is received, and after receiving the write data response message returned from the storage device, then send a write timeout message to the host, so that the host sends an unfinished write operation to the main storage system The data.
在本实施例中,主存储系统每次向主存储设备和从存储设备执行写入数据的操作后,主存储设备和从存储设备便分别向主存储系统返回响应消息,该响应消息用于表示本次写数据是否成功。当主存储系统接收到主存储设备返回的写数据重试消息之后,等待从存储设备返回响应消息,此时,无论从存储设备返回的写数据响应消息是写数据成功、写数据失败还是写数据重试,主存储系统均向主机发送写超时消息。当主机接收到该写超时消息之后,向主存储系统发送未完成写操作的数据。In this embodiment, each time the primary storage system performs an operation of writing data to the primary storage device and the secondary storage device, the primary storage device and the secondary storage device respectively return a response message to the primary storage system, and the response message is used to indicate Whether the write data is successful this time. After the main storage system receives the write data retry message returned by the main storage device, it waits for the response message returned from the storage device. For each test, the primary storage system sends a write timeout message to the host. After the host receives the write timeout message, it sends the data of the unfinished write operation to the main storage system.
步骤103、若在预设时间段内未接收主机发送的未完成写操作的数据,则使用主存储设备中上一次写成功的数据覆盖从存储设备中最后一次写成功的数据。Step 103 , if the data of the incomplete write operation sent by the host is not received within the preset time period, then use the last successfully written data in the primary storage device to overwrite the last successfully written data in the secondary storage device.
在本实施例中,主存储系统向主机发送写超时消息之后,会启动一个定时器,若在预设时间段内,主存储系统未接收到主机发送的未完成写操作的数据,则读取主存储设备中上一次写成功的数据,并利用该数据将从存储设备中最后一次写成功的数据进行覆盖。例如:在预设时间之后,主存储系统未接收到主机发送的未完成写操作的数据A,此时将主存储设备中上一次写成功的数据覆盖从存储设备中最后一次写成功的数据,以保证主存储设备和从存储设备中的数据一致,而且可以避免双写数据操作的频繁中断,同时减轻主存储系统读写数据的压力。其中,对于从存储设备来说,若本次写数据操作失败,则最后一次写成功的数据是指上一次写成功的数据,若本次写数据操作成功,则最后一次写成功的数据是指本次写成功的数据。In this embodiment, after the main storage system sends a write timeout message to the host, it will start a timer. The last successfully written data in the primary storage device, and use this data to overwrite the last successfully written data in the secondary storage device. For example: after the preset time, the primary storage system does not receive the data A of the incomplete write operation sent by the host, at this time, the last successfully written data in the primary storage device overwrites the last successfully written data in the secondary storage device, In order to ensure that the data in the primary storage device and the secondary storage device are consistent, and can avoid frequent interruption of double-write data operations, and at the same time reduce the pressure of the primary storage system for reading and writing data. Among them, for the slave storage device, if the data writing operation fails this time, the data that was successfully written last time refers to the data that was successfully written last time; if the data writing operation is successful this time, the data that was successfully written last time refers to Data written successfully this time.
另外,通过判断主存储系统是否在预设时间段内接收到主机发送的未完成写操作的数据,可以减小主存储系统的读写时延。其中,预设时间段的值可以根据经验或者数据量的大小选取合适的值,例如:当主存储系统读写数据量大时,选取1.5s,当主存储系统读写数据量小时,选取1s。对于预设时间段的具体值的选取,本实施例在此不作特别限制。In addition, by judging whether the main storage system has received the unfinished write operation data sent by the host within a preset time period, the read and write time delay of the main storage system can be reduced. Among them, the value of the preset time period can be selected according to the experience or the size of the data volume. For example, when the main storage system reads and writes a large amount of data, select 1.5s; when the main storage system reads and writes a small amount of data, select 1s. For the selection of the specific value of the preset time period, this embodiment does not make any special limitation here.
本发明提供的双写数据的方法,通过接收主机发送的双写数据请求,并同时向主LUN对应的主存储设备和从LUN对应的从存储设备中分别进行写数据操作;若主存储系统接收主存储设备发送的写数据重试消息,且接收从存储设备返回的写数据响应消息,则向主机发送写超时消息,以使主机向主存储系统发送未完成写操作的数据,若主存储系统在预设时间段内未接收到主机发送的未完成写操作的数据,则使用主存储设备中上一次写成功的数据覆盖从存储设备中最后一次写成功的数据。通过确定主存储系统在预设时间段内未接收到未完成写操作的数据,从而使用主存储设备中上一次写成功的数据覆盖从存储设备中最后一次写成功的数据,来保证主存储设备和从存储设备数据的一致,避免了通过频繁断开双写数据的业务来启动同步保证的情况,降低了丢失数据的风险,提高了存储系统的可靠性。The method for double-writing data provided by the present invention is to receive the double-writing data request sent by the host, and simultaneously write data to the primary storage device corresponding to the primary LUN and the secondary storage device corresponding to the secondary LUN; if the primary storage system receives The main storage device sends the write data retry message, and receives the write data response message returned from the storage device, then sends a write timeout message to the host, so that the host sends the unfinished write operation data to the main storage system, if the main storage system If the data of the unfinished write operation sent by the host is not received within the preset time period, the last successfully written data in the primary storage device is used to overwrite the last successfully written data in the secondary storage device. By determining that the primary storage system has not received unfinished write operation data within a preset period of time, the data that was successfully written last time in the primary storage device is used to overwrite the data that was successfully written last time in the secondary storage device to ensure that the primary storage device Consistency with the data of the slave storage device avoids the situation of starting synchronization guarantee by frequently disconnecting the business of double-writing data, reduces the risk of data loss, and improves the reliability of the storage system.
在上述方法实施例的基础上,若主存储系统在预设时间段内接收到主机发送的未完成写操作的数据,则将重新向主存储设备和从存储设备中写入主存储设备中需要重写的数据。例如:主存储系统同时向主存储设备和从存储设备写数据A,无论接收到从存储设备发送的写数据A成功的消息还是写数据A失败的消息,如果一旦接收到主存储设备发送的写数据A重试的消息,就认为主存储设备和从存储设备中的数据不一致,此时,重新将数据A写入主存储设备和从存储设备中。On the basis of the above method embodiments, if the primary storage system receives the unfinished write operation data sent by the host within the preset time period, it will re-write the data required in the primary storage device to the primary storage device and the secondary storage device. rewritten data. For example: the primary storage system writes data A to the primary storage device and the secondary storage device at the same time. If the data A retry message, it is considered that the data in the primary storage device and the secondary storage device are inconsistent, and at this time, data A is rewritten into the primary storage device and the secondary storage device.
在上述方法实施例的基础上,双写数据请求中携带有待写数据的相关信息,其中,相关信息包括待写数据的位置和大小,从而使主存储系统可以根据待写数据的位置和大小,向主存储设备和从存储设备分别进行写数据操作。On the basis of the above method embodiments, the double-write data request carries relevant information of the data to be written, wherein the relevant information includes the location and size of the data to be written, so that the main storage system can, according to the location and size of the data to be written, Write data to the master storage device and the slave storage device respectively.
在上述方法实施例的基础上,写数据重试消息中携带有未完成写操作的数据的信息,从而使主存储系统可以根据主存储设备返回的写数据重试消息中携带的未完成写操作的数据的相关信息,确定出需要重写的数据,并将需要重写的数据进行标记。另外,主机接收到写超时消息后,向主存储系统发送未完成写操作的数据,可选的,当主存储系统在预设时间段内接收到主机发送的未完成写操作的数据,则将对重写的数据所作的标记删除,同时根据主机发送的未完成写操作的数据,重新向主存储设备和从存储设备中写入该未完成写操作的数据;当主存储系统在预设时间段内没有接收到主机发送的未完成写操作的数据,则主存储系统可以根据所作的标记,获取主存储设备中上一次写成功的数据,并使用该数据覆盖从存储设备中最后一次写成功的数据,其中,所作的标记中包括未完成写操作的数据的位置和大小。On the basis of the above method embodiments, the write data retry message carries the data information of the uncompleted write operation, so that the primary storage system can retry the uncompleted write operation carried in the message according to the write data returned by the primary storage device Relevant information of the data, determine the data that needs to be rewritten, and mark the data that needs to be rewritten. In addition, after receiving the write timeout message, the host sends the unfinished write operation data to the main storage system. Optionally, when the main storage system receives the unfinished write operation data sent by the host within a preset time period, it will The mark made by the rewritten data is deleted, and at the same time, according to the data of the incomplete write operation sent by the host, the data of the incomplete write operation is rewritten to the main storage device and the slave storage device; when the main storage system is within the preset time period If the data of the incomplete write operation sent by the host is not received, the primary storage system can obtain the last successfully written data in the primary storage device according to the mark, and use this data to overwrite the last successfully written data in the secondary storage device , where the mark includes the position and size of the data of the unfinished write operation.
图2为本发明双写数据的方法实施例二的流程示意图。本实施例在双写数据的方法实施例一的基础上,对若接收到主存储设备发送的写数据成功消息的实施例,作详细说明。如图2所示,本实施例的方法可以包括:FIG. 2 is a schematic flowchart of Embodiment 2 of the method for double writing data in the present invention. In this embodiment, on the basis of the first embodiment of the method for double-writing data, a detailed description will be given of an embodiment in which the data writing success message sent by the main storage device is received. As shown in Figure 2, the method of this embodiment may include:
步骤201:接收主机发送的双写数据请求,并同时向主LUN对应的主存储设备和从LUN对应的从存储设备中分别进行写数据操作。Step 201: Receive a double-write data request sent by the host, and simultaneously perform data write operations on the primary storage device corresponding to the primary LUN and the secondary storage device corresponding to the secondary LUN.
在本实施例中,双写数据请求中携带有待写数据的位置和大小,以使主存储系统获知将哪些数据写入主存储设备和从存储设备中,并根据待写数据的位置和大小,向主存储设备和从存储设备中进行写数据的操作。In this embodiment, the double write data request carries the location and size of the data to be written, so that the primary storage system knows which data to write into the primary storage device and the secondary storage device, and according to the location and size of the data to be written, Write data to the primary storage device and the secondary storage device.
步骤202、判断是否接收主存储设备发送的写数据重试消息。Step 202, judging whether to receive a write data retry message sent by the primary storage device.
若是,则执行步骤203后直接执行步骤208,否则,执行步骤204。If yes, step 208 is directly executed after step 203 is executed; otherwise, step 204 is executed.
步骤203、接收从存储设备返回的写数据响应消息,向主机发送写超时消息,以使主机向主存储系统发送未完成写操作的数据。Step 203: Receive a write data response message returned from the storage device, and send a write timeout message to the host, so that the host sends unfinished data of the write operation to the main storage system.
在本实施例中,若主存储系统接收到主存储设备发送的写数据重试消息,会等待从存储设备返回写数据响应消息,当接收到从存储设备返回的写数据响应消息后,根据写数据重试消息中携带的未完成写操作的数据的信息,标记出需要重写的数据,同时启动重试定时器,判断主存储系统是否能在预设的时间段内接收到主机发送的未完成写操作的数据。In this embodiment, if the primary storage system receives the write data retry message sent by the primary storage device, it will wait for the write data response message to be returned from the storage device. After receiving the write data response message returned from the storage device, it will The data information of the incomplete write operation carried in the data retry message marks the data that needs to be rewritten, and starts the retry timer at the same time to judge whether the main storage system can receive the unfinished data sent by the host within the preset time period. Complete the data for the write operation.
步骤204、确定接收主存储设备发送的写数据成功消息。Step 204, determine to receive the data writing success message sent by the primary storage device.
步骤205、判断是否接收从存储设备发送的写数据成功消息。Step 205, judging whether to receive a data writing success message sent from the storage device.
若是,执行步骤206,否则,执行步骤207。If yes, go to step 206; otherwise, go to step 207.
步骤206、向主机发送写数据成功指令,并删除待写数据的相关信息。Step 206 , sending a data write success instruction to the host, and deleting the relevant information of the data to be written.
在本实施例中,主存储系统分别接收到主存储设备和从存储设备发送的写数据成功消息后,向主机返回写数据成功的指令,同时,将待写数据的位置和大小删除,以进行下一个数据的双写操作。In this embodiment, after the main storage system respectively receives the write data success message sent by the main storage device and the slave storage device, it returns an instruction to the host to write data successfully, and at the same time, deletes the location and size of the data to be written, so that Double write operation of next data.
步骤207、中断向从存储设备进行的写数据操作,并向主机发送写数据成功指令。Step 207, interrupt the data writing operation to the slave storage device, and send a data writing success instruction to the host.
在本实施例中,当主存储系统接收到主存储设备发送的写数据成功消息,而从存储设备发送的写数据失败消息时,此时从存储设备的数据不可用,因此,将中断向从存储设备继续进行写数据的操作,并向主机返回写数据成功的指令,并记录从存储设备中写失败的数据的位置和大小。In this embodiment, when the primary storage system receives the write data success message sent by the primary storage device and the write data failure message sent by the secondary storage device, the data of the secondary storage device is not The device continues to write data, and returns an instruction to the host that the data is written successfully, and records the location and size of the data that failed to be written from the storage device.
步骤208、判断是否在预设时间段内接收主机发送的未完成写操作的数据。Step 208, judging whether to receive the data of the unfinished write operation sent by the host within a preset time period.
在本实施例中,通过启动一个定时器,判断主存储系统是否在预设时间段内接收主机发送的未完成写操作的数据,若是,则执行步骤209,否则,执行步骤211。In this embodiment, by starting a timer, it is judged whether the main storage system receives the unfinished write operation data sent by the host within a preset time period, if yes, execute step 209 , otherwise, execute step 211 .
步骤209、将重新向主存储设备和从存储设备进行写数据操作。In step 209, the operation of writing data to the primary storage device and the secondary storage device will be performed again.
在本实施例中,若主存储系统在预设时间段内接收到主机发送的未完成写操作的数据,则将该未完成写操作的数据重新写入主存储设备和从存储设备中。In this embodiment, if the primary storage system receives the data of the uncompleted write operation sent by the host within a preset time period, it rewrites the data of the uncompleted write operation into the primary storage device and the secondary storage device.
步骤210、若在预设时间段内接收主存储设备发送的完成重写操作消息,则删除待写数据的相关信息。Step 210, if the rewriting operation completion message sent by the main storage device is received within the preset time period, then delete the relevant information of the data to be written.
在本实施例中,若主存储设备在预设的时间段内完成了重写操作,则主存储设备和从存储设备的数据相同,此时,将设置的定时器和记录的待写数据的位置和大小等相关信息删除,以进行下一个数据的双写操作。In this embodiment, if the master storage device completes the rewriting operation within the preset time period, the data of the master storage device and the slave storage device are the same. At this time, the set timer and the recorded data to be written Relevant information such as location and size are deleted for the next data double-write operation.
步骤211、使用主存储设备中上一次写成功的数据覆盖从存储设备中最后一次写成功的数据。Step 211 , use the last successfully written data in the primary storage device to overwrite the last successfully written data in the secondary storage device.
在本实施例中,若主存储系统在预设时间段内未接收到主机发送的未完成写操作的数据,则根据对需要重写的数据所作的标记,获取主存储设备中上一次写成功的数据,并使用该数据覆盖从存储设备中最后一次写成功的数据,由此可见,当主存储设备写数据超时之后,可以自动地将主存储设备和从存储设备的数据进行数据一致性的修复,避免了人工的干预,提高了系统的自愈性。In this embodiment, if the main storage system does not receive the data of the unfinished write operation sent by the host within the preset period of time, then according to the mark made on the data that needs to be rewritten, the last write success in the main storage device is obtained. data, and use the data to overwrite the last successfully written data from the storage device. It can be seen that when the data written by the primary storage device times out, the data consistency of the primary storage device and the secondary storage device can be automatically repaired , avoiding manual intervention and improving the self-healing property of the system.
需要进行说明的是,若主存储系统接收到主存储设备发送的写数据失败消息,则保存待写数据的相关信息,同时向主机返回写数据失败指令。It should be noted that, if the primary storage system receives the data write failure message sent by the primary storage device, it saves relevant information of the data to be written, and returns a data write failure instruction to the host at the same time.
本发明提供的双写数据的方法,通过接收主机发送的双写数据请求,并同时向主LUN对应的主存储设备和从LUN对应的从存储设备中分别进行写数据操作;若主存储系统接收主存储设备发送的写数据重试消息,并在接收从存储设备返回的写数据响应消息后,向主机发送写超时消息,以使主机向主存储系统发送未完成写操作的数据,若在预设时间段内主存储系统未接收主机发送的未完成写操作的数据,则使用主存储设备中上一次写成功的数据覆盖从存储设备中最后一次写成功的数据。通过确定主存储系统在预设时间段内未接收到未完成写操作的数据,从而使用主存储设备中上一次写成功的数据覆盖从存储设备中最后一次写成功的数据,来保证主存储设备和从存储设备数据的一致,避免了通过频繁断开双写数据的业务来启动同步保证的情况,降低了丢失数据的风险,提高了存储系统的可靠性。The method for double-writing data provided by the present invention is to receive the double-writing data request sent by the host, and simultaneously write data to the primary storage device corresponding to the primary LUN and the secondary storage device corresponding to the secondary LUN; if the primary storage system receives The write data retry message sent by the main storage device, and after receiving the write data response message returned from the storage device, sends a write timeout message to the host, so that the host sends the unfinished write operation data to the main storage system. Assuming that the primary storage system does not receive the unfinished write operation data sent by the host within the period of time, the last successfully written data in the primary storage device is used to overwrite the last successfully written data in the secondary storage device. By determining that the primary storage system has not received unfinished write operation data within a preset period of time, the data that was successfully written last time in the primary storage device is used to overwrite the data that was successfully written last time in the secondary storage device to ensure that the primary storage device Consistency with the data of the slave storage device avoids the situation of starting synchronization guarantee by frequently disconnecting the business of double-writing data, reduces the risk of data loss, and improves the reliability of the storage system.
可选地,在上述方法实施例的基础上,使用主存储设备中上一次写成功的数据覆盖从存储设备中最后一次写成功的数据之后,若接收从存储设备发送的写数据成功消息,则删除待写数据的相关信息;否则,重新向所述主存储设备和所述从存储设备进行写数据的操作。Optionally, on the basis of the above method embodiments, after overwriting the last successfully written data in the secondary storage device with the data that was successfully written last time in the primary storage device, if the write data success message sent from the secondary storage device is received, then Delete the relevant information of the data to be written; otherwise, perform the operation of writing data to the primary storage device and the secondary storage device again.
具体地,使用主存储设备中上一次写成功的数据覆盖从存储设备中最后一次写成功的数据之后,从存储设备将会返回写数据的结果,若从存储设备写数据成功,则向主存储系统返回写数据重试消息,同时将记录的待写数据的位置和大小等相关信息删除;若从存储设备返回写数据失败消息,则向主存储系统上报复制数据错误信息,并中断重新向主存储设备和从存储设备进行写数据的操作,即中断主存储设备和从存储设备之间的复制关系,同时将记录写数据的差异,并向主机发送主存储系统写数据的结果。在具体的实现过程中,可以通过手动启同步的方式,将主存储设备中上一次写成功的数据覆盖从存储设备中最后一次写成功的数据,保证主存储设备和从存储设备中数据的一致性。Specifically, after overwriting the last successfully written data in the secondary storage device with the last successfully written data in the primary storage device, the secondary storage device will return the result of writing data. The system returns a write data retry message, and at the same time deletes relevant information such as the location and size of the recorded data to be written; The operation of writing data between the storage device and the slave storage device is to interrupt the replication relationship between the master storage device and the slave storage device, and record the difference of the written data at the same time, and send the result of the master storage system to write data to the host. In the specific implementation process, the last successfully written data in the primary storage device can be overwritten by the last successfully written data in the secondary storage device by manually starting synchronization, so as to ensure the consistency of the data in the primary storage device and the secondary storage device sex.
图3为本发明双写数据的装置实施例一的结构示意图,如图3所示,本发明实施例提供的双写数据的装置包括接收模块301,处理模块302和发送模块303。FIG. 3 is a schematic structural diagram of Embodiment 1 of the device for double writing data according to the present invention. As shown in FIG.
其中,接收模块301用于接收主机发送的双写数据请求;处理模块302用于同时向主逻辑单元号LUN对应的主存储设备和从LUN对应的从存储设备中分别进行写数据操作;发送模块303用于在所述接收模块接收所述主存储设备发送的写数据重试消息,并在接收所述从存储设备返回的写数据响应消息后,向所述主机发送写超时消息,以使所述主机向所述主存储系统发送未完成写操作的数据;所述处理模块302还用于若所述接收模块在预设时间段内未接收所述主机发送的未完成写操作的数据,则使用所述主存储设备中上一次写成功的数据覆盖所述从存储设备中最后一次写成功的数据。Among them, the receiving module 301 is used to receive the double write data request sent by the host; the processing module 302 is used to simultaneously write data to the master storage device corresponding to the master logical unit number LUN and the slave storage device corresponding to the slave LUN; the sending module 303 is configured to receive, after the receiving module receives the write data retry message sent by the primary storage device, and after receiving the write data response message returned from the secondary storage device, send a write timeout message to the host, so that all The host sends the data of the incomplete write operation to the main storage system; the processing module 302 is further configured to: if the receiving module does not receive the data of the incomplete write operation sent by the host within a preset time period, then Using the last successfully written data in the master storage device to overwrite the last successfully written data in the slave storage device.
本发明提供的双写数据的装置,通过接收主机发送的双写数据请求,并同时向主LUN对应的主存储设备和从LUN对应的从存储设备中分别进行写数据操作;若主存储系统接收主存储设备发送的写数据重试消息,且接收从存储设备返回的写数据响应消息,则向主机发送写超时消息,以使主机向主存储系统发送未完成写操作的数据,若主存储系统在预设时间段内未接收到主机发送的未完成写操作的数据,则使用主存储设备中上一次写成功的数据覆盖从存储设备中最后一次写成功的数据。通过确定主存储系统在预设时间段内未接收到未完成写操作的数据,从而使用主存储设备中上一次写成功的数据覆盖从存储设备中最后一次写成功的数据,来保证主存储设备和从存储设备数据的一致,避免了通过频繁断开双写数据的业务来启动同步保证的情况,降低了丢失数据的风险,提高了存储系统的可靠性。The device for double-writing data provided by the present invention, by receiving the double-writing data request sent by the host, and simultaneously writes data to the primary storage device corresponding to the primary LUN and the secondary storage device corresponding to the secondary LUN; if the primary storage system receives The main storage device sends the write data retry message, and receives the write data response message returned from the storage device, then sends a write timeout message to the host, so that the host sends the unfinished write operation data to the main storage system, if the main storage system If the data of the unfinished write operation sent by the host is not received within the preset time period, the last successfully written data in the primary storage device is used to overwrite the last successfully written data in the secondary storage device. By determining that the primary storage system has not received unfinished write operation data within a preset period of time, the data that was successfully written last time in the primary storage device is used to overwrite the data that was successfully written last time in the secondary storage device to ensure that the primary storage device Consistency with the data of the slave storage device avoids the situation of starting synchronization guarantee by frequently disconnecting the business of double-writing data, reduces the risk of data loss, and improves the reliability of the storage system.
可选地,所述处理模块302还用于若所述接收模块在预设时间段内接收所述主机发送的未完成写操作的数据,则将重新向所述主存储设备和所述从存储设备进行写数据操作。Optionally, the processing module 302 is further configured to re-send data to the master storage device and the slave storage device if the receiving module receives the unfinished write operation data sent by the host within a preset time period. The device performs a data write operation.
可选地,所述双写数据请求中携带待写数据的相关信息,所述相关信息包括所述待写数据的位置和大小;Optionally, the double-write data request carries related information of the data to be written, and the related information includes the location and size of the data to be written;
所述处理模块302还用于:The processing module 302 is also used for:
根据所述待写数据的位置和大小,向所述主存储设备和所述从存储设备分别进行写数据操作。According to the location and size of the data to be written, write data to the master storage device and the slave storage device respectively.
可选地,所述写数据重试消息中携带未完成写操作的数据的信息;Optionally, the write data retry message carries data information of unfinished write operations;
所述处理模块302还用于:The processing module 302 is also used for:
根据未完成写操作的数据的信息获取所述主存储设备中上一次写成功的数据,并使用所述主存储设备中上一次写成功的数据覆盖所述从存储设备中最后一次写成功的数据。Obtain the last successfully written data in the primary storage device according to the information of the unfinished write data, and use the last successfully written data in the primary storage device to overwrite the last successfully written data in the secondary storage device .
可选地,所述发送模块303还用于若所述接收模块301分别接收所述主存储设备和所述从存储设备发送的写数据成功消息,则向所述主机发送写数据成功指令,所述处理模块302用于删除所述待写数据的相关信息;Optionally, the sending module 303 is further configured to send a write data success instruction to the host if the receiving module 301 respectively receives the write data success messages sent by the master storage device and the slave storage device, The processing module 302 is used to delete the relevant information of the data to be written;
所述处理模块302还用于若所述接收模块301接收所述主存储设备发送的写数据成功消息,且接收所述从存储设备发送的写数据失败消息,则中断向所述从存储设备进行的写数据操作,所述发送模块303用于向主机发送写数据成功指令。The processing module 302 is further configured to: if the receiving module 301 receives the write data success message sent by the master storage device, and receives the write data failure message sent by the slave storage device, then interrupt the data transfer to the slave storage device. In the data writing operation, the sending module 303 is configured to send a data writing success instruction to the host.
可选地,所述处理模块302还用于:Optionally, the processing module 302 is further configured to:
若所述接收模块301在所述预设时间段内接收所述主存储设备发送的完成重写操作消息,则删除所述待写数据的相关信息。If the receiving module 301 receives the rewrite operation completion message sent by the main storage device within the preset time period, then delete the information related to the data to be written.
可选地,所述处理模块302还用于:Optionally, the processing module 302 is further configured to:
若所述接收模块301接收所述从存储设备发送的写数据成功消息,则删除所述待写数据的相关信息;否则,中断向所述从存储设备进行写数据的操作。If the receiving module 301 receives the data writing success message sent by the secondary storage device, then delete the relevant information of the data to be written; otherwise, interrupt the operation of writing data to the secondary storage device.
本实施例的双写数据的装置,可以用于执行本发明任意实施例所提供的双写数据的方法的技术方案,其实现原理和技术效果类似,此处不再赘述。The device for double writing data in this embodiment can be used to implement the technical solution of the method for double writing data provided in any embodiment of the present invention, and its implementation principle and technical effect are similar, and will not be repeated here.
图4为本发明存储设备实施例一的结构示意图,如图4所示,本实施例提供的存储设备包括接收器10、处理器11和发送器12。FIG. 4 is a schematic structural diagram of Embodiment 1 of a storage device according to the present invention. As shown in FIG. 4 , the storage device provided in this embodiment includes a receiver 10 , a processor 11 and a transmitter 12 .
其中,接收器10用于接收主机发送的双写数据请求,处理器11用于同时向主逻辑单元号LUN对应的主存储设备和从LUN对应的从存储设备中分别进行写数据操作;所述发送器12用于若接收器10接收所述主存储设备发送的写数据重试消息,并在接收所述从存储设备返回的写数据响应消息后,则向所述主机发送写超时消息,以使所述主机向所述主存储系统发送未完成写操作的数据;所述处理器11还用于若所述接收器10在预设时间段内未接收所述主机发送的未完成写操作的数据,则使用所述主存储设备中上一次写成功的数据覆盖所述从存储设备中最后一次写成功的数据。Wherein, the receiver 10 is used to receive the double write data request sent by the host, and the processor 11 is used to simultaneously write data to the master storage device corresponding to the master logical unit number LUN and the slave storage device corresponding to the slave LUN; The transmitter 12 is configured to send a write timeout message to the host if the receiver 10 receives the write data retry message sent by the primary storage device, and after receiving the write data response message returned from the storage device, to Make the host send the data of the unfinished write operation to the main storage system; the processor 11 is also configured to if the receiver 10 does not receive the unfinished write operation sent by the host within a preset time period data, use the last successfully written data in the master storage device to overwrite the last successfully written data in the slave storage device.
本发明实施例提供的存储设备,可以执行上述双写数据的方法的技术方案,其实现原理和技术效果类似,在此不再赘述。The storage device provided by the embodiment of the present invention can execute the technical solution of the above method for double writing data, and its implementation principle and technical effect are similar, and will not be repeated here.
在本发明实施例中,所述处理器11还用于若所述接收器10在预设时间段内接收所述主机发送的未完成写操作的数据,则将重新向所述主存储设备和所述从存储设备进行写数据操作。In the embodiment of the present invention, the processor 11 is further configured to send data to the main storage device and The slave storage device performs a data write operation.
在本发明实施例中,所述双写数据请求中携带待写数据的相关信息,所述相关信息包括所述待写数据的位置和大小;所述处理器11还用于根据所述待写数据的位置和大小,向所述主存储设备和所述从存储设备分别进行写数据操作。In the embodiment of the present invention, the double-write data request carries related information of the data to be written, and the related information includes the location and size of the data to be written; the processor 11 is also configured to The position and size of the data are respectively written to the master storage device and the slave storage device.
在本发明实施例中,所述写数据重试消息中携带未完成写操作的数据的信息;所述处理器11还用于根据未完成写操作的数据的信息获取所述主存储设备中上一次写成功的数据,并使用所述主存储设备中上一次写成功的数据覆盖所述从存储设备中最后一次写成功的数据。In the embodiment of the present invention, the write data retry message carries data information of incomplete write operations; the processor 11 is further configured to acquire the Write the data that was successfully written once, and use the data that was successfully written last time in the master storage device to overwrite the data that was successfully written last time in the slave storage device.
在本发明实施例中,所述发送器12还用于若所述接收器10分别接收所述主存储设备和所述从存储设备发送的写数据成功消息,则向所述主机发送写数据成功指令,所述处理器11用于删除所述待写数据的相关信息;所述处理器11还用于若所述接收器10接收所述主存储设备发送的写数据成功消息,且接收所述从存储设备发送的写数据失败消息,则中断向所述从存储设备进行的写数据操作,所述发送器12用于向主机发送写数据成功指令。In the embodiment of the present invention, the transmitter 12 is further configured to send a write data success message to the host if the receiver 10 respectively receives the write data success message sent by the master storage device and the slave storage device. instruction, the processor 11 is used to delete the relevant information of the data to be written; the processor 11 is also used to if the receiver 10 receives the write data success message sent by the main storage device, and receives the If the write data failure message sent by the slave storage device interrupts the data write operation to the slave storage device, the transmitter 12 is configured to send a write data success instruction to the host.
在本发明实施例中,所述处理器11用于若所述接收器10在所述预设时间段内接收所述主存储设备发送的完成重写操作消息,则删除所述待写数据的相关信息。In the embodiment of the present invention, the processor 11 is configured to delete the data to be written if the receiver 10 receives the rewriting operation completion message sent by the main storage device within the preset time period. Related Information.
在本发明实施例中,所述处理器11用于若所述接收器10接收所述从存储设备发送的写数据成功消息,则删除所述待写数据的相关信息;否则,中断重新向所述主存储设备和所述从存储设备进行写数据的操作。In the embodiment of the present invention, the processor 11 is configured to delete the relevant information of the data to be written if the receiver 10 receives the write data success message sent from the storage device; The master storage device and the slave storage device perform data writing operations.
本发明实施例提供的存储设备,可以执行上述双写数据的方法的技术方案,其实现原理和技术效果类似,在此不再赘述。The storage device provided by the embodiment of the present invention can execute the technical solution of the above method for double writing data, and its implementation principle and technical effect are similar, and will not be repeated here.
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps for implementing the above method embodiments can be completed by program instructions and related hardware. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above-mentioned method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other various media that can store program codes.
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than limiting them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: It is still possible to modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the various embodiments of the present invention. scope.
Claims (14)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410676570.2A CN104407814B (en) | 2014-11-21 | 2014-11-21 | Double method and apparatus for writing data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410676570.2A CN104407814B (en) | 2014-11-21 | 2014-11-21 | Double method and apparatus for writing data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104407814A true CN104407814A (en) | 2015-03-11 |
CN104407814B CN104407814B (en) | 2017-10-17 |
Family
ID=52645447
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410676570.2A Active CN104407814B (en) | 2014-11-21 | 2014-11-21 | Double method and apparatus for writing data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104407814B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106502822A (en) * | 2015-09-08 | 2017-03-15 | 中兴通讯股份有限公司 | Data read-write method and device |
CN106844234A (en) * | 2015-12-04 | 2017-06-13 | 成都华为技术有限公司 | Method for writing data and device, dual-active system |
CN106909307A (en) * | 2015-12-22 | 2017-06-30 | 华为技术有限公司 | A kind of method and device for managing dual-active storage array |
CN107016029A (en) * | 2016-12-13 | 2017-08-04 | 阿里巴巴集团控股有限公司 | A kind of processing method of business datum, apparatus and system |
CN107203339A (en) * | 2017-05-10 | 2017-09-26 | 杭州宏杉科技股份有限公司 | A kind of date storage method and device |
CN113190177A (en) * | 2021-05-12 | 2021-07-30 | 西安雷风电子科技有限公司 | Data storage method, terminal equipment, server and system |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101169705A (en) * | 2007-11-30 | 2008-04-30 | 中兴通讯股份有限公司 | Method for implementing file class mirror-image under multiple hard disk based on nude file system |
US20110022913A1 (en) * | 2002-09-25 | 2011-01-27 | Renesas Electronics Corporation | Nonvolatile memory |
CN103036717A (en) * | 2012-12-12 | 2013-04-10 | 北京邮电大学 | Consistency maintenance system and methods for distributed-type data |
CN103297268A (en) * | 2013-05-13 | 2013-09-11 | 北京邮电大学 | P2P (peer to peer) technology based distributed data consistency maintaining system and method |
-
2014
- 2014-11-21 CN CN201410676570.2A patent/CN104407814B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110022913A1 (en) * | 2002-09-25 | 2011-01-27 | Renesas Electronics Corporation | Nonvolatile memory |
CN101169705A (en) * | 2007-11-30 | 2008-04-30 | 中兴通讯股份有限公司 | Method for implementing file class mirror-image under multiple hard disk based on nude file system |
CN103036717A (en) * | 2012-12-12 | 2013-04-10 | 北京邮电大学 | Consistency maintenance system and methods for distributed-type data |
CN103297268A (en) * | 2013-05-13 | 2013-09-11 | 北京邮电大学 | P2P (peer to peer) technology based distributed data consistency maintaining system and method |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106502822A (en) * | 2015-09-08 | 2017-03-15 | 中兴通讯股份有限公司 | Data read-write method and device |
WO2017041616A1 (en) * | 2015-09-08 | 2017-03-16 | 中兴通讯股份有限公司 | Data reading and writing method and device, double active storage system and realization method thereof |
CN106844234A (en) * | 2015-12-04 | 2017-06-13 | 成都华为技术有限公司 | Method for writing data and device, dual-active system |
CN106844234B (en) * | 2015-12-04 | 2020-01-03 | 成都华为技术有限公司 | Data writing method and device and double-active system |
CN106909307A (en) * | 2015-12-22 | 2017-06-30 | 华为技术有限公司 | A kind of method and device for managing dual-active storage array |
CN106909307B (en) * | 2015-12-22 | 2020-01-03 | 华为技术有限公司 | Method and device for managing double-active storage array |
CN107016029A (en) * | 2016-12-13 | 2017-08-04 | 阿里巴巴集团控股有限公司 | A kind of processing method of business datum, apparatus and system |
CN107203339A (en) * | 2017-05-10 | 2017-09-26 | 杭州宏杉科技股份有限公司 | A kind of date storage method and device |
CN107203339B (en) * | 2017-05-10 | 2020-04-21 | 杭州宏杉科技股份有限公司 | Data storage method and device |
CN113190177A (en) * | 2021-05-12 | 2021-07-30 | 西安雷风电子科技有限公司 | Data storage method, terminal equipment, server and system |
CN113190177B (en) * | 2021-05-12 | 2023-07-14 | 西安雷风电子科技有限公司 | Data storage method, terminal equipment, server and system |
Also Published As
Publication number | Publication date |
---|---|
CN104407814B (en) | 2017-10-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104407814B (en) | Double method and apparatus for writing data | |
JP6344798B2 (en) | Data transmission method, data reception method, and storage device | |
US11550675B2 (en) | Remote data replication method and system | |
US7966463B2 (en) | Asynchronous remote copy system and control method for the same | |
US8566282B2 (en) | Creating a buffer point-in-time copy relationship for a point-in-time copy function executed to create a point-in-time copy relationship | |
JP4942418B2 (en) | Computer system and snapshot creation method thereof | |
CN107003893B (en) | Virtual machine backup method, backup device and host machine | |
CN104166605A (en) | Data backup method and system based on incremental data files | |
US8677090B2 (en) | First storage apparatus and first storage apparatus control method | |
CN103034564B (en) | Data disaster tolerance drilling method, data disaster tolerance practice device and system | |
CN103617096A (en) | Storage data copying method, equipment and system | |
CN104520802B (en) | Data sending method, data receiving method and storage device | |
JP2006079568A (en) | Storage remote copy method | |
JP2006164162A (en) | Copy control apparatus and method | |
JP6281511B2 (en) | BACKUP CONTROL DEVICE, BACKUP CONTROL METHOD, AND PROGRAM | |
WO2018113322A1 (en) | Method and device for reading data | |
CN104461784A (en) | Single progress bitmap based clone copying method and system | |
US20150169220A1 (en) | Storage control device and storage control method | |
US9235349B2 (en) | Data duplication system, data duplication method, and program thereof | |
CN110879764B (en) | A bitmap setting method, apparatus, device and readable storage medium | |
JP5170169B2 (en) | Remote copy processing system, processing method, and processing program between disk array devices | |
CN107357536B (en) | Data modification and writing method and system for distributed storage system | |
CN105893186A (en) | Method, device and system for verifying stored disaster recovery data | |
CN110990191B (en) | Data recovery method and system based on mirror image storage | |
CN115509806A (en) | Real-time protection asynchronous remote copying method, device and equipment based on ROW |
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 |