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
- write data
- 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
- 238000000034 method Methods 0.000 title claims abstract description 45
- 230000004044 response Effects 0.000 claims abstract description 19
- 238000012545 processing Methods 0.000 claims description 28
- 230000009977 dual effect Effects 0.000 claims description 10
- 238000010586 diagram Methods 0.000 description 4
- 230000000694 effects Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000011084 recovery Methods 0.000 description 3
- 230000005012 migration Effects 0.000 description 2
- 238000013508 migration Methods 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
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
The embodiment of the invention provides a method and a device for data double writing. The method comprises the following steps of receiving a data double writing request send by a host, and performing data writing on main storage equipment corresponding to a main LUN (logic unit number) and auxiliary storage equipment corresponding to an auxiliary LUN; when the data writing retesting information send by the main storage equipment is received, and the data writing response information returned from the auxiliary storage equipment is received, sending the writing delay information to the host, so as to enable the host to send the data with uncompleted writing to the main storage system; when the data with uncompleted writing sent by the host is not received within the preset time range, using the previously successfully written data of the main storage equipment to cover the latest successfully written data of the auxiliary storage equipment. The method and the device for data double writing provided by the embodiment of the invention have the advantage that the reliability of the storage system is improved.
Description
Technical Field
The embodiment of the invention relates to a data backup technology, in particular to a method and a device for double-write data.
Background
The double write data is data written by a host into a main storage device corresponding to a main Logical Unit Number (LUN) in a main storage system, and is written into a slave storage device corresponding to a slave LUN in a slave storage system in real time, so as to ensure that the data of the main storage system and the data of the slave storage system are consistent, and whether the double write data has a reliable influence on the system in applications such as disaster tolerance, mirroring or migration is very large.
At present, when double write data is written, if a host receives a return retry instruction, it indicates that the write data of a master storage system is overtime, and at this time, data inconsistency of the master storage system and the slave storage system occurs when the write data of the slave storage system is successful. In order to solve the above problems, the following two methods are mainly adopted in the prior art: first, the retry instruction is treated as a write error to break the data copy relationship between the arrays, and such an exception can ensure the consistency of the data at the master and the slave by starting a synchronization operation to copy the data of the master storage system to the slave storage system. And the second method comprises the following steps: and ignoring the write operation result returned by the main storage system, returning the retry write result to the host, and retransmitting the double-write data request by the host to ensure that the main storage system and the slave storage system execute double-write operation again to ensure the consistency of the data of the main storage system and the slave storage system.
However, in the first mode, when the read-write data of the main storage system is large, the inter-array copy service is frequently disconnected, and the data consistency of the main storage system and the slave storage system is ensured by starting synchronization; in the second method, if the host fails to retry data writing due to the read-write pressure of the host itself or the link between the host and the array link, the primary storage system cannot sense a write error and the dual-write operation is normal, but the data of the primary storage system and the data of the secondary storage system are not really in a consistent state, so that the risk of data loss exists. Therefore, both solutions of the prior art have the problem of low reliability of the storage system.
Disclosure of Invention
The embodiment of the invention provides a method and a device for double-write data, which are used for improving the reliability of a storage system.
In a first aspect, an embodiment of the present invention provides a method for double-writing data, including:
receiving a double-write data request sent by a host, and simultaneously respectively performing write data operation on a main storage device corresponding to a main Logic Unit Number (LUN) and a slave storage device corresponding to a slave LUN;
if receiving a write data retry message sent by the primary storage device and after receiving a write data response message returned by the secondary storage device, sending a write timeout message to the host, so that the host sends data with uncompleted write operation to the primary storage system;
and if the data of the uncompleted write operation sent by the host computer is not received within a preset time period, overwriting the data successfully written last time in the slave storage equipment by using the data successfully written last time in the master storage equipment.
With reference to the first aspect, in a first possible implementation manner of the first aspect, the method further includes:
and if the data of the uncompleted write operation sent by the host is received within a preset time period, the data writing operation is carried out to the main storage device and the auxiliary storage device again.
With reference to the first aspect and the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, the dual write data request carries relevant information of data to be written, where the relevant information includes a position and a size of the data to be written;
the simultaneously performing data writing operation on the main storage device corresponding to the main logical unit number LUN and the slave storage device corresponding to the slave LUN respectively specifically includes:
and respectively writing data to the main storage device and the auxiliary storage device according to the position and the size of the data to be written.
With reference to the first aspect and the second possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, the write data retry message carries information of data for which a write operation is not completed;
the overwriting the last successful write data in the secondary storage device with the last successful write data in the primary storage device specifically includes:
and acquiring the data successfully written last time in the main storage device according to the information of the data which is not written successfully, and covering the data successfully written last time in the auxiliary storage device with the data successfully written last time in the main storage device.
With reference to the second possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, after the simultaneously performing the data writing operation on the primary storage device corresponding to the primary logical unit number LUN and the secondary storage device corresponding to the secondary LUN, respectively, the method further includes:
if the write data success messages sent by the main storage device and the auxiliary storage device are received respectively, sending a write data success command to the host, and deleting the related information of the data to be written; or,
and if the write data success message sent by the main storage device is received and the write data failure message sent by the auxiliary storage device is received, interrupting the write data operation to the auxiliary storage device and sending a write data success command to the host.
With reference to the second aspect or any one of the fourth possible implementation manners of the first aspect, in a fifth possible implementation manner of the first aspect, after the operation of writing data to the master storage device and the slave storage device again, the method further includes:
and if the message of completing the rewriting operation sent by the main storage device is received in the preset time period, deleting the related information of the data to be written.
With reference to the second aspect or any one of the fourth to fifth possible implementation manners of the first aspect, in a sixth possible implementation manner of the first aspect, after overwriting data that was successfully written last time in the slave storage device with data that was successfully written last time in the master storage device, the method further includes:
if the data writing success message sent by the slave storage equipment is received, deleting the related information of the data to be written;
otherwise, the operation of writing data to the master storage device and the slave storage device again is interrupted.
In a second aspect, an embodiment of the present invention provides an apparatus for double-writing data, including:
the receiving module is used for receiving a double-write data request sent by a host;
the processing module is used for respectively writing data into the main storage device corresponding to the main logic unit number LUN and the auxiliary storage device corresponding to the auxiliary LUN;
a sending module, configured to send a write timeout message to the host after the receiving module receives a write data retry message sent by the primary storage device and receives a write data response message returned by the secondary storage device, so that the host sends data with incomplete write operations to the primary storage system;
the processing module is further configured to, if the receiving module does not receive the data of the uncompleted write operation sent by the host within a preset time period, overwrite the data successfully written last time in the secondary storage device with the data successfully written last time in the primary storage device.
With reference to the second aspect, in a first possible implementation manner of the second aspect, the processing module is further configured to perform a data writing operation to the primary storage device and the secondary storage device again if the receiving module receives data of an incomplete write operation sent by the host within a preset time period.
With reference to the second aspect and the first possible implementation manner of the second aspect, in a second possible implementation manner of the second aspect, the dual write data request carries related information of data to be written, where the related information includes a position and a size of the data to be written;
the processing module is further configured to:
and respectively writing data to the main storage device and the auxiliary storage device according to the position and the size of the data to be written.
With reference to the second aspect and the second possible implementation manner of the second aspect, in a third possible implementation manner of the second aspect, the write data retry message carries information of data of an incomplete write operation;
the processing module is further configured to:
and acquiring the data successfully written last time in the main storage device according to the information of the data which is not written successfully, and covering the data successfully written last time in the auxiliary storage device with the data successfully written last time in the main storage device.
With reference to the second possible implementation manner of the second aspect, in a fourth possible implementation manner of the second aspect, the sending module is further configured to send a write data success instruction to the host if the receiving module receives write data success messages sent by the master storage device and the slave storage device, respectively, and the processing module is configured to delete the relevant information of the data to be written;
the processing module is further configured to interrupt a write data operation performed to the slave storage device if the receiving module receives a write data success message sent by the master storage device and receives a write data failure message sent by the slave storage device, and the sending module is configured to send a write data success instruction to the host.
With reference to the second or any one of the 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:
and if the receiving module receives the message of completing the rewriting operation sent by the main storage device in the preset time period, deleting the related information of the data to be written.
With reference to the second aspect or any one 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 data writing success message sent by the slave storage device, deleting the relevant information of the data to be written; otherwise, the operation of writing data to the master storage device and the slave storage device again is interrupted.
According to the method and the device for double-write data, the double-write data request sent by the host is received, and the data writing operation is respectively carried out on the main storage equipment corresponding to the main LUN and the auxiliary storage equipment corresponding to the auxiliary LUN; if the master storage system receives a write data retry message sent by the master storage device and receives a write data response message returned by the slave storage device, a write timeout message is sent to the host, so that the host sends data of incomplete write operation to the master storage system, and if the master storage system does not receive the data of incomplete write operation sent by the host within a preset time period, the last successful write data in the slave storage device is overwritten by the last successful write data in the master storage device. The data which are not written successfully in the last time in the main storage device are used for covering the data which are written successfully in the last time in the auxiliary storage device by determining that the main storage system does not receive the data which are not written successfully in the preset time period, so that the data consistency of the main storage device and the auxiliary storage device is ensured, the condition that the synchronization is ensured by frequently disconnecting the double-write data service is avoided, the risk of data loss is reduced, and the reliability of the storage system is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flowchart illustrating a first embodiment of a method for double-writing data according to the present invention;
FIG. 2 is a flowchart illustrating a second embodiment of a method for double-writing data according to the present invention;
FIG. 3 is a schematic diagram of a first apparatus for double-write data according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a memory device according to a first embodiment of the present invention.
Detailed Description
In order to make the objects, 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 with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The method for double-writing data provided by the embodiment of the invention can be suitable for scenes such as mirror images, disaster recovery systems, migration or data copying and the like added on a business storage space. Wherein mirroring is a type of redundancy that keeps data on a master storage device in an identical copy on a slave storage device. The disaster recovery system is characterized in that two or more sets of IT systems with the same function are established in different places far away from each other, normal state monitoring and function switching can be performed among the IT systems, and when a main end system stops working due to accidents (such as fire, earthquake and the like), the whole application system can be switched to a slave end, so that the functions of the system can continue to work normally. Migrating or copying data includes copying data in a master storage device to a slave storage device over a network or creating a backup of a file system, etc. Therefore, in scenes such as mirroring, disaster recovery systems, migrating or copying data and the like, how to improve the reliability of the storage system under the condition of ensuring that the data in the master storage device and the data in the slave storage device are consistent is a very important problem.
Fig. 1 is a flowchart illustrating a first embodiment of a method for double-writing data according to the present invention. The embodiment of the invention provides a method for double-writing data, which can be executed by any storage system, for example: the storage device, the virtualized head or the backup software, etc. may be implemented by software and/or hardware. As shown in fig. 1, the method of this embodiment may include:
step 101: and receiving a double-write data request sent by the host, and simultaneously respectively performing write data operation on the main storage device corresponding to the main LUN and the slave storage device corresponding to the slave LUN.
In this embodiment, after receiving a request for dual write data sent by a host, a primary storage system sends the request for dual write data to a primary storage device corresponding to a primary LUN and a secondary storage device corresponding to a secondary LUN at the same time, so that the primary storage system writes data to the primary storage device and the secondary storage device. The storage device may be, for example, a memory, a hard disk, or the like. The invention is not limited with respect to the particular type of storage device.
And 102, if a write data retry message sent by the primary storage device is received and a write data response message returned by the secondary storage device is received, sending a write timeout message to the host so that the host sends data of which the write operation is not finished to the primary storage system.
In this embodiment, after the master storage system performs the operation of writing data to the master storage device and the slave storage device each time, the master storage device and the slave storage device respectively return a response message to the master storage system, where the response message is used to indicate whether the data writing is successful this time. When the primary storage system receives a write data retry message returned by the primary storage device, the primary storage system waits for a response message returned by the secondary storage device, and at this time, the primary storage system sends a write timeout message to the host no matter whether the write data response message returned by the secondary storage device is write data success, write data failure or write data retry. After receiving the write timeout message, the host sends data of the uncompleted write operation to the primary storage system.
Step 103, if the data of the uncompleted write operation sent by the host is not received within the preset time period, overwriting the data successfully written last time in the slave storage device with the data successfully written last time in the master storage device.
In this embodiment, after the primary storage system sends a write timeout message to the host, a timer is started, and if the primary storage system does not receive data of an uncompleted write operation sent by the host within a preset time period, the last successful write data in the primary storage device is read, and the last successful write data in the secondary storage device is overwritten by the data. For example: after the preset time, the main storage system does not receive the data A of the uncompleted write operation sent by the host, and at the moment, the data successfully written last time in the main storage device is overwritten to the data successfully written last time in the auxiliary storage device, so that the data consistency between the main storage device and the auxiliary storage device is ensured, the frequent interruption of the double-write data operation can be avoided, and the pressure of the main storage system for reading and writing the data is reduced. For the slave storage device, if the data writing operation fails, the last successful data is the last successful data, and if the data writing operation succeeds, the last successful data is the current successful data.
In addition, the read-write time delay of the main storage system can be reduced by judging whether the main storage system receives the data which is sent by the host and does not finish the write operation in the preset time period. The value of the preset time period may be a suitable value according to experience or the size of the data volume, for example: when the main storage system has large read-write data volume, 1.5s is selected, and when the main storage system has small read-write data volume, 1s is selected. The embodiment is not particularly limited herein with respect to the selection of the specific value of the preset time period.
The method for double-write data provided by the invention comprises the steps of receiving a double-write data request sent by a host, and simultaneously respectively performing data writing operation on a main storage device corresponding to a main LUN and a slave storage device corresponding to a slave LUN; if the master storage system receives a write data retry message sent by the master storage device and receives a write data response message returned by the slave storage device, a write timeout message is sent to the host, so that the host sends data of incomplete write operation to the master storage system, and if the master storage system does not receive the data of incomplete write operation sent by the host within a preset time period, the last successful write data in the slave storage device is overwritten by the last successful write data in the master storage device. The data which are not written successfully in the last time in the main storage device are used for covering the data which are written successfully in the last time in the auxiliary storage device by determining that the main storage system does not receive the data which are not written successfully in the preset time period, so that the data consistency of the main storage device and the auxiliary storage device is ensured, the condition that the synchronization is ensured by frequently disconnecting the double-write data service is avoided, the risk of data loss is reduced, and the reliability of the storage system is improved.
On the basis of the above method embodiment, if the primary storage system receives the data of the uncompleted write operation sent by the host within the preset time period, the data which needs to be rewritten in the primary storage device will be rewritten into the primary storage device and the secondary storage device. For example: the master storage system writes data A to the master storage device and the slave storage device simultaneously, and if a message that write data A sent from the master storage device succeeds or a message that write data A fails is received once a message that write data A sent from the master storage device retries is received, the data in the master storage device and the data in the slave storage device are considered to be inconsistent, and at this time, the data A is written into the master storage device and the slave storage device again.
On the basis of the embodiment of the method, the double-write data request carries the relevant information of the data to be written, wherein the relevant information comprises the position and the size of the data to be written, so that the main storage system can respectively write data to the main storage device and the auxiliary storage device according to the position and the size of the data to be written.
On the basis of the embodiment of the method, the data writing retry message carries the information of the data which does not complete the writing operation, so that the main storage system can determine the data which needs to be rewritten according to the relevant information of the data which does not complete the writing operation and is carried in the data writing retry message returned by the main storage device, and mark the data which needs to be rewritten. In addition, after receiving the write timeout message, the host sends data of the incomplete write operation to the primary storage system, optionally, when the primary storage system receives the data of the incomplete write operation sent by the host within a preset time period, the primary storage system deletes the mark made to the rewritten data, and at the same time, the data of the incomplete write operation is rewritten into the primary storage device and the secondary storage device according to the data of the incomplete write operation sent by the host; when the primary storage system does not receive the data of the incomplete write operation sent by the host within the preset time period, the primary storage system may obtain the data of the last successful write in the primary storage device according to the marked data, and use the data to overwrite the data of the last successful write in the secondary storage device, where the marked data includes the position and size of the data of the incomplete write operation.
Fig. 2 is a flowchart illustrating a second embodiment of a method for double-writing data according to the present invention. In this embodiment, on the basis of the first embodiment of the method for double write data, a detailed description is given to an embodiment in which a write data success message sent by the main storage device is received. As shown in fig. 2, the method of this embodiment may include:
step 201: and receiving a double-write data request sent by the host, and simultaneously respectively performing write data operation on the main storage device corresponding to the main LUN and the slave storage device corresponding to the slave LUN.
In this embodiment, the location and size of the data to be written are carried in the dual write data request, so that the master storage system knows which data are written in the master storage device and the slave storage device, and performs a data writing operation to the master storage device and the slave storage device according to the location and size of the data to be written.
Step 202, determining whether to receive a write data retry message sent by the primary storage device.
If yes, go to step 203 and then go to step 208, otherwise go to step 204.
Step 203, receiving a write data response message returned from the storage device, and sending a write timeout message to the host, so that the host sends data of the incomplete write operation to the primary storage system.
In this embodiment, if the primary storage system receives a write data retry message sent by the primary storage device, it waits for a write data response message to be returned from the secondary storage device, and after the write data response message returned from the secondary storage device is received, according to information of data of an uncompleted write operation carried in the write data retry message, marks data that needs to be rewritten, and simultaneously starts a retry timer to determine whether the primary storage system can receive the data of the uncompleted write operation sent by the host within a preset time period.
Step 204, determining to receive a write data success message sent by the primary storage device.
Step 205, determine whether to receive the write data success message sent from the storage device.
If so, go to step 206, otherwise, go to step 207.
Step 206, sending a data writing success command to the host, and deleting the related information of the data to be written.
In this embodiment, after receiving the write data success messages sent by the master storage device and the slave storage device, the master storage system returns a write data success instruction to the host, and deletes the position and size of the data to be written to perform the next double write operation of the data.
Step 207, the write data operation to the slave storage device is interrupted, and a write data success command is sent to the host.
In this embodiment, when the master storage system receives a write data success message sent by the master storage device and a write data failure message sent by the slave storage device, the data of the slave storage device is unavailable at this time, so that the operation of continuing writing data to the slave storage device is interrupted, and an instruction of success in writing data is returned to the host, and the position and size of the data which failed in writing in the slave storage device are recorded.
And step 208, judging whether the data of the uncompleted write operation sent by the host is received within a preset time period.
In this embodiment, it is determined whether the primary storage system receives the data of the uncompleted write operation sent by the host within the preset time period by starting a timer, if so, step 209 is executed, otherwise, step 211 is executed.
Step 209 is to re-write data to the master and slave storage devices.
In this embodiment, if the primary storage system receives data of an uncompleted write operation sent by the host within a preset time period, the data of the uncompleted write operation is rewritten into the primary storage device and the secondary storage device.
Step 210, if the message of completing the rewrite operation sent by the main storage device is received within the preset time period, deleting the related information of the data to be written.
In this embodiment, if the master storage device completes the rewrite operation within a preset time period, the data of the master storage device and the slave storage device are the same, and at this time, the set timer and the recorded related information such as the position and size of the data to be written are deleted to perform the double write operation of the next data.
And step 211, overwriting the data which is successfully written last time in the slave storage device with the data which is successfully written last time in the master storage device.
In this embodiment, if the primary storage system does not receive the data of the uncompleted write operation sent by the host within the preset time period, the data successfully written last time in the primary storage device is acquired according to the mark made on the data to be rewritten, and the data successfully written last time in the secondary storage device is covered by the data, so that, after the data written by the primary storage device is overtime, the data consistency of the data in the primary storage device and the data in the secondary storage device can be automatically repaired, thereby avoiding manual intervention and improving the self-healing performance of the system.
It should be noted that, if the primary storage system receives a write data failure message sent by the primary storage device, the primary storage system saves the relevant information of the data to be written, and simultaneously returns a write data failure instruction to the host.
The method for double-write data provided by the invention comprises the steps of receiving a double-write data request sent by a host, and simultaneously respectively performing data writing operation on a main storage device corresponding to a main LUN and a slave storage device corresponding to a slave LUN; if the master storage system receives a write data retry message sent by the master storage device and receives a write data response message returned by the slave storage device, a write timeout message is sent to the host, so that the host sends data of incomplete write operation to the master storage system, and if the master storage system does not receive the data of incomplete write operation sent by the host within a preset time period, the last successful write data in the slave storage device is overwritten by the last successful write data in the master storage device. The data which are not written successfully in the last time in the main storage device are used for covering the data which are written successfully in the last time in the auxiliary storage device by determining that the main storage system does not receive the data which are not written successfully in the preset time period, so that the data consistency of the main storage device and the auxiliary storage device is ensured, the condition that the synchronization is ensured by frequently disconnecting the double-write data service is avoided, the risk of data loss is reduced, and the reliability of the storage system is improved.
Optionally, on the basis of the above method embodiment, after the data successfully written last time in the master storage device is used to cover the data successfully written last time in the slave storage device, if a data writing success message sent by the slave storage device is received, deleting the related information of the data to be written; otherwise, the operation of writing data to the main storage device and the auxiliary storage device is carried out again.
Specifically, after the last successful write data in the master storage device is used to cover the last successful write data in the slave storage device, the slave storage device returns the result of the write data, and if the write data in the slave storage device is successful, a write data retry message is returned to the master storage system, and meanwhile, the recorded information related to the position, size and the like of the data to be written is deleted; if the slave storage device returns a data writing failure message, reporting copy data error information to the master storage system, and interrupting the operation of writing data to the master storage device and the slave storage device again, namely interrupting the copy relationship between the master storage device and the slave storage device, simultaneously recording the difference of the written data, and sending the result of the written data of the master storage system to the host. In a specific implementation process, the last successful write data in the master storage device can be overwritten to the last successful write data in the slave storage device in a manual synchronization starting mode, so that the consistency of the data in the master storage device and the data in the slave storage device is ensured.
Fig. 3 is a schematic structural diagram of a first apparatus for double-write data according to the present invention, and as shown in fig. 3, the apparatus for double-write data according to the present invention includes a receiving module 301, a processing module 302, and a sending module 303.
The receiving module 301 is configured to receive a dual write data request sent by a host; the processing module 302 is configured to perform data writing operations on a master storage device corresponding to the master logical unit number LUN and a slave storage device corresponding to the slave LUN at the same time; the sending module 303 is configured to send a write timeout message to the host after the receiving module receives the write data retry message sent by the primary storage device and receives the write data response message returned by the secondary storage device, so that the host sends data with incomplete write operations to the primary storage system; the processing module 302 is further configured to overwrite the last successful write data in the secondary storage device with the last successful write data in the primary storage device if the receiving module does not receive the data of the uncompleted write operation sent by the host within a preset time period.
The device for double-write data provided by the invention receives the double-write data request sent by the host, and simultaneously respectively performs data writing operation to the main storage equipment corresponding to the main LUN and the auxiliary storage equipment corresponding to the auxiliary LUN; if the master storage system receives a write data retry message sent by the master storage device and receives a write data response message returned by the slave storage device, a write timeout message is sent to the host, so that the host sends data of incomplete write operation to the master storage system, and if the master storage system does not receive the data of incomplete write operation sent by the host within a preset time period, the last successful write data in the slave storage device is overwritten by the last successful write data in the master storage device. The data which are not written successfully in the last time in the main storage device are used for covering the data which are written successfully in the last time in the auxiliary storage device by determining that the main storage system does not receive the data which are not written successfully in the preset time period, so that the data consistency of the main storage device and the auxiliary storage device is ensured, the condition that the synchronization is ensured by frequently disconnecting the double-write data service is avoided, the risk of data loss is reduced, and the reliability of the storage system is improved.
Optionally, the processing module 302 is further configured to perform a data writing operation to the primary storage device and the secondary storage device again if the receiving module receives data of an incomplete write operation sent by the host within a preset time period.
Optionally, the double-write data request carries related information of data to be written, where the related information includes a position and a size of the data to be written;
the processing module 302 is further configured to:
and respectively writing data to the main storage device and the auxiliary storage device according to the position and the size of the data to be written.
Optionally, the write data retry message carries information of data of an incomplete write operation;
the processing module 302 is further configured to:
and acquiring the data successfully written last time in the main storage device according to the information of the data which is not written successfully, and covering the data successfully written last time in the auxiliary storage device with the data successfully written last time in the main storage device.
Optionally, the sending module 303 is further configured to send a write data success instruction to the host if the receiving module 301 receives write data success messages sent by the primary storage device and the secondary storage device, respectively, and the processing module 302 is configured to delete the relevant information of the data to be written;
the processing module 302 is further configured to interrupt a write data operation performed to the slave storage device if the receiving module 301 receives a write data success message sent by the master storage device and receives a write data failure message sent by the slave storage device, and the sending module 303 is configured to send a write data success instruction to the host.
Optionally, the processing module 302 is further configured to:
if the receiving module 301 receives the message of completing the rewrite operation sent by the main storage device within the preset time period, the relevant information of the data to be written is deleted.
Optionally, the processing module 302 is further configured to:
if the receiving module 301 receives the data writing success message sent from the storage device, deleting the related information of the data to be written; otherwise, the operation of writing data to the slave storage device is interrupted.
The apparatus for double data writing in this embodiment may be used to implement the technical solution of the method for double data writing provided in any embodiment of the present invention, and the implementation principle and the technical effect are similar, and are not described herein again.
Fig. 4 is a schematic structural diagram of a first embodiment of a storage device according to the present invention, and as shown in fig. 4, the storage device provided in this embodiment includes a receiver 10, a processor 11, and a transmitter 12.
The receiver 10 is configured to receive a dual write data request sent by a host, and the processor 11 is configured to simultaneously perform a write data operation to a master storage device corresponding to a master logical unit number LUN and a slave storage device corresponding to a slave LUN, respectively; the sender 12 is configured to send a write timeout message to the host if the receiver 10 receives a write data retry message sent by the primary storage device and receives a write data response message returned by the secondary storage device, so that the host sends data with an uncompleted write operation to the primary storage system; the processor 11 is further configured to overwrite the last successful write data in the secondary storage device with the last successful write data in the primary storage device if the receiver 10 does not receive the data of the uncompleted write operation sent by the host within a preset time period.
The storage device provided by the embodiment of the present invention may implement the technical solution of the above method for double-writing data, and the implementation principle and technical effect are similar, which are not described herein again.
In this embodiment of the present invention, the processor 11 is further configured to perform a data writing operation to the master storage device and the slave storage device again if the receiver 10 receives data of an uncompleted write operation sent by the host within a preset time period.
In the embodiment of the present invention, the double write data request carries related information of data to be written, where the related information includes a position and a size of the data to be written; the processor 11 is further configured to perform a data writing operation to the master storage device and the slave storage device according to the position and size of the data to be written.
In the embodiment of the present invention, the write data retry message carries information of data of which the write operation is not completed; the processor 11 is further configured to obtain data successfully written last time in the main storage device according to the information of the data of the incomplete write operation, and overwrite the data successfully written last time in the slave storage device with the data successfully written last time in the main storage device.
In this embodiment of the present invention, the transmitter 12 is further configured to send a write data success instruction to the host if the receiver 10 receives write data success messages sent by the master storage device and the slave storage device, respectively, and the processor 11 is configured to delete the relevant information of the data to be written; the processor 11 is further configured to interrupt a write data operation to the slave storage device if the receiver 10 receives a write data success message sent by the master storage device and receives a write data failure message sent by the slave storage device, and the transmitter 12 is configured to send a write data success instruction to the host.
In this embodiment of the present invention, the processor 11 is configured to delete the information related to the data to be written if the receiver 10 receives a message of completing the rewrite operation sent by the main storage device within the preset time period.
In this 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; otherwise, the operation of writing data to the master storage device and the slave storage device again is interrupted.
The storage device provided by the embodiment of the present invention may implement the technical solution of the above method for double-writing data, and the implementation principle and technical effect are similar, which are not described herein again.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.
Claims (14)
1. A method of dual write data, comprising:
receiving a double-write data request sent by a host, and simultaneously respectively performing write data operation on a main storage device corresponding to a main Logic Unit Number (LUN) and a slave storage device corresponding to a slave LUN;
if receiving a write data retry message sent by the primary storage device and after receiving a write data response message returned by the secondary storage device, sending a write timeout message to the host, so that the host sends data with uncompleted write operation to the primary storage system;
and if the data of the uncompleted write operation sent by the host computer is not received within a preset time period, overwriting the data successfully written last time in the slave storage equipment by using the data successfully written last time in the master storage equipment.
2. The method of claim 1, further comprising:
and if the data of the uncompleted write operation sent by the host is received within a preset time period, the data writing operation is carried out to the main storage device and the auxiliary storage device again.
3. The method according to claim 1 or 2, wherein the double write data request carries related information of data to be written, and the related information includes a position and a size of the data to be written;
the simultaneously performing data writing operation on the main storage device corresponding to the main logical unit number LUN and the slave storage device corresponding to the slave LUN respectively specifically includes:
and respectively writing data to the main storage device and the auxiliary storage device according to the position and the size of the data to be written.
4. The method of claim 1 or 3, wherein the write data retry message carries information of data of incomplete write operation;
the overwriting the last successful write data in the secondary storage device with the last successful write data in the primary storage device specifically includes:
and acquiring the data successfully written last time in the main storage device according to the information of the data which is not written successfully, and covering the data successfully written last time in the auxiliary storage device with the data successfully written last time in the main storage device.
5. The method according to claim 3, wherein after the simultaneously performing the data writing operation to the master storage device corresponding to the master logical unit number LUN and the slave storage device corresponding to the slave LUN, respectively, further comprises:
if the write data success messages sent by the main storage device and the auxiliary storage device are received respectively, sending a write data success command to the host, and deleting the related information of the data to be written; or,
and if the write data success message sent by the main storage device is received and the write data failure message sent by the auxiliary storage device is received, interrupting the write data operation to the auxiliary storage device and sending a write data success command to the host.
6. The method according to claim 3 or 5, wherein after the operation of writing data to the master storage device and the slave storage device again, the method further comprises:
and if the message of completing the rewriting operation sent by the main storage device is received in the preset time period, deleting the related information of the data to be written.
7. The method according to claim 3, 5 or 6, wherein overwriting the last successful write data in the slave storage device with the last successful write data in the master storage device further comprises:
if the data writing success message sent by the slave storage equipment is received, deleting the related information of the data to be written;
otherwise, the operation of writing data to the master storage device and the slave storage device again is interrupted.
8. An apparatus for dual write data, comprising:
the receiving module is used for receiving a double-write data request sent by a host;
the processing module is used for respectively writing data into the main storage device corresponding to the main logic unit number LUN and the auxiliary storage device corresponding to the auxiliary LUN;
a sending module, configured to send a write timeout message to the host after the receiving module receives a write data retry message sent by the primary storage device and receives a write data response message returned by the secondary storage device, so that the host sends data with incomplete write operations to the primary storage system;
the processing module is further configured to, if the receiving module does not receive the data of the uncompleted write operation sent by the host within a preset time period, overwrite the data successfully written last time in the secondary storage device with the data successfully written last time in the primary storage device.
9. The apparatus of claim 8,
the processing module is further configured to perform a data writing operation to the primary storage device and the secondary storage device again if the receiving module receives the data of the uncompleted write operation sent by the host within a preset time period.
10. The apparatus according to claim 8 or 9, wherein the dual write data request carries related information of data to be written, and the related information includes a position and a size of the data to be written;
the processing module is further configured to:
and respectively writing data to the main storage device and the auxiliary storage device according to the position and the size of the data to be written.
11. The apparatus of claim 8 or 10, wherein the write data retry message carries information of data of an incomplete write operation;
the processing module is further configured to:
and acquiring the data successfully written last time in the main storage device according to the information of the data which is not written successfully, and covering the data successfully written last time in the auxiliary storage device with the data successfully written last time in the main storage device.
12. The apparatus according to claim 10, wherein the sending module is further configured to send a write data success instruction to the host if the receiving module receives write data success messages sent by the master storage device and the slave storage device, respectively, and the processing module is configured to delete the information related to the data to be written;
the processing module is further configured to interrupt a write data operation performed to the slave storage device if the receiving module receives a write data success message sent by the master storage device and receives a write data failure message sent by the slave storage device, and the sending module is configured to send a write data success instruction to the host.
13. The apparatus of claim 10 or 12, wherein the processing module is further configured to:
and if the receiving module receives the message of completing the rewriting operation sent by the main storage device in the preset time period, deleting the related information of the data to be written.
14. The apparatus of claim 10, 12 or 13, wherein the processing module is further configured to:
if the receiving module receives the data writing success message sent by the slave storage device, deleting the relevant information of the data to be written; otherwise, the operation of writing data to the master storage device and the slave storage device again is interrupted.
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 | |
US10108367B2 (en) | Method for a source storage device sending data to a backup storage device for storage, and storage device | |
CN103814360B (en) | Data copy method and storage system | |
US8285679B2 (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 | |
US7684073B2 (en) | Copy controller and method thereof | |
US9998537B1 (en) | Host-side tracking of data block changes for incremental backup | |
JP2008225616A (en) | Storage system, remote copy system and data restoration method | |
CN104166605A (en) | Data backup method and system based on incremental data files | |
US8533411B2 (en) | Multiple backup processes | |
JP6281511B2 (en) | BACKUP CONTROL DEVICE, BACKUP CONTROL METHOD, AND PROGRAM | |
JP2004272854A (en) | Storage system and snapshot management method therein | |
CN104133742A (en) | Data protection method and device | |
US20150169220A1 (en) | Storage control device and storage control method | |
CN109165117B (en) | Data processing method and system | |
JP3937878B2 (en) | Magnetic tape device, control method thereof, and program for controlling magnetic tape device | |
JP5644795B2 (en) | Storage device, data recovery method and program | |
CN109828950A (en) | Data protection method, management system, server and readable storage medium | |
JP2019185661A (en) | Storage device and control program | |
CN110990191B (en) | Data recovery method and system based on mirror image storage | |
US10209926B2 (en) | Storage system and control method therefor | |
CN112162699A (en) | Data reading and writing method, device and equipment and computer readable storage medium | |
JP7358809B2 (en) | Storage control device, storage control program and storage system | |
JP5290938B2 (en) | Copy control apparatus and method | |
CN118708130A (en) | Remote replication method and device for data volume, computer equipment and storage medium | |
JP2009129283A (en) | Data storage device, data backup method and data backup program |
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 |