WO2014079028A1 - 数据处理方法和存储设备 - Google Patents

数据处理方法和存储设备 Download PDF

Info

Publication number
WO2014079028A1
WO2014079028A1 PCT/CN2012/085107 CN2012085107W WO2014079028A1 WO 2014079028 A1 WO2014079028 A1 WO 2014079028A1 CN 2012085107 W CN2012085107 W CN 2012085107W WO 2014079028 A1 WO2014079028 A1 WO 2014079028A1
Authority
WO
WIPO (PCT)
Prior art keywords
snapshot
data
time point
log
preset
Prior art date
Application number
PCT/CN2012/085107
Other languages
English (en)
French (fr)
Inventor
母子安
李毅
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN2012800029371A priority Critical patent/CN103221925A/zh
Priority to PCT/CN2012/085107 priority patent/WO2014079028A1/zh
Publication of WO2014079028A1 publication Critical patent/WO2014079028A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1471Saving, restoring, recovering or retrying involving logging of persistent data for recovery
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/84Using snapshots, i.e. a logical point-in-time copy of the data

Definitions

  • the present invention relates to storage technologies, and in particular, to a data processing method and a storage device.
  • Data backup is the basis of disaster recovery. It refers to the process of copying all or part of the data set from the hard disk or array of the application host to other storage media in order to prevent data loss caused by operating errors or system failures.
  • snapshots are usually used to implement data backup.
  • a snapshot is a fully available copy of a specified data set that includes an image of the corresponding data at a point in time (the point in time when the copy begins).
  • a snapshot can be a copy of the data it represents, or it can be a replica of the data.
  • Embodiments of the present invention provide a data processing method and a storage device, which are capable of recovering data at any time.
  • an embodiment of the present invention provides a data processing method, including:
  • the write operation log includes a time point of receiving at least one write data operation, data to be written, and a logical block address LBA;
  • the data block corresponding to the LBA in the write operation log is snapshot processed to obtain snapshot data, and the snapshot log is recorded in the log table, where the snapshot includes the pre- Set the snapshot time point; Obtaining the snapshot data and the write operation log after the snapshot time point according to the snapshot time point to perform data recovery.
  • the pair of the write operation logs
  • the data block corresponding to the LBA is snapshot processed to obtain snapshot data, including:
  • the method further includes:
  • the method further includes:
  • the write data operation is suspended, and the data to be written is written into the non-volatile storage medium of the storage device.
  • the acquiring the snapshot data and the write operation log after the snapshot time point according to the snapshot time point to perform data recovery includes: determining according to a specified time point The last snapshot time point before the specified time point, when the last snapshot time point is the preset snapshot time point, the snapshot data corresponding to the preset snapshot time point is obtained;
  • an embodiment of the present invention provides a storage device, including:
  • a write operation log module configured to record a write operation log in the log table, the write operation log package The time point of the received at least one write data operation, the data to be written, and the logical block address LBA;
  • the snapshot processing module configured to: when the preset snapshot time point arrives, the data corresponding to the LBA in the write operation log Snapshot processing is performed to obtain snapshot data, and a snapshot log is recorded in the log table, where the snapshot log includes the preset snapshot time point;
  • a recovery module configured to acquire the snapshot data and the write operation log after the snapshot time point according to the snapshot time point to perform data recovery.
  • the snapshot processing module includes: a marking unit, configured to perform a snapshot processing of the data block corresponding to the LBA, to represent a data block corresponding to the LBA Do snapshot processing;
  • a saving unit configured to save, according to the mark processed by the snapshot, data in a data block corresponding to an LBA of each write operation log in the write operation log to a snapshot area;
  • a recording unit configured to record a snapshot log in the log table, where the snapshot log includes the preset snapshot time point.
  • the second possible implementation of the second aspect further includes: a log saving module, configured to save the log table to a storage device for data recovery.
  • the third possible implementation manner of the second aspect further includes: a suspension module, configured to suspend a write data operation when a preset snapshot time point arrives, and The data to be written is written into a non-volatile storage medium of the storage device.
  • a suspension module configured to suspend a write data operation when a preset snapshot time point arrives, and The data to be written is written into a non-volatile storage medium of the storage device.
  • the recovery module includes: a snapshot data acquiring unit, configured to determine, according to the specified time point, a last snapshot time point before the specified time point, when the last time When the snapshot time point is the preset snapshot time point, the snapshot data corresponding to the preset snapshot time point is obtained;
  • a write operation log obtaining unit configured to acquire a write operation log after the preset snapshot time point
  • an embodiment of the present invention provides a storage device, including: a processor, a communication interface, and a communication bus;
  • the processor and the communication interface communicate through the communication bus; the processor is configured to record a write operation log in a log table, where the write operation log includes a time of receiving at least one write data operation Point, the data to be written, and the logical block address LBA; when the preset snapshot time point arrives, snapshot the data block corresponding to the LBA in the write operation log to obtain snapshot data, and record in the log table
  • the snapshot log includes the preset snapshot time point. The snapshot data and the write operation log after the snapshot time point are acquired according to the snapshot time point to perform data recovery.
  • the processor is configured to perform snapshot processing on the data block corresponding to the LBA in the write operation log to obtain snapshot data, where the processor is configured to correspond to the LBA.
  • the data block is marked by the snapshot processing to indicate that the data block corresponding to the LBA needs to be subjected to a snapshot process; according to the mark processed by the snapshot, the data block corresponding to the LBA of each write operation log in the write operation log is The data is saved to the snapshot area.
  • the processor is further configured to save the log table to a storage device for data recovery.
  • the processor is further configured to: when the preset snapshot time point arrives, suspend the write data operation, and The data to be written is written into a non-volatile storage medium of the storage device.
  • the processor is configured to acquire, according to the snapshot time point, the snapshot data and a write operation log after the snapshot time point, to perform data recovery, including: The processor is configured to determine, according to the specified time point, a last snapshot time point before the specified time point, when the last snapshot time point is the preset snapshot time At the time of the point, the snapshot data corresponding to the preset snapshot time point is obtained; the write operation log after the preset snapshot time point is obtained; the write operation log after the preset snapshot time point, and the The snapshot data corresponding to the preset snapshot time point recovers the data at the specified time point.
  • an embodiment of the present invention provides a storage device, including:
  • the host is configured to send a write data operation to the storage device.
  • the storage system further includes a connection device
  • the connecting device is configured to connect the host and the storage device
  • the host configured to send a write data operation to the storage device, includes: the host, configured to send a write data operation to the storage device by using the connection device.
  • each write data operation since each write data operation is intercepted, the data to be written carried in each write data operation is formed into a log record, so that the snapshot time point can be restored directly through the snapshot log.
  • the data can be recovered at any point in time through the log table.
  • FIG. 1 is a schematic diagram of an application network architecture of a data processing method according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a data processing method according to an embodiment of the present invention
  • FIG. 3 is a flowchart of still another data processing method according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of a storage device according to an embodiment of the present disclosure.
  • FIG. 5 is a schematic structural diagram of still another storage device according to an embodiment of the present invention. detailed description
  • FIG. 1 is a schematic structural diagram of a system for processing a data according to an embodiment of the present invention.
  • the storage system includes a host, a storage device, and a connection device.
  • the host can include any computing device known in the art, such as servers, desktop computers, and the like. Inside the host, an operating system and other applications are installed.
  • the storage device may include a storage device with snapshot function known in the prior art, such as Redundant Arrays of Independent Disks (RAID), Just a Bunch Of Disks (JBOD), direct access.
  • RAID Redundant Arrays of Independent Disks
  • JBOD Just a Bunch Of Disks
  • DASD Direct Access Storage Device
  • connection device can include any interface between the storage device known to the prior art and the host, such as a fiber switch, or other existing switch.
  • FIG. 2 is a flowchart of a data processing method according to an embodiment of the present invention.
  • this embodiment provides a data processing method, which is performed from the perspective of a storage device. Description, can be used to back up the data to be written in the write data operation, in order to restore the data to any point in time in the future.
  • the method can include the following steps:
  • Step 202 Record a write operation log in the log table, where the write operation log includes at least one time point of the received write data operation, the data to be written, and a logical block address (LBA);
  • LBA logical block address
  • the storage device receives the write data operation sent by the host, and requests the data to be Write to the storage device, the write data operation includes data to be written, and an LBA.
  • the LBA is the logical address of the storage device to be written to which data is to be written.
  • the LBA Before the host sends a write data operation to the storage device, the LBA usually stores data. After receiving the write data operation, the data to be written carried in the write data operation overwrites the original stored data in the LBA, if not in the LBA. The original stored data is processed otherwise, and the data is lost and cannot be recovered.
  • the storage device may include a write operation log module.
  • the write operation log module may obtain the data to be written and the LBA by intercepting the write data operation to form a write.
  • the operation log is recorded in the log table, and the log table can be stored in the storage device.
  • the write operation log also includes the point in time at which the write data operation is received.
  • each write operation log record in the log table can contain three fields, one of which is the point in time when the write data operation is received, the other is the data to be written, and one field is the LBA.
  • step 202 When the next write data operation is received, the action of step 202 is repeatedly performed.
  • Step 203 When a preset snapshot time point arrives, perform snapshot processing on the data block corresponding to the LBA in the write operation log to obtain snapshot data, and record a snapshot log in the log table, where the snapshot log includes The preset snapshot time point.
  • the storage device has a snapshot function
  • the so-called snapshot refers to a technology that is implemented on the operating system and the storage technology to record the state of the system at a certain time.
  • the snapshot time point can be preset according to the user's needs. For example, set the snapshot time point to 9:00, 9:10, 9:20, etc., or set the snapshot interval to 10s or 20s or 30s, etc.
  • a snapshot log needs to be added to the log table of step 202.
  • the snapshot log may include a field, that is, a preset snapshot time point, or may include two Field, one of the fields is the preset snapshot time point, and the other field is the identifier of the snapshot processing.
  • the identifier of the snapshot processing is used to identify the snapshot log in the log table, and distinguish the snapshot log from the write operation log.
  • LBA Logical Unit Number, LUN
  • LUN Logical Unit Number
  • the LU is a logical storage area.
  • the physical disk itself contained in the storage device is not directly presented to the operating system. Instead, the storage space provided by each physical disk is mapped into a piece of logic.
  • the zone ie LU
  • the LBA carried in the write data operation refers to the address of the LUN to be written to which the data is to be written. Since LUs are mapped from physical disks, and the smallest unit of storage for physical disks is data blocks, LBAs also have data blocks on their corresponding physical disks.
  • a LUN may be divided into a snapshot area on the storage device to save snapshot data of each preset snapshot time point.
  • the data in the data block corresponding to the LBA can be saved to the snapshot area.
  • the purpose of the snapshot is to recover the snapshot data saved in the snapshot area if it is necessary to restore the original data in the data block at some time in the future.
  • snapshot processing and the addition of the snapshot log in the log table are not sequential and can be performed simultaneously.
  • the snapshot process may be performed first, and then the snapshot record is recorded in the log table to ensure that the write operation log recorded in the log table completely includes the write operation log at all time points before the snapshot is created.
  • Step 204 Acquire the snapshot data and the write operation log after the snapshot time point according to the snapshot time point to perform data recovery.
  • step 202, step 203, and step 204 are repeatedly performed multiple times, and a log table is saved every time the preset snapshot time point arrives, and the log table includes two preset snapshot time points.
  • the snapshot data corresponding to the last snapshot time point is obtained, and the write operation log after the last snapshot time point is obtained, and then the snapshot data corresponding to the last snapshot time point and the write after the last snapshot time point are obtained.
  • the operation log restores data at a specified point in time.
  • the snapshot data corresponding to the last snapshot time point is obtained, that is, the snapshot data corresponding to the preset snapshot time point in step 203 is obtained.
  • step 203 of the foregoing embodiment, performing snapshot processing on the data block corresponding to the LBA to obtain snapshot data may specifically include the following steps:
  • Step 2031 Perform a snapshot processing on the data block corresponding to the LBA, so that the data block corresponding to the LBA needs to be snapshot processed.
  • the data block corresponding to the LBA may be snapshot marked, or the data block may be labeled with a snapshot label, which may be known in the prior art. Any way of marking.
  • the snapshot tag is used for the entire LU.
  • only the data block corresponding to the LBA is needed, so that it can be understood as a tag for performing snapshot processing on the data block corresponding to the LBA.
  • the snapshot processing flag and the snapshot log in step 203 include the snapshot processing identifier.
  • the snapshot processing identifier is mainly used to mark a snapshot first when the data is not synchronously written. , indicating that the data block needs to perform snapshot processing when receiving the next write data operation, and the identifier of the snapshot processing in step 203 is a field in the snapshot log, which is used to distinguish the write operation log in the log table.
  • Step 2032 Save the data in the data block corresponding to the LBA of each write operation in the write operation log to the snapshot area according to the mark processed by the snapshot;
  • the write data operation includes the data to be written and the LBA. If the system recognizes that the data block corresponding to the LBA includes the snapshot mark, the data of the data block corresponding to the LBA is first backed up to The snapshot area is written into the LBA by the data to be written carried in the write data operation.
  • the method may further include:
  • Step 205 Save the log table to the storage device for data recovery.
  • the log table is usually stored in a cache of the storage device, and the record in the log table is saved to the storage device, and the log table may be saved to a non-volatile storage medium in the storage device. And clear the records in the cache table of the log table to save cache resources.
  • each log table is separately saved to the storage device at intervals of each preset snapshot time point, and then the data change record in each log table includes only two presets. The data change record between snapshot time points, so the log table is relatively small and does not take up too much storage space.
  • the steps are not in the order of the snapshot processing. You can save the log table to the storage device and then perform snapshot processing. You can also save the log table to the storage device first, or you can save the log table to the storage device. carried out. In a preferred embodiment of the present invention, the log table may be saved to a storage device and then snapshot processed to prevent the log table from being lost after the system is powered off.
  • the data to be written carried in each write data operation is formed into a log record, so that the data at the snapshot time point can be restored directly through the snapshot log.
  • the log records are saved to the storage device at intervals of preset snapshot time points, and the log records originally saved in the cache are cleared, thereby avoiding loss of the log table during power failure. , also saves cache resources.
  • the method may further include:
  • Step 206 When the preset snapshot time point arrives, suspend the write data operation instruction received at this time, and write the to-be-written data into the non-volatile storage medium of the storage device;
  • the system Normally, after the host sends a write data operation to the storage device, the system temporarily stores the information about the write data operation in the cache, and then writes the data to be written from the cache according to the LBA carried in the write data operation.
  • the non-volatile storage medium of the storage device such as a hard disk
  • the data to be written in the cache is emptied. Therefore, you need to ensure that the data in the cache is consistent with the data on the hard disk.
  • the write data operation received at this time may be suspended, and the data in the cache at this time is first written into the non-volatile storage medium of the storage device.
  • the operation of suspending the write data refers to temporarily not performing the write data operation received at this time, so that when the system writes the data in the cache to the hard disk, or when recording the snapshot log. , or when a snapshot operation is performed, no new data is written, resulting in inconsistency between the data stored in the cache and the data on the hard disk.
  • the snapshot processing is complete and the snapshot log has been added to the log table, you can stop the suspension.
  • the write data operation instruction received at this time is suspended, and the data in the cache is written into the non-volatile storage medium of the storage device, so that the data is guaranteed.
  • the data is consistent.
  • the write operation log module is included in the storage device, and the storage device intercepts the write data operation sent by the host to obtain the data to be written and the LBA carried in the write data operation to form a write operation.
  • the log is recorded in the log table;
  • the write operation log module may be included in the host.
  • the host may intercept the write data operation to obtain the read data operation.
  • Write data and LBA form a write operation log recorded in the log table.
  • the write operation log module may be included in a connection device, such as a switch.
  • a connection device such as a switch.
  • the switch may pass The write operation log module intercepts the write data operation to obtain data to be written and the LBA, and forms a write operation log record in the log table.
  • the log table may be stored in the storage device
  • the directory when the write operation log module is included on the host side, the directory may be stored in the host, and other storage devices connected to the host;
  • the log table when the write operation log module is included in the switch, can be stored in a hard disk and other storage devices connected to the switch.
  • the storage table is saved to the storage device, and the storage table can be saved to the non-volatile storage medium of the storage device, and the record of the log table in the cache is cleared to save the cache resource.
  • saving the log table to the storage device may save the log table to the storage device and clear the record of the log table in the host to save host resources.
  • step 204 may specifically include the following steps, as shown in FIG. 3: Step 2041: Determine a last snapshot time point before the specified time point according to a specified time point, when the last snapshot time point is Obtaining snapshot data corresponding to the preset snapshot time point when the preset snapshot time point is obtained;
  • the specified time point here can be an arbitrary time point, that is, the log table shown in the above embodiment can recover the data of the user-specified arbitrary time point.
  • the last snapshot time point before the specified time point may be determined according to the specified time point, and the snapshot data corresponding to the last snapshot time point may be obtained;
  • the storage device can preset the snapshot time point, for example, set the time point of the snapshot to 9:00, 9:10, 9:20, etc., or set the snapshot interval to 10s or 20s or 30s, etc.
  • the preset snapshot time point or the preset time interval arrives, the system automatically performs snapshot processing on the data in a certain LUN. Therefore, the last preset snapshot time point before the specified time point can be obtained according to the specified time point.
  • the snapshot data is saved in the snapshot area of the storage device. Therefore, snapshot data of the time point can be obtained in the snapshot area according to the last preset snapshot time point before the specified time point.
  • Step 2042 Obtain a write operation log after the last snapshot time point.
  • the log table is saved in segments at a preset snapshot point.
  • the log may include three. Fields, one of which is the point in time when the write data operation is received, the other field is the data to be written, and the other field is the LBA. Therefore, the log table corresponding to it can be determined by specifying the time point.
  • the log table contains the write operation log of the data block corresponding to the LBA for a period of time based on the preset snapshot time point.
  • Step 2043 The data of the specified time point is restored according to the write operation log after the preset snapshot time point and the snapshot data corresponding to the preset snapshot time point.
  • the data of the specified time point may be restored according to the snapshot data of the last preset time point before the specified time point obtained in step 2041, and the write operation log of the last preset time point obtained in step 2042.
  • the data change record before the specified time point may be sequentially overwritten according to the snapshot data of the last preset time point and according to the time sequence of the write operation log in the log table.
  • the snapshot data of the baseline until the time when the operation log is written has reached the specified time point.
  • the write operation log in the log table how much is performed between the last preset time point and the specified time point. The data write operation is repeated, and then the data change record of the last write data operation is overwritten into the snapshot data as the reference.
  • any specified time point data may be recovered according to the write operation log in the log table and the snapshot data of the last preset snapshot time point before the specified time point.
  • the method may further include:
  • Step 2044 Determine whether the specified time point is a preset snapshot time point. If yes, the data of the specified time point is restored by using the snapshot data corresponding to the preset snapshot time point; if no, step 2041 is performed.
  • the specified time point is exactly the preset snapshot time point, the snapshot data can be directly restored, and the subsequent steps need not be performed, which saves the time for restoring data.
  • the following is a specific example to illustrate the process of data recovery:
  • the storage device takes snapshots at 9:00, 9:10, and 9:20, and the recovery time is 9:05. Because the snapshot area saves only 9:00, 9:10, and 9:20. The snapshot data, there is no snapshot data of 9:05, so it cannot be recovered directly from the snapshot area. The time point from the last snapshot at 9:05 is 9:00, so the snapshot data at 9:00 is read into the cache.
  • the log table is saved according to the snapshot log segment.
  • the first log table may hold a write data operation log of all write data operations from 8:50 to 9:00, and a snapshot log at 8:50 and a snapshot log at 9:00, second.
  • the log table may hold a write data operation log of all write data operations from 9:00 to 9:10, and a snapshot log at 9:00 and a snapshot log at 9:10.
  • the third log table may Saved is a write data operation log of all write data operations from 9:10 to 9:20, and a snapshot log at 9:10 and a snapshot log at 9:20.
  • the data log record can be obtained through the period of 9:00 to 9:05.
  • the steps to recover the data at 9:05 are: First, the snapshot data at 9:00 is used as the reference data; then, the records in the log records are recorded. The data to be written at 9:01 is written into the LBA; then the data to be written at the 9:02 time recorded in the log record is written into the LBA; then the 9:03 time recorded in the log record is to be written. The data is written into the LBA. Since 9:03 is the last data write operation, the recovery is completed, and the data at this time is the data of the specified time point to be restored.
  • the snapshot data at 9:00 is used as the reference data; then, the data write operation is performed three times between 9:00 and 9:05; and the last data write operation is performed according to the record of the log table, that is, 9:
  • the data to be written at time 03 is written to the LBA.
  • the data at this time is the data at the specified point in time to be restored.
  • the embodiment of the present invention further provides a storage device.
  • the storage device 40 includes: a write operation log module 402, configured to record a write operation log in the log table, where the write operation log includes at least one write received. The point in time of data operation, the data to be written, and the Logical Block Address (LBA);
  • the storage device 40 receives the write data operation issued by the host, and requests the data to be written into the storage device, where the write data operation includes the data to be written, and the LBA.
  • the LBA is the logical address of the storage device to be written to which data is to be written.
  • the LBA stores data.
  • the data carried in the write data operation overwrites the original stored data in the LBA, if not in the LBA. The stored data is processed otherwise, and the data is lost and cannot be recovered.
  • the write operation log module 402 can obtain the data to be written and the LBA by intercepting the write data operation to form a write operation.
  • the log is recorded in the log table, and the log table can be stored in the storage device On.
  • the write operation log also includes the point in time at which the write data operation is received.
  • each write operation log record in the log table can contain three fields, one of which is the point in time at which the write data operation is received, the other is the data to be written, and the other field is the LBA.
  • the operation performed by the write operation log module 402 is repeatedly executed upon receiving the next write data operation.
  • the snapshot processing module 403 is configured to perform snapshot processing on the data block corresponding to the LBA in the write operation log to obtain snapshot data, and record a snapshot log in the log table, when the preset snapshot time point arrives,
  • the snapshot log includes the preset snapshot time point;
  • the storage device 40 has a snapshot function, and the so-called snapshot refers to a technology that is implemented on the operating system and the storage technology to record the state of the system at a certain time.
  • the snapshot time point can be preset according to the user's needs. For example, set the snapshot time point to 9:00, 9:10, 9:20, etc., or set the snapshot interval to 10s or 20s or 30s, etc.
  • the snapshot log can contain a field, that is, a preset snapshot time point, or two fields, one of which The field is the preset snapshot time point, and the other field is the identifier of the snapshot processing.
  • the identifier of the snapshot processing is used to identify the snapshot log in the log table, and distinguish the snapshot log from the write operation log.
  • the logical unit number (LUN) corresponding to the LBA is snapshot processed, that is, the data of the entire LUN needs to be copied to other data storage areas, and the data corresponding to the LBA is also included.
  • the embodiment of the present invention takes only the snapshot processing of the data block corresponding to the LBA as an example.
  • a LUN may be divided into a snapshot area on the storage device to save snapshot data of each preset snapshot time point.
  • the data in the data block corresponding to the LBA can be saved to the snapshot area.
  • the purpose of the snapshot is to restore the original data in the data block at some time in the future. Complex.
  • the recovery module 404 is configured to acquire the snapshot data and the write operation log after the snapshot time point according to the snapshot time point to perform data recovery.
  • the snapshot processing module 403 does not have a sequence when performing snapshot processing and when recording snapshot logs in the log table, and can be executed simultaneously.
  • the data block corresponding to the LBA may be snapshot processed, and then the snapshot log is recorded in the log table to ensure that the write operation log recorded in the log completely includes the write of all the time points before the snapshot is created. Operation log.
  • each write data operation since each write data operation is intercepted, the data to be written carried in each write data operation is formed into a log record, so that the snapshot time point can be restored directly through the snapshot log.
  • the data can be recovered at any point in time through the log table.
  • the marking unit 4031, the saving unit 4032, and the recording unit 4033 may be included.
  • a marking unit 4031 configured to mark the data block corresponding to the LBA corresponding to the LBA, to indicate that the data block corresponding to the LBA needs to be snapshot processed
  • the data block corresponding to the LBA when the preset snapshot time point arrives, the data block corresponding to the LBA may be snapshot marked, or the data block may be marked with a snapshot label, which may be any known in the current technology.
  • the snapshot tag is used for the entire LU.
  • only the data block corresponding to the LBA is needed, so that it can be understood as a tag for the snapshot processing of the data block corresponding to the LBA.
  • the saving unit 4032 is configured to save data in the data block corresponding to the LBA of each write operation log in the write operation log to the snapshot area according to the mark processed by the snapshot;
  • the write data operation When the next write data operation is received, the write data operation includes the data to be written and the LBA. If the system recognizes that the data block corresponding to the LBA includes the snapshot mark, the data corresponding to the LBA is first backed up to the snapshot area. Write the data to be written carried in the write data operation to the LBA. in.
  • the recording unit 4033 is configured to record a snapshot log in the log table, where the snapshot log includes the preset snapshot time point.
  • the snapshot log may also include a tag for snapshot processing to distinguish the snapshot log from the write operation log in the log table.
  • the method may further include:
  • the log saving module 405 is configured to save the log table to the storage device for data recovery.
  • the log table is usually stored in the cache of the storage device, and the log table may be saved to the storage device, and the log table may be saved to a non-volatile storage medium in the storage device, and the The records in the cache are cached to save cache resources.
  • each log table is separately saved to the storage device at intervals of each preset snapshot time point, and then the data change record in each log table includes only two presets. The data change record between snapshot time points, so the log table is relatively small and does not take up too much storage space.
  • each write data operation since each write data operation is intercepted, the data to be written carried in each write data operation is formed into a log record, so that the data at the snapshot time point can be restored directly through the snapshot log. In addition, you can recover data at any point in time through logging.
  • the log records are saved to the storage device at intervals of preset snapshot time points, and the log records originally saved in the cache are cleared, thereby avoiding loss of the log table during power failure. , also saves cache resources.
  • the method may further include:
  • the suspension module 406 is configured to suspend the write data operation when the preset snapshot time point arrives, and write the to-be-written data into the non-volatile storage medium of the storage device.
  • the system will write the number. According to the operation related information temporarily stored in the cache, and then according to the write data operation carrying the LBA to write the data to be written from the cache to the non-volatile storage medium of the storage device, such as a hard disk, and then clear the cache to be written Into the data. Therefore, you need to ensure that the data in the cache is consistent with the data on the hard disk.
  • the write data operation received at this time may be suspended, and the data in the cache at this time is first written into the non-volatile storage medium of the storage device.
  • the operation of suspending the write data refers to temporarily not performing the write data operation received at this time, so that when the system writes the data in the cache to the hard disk, or when recording the snapshot log. , or when a snapshot operation is performed, no new data is written, resulting in inconsistency between the data stored in the cache and the data on the hard disk.
  • the snapshot processing is complete and the snapshot log has been added to the log table, you can stop the suspension.
  • the write data operation instruction received at this time is suspended, and the data in the cache is written into the non-volatile storage medium of the storage device, so that the data is guaranteed.
  • the data is consistent.
  • the write operation log module 402 is included in the storage device, and the storage device intercepts the write data operation sent by the host to obtain the data to be written and the LBA carried in the write data operation to form a write. Operation logs are recorded in the log table;
  • the write operation log module 402 may be included on the host side.
  • the host may intercept the write data operation to obtain the data write operation.
  • the data to be written and the LBA form a write operation log recorded in the log table;
  • the write operation log module 402 may be included in a connection device, such as a switch.
  • the switch may intercept the write data operation by using the write operation log module. , to obtain data to be written and LBA, form a write operation log recorded in the log table.
  • the log table may be stored in the storage device;
  • the directory may be stored in the host, and other storage devices connected to the host;
  • the log table when the write operation log module 402 is included in the switch, can be stored in a hard disk and other storage devices connected to the switch.
  • the records in the log table are saved to the storage device, and the records in the log table can be saved to the non-volatile storage medium of the storage device, and the cache table is emptied in the cache. Record to save cache resources.
  • the records in the log table are saved to the storage device, and the records in the log table are saved to the storage device, and the records in the host table are cleared to save the host. Resources.
  • the records in the log table can be saved to a non-volatile storage medium of the storage device, and the records in the cache table of the log table can be emptied to save cache resources.
  • Other storage devices connected to the switch can be saved to a non-volatile storage medium of the storage device, and the records in the cache table of the log table can be emptied to save cache resources.
  • the recovery module 404 may include a snapshot data obtaining unit 4041, a write operation log obtaining unit 4042, and a data restoring unit 4043.
  • the snapshot data obtaining unit 4041 is configured to determine, according to the specified time point, a last snapshot time point before the specified time point, and when the last snapshot time point is the preset snapshot time point, obtain the preset Snapshot data corresponding to the snapshot time point;
  • the specified time point here can be an arbitrary time point, that is, the log table shown in the above embodiment can recover the data of the user-specified arbitrary time point.
  • the storage device can preset the snapshot time point, for example, set the time point of the snapshot to 9:00, 9:10, 9:20, etc. or set the snapshot interval to 10s or
  • the system automatically performs snapshot processing on the data in a certain LUN. Therefore, the last preset snapshot time point before the specified time point can be obtained according to the specified time point. According to the manner of the snapshot processing, the snapshot data is saved in the snapshot area of the storage device. Therefore, the snapshot data of the time point can be obtained in the snapshot area according to the last preset snapshot time point before the specified time point.
  • a write operation log obtaining unit 4042 configured to acquire a write operation after the preset snapshot time point
  • the log table is segmentally stored at intervals of preset snapshot points.
  • the write operation log it may include three fields, one of which is the time point of receiving the write data operation, and the other The field is the data to be written, and the other field is the LBA. Therefore, you can specify the log table corresponding to it by specifying the time point.
  • the log table contains the write log of the data block corresponding to the LBA for a period of time.
  • the data recovery unit 4043 is configured to recover data of the specified time point according to the write operation log after the preset snapshot time point and the snapshot data corresponding to the preset snapshot time point.
  • the snapshot data of the last preset time point before the specified time point obtained by the snapshot data obtaining unit 4041 and the write operation log recovery in the log table corresponding to the specified time point obtained by the write operation log obtaining unit 4042 may be recovered. Specify the data at the point in time.
  • the data change record before the specified time point may be sequentially overwritten according to the snapshot data of the last preset time point and according to the time sequence of the write operation log in the log table.
  • the snapshot data of the baseline until the time when the operation log is written has reached the specified time point.
  • the write operation log in the log table how much is performed between the last preset time point and the specified time point. The data write operation is repeated, and then the data change record of the last write data operation is overwritten into the snapshot data as the reference.
  • any specified time point data may be recovered according to the snapshot data of the last preset snapshot time point before the specified time point and the write operation log after the last preset snapshot time point.
  • the recovery module 404 may further include: The determining unit 4044 is configured to determine whether the specified time point is a preset snapshot time point, and if yes, recover the data of the specified time point by using the snapshot data corresponding to the preset snapshot time point; if not, executing the snapshot data acquiring unit The action of 4041.
  • the specified time point is exactly the preset snapshot time point, the snapshot data can be directly restored, and the subsequent steps need not be performed, which saves the time for restoring data.
  • the storage device further includes other functions as described in the foregoing embodiment.
  • the storage device further includes other functions as described in the foregoing embodiment.
  • an embodiment of the present invention provides a schematic diagram of a storage device 500.
  • the storage device 500 may be a server containing storage capabilities, or a personal computer PC, or other device 500 including:
  • a processor 510 a communications interface 520, a memory 530, and a bus 540.
  • the processor 510, the communication interface 520, and the memory 530 complete communication with each other via the bus 540.
  • the communication interface 520 is configured to communicate with the network element, such as the virtual machine management center 280, the shared storage 240, and the like.
  • the processor 510 is configured to execute the program 532.
  • program 532 can include program code, the program code including computer operating instructions.
  • the processor 510 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention.
  • CPU central processing unit
  • ASIC Application Specific Integrated Circuit
  • the memory 530 is configured to store the program 532.
  • the memory 530 may include a high speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory. Reservoir.
  • the program 532 may specifically include:
  • the write operation log module 5322 is configured to record a write operation log in the log table, where the write operation log includes a time point of the received at least one write data operation, a data to be written, and an LBA;
  • the snapshot processing module 5323 is configured to perform snapshot processing on the data block corresponding to the LBA in the write operation log to obtain snapshot data, and record the snapshot log in the log table, when the preset snapshot time point arrives,
  • the snapshot log includes the preset snapshot time point.
  • the recovery module 5324 is configured to acquire the snapshot data and the write operation log after the snapshot time point according to the snapshot time point to perform data recovery.
  • each module in the program 532 refers to the corresponding modules in the embodiment shown in FIG. 4, and details are not described herein.
  • an embodiment of the present invention further provides a storage system, where the storage system includes a storage device and a host;
  • modules of the storage device For the specific implementation of the modules of the storage device, refer to the corresponding modules in the embodiment shown in FIG. 4, and details are not described herein.
  • the host is configured to send a write data operation to the storage device.
  • connection device can also be included, the connection device for connecting the host and the storage device.
  • the disclosed apparatus and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the modules is only a logical function division.
  • there may be another division manner for example, multiple modules or components may be combined or Can be integrated into another device, or some features can be ignored, or not executed.
  • Another point, the mutual coupling shown or discussed Or a direct coupling or communication connection may be an indirect coupling or communication connection through some communication interface, device or module, and may be electrical, mechanical or otherwise.
  • the modules described as separate components may or may not be physically separated.
  • the components displayed as modules may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the objectives of the solution of the embodiment.
  • each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明实施例提供了一种数据处理方法和存储设备,其中方法包括:在日志表中记录写操作日志,所述写操作日志包括接收的至少一条写数据操作的时间点、待写入数据以及逻辑块地址LBA;当预设的快照时间点到达时,对所述写操作日志中的LBA对应的数据块做快照处理得到快照数据,并在所述日志表中记录快照日志,所述快照日志包括所述预设的快照时间点;根据所述快照时间点获取所述快照数据及所述快照时间点之后的写操作日志,以进行数据恢复。

Description

数据处理方法和存储设备 技术领域
本发明涉及存储技术, 尤其涉及一种数据处理方法和存储设备。 背景技术 数据备份是容灾的基础, 是指为防止系统出现操作失误或系统故障导致 数据丟失, 而将全部或部分数据集合从应用主机的硬盘或阵列复制到其它的 存储介质的过程。 现有技术中通常釆用快照的方式来实现数据备份。 快照是 关于指定数据集合的一个完全可用拷贝, 该拷贝包括相应数据在某个时间点 (拷贝开始的时间点) 的映像。 快照可以是其所表示的数据的一个副本, 也 可以是数据的一个复制品。 通常的做法是, 预先设置好进行快照的时间点, 定时对 10请求中待写入的地址中存储的数据进行快照,当需要恢复某个时间 点的数据时, 再将快照数据转化为备份或副本数据。 但是这种技术无法将数 据恢复到任意时间点, 而只能恢复到快照时间点。 发明内容
本发明实施例提供一种数据处理方法和存储设备, 能够恢复任意时刻 的数据。
第一方面, 本发明实施例提供一种数据处理方法, 包括:
在日志表中记录写操作日志, 所述写操作日志包括接收的至少一条写数 据操作的时间点、 待写入数据以及逻辑块地址 LBA;
当预设的快照时间点到达时,对所述写操作日志中的 LBA对应的数据块 做快照处理得到快照数据, 并在所述日志表中记录快照日志, 所述快照曰志 包括所述预设的快照时间点; 根据所述快照时间点获取所述快照数据及所述快照时间点之后的写操作 日志, 以进行数据恢复。
在第一方面的第一种可能的实现方式中, 所述对所述写操作日志中
LBA对应的数据块做快照处理得到快照数据包括:
给所述 LBA对应的数据块 ^1快照处理的标记, 以表示所述 LBA对应的 数据块需要做快照处理;
根据所述快照处理的标记, 将所述写操作日志中每条写操作日志的 LBA 对应的数据块中的数据保存至快照区。
结合第一方面的第一种可能的实现方式, 在第一方面的第二种可能的 实现方式中, 还包括:
将所述日志表保存至存储设备中, 以进行数据恢复。
结合第一方面的第一种可能的实现方式, 在第一方面的第三种可能的 实现方式中, 还包括:
当预设的快照时间点到达时, 悬挂写数据操作, 并将所述待写入数据写 入存储设备的非易失性存储介质中。
在第一方面的第一种可能的实现方式中, 所述根据所述快照时间点获 取所述快照数据及所述快照时间点之后的写操作日志,以进行数据恢复包括: 根据指定时间点确定所述指定时间点之前的最后一次快照时间点, 当所 述最后一次快照时间点为所述预设的快照时间点时, 得到所述预设的快照时 间点对应的快照数据;
获取所述预设的快照时间点之后的写操作日志;
根据所述预设的快照时间点之后的写操作日志, 以及所述预设的快照时 间点对应的快照数据恢复所述指定时间点的数据。 第二方面, 本发明实施例提供一种存储设备, 包括:
写操作日志模块, 用于在日志表中记录写操作日志, 所述写操作日志包 括接收的至少一条写数据操作的时间点、 待写入数据以及逻辑块地址 LBA; 快照处理模块, 用于当预设的快照时间点到达时, 对所述写操作日志中 的 LBA对应的数据块做快照处理得到快照数据,并在所述日志表中记录快照 日志, 所述快照日志包括所述预设的快照时间点;
恢复模块, 用于根据所述快照时间点获取所述快照数据及所述快照时间 点之后的写操作日志, 以进行数据恢复。
在第二方面的第一种可能的实现方式中, 所述快照处理模块包括: 标记单元, 用于给所述 LBA对应的数据块做快照处理的标记, 以表示所 述 LBA对应的数据块需要做快照处理;
保存单元, 用于根据所述快照处理的标记, 将所述写操作日志中每条写 操作日志的 LBA对应的数据块中的数据保存至快照区;
记录单元, 用于在所述日志表中记录快照日志, 所述快照日志包括所述 预设的快照时间点。
结合第二方面的第一种可能的实现方式, 第二方面的第二种可能的实 现方式, 还包括: 日志保存模块, 用于将所述日志表保存至存储设备中, 以 进行数据恢复。
结合第二方面的第一种可能的实现方式, 第二方面的第三种可能的实 现方式, 还包括: 悬挂模块, 用于当预设的快照时间点到达时, 悬挂写数据 操作, 并将所述待写入数据写入存储设备的非易失性存储介质中。
在第二方面的第一种可能的实现方式中, 所述恢复模块包括: 快照数据获取单元, 用于根据指定时间点确定所述指定时间点之前的最 后一次快照时间点, 当所述最后一次快照时间点为所述预设的快照时间点时, 得到所述预设的快照时间点对应的快照数据;
写操作日志获取单元, 用于获取所述预设的快照时间点之后的写操作日 志;
数据恢复单元, 用于根据所述预设的快照时间点之后的写操作日志, 以 及所述预设的快照时间点对应的快照数据恢复所述指定时间点的数据。 第三方面, 本发明实施例提供一种存储设备, 包括: 处理器、 通信接 口和通信总线;
其中, 所述处理器和所述通信接口通过所述通信总线进行通信; 所述处理器, 用于在日志表中记录写操作日志, 所述写操作日志包括接 收的至少一条写数据操作的时间点、 待写入数据以及逻辑块地址 LBA; 当预 设的快照时间点到达时,对所述写操作日志中的 LBA对应的数据块做快照处 理得到快照数据, 并在所述日志表中记录快照日志, 所述快照日志包括所述 预设的快照时间点; 根据所述快照时间点获取所述快照数据及所述快照时间 点之后的写操作日志, 以进行数据恢复。
在本发明第三方面的第一种可能实施方式中, 所述处理器用于对所述 写操作日志中 LBA对应的数据块做快照处理得到快照数据包括:所述处理器 用于给所述 LBA对应的数据块做快照处理的标记, 以表示所述 LBA对应的 数据块需要做快照处理; 根据所述快照处理的标记, 将所述写操作日志中每 条写操作日志的 LBA对应的数据块中的数据保存至快照区。
结合第三方面的第一种可能的实现方式, 第三方面的第二种可能的实 现方式, 所述处理器还用于, 将所述日志表保存至存储设备中, 以进行数据 恢复。
结合第三方面的第一种可能的实现方式, 第三方面的第三种可能的实 现方式, 所述处理器还用于, 当预设的快照时间点到达时, 悬挂写数据操作, 并将所述待写入数据写入存储设备的非易失性存储介质中。
在本发明第三方面的第一种可能实施方式中, 所述处理器用于根据所 述快照时间点获取所述快照数据及所述快照时间点之后的写操作日志, 以进 行数据恢复包括: 所述处理器用于根据指定时间点确定所述指定时间点之前 的最后一次快照时间点, 当所述最后一次快照时间点为所述预设的快照时间 点时, 得到所述预设的快照时间点对应的快照数据; 获取所述预设的快照时 间点之后的写操作日志; 根据所述预设的快照时间点之后的写操作日志, 以 及所述预设的快照时间点对应的快照数据恢复所述指定时间点的数据。 第四方面, 本发明实施例提供一种存储设备, 包括: 包括如权利要求
7-12任意权利要求所述的存储设备和主机;
所述主机, 用于向所述存储设备发送写数据操作。
结合第四方面的第一种可能的实现方式, 第四方面的第二种可能的实 现方式, 所述存储系统还包括连接设备;
所述连接设备用于连接所述主机和所述存储设备;
所述主机, 用于向所述存储设备发送写数据操作包括: 所述主机, 用于 通过所述连接设备向所述存储设备发送写数据操作。
在本发明实施例中, 由于对每个写数据操作进行截获, 将每个写数据操 作中携带的待写入数据形成日志记录在日志表中, 因此除了可以直接通过快 照日志恢复快照时间点的数据以夕卜,还可以通过日志表恢复任意时间点数据。 附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对实 施例或现有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面 描述中的附图是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不 付出创造性劳动性的前提下, 还可以根据这些附图获得其他的附图。
图 1为本发明实施例提供的一种数据处理方法的应用网络架构示意图; 图 2为本发明实施例提供的一种数据处理方法的流程图;
图 3为本发明实施例提供的又一种数据处理方法的流程图;
图 4为本发明实施例提供的一种存储设备的结构示意图;
图 5为本发明实施例提供的又一种存储设备的结构示意图。 具体实施方式
为使本发明实施例的目的、 技术方案和优点更加清楚, 下面将结合本发 明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完整地描述, 显然, 所描述的实施例是本发明一部分实施例, 而不是全部的实施例。 基于 本发明中的实施例, 本领域普通技术人员在没有作出创造性劳动前提下所获 得的所有其他实施例, 都属于本发明保护的范围。
本发明实施例提供的数据处理方法可以在存储系统上实现。 图 1为本发 明实施例提供的一种数据处理方法的系统架构示意图, 如图 1所示, 该存储 系统包括主机、 存储设备和连接设备。
主机可以包括当前技术已知的任何计算设备, 如服务器、 台式计算机等 等。 在主机内部, 安装有操作系统以及其他应用程序。
存储设备可以包括当前技术已知的具有快照功能的存储设备, 如独立磁 盘冗余阵歹' J ( Redundant Arrays of Independent Disks, RAID )、 磁盘条( Just a Bunch Of Disks, JBOD ) 、 直接存取存储器( Direct Access Storage Device , DASD ) 的一个或多个互连的磁盘驱动器, 诸如磁带库、 一个或多个存储单 元的磁带存储设备。
连接设备可以包括当前技术已知的存储设备和主机之间的任何接口, 如 光纤交换机, 或者其他现有的交换机。
请参见图 2 , 图 2为本发明实施例提供的一种数据处理方法的流程图, 如图 2所示, 本实施例提供了一种数据处理方法, 该数据处理方法从存储设 备的角度进行描述, 可以用于对写数据操作中待写入的数据进行备份, 以便 将来将数据恢复到任意时间点。 该方法可以包括如下步骤:
步骤 202 , 在日志表中记录写操作日志, 写操作日志包括接收的至少一 条写数据操作的时间点、待写入数据以及逻辑块地址( Logical Block Address , LBA ) ;
在本发明实施例中, 存储设备接收主机下发的写数据操作, 要求将数据 写入存储设备中, 该写数据操作包括待写入数据, 以及 LBA。 LBA为待写入 数据将要写入的存储设备的逻辑地址。 在主机下发写数据操作给存储设备之 前, 通常该 LBA存储有数据, 在接收到写数据操作后, 用写数据操作中携带 的待写入数据覆盖 LBA中原来存储的数据, 如果不对 LBA中原来存储的数 据做其他处理, 该数据就会丟失, 不能恢复。
存储设备中可以包括写操作日志模块, 当主机下发写数据操作给存储设 备用于写入数据时, 该写操作日志模块可以通过截获该写数据操作获得待写 入数据以及 LBA, 形成一条写操作日志记录在日志表中, 日志表可以存储在 该存储设备中。 另外, 写操作日志中还包括接收写数据操作的时间点。
具体而言, 日志表中的每一条写操作日志记录可以包含三个字段, 其中 一个字段是接收写数据操作的时间点, 另一个字段是待写入数据, 还有一个 字段是 LBA。
在接收到下一个写数据操作时, 重复执行步骤 202的动作。
步骤 203 , 当预设的快照时间点到达时, 对所述写操作日志中的 LBA对 应的数据块做快照处理得到快照数据, 并在所述日志表中记录快照日志, 所 述快照日志包括所述预设的快照时间点。
在本发明实施例中, 存储设备具有快照功能, 所谓快照是指一种在操作 系统以及存储技术上实现的一种记录某一时间系统状态的技术。 快照时间点 可以根据用户的需要预先设置, 例如将快照的时间点设置为 9:00、 9:10、 9:20 等等,或者将快照的时间间隔设置为 10s或者 20s或者 30s等等, 当预设的快 照时间点或者预设的时间间隔到达时, 则需要在步骤 202的日志表中增加一 条快照日志, 该快照日志可以包含一个字段, 即预设的快照时间点, 也可以 包含两个字段, 其中一个字段是预设的快照时间点, 另一个字段是快照处理 的标识, 该快照处理的标识是用于在日志表标识快照日志, 将快照日志和写 操作日志区分开来。
在实际应用中, 是对该 LBA所对应的逻辑存储单元( Logical Unit Number, LUN )做快照处理, 即整个 LUN的数据都需要拷贝到其他数据存 储区域,其中也包含了该 LBA所对应的数据块。本发明实施例仅以对该 LBA 所对应的数据块进行快照处理为例。
需要说明的是, LU 是一段逻辑存储区域, 对于大多数存储设备而言, 并不直接对操作系统呈现存储设备所包含的物理磁盘本身, 而是将各物理磁 盘提供的存储空间映射为一段逻辑区域(即 LU )供用户使用。 因此, 操作 系统对磁盘进行的读写操作实际上都是在 LU 层面进行的操作。写数据操作 中携带的 LBA, 是指待写入数据将要写入的 LUN的地址。 由于 LU 是由物 理磁盘映射而来的, 而物理磁盘的最小存储单位是数据块, 所以 LBA也有其 对应的物理磁盘上的数据块。
具体的, 可以预先在存储设备上划分一段 LUN作为快照区, 用以保存各 个预设快照时间点的快照数据。 当预设的快照时间点到达时, 可以将该 LBA 所对应的数据块中的数据保存至快照区。 做快照的目的是若将来某个时候需 要恢复该数据块中原有的数据时, 可以利用快照区中保存的快照数据进行恢 复。
需要说明的是,进行快照处理和在日志表中增加快照日志没有先后顺序, 可以同时执行。
在另一个实施例中, 可以先进行快照处理, 再在日志表中记录快照曰志 以保证日志表中记录的写操作日志已经完全包含了快照创建前的所有时间点 的写操作日志。
步骤 204, 根据所述快照时间点获取所述快照数据及所述快照时间点之 后的写操作日志, 以进行数据恢复。
需要说明的是, 步骤 202、 步骤 203、 步骤 204会反复执行多次, 在每次 预设的快照时间点到达时形成一份日志表保存, 该日志表包括前后两次预设 的快照时间点的快照日志, 以及快照时间点之间所有的写操作日志。
因此, 当需要恢复指定时间点的数据时, 首先要确定指定时间点之前的 最后一次快照时间点, 得到最后一次快照时间点对应的快照数据, 并且获取 最后一次快照时间点之后的写操作日志, 再根据最后一次快照时间点对应的 快照数据和最后一次快照时间点之后的写操作日志恢复指定时间点的数据。
当最后一次快照时间点为步骤 203中的预设的快照时间点时, 得到最后 —次快照时间点对应的快照数据也就是获得步骤 203中的预设的快照时间点 对应的快照数据。
在本发明实施例中, 由于对每个写数据操作进行截获, 将每个写数据操 作中携带的待写入数据形成日志记录在日志表中, 因此除了可以直接通过快 照日志恢复快照时间点的数据以夕卜,还可以通过日志表恢复任意时间点数据。 在上述实施例的步骤 203中,对该 LBA所对应的数据块做快照处理得到 快照数据, 可以具体包括如下步骤:
步骤 2031 : 给所述 LBA对应的数据块做快照处理的标记, 以表示所述 LBA对应的数据块需要做快照处理;
具体的, 在本发明实施例中, 当预设的快照时间点到达时, 可以给 LBA 所对应的数据块做快照标记, 可以是给该数据块打上一个快照标签, 可以是 当前技术已知的任何做标记的方式。 在实际应用中, 快照标记是给整个 LU 做的, 但在本发明实施例中仅需要用到 LBA对应的数据块, 所以可以理解为 给所述 LBA对应的数据块做快照处理的标记。
需要说明的是, 这里的快照处理的标记和步骤 203中快照日志包括快照 处理的标识有所不同, 这里的快照处理的标记主要是为了在数据没有同步写 入的情况下, 先打上一个快照标记, 表示该数据块在接收到下一个写数据操 作时需要进行快照处理, 而步骤 203中的快照处理的标识是快照日志中的一 个字段, 用以区别日志表中的写操作日志。
步骤 2032: 根据所述快照处理的标记, 将所述写操作日志中每条写操作 曰志的 LBA对应的数据块中的数据保存至快照区; 当接收到下一个写数据操作, 该写数据操作中包括待写入数据和 LBA, 如果系统识别到该 LBA对应的数据块包含有快照标记, 则先将该 LBA对应 的数据块的数据备份到快照区, 再将该写数据操作中携带的待写入数据写入 该 LBA中。
这主要是为了保证当预设的快照时间点和接收到写操作请求的时间点不 一致时, 仍然能够进行快照处理。 在本发明的另一个实施例中, 还可以包括:
步骤 205, 将日志表保存至存储设备中, 以进行数据恢复;
在实际应用中, 日志表通常是存在于存储设备的緩存中的, 将日志表中 的记录保存至存储设备中具体可以是, 将日志表保存至存储设备中的非易失 性存储介质中, 并清空该日志表在緩存中的记录, 以节省緩存资源。 在本发 明实施例中, 以每个预设的快照时间点为间隔, 分别将每个日志表保存至存 储设备中, 那么每一份日志表中的数据变化记录都只包含两个预设的快照时 间点之间的数据变化记录, 因此日志表就比较小, 不会占用太多的存储空间。
需要说明的是, 该步骤和进行快照处理的步骤没有先后顺序, 可以先将 日志表保存到存储设备再进行快照处理, 也可以先进行快照处理再将日志表 保存到存储设备中, 也可以同时执行。 在本发明一个更优的实施例中, 可以 先将日志表保存到存储设备再进行快照处理,防止系统掉电以后日志表丟失。
在本实施例中, 由于对每个写数据操作进行截获, 将每个写数据操作中 携带的待写入数据形成日志记录在日志表中, 因此除了可以直接通过快照日 志恢复快照时间点的数据以外, 还可以通过日志记录恢复任意时间点数据。 并且, 由于在本发明实施例中, 以预先设置的快照时间点为间隔, 将日志记 录保存至存储设备中, 并将原来保存在緩存中的日志记录清空, 因此避免了 掉电时日志表丟失, 也节省了緩存资源。 在本发明的再一个实施例中, 还可以包括:
步骤 206, 在预设的快照时间点到达时, 悬挂此时接收到的写数据操作 指令, 并且将所述待写入数据写入存储设备的非易失性存储介质中;
通常情况下, 在主机下发写数据操作给存储设备以后, 系统会将该写数 据操作的相关信息暂存在緩存里面,然后根据该写数据操作中携带的 LBA将 待写入数据从緩存写入到存储设备的非易失性存储介质, 例如硬盘中, 再清 空緩存中的待写入数据。 因此需保证緩存中的数据与硬盘中的数据一致。
在本发明实施例中, 在预设的快照时间点到达时, 可以悬挂此时接收到 的写数据操作,先将此时緩存中的数据写入存储设备的非易失性存储介质中。 本领域技术人员可以理解的是, 这里的悬挂该写数据操作是指暂不执行此时 接收到的写数据操作, 使得系统在将緩存中的数据写入硬盘中时, 或者在记 录快照日志时, 或者在进行快照操作时, 不会有新的数据写入从而导致緩存 中存储的数据和硬盘的数据不一致。
当快照处理完成,并且快照日志已经添加到日志表中以后,可以停止悬挂。 本发明实施例, 当预设的快照时间点到达时, 悬挂此时接收到的写数据操 作指令, 并且将緩存中的数据写入存储设备的非易失性存储介质中, 可以保 证在将数据从緩存写入硬盘时, 数据是一致的。
在上述实施例中, 写操作日志模块是包含在存储设备中的, 由存储设备 去截获主机下发的写数据操作, 以获得写数据操作中携带的待写入数据以及 LBA, 形成一条写操作日志记录在日志表中;
在本发明另一个实施例中, 写操作日志模块可以包含在主机端, 当主机 下发写数据操作给存储设备时, 可以由主机去截获该写数据操作, 以获得写 数据操作中携带的待写入数据以及 LBA, 形成一条写操作日志记录在日志表 中。
在本发明再一个实施例中, 写操作日志模块可以包含在连接设备, 例如 交换机中, 当主机经交换机下发写数据操作给存储设备时, 交换机可以通过 写操作日志模块截获该写数据操作, 以获得待写入数据以及 LBA, 形成一条 写操作日志记录在日志表中。
需要说明的是, 当写操作日志模块包含在存储设备中时, 日志表可以存 储在该存储设备中;
在本发明的另一个实施例中, 当写操作日志模块包含在主机端时, 曰志 表可以存储在主机中, 以及其他与该主机连接的存储设备中;
在本发明的再一个实施例中, 当写操作日志模块包含在交换机中时, 曰 志表可以存储在与交换机连接的硬盘和其他存储设备中。
对于步骤 205而言, 将曰志表保存至存储设备中, 可以将曰志表保存至 存储设备的非易失性存储介质中, 并清空该日志表在緩存中的记录, 以节省 緩存资源。
在本发明的另一个实施例中, 将日志表保存至存储设备中, 可以是将曰 志表保存至存储设备中, 并清空该日志表在主机中的记录, 以节省主机资源。
在本发明的再一个实施例中, 可以将日志表保存至存储设备的非易失性 存储介质中, 并清空该日志表在緩存中的记录, 以节省緩存资源。 需要说明 机连接的其他存储设备。 在上述实施例中, 步骤 204可以具体包括以下步骤, 如图 3所示: 步骤 2041 , 根据指定时间点确定所述指定时间点之前的最后一次快照时 间点, 当所述最后一次快照时间点为所述预设的快照时间点时, 得到所述预 设的快照时间点对应的快照数据;
这里的指定时间点可以任意的时间点, 即, 根据上述实施例所示的日志 表可以恢复用户指定的任意时间点的数据。
具体地, 可以根据指定时间点确定指定时间点之前的最后一次快照时间 点, 并得到最后一次快照时间点对应的快照数据; 由上述实施例可知, 存储设备可以预先设置快照时间点, 例如将快照的 时间点设置为 9:00、 9:10、 9:20等等或者将快照的时间间隔设置为 10s或者 20s或者 30s等等, 当预设的快照时间点或者预设的时间间隔到达时, 系统会 自动对某一个 LUN中的数据进行快照处理。 因此, 可以根据指定时间点获得 在该指定时间点之前最后一次预设的快照时间点。
根据快照处理的方式可知, 快照数据是保存在存储设备的快照区的, 因 此可以根据指定时间点之前最后一次预设的快照时间点, 在快照区获得与该 时间点的快照数据。
步骤 2042: 获取所述最后一次快照时间点之后的写操作日志; 由上述实施例可知, 日志表是以预设的快照点为间隔分段保存的, 对于 写操作日志而言, 其可以包含三个字段, 其中一个字段是接收写数据操作的 时间点, 另一个字段是待写入数据, 再一个字段是 LBA。 因此, 可以通过指 定时间点确定与其对应的日志表。 该日志表中包含了以上次预设的快照时间 点为基准, 一段时间内对该 LBA对应的数据块进行的写操作日志。
步骤 2043: 根据所述预设的快照时间点之后的写操作日志, 以及所述预 设的快照时间点对应的快照数据恢复所述指定时间点的数据。
具体地,可以根据步骤 2041中获得的指定时间点之前最后一次预设时间 点的快照数据,以及根据步骤 2042中获得的最后一次预设时间点的写操作日 志恢复指定时间点的数据。
更加具体地, 在本发明一个实施例中, 可以以最后一次预设时间点的快 照数据为基准, 按照日志表中写操作日志的时间顺序, 依次将指定时间点前 的数据变化记录覆盖到作为基准的快照数据中, 直到写操作日志的时间已经 到达指定的时间点。 在本发明另一个实施例中, 可以以最后一次预设时间点 的快照数据为基准, 按照日志表中的写操作日志, 统计在最后一次预设时间 点与指定时间点之间总共进行了多少次写数据操作, 然后将最后一次写数据 操作的数据变化记录覆盖到作为基准的快照数据中。 在本发明实施例中, 可以根据日志表中的写操作日志以及指定时间点之 前最后一次预设的快照时间点的快照数据恢复任意指定时间点数据。
在本发明另一个实施例中, 步骤 2041之前还可以包括:
步骤 2044: 判断指定时间点是否是预设的快照时间点, 如果是, 则通过 预设的快照时间点对应的快照数据恢复所述指定时间点的数据; 如果否, 则 执行步骤 2041。
可以理解是, 如果指定时间点正好是预设的快照时间点, 则可以直接通 过快照数据进行恢复, 不需要再执行后面的步骤, 节省了恢复数据的时间。 下面以一个具体的例子来说明数据恢复的过程:
例如, 存储设备做快照的时间点为 9:00、 9:10、 9:20, 而需要恢复的时间 点是 9:05 , 由于快照区保存的只有 9:00、 9:10、 9:20的快照数据, 没有 9:05 的快照数据, 所以不能直接从快照区恢复。 离 9:05最后一次做快照的时间点 是 9:00, 因此, 将 9:00的快照数据读取到緩存中。
可以理解的是, 日志表是根据快照日志分段保存的。 例如, 第一个日志 表可能保存的是从 8:50到 9:00之间所有写数据操作的写数据操作日志,以及 8:50时刻的快照日志和 9:00时刻的快照日志, 第二个日志表可能保存的是从 9:00到 9:10之间所有写数据操作的写数据操作日志,以及 9:00时刻的快照日 志和 9:10时刻的快照日志, 第三个日志表可能保存的是从 9:10到 9:20之间 所有写数据操作的写数据操作日志,以及 9:10时刻的快照日志和 9:20时刻的 快照日志。
要恢复 9:05时刻的数据, 除了要知道 9:00时刻的快照数据之外,还需要 知道从 9:00到 9: 05这段时间中, 该 LBA所对应的数据块上的数据变化, 在 本发明实施例中,可以通过 9:00到 9:05这段时间内的写数据日志记录来获得
Figure imgf000015_0001
例如, 9:00到 9: 05这段时间内共进行了 3次写数据操作, 分别对应的系 统时间戳是 9:01、 9:02、 9:03 , 那么恢复 9:05时刻的数据的步骤是: 首先, 将 9:00时刻的快照数据作为基准数据; 然后, 将日志记录中记录 的 9:01时刻的待写入数据写入 LBA中; 然后将日志记录中记录的 9:02时刻 的待写入数据写入 LBA中; 然后将日志记录中记录的 9:03时刻的待写入数 据写入 LBA中, 由于 9:03是最后一次写数据操作, 因此本次恢复结束, 此 时的数据即要恢复的指定的时间点的数据。
或者, 也可以按照以下步骤恢复 9:05时刻的数据:
首先, 将 9:00时刻的快照数据作为基准数据; 然后统计 9:00到 9:05之 间共进行了 3次写数据操作; 再根据日志表的记录将最后一次写数据操作, 即 9:03时刻的待写入数据写入 LBA。此时的数据即要恢复的指定的时间点的 数据。 本发明实施例还提供一种存储设备, 如图 4所示, 存储设备 40包括: 写操作日志模块 402, 用于在日志表中记录写操作日志, 所述写操作日 志包括接收的至少一条写数据操作的时间点、 待写入数据以及逻辑块地址 ( Logical Block Address, LBA ) ;
在本发明实施例中, 存储设备 40接收主机下发的写数据操作, 要求将 数据写入存储设备中, 该写数据操作包括待写入数据, 以及 LBA。 LBA为待 写入数据将要写入的存储设备的逻辑地址。 在主机下发写数据操作给存储设 备之前, 通常该 LBA存储有数据, 在接收到写数据操作后, 用写数据操作中 携带的数据覆盖会掉 LBA中原来存储的数据, 如果不对 LBA中原来存储的 数据做其他处理, 该数据就会丟失, 不能恢复。
在本发明实施例中, 当主机下发写数据操作给存储设备 40用于写入数据 时, 该写操作日志模块 402可以通过截获该写数据操作获得待写入数据以及 LBA, 形成一条写操作日志记录在日志表中, 日志表可以存储在该存储设备 上。 另外, 写操作日志中还包括接收写数据操作的时间点。
具体而言, 日志表中的每一条写操作日志记录可以包含三个字段, 其中 一个字段是接收写数据操作的时间点, 另一个字段是待写入数据, 再一个字 段是 LBA。
在接收到下一个写数据操作时, 重复执行写操作日志模块 402执行的动 作。
快照处理模块 403 , 用于当预设的快照时间点到达时, 对所述写操作日 志中的 LBA对应的数据块做快照处理得到快照数据,并在所述日志表中记录 快照日志, 所述快照日志包括所述预设的快照时间点;
在本发明实施例中, 存储设备 40具有快照功能, 所谓快照是指一种在操 作系统以及存储技术上实现的一种记录某一时间系统状态的技术。 快照时间 点可以根据用户的需要预先设置, 例如将快照的时间点设置为 9:00、 9:10、 9:20等等或者将快照的时间间隔设置为 10s或者 20s或者 30s等等,当预设的 快照时间点或者预设的时间间隔到达时, 则需要在日志表中增加一条快照日 志, 该快照日志可以包含一个字段, 即预设的快照时间点, 也可以包含两个 字段, 其中一个字段是预设的快照时间点, 另一个字段是快照处理的标识, 该快照处理的标识是用于在日志表标识快照日志, 将快照日志和写操作日志 区分开来。
在实际应用中, 是对该 LBA所对应的逻辑存储单元( Logical Unit Number, LUN )做快照处理, 即整个 LUN的数据都需要拷贝到其他数据存 储区域,其中也包含了该 LBA所对应的数据块。本发明实施例仅以对该 LBA 所对应的数据块进行快照处理为例。
具体的, 可以预先在存储设备上划分一段 LUN作为快照区, 用以保存各 个预设快照时间点的快照数据。 当预设的快照时间点到达时, 可以将该 LBA 所对应的数据块中的数据保存至快照区。 做快照的目的是若将来某个时候需 要恢复该数据块中原有的数据时, 可以利用快照区中保存的快照数据进行恢 复。
恢复模块 404, 用于根据所述快照时间点获取所述快照数据及所述快照 时间点之后的写操作日志, 以进行数据恢复。
需要说明的是, 快照处理模块 403在执行快照处理的时候和在日志表中 记录快照日志的时候没有先后顺序, 可以同时执行。
在另一个实施例中, 可以先对 LBA对应的数据块做快照处理, 再在曰志 表中记录快照日志以保证日志中记录的写操作日志已经完全包含了快照创建 前的所有时间点的写操作日志。
在本发明实施例中, 由于对每个写数据操作进行截获, 将每个写数据操 作中携带的待写入数据形成日志记录在日志表中, 因此除了可以直接通过快 照日志恢复快照时间点的数据以夕卜,还可以通过日志表恢复任意时间点数据。 在上述实施例的快照处理模块 403中, 可以包括标记单元 4031、 保存单 元 4032和记录单元 4033 , 其中,
标记单元 4031 , 用于给所述 LBA对应的数据块 ^1快照处理的标记, 以 表示所述 LBA对应的数据块需要做快照处理;
具体的, 在本发明实施例中, 当预设的快照时间点到达时, 可以给 LBA 所对应的数据块做快照标记, 可以是给数据块打上一个快照标签, 可以是当 前技术已知的任何做标记的方式。在实际应用中, 快照标记是给整个 LU 做 的, 但在本发明实施例中仅需要用到 LBA对应的数据块, 所以可以理解为给 所述 LBA对应的数据块做快照处理的标记。
保存单元 4032, 用于根据所述快照处理的标记, 将所述写操作日志中每 条写操作日志的 LBA对应的数据块中的数据保存至快照区;
当接收到下一个写数据操作, 该写数据操作中包括待写入数据和 LBA, 如果系统识别到该 LBA对应的数据块包含有快照标记, 则先将该 LBA对应 的数据备份到快照区, 再将该写数据操作中携带的待写入数据写入该 LBA 中。
这主要是为了保证当预设的快照时间点和接收到写操作请求的时间点不 一致时, 仍然能够进行快照处理。
记录单元 4033 , 用于在所述日志表中记录快照日志, 所述快照日志包括 所述预设的快照时间点。
此外, 该快照日志中还可以包括快照处理的标记, 用以在日志表中将快 照日志和写操作日志区别开来。 在本发明的另一个实施例中, 还可以包括:
日志保存模块 405 , 用于将日志表保存至存储设备中, 以进行数据恢复。 在实际应用中, 日志表通常是存在于存储设备的緩存中的, 将日志表保 存至存储设备中具体可以是, 将日志表保存至存储设备中的非易失性存储介 质中, 并清空该曰志表在緩存中的记录, 以节省緩存资源。 在本发明实施例 中, 以每个预设的快照时间点为间隔, 分别将每个日志表保存至存储设备中, 那么每一份日志表中的数据变化记录都只包含两个预设的快照时间点之间的 数据变化记录, 因此日志表就比较小, 不会占用太多的存储空间。
在本实施例中, 由于对每个写数据操作进行截获, 将每个写数据操作中 携带的待写入数据形成日志记录在日志表中, 因此除了可以直接通过快照日 志恢复快照时间点的数据以外, 还可以通过日志记录恢复任意时间点数据。 并且, 由于在本发明实施例中, 以预先设置的快照时间点为间隔, 将日志记 录保存至存储设备中, 并将原来保存在緩存中的日志记录清空, 因此避免了 掉电时日志表丟失, 也节省了緩存资源。
在本发明的再一个实施例中, 还可以包括:
悬挂模块 406 , 用于当预设的快照时间点到达时, 悬挂写数据操作, 并 将所述待写入数据写入存储设备的非易失性存储介质中。
通常情况下, 在主机下发写数据操作给存储设备以后, 系统会将该写数 据操作的相关信息暂存在緩存里面,然后根据该写数据操作中携带 LBA将待 写入数据从緩存写入到存储设备的非易失性存储介质, 例如硬盘中, 再清空 緩存中的待写入数据。 因此需保证緩存中的数据与硬盘中的数据一致。
在本发明实施例中, 在预设的快照时间点到达时, 可以悬挂此时接收到 的写数据操作,先将此时緩存中的数据写入存储设备的非易失性存储介质中。 本领域技术人员可以理解的是, 这里的悬挂该写数据操作是指暂不执行此时 接收到的写数据操作, 使得系统在将緩存中的数据写入硬盘中时, 或者在记 录快照日志时, 或者在进行快照操作时, 不会有新的数据写入从而导致緩存 中存储的数据和硬盘的数据不一致。
当快照处理完成,并且快照日志已经添加到日志表中以后,可以停止悬挂。 本发明实施例, 当预设的快照时间点到达时, 悬挂此时接收到的写数据 操作指令, 并且将緩存中的数据写入存储设备的非易失性存储介质中, 可以 保证在将数据从緩存写入硬盘时, 数据是一致的。
在上述实施例中, 写操作日志模块 402是包含在存储设备中的, 由存储 设备去截获主机下发的写数据操作, 以获得写数据操作中携带的待写入数据 以及 LBA, 形成一条写操作日志记录在日志表中;
在本发明另一个实施例中, 写操作日志模块 402可以包含在主机端, 当 主机下发写数据操作给存储设备时, 可以由主机去截获该写数据操作, 以获 得写数据操作中携带的待写入数据以及 LBA, 形成一条写操作日志记录在日 志表中;
在本发明再一个实施例中, 写操作日志模块 402可以包含在连接设备, 例如交换机中, 当主机经交换机下发写数据操作给存储设备时, 交换机可以 通过写操作日志模块截获该写数据操作, 以获得待写入数据以及 LBA, 形成 一条写操作日志记录在日志表中。
需要说明的是, 当写操作日志模块 402包含在存储设备中时, 日志表可 以存储在该存储设备中; 在本发明的另一个实施例中, 当写操作日志模块 402包含在主机端时, 曰志表可以存储在主机中, 以及其他与该主机连接的存储设备中;
在本发明的再一个实施例中, 当写操作日志模块 402包含在交换机中时, 日志表可以存储在与交换机连接的硬盘和其他存储设备中。
对于日志保存模块 405而言, 将日志表中的记录保存至存储设备中, 可 以将日志表中的记录保存至存储设备的非易失性存储介质中, 并清空该曰志 表在緩存中的记录, 以节省緩存资源。
在本发明的另一个实施例中, 将日志表中的记录保存至存储设备中, 可 以是将日志表中的记录保存至存储设备中,并清空该日志表在主机中的记录, 以节省主机资源。
在本发明的再一个实施例中, 可以将日志表中的记录保存至存储设备的 非易失性存储介质中, 并清空该日志表在緩存中的记录, 以节省緩存资源。 与该交换机连接的其他存储设备。
在上述实施例中, 恢复模块 404, 可以包括快照数据获取单元 4041、 写 操作日志获取单元 4042和数据恢复单元 4043。
快照数据获取单元 4041 , 用于根据指定时间点确定所述指定时间点之前 的最后一次快照时间点, 当所述最后一次快照时间点为所述预设的快照时间 点时, 得到所述预设的快照时间点对应的快照数据;
这里的指定时间点可以任意的时间点, 即, 根据上述实施例所示的日志 表可以恢复用户指定的任意时间点的数据。
由上述实施例可知, 存储设备可以预先设置快照时间点, 例如将快照的 时间点设置为 9:00、 9:10、 9:20等等或者将快照的时间间隔设置为 10s或者
20s或者 30s等等, 当预设的快照时间点或者预设的时间间隔到达时, 系统会 自动对某一个 LUN中的数据进行快照处理。 因此, 可以根据指定时间点获得 在该指定时间点之前最后一次预设的快照时间点。 根据快照处理的方式可知, 快照数据是保存在存储设备的快照区的, 因 此可以根据指定时间点之前最后一次预设的快照时间点, 在快照区获得与该 时间点的快照数据。
写操作日志获取单元 4042 , 用于获取所述预设的快照时间点之后的写操 作曰志;
由上述实施例可知, 日志表是以预设的快照点为间隔分段保存的, 对于 写操作日志而言, 其可以包含三个字段, 其中一个字段是接收写数据操作的 时间点, 另一个字段是待写入数据, 再一个字段是 LBA。 因此, 可以通过指 定时间点与其对应的日志表。 该日志表中包含了以上次预设的快照时间点为 基准, 一段时间内对该 LBA对应的数据块进行的写操作日志。
数据恢复单元 4043 , 用于根据所述预设的快照时间点之后的写操作日 志,以及所述预设的快照时间点对应的快照数据恢复所述指定时间点的数据。
具体地,可以根据快照数据获取单元 4041获得的指定时间点之前最后一 次预设时间点的快照数据,以及根据写操作日志获取单元 4042获得的与指定 时间点对应的日志表中的写操作日志恢复指定时间点的数据。
更加具体地, 在本发明一个实施例中, 可以以最后一次预设时间点的快 照数据为基准, 按照日志表中写操作日志的时间顺序, 依次将指定时间点前 的数据变化记录覆盖到作为基准的快照数据中, 直到写操作日志的时间已经 到达指定的时间点。 在本发明另一个实施例中, 可以以最后一次预设时间点 的快照数据为基准, 按照日志表中的写操作日志, 统计在最后一次预设时间 点与指定时间点之间总共进行了多少次写数据操作, 然后将最后一次写数据 操作的数据变化记录覆盖到作为基准的快照数据中。
在本发明实施例中, 可以根据指定时间点之前最后一次预设的快照时间 点的快照数据以及最后一次预设的快照时间点之后的写操作日志恢复任意指 定时间点数据。
在本发明另一个实施例中, 恢复模块 404还可以包括: 判断单元 4044,用于判断指定时间点是否是预设的快照时间点,如果是, 则通过预设的快照时间点对应的快照数据恢复指定时间点的数据; 如果否, 则执行快照数据获取单元 4041的动作。
可以理解是, 如果指定时间点正好是预设的快照时间点, 则可以直接通 过快照数据进行恢复, 不需要再执行后面的步骤, 节省了恢复数据的时间。
上述实施例中描述的功能单元或者模块可以用来实施上述图 2-图 3的方 法。
此外, 该存储设备还包括如上面实施例所述的其他功能, 具体实现可以 参见图 4所示实施例中的相应模块, 在此不赘述。
请参考图 5A, 本发明实施例提供了一种存储设备 500的示意图。 存储 设备 500可能是包含存储能力的服务器, 或者是个人计算机 PC, 或者是其他 设备 500包括:
处理器 (processor)510 , 通信接口 (Communications Interface)520 , 存储器 (memory)530, 总线 540。
处理器 510,通信接口 520,存储器 530通过总线 540完成相互间的通信。 通信接口 520 , 用于与网元通信, 比如虚拟机管理中心 280、 共享存储 240等。
处理器 510, 用于执行程序 532。
具体地, 程序 532可以包括程序代码, 所述程序代码包括计算机操作指 令。
处理器 510 可能是一个中央处理器 CPU, 或者是特定集成电路 ASIC ( Application Specific Integrated Circuit ) , 或者是被配置成实施本发明实施例 的一个或多个集成电路。
存储器 530 ,用于存放程序 532。存储器 530可能包含高速 RAM存储器, 也可能还包括非易失性存储器( non-volatile memory ) , 例如至少一个磁盘存 储器。
程序 532具体可以包括:
写操作日志模块 5322 , 用于在日志表中记录写操作日志, 所述写操作日 志包括接收的至少一条写数据操作的时间点、 待写入数据以及 LBA;
快照处理模块 5323 , 用于当预设的快照时间点到达时, 对所述写操作日 志中的 LBA对应的数据块做快照处理得到快照数据,并在所述日志表中记录 快照日志, 所述快照日志包括所述预设的快照时间点。
恢复模块 5324, 用于根据所述快照时间点获取所述快照数据及所述快照 时间点之后的写操作日志, 以进行数据恢复。
程序 532中各模块的具体实现可以参见图 4所示实施例中的相应模块, 在此不赘述。
此外, 本发明实施例还提供一种存储系统, 该存储系统包括存储设备和 主机;
存储设备各模块的具体实现可以参见图 4所示实施例中的相应模块, 在 此不赘述。
所述主机, 用于向所述存储设备发送写数据操作。
在存储系统的另一个实施例中, 还可以包括连接设备, 所述连接设备用 于连接所述主机和所述存储设备。
所属领域的技术人员可以清楚地了解到, 为描述的方便和简洁, 上述描 述的设备和模块的具体工作过程, 可以参考前述方法实施例中的对应过程描 述, 在此不再赘述。
在本申请所提供的几个实施例中, 应该理解到, 所揭露的设备和方法, 可以通过其它的方式实现。 例如, 以上所描述的装置实施例仅仅是示意性的, 例如, 所述模块的划分, 仅仅为一种逻辑功能划分, 实际实现时可以有另外 的划分方式, 例如多个模块或组件可以结合或者可以集成到另一个设备中, 或一些特征可以忽略, 或不执行。 另一点, 所显示或讨论的相互之间的耦合 或直接耦合或通信连接可以是通过一些通信接口, 装置或模块的间接耦合或 通信连接, 可以是电性, 机械或其它的形式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的, 作 为模块显示的部件可以是或者也可以不是物理单元, 即可以位于一个地方, 或者也可以分布到多个网络单元上。 可以根据实际的需要选择其中的部分或 者全部, 模块来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能模块可以集成在一个处理模块中, 也可以是各个模块单独物理存在, 也可以两个或两个以上模块集成在一个模 块中。
最后应说明的是: 以上各实施例仅用以说明本发明的技术方案, 而非对 其限制; 尽管参照前述各实施例对本发明进行了详细的说明, 本领域的普通 技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改, 或者对其中部分或者全部技术特征进行等同替换; 而这些修改或者替换, 并 不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims

权 利 要 求 书
1、 一种数据处理方法, 其特征在于, 包括:
在日志表中记录写操作日志, 所述写操作日志包括接收的至少一条写数 据操作的时间点、 待写入数据以及逻辑块地址 LBA;
当预设的快照时间点到达时,对所述写操作日志中的 LBA对应的数据块 做快照处理得到快照数据, 并在所述日志表中记录快照日志, 所述快照曰志 包括所述预设的快照时间点;
根据所述快照时间点获取所述快照数据及所述快照时间点之后的写操作 日志, 以进行数据恢复。
2、 根据权利要求 1所述的方法, 其特征在于, 所述对所述写操作日志中
LBA对应的数据块做快照处理得到快照数据包括:
给所述 LBA对应的数据块做快照处理的标记, 以表示所述 LBA对应的 数据块需要做快照处理;
根据所述快照处理的标记, 将所述写操作日志中每条写操作日志的 LBA 对应的数据块中的数据保存至快照区。
3、 根据权利要求 1所述的方法, 其特征在于, 所述方法还包括: 将所述 日志表保存至存储设备中, 以进行数据恢复。
4、 根据权利要求 1所述的方法, 其特征在于, 所述方法还包括: 当预设 的快照时间点到达时, 悬挂写数据操作, 并将所述待写入数据写入存储设备 的非易失性存储介质中。
5、 根据权利要求 1所述的方法, 其特征在于, 所述根据所述快照时间点 获取所述快照数据及所述快照时间点之后的写操作日志, 以进行数据恢复包 括:
根据指定时间点确定所述指定时间点之前的最后一次快照时间点, 当所 述最后一次快照时间点为所述预设的快照时间点时, 得到所述预设的快照时 间点对应的快照数据; 获取所述预设的快照时间点之后的写操作日志;
根据所述预设的快照时间点之后的写操作日志, 以及所述预设的快照时 间点对应的快照数据恢复所述指定时间点的数据。
6、 根据权利要求 5所述的方法, 其特征在于, 所述方法还包括: 判断所述指定时间点是否是预设的快照时间点,如果是, 则通过预设的 快照时间点对应的快照数据恢复所述指定时间点的数据; 如果否, 则执行所 述根据所述指定时间点确定所述指定时间点之前的最后一次快照时间点的步 骤。
7、 一种存储设备, 其特征在于, 包括:
写操作日志模块, 用于在日志表中记录写操作日志, 所述写操作日志包 括接收的至少一条写数据操作的时间点、 待写入数据以及逻辑块地址 LBA; 快照处理模块, 用于当预设的快照时间点到达时, 对所述写操作日志中 的 LBA对应的数据块做快照处理得到快照数据,并在所述日志表中记录快照 日志, 所述快照日志包括所述预设的快照时间点;
恢复模块, 用于根据所述快照时间点获取所述快照数据及所述快照时间 点之后的写操作日志, 以进行数据恢复。
8、 根据权利要求 7 所述的存储设备, 其特征在于, 所述快照处理模块 包括:
标记单元, 用于给所述 LBA对应的数据块做快照处理的标记, 以表示所 述 LBA对应的数据块需要做快照处理;
保存单元, 用于根据所述快照处理的标记, 将所述写操作日志中每条写 操作日志的 LBA对应的数据块中的数据保存至快照区;
记录单元, 用于在所述日志表中记录快照日志, 所述快照日志包括所述 预设的快照时间点。
9、 根据权利要求 7所述的存储设备, 其特征在于, 所述装置还包括: 日志保存模块, 用于将所述日志表保存至存储设备中, 以进行数据恢复。
10、 根据权利要求 7所述的存储设备, 其特征在于, 所述装置还包括: 悬挂模块, 用于当预设的快照时间点到达时, 悬挂写数据操作, 并将所 述待写入数据写入存储设备的非易失性存储介质中。
11、根据权利要求 7所述的存储设备,其特征在于,所述恢复模块包括: 快照数据获取单元, 用于根据指定时间点确定所述指定时间点之前的最 后一次快照时间点, 当所述最后一次快照时间点为所述预设的快照时间点时, 得到所述预设的快照时间点对应的快照数据;
写操作日志获取单元, 用于获取所述预设的快照时间点之后的写操作日 志;
数据恢复单元, 用于根据所述预设的快照时间点之后的写操作日志, 以 及所述预设的快照时间点对应的快照数据恢复所述指定时间点的数据。
12、 根据权利要求 11 所述的存储设备, 其特征在于, 所述恢复模块还 包括:
判断单元,用于判断所述指定时间点是否是预设的快照时间点,如果是, 则通过预设的快照时间点对应的快照数据恢复所述指定时间点的数据; 如果 否, 则执行所述快照数据获取单元执行的动作。
13、 一种存储设备, 其特征在于, 包括: 处理器、 通信接口和通信总线; 其中, 所述处理器和所述通信接口通过所述通信总线进行通信; 所述处理器, 用于在日志表中记录写操作日志, 所述写操作日志包括接 收的至少一条写数据操作的时间点、 待写入数据以及逻辑块地址 LBA; 当预 设的快照时间点到达时,对所述写操作日志中的 LBA对应的数据块做快照处 理得到快照数据, 并在所述日志表中记录快照日志, 所述快照日志包括所述 预设的快照时间点; 根据所述快照时间点获取所述快照数据及所述快照时间 点之后的写操作日志, 以进行数据恢复。
14、 根据权利要求 13 所述的存储设备, 其特征在于, 所述处理器用于 对所述写操作日志中 LBA对应的数据块做快照处理得到快照数据包括:所述 处理器用于给所述 LBA对应的数据块做快照处理的标记, 以表示所述 LBA 对应的数据块需要做快照处理; 根据所述快照处理的标记, 将所述写操作日 志中每条写操作日志的 LBA对应的数据块中的数据保存至快照区。
15、根据权利要求 13所述的存储设备,其特征在于,所述处理器还用于, 将所述日志表保存至存储设备中, 以进行数据恢复。
16、根据权利要求 13所述的存储设备,其特征在于,所述处理器还用于, 当预设的快照时间点到达时, 悬挂写数据操作, 并将所述待写入数据写入存 储设备的非易失性存储介质中。
17、根据权利要求 13所述的存储设备, 其特征在于, 所述处理器用于根 据所述快照时间点获取所述快照数据及所述快照时间点之后的写操作日志, 以进行数据恢复包括: 所述处理器用于根据指定时间点确定所述指定时间点 之前的最后一次快照时间点, 当所述最后一次快照时间点为所述预设的快照 时间点时, 得到所述预设的快照时间点对应的快照数据; 获取所述预设的快 照时间点之后的写操作日志;根据所述预设的快照时间点之后的写操作日志, 以及所述预设的快照时间点对应的快照数据恢复所述指定时间点的数据。
18、 根据权利要求 17所述的存储设备, 其特征在于,
所述处理器还用于, 判断所述指定时间点是否是预设的快照时间点, 如 果是,则通过预设的快照时间点对应的快照数据恢复所述指定时间点的数据; 如果否, 则执行所述根据所述指定时间点确定所述指定时间点之前的最后一 次快照时间点的步骤。
19、 一种存储系统, 其特征在于, 包括如权利要求 7-12任意权利要求所 述的存储设备和主机;
所述主机, 用于向所述存储设备发送写数据操作。
20、 根据权利要求 19所述的存储系统, 其特征在于, 还包括连接设备; 所述连接设备用于连接所述主机和所述存储设备;
所述主机, 用于向所述存储设备发送写数据操作包括: 所述主机, 用于 通过所述连接设备向所述存储设备发送写数据操作。
PCT/CN2012/085107 2012-11-23 2012-11-23 数据处理方法和存储设备 WO2014079028A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN2012800029371A CN103221925A (zh) 2012-11-23 2012-11-23 数据处理方法和存储设备
PCT/CN2012/085107 WO2014079028A1 (zh) 2012-11-23 2012-11-23 数据处理方法和存储设备

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2012/085107 WO2014079028A1 (zh) 2012-11-23 2012-11-23 数据处理方法和存储设备

Publications (1)

Publication Number Publication Date
WO2014079028A1 true WO2014079028A1 (zh) 2014-05-30

Family

ID=48818189

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/085107 WO2014079028A1 (zh) 2012-11-23 2012-11-23 数据处理方法和存储设备

Country Status (2)

Country Link
CN (1) CN103221925A (zh)
WO (1) WO2014079028A1 (zh)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103617097B (zh) * 2013-11-19 2017-07-07 华为技术有限公司 文件恢复方法及装置
CN103617009A (zh) * 2013-12-10 2014-03-05 北京奇虎科技有限公司 一种开机启动中通过缓存向磁盘写数据的方法和装置
US9940205B2 (en) * 2015-03-27 2018-04-10 EMC IP Holding Company LLC Virtual point in time access between snapshots
CN107844491B (zh) * 2016-09-19 2021-11-16 阿里巴巴集团控股有限公司 一种在分布式系统中实现强一致性读操作的方法与设备
CN107967188B (zh) * 2016-10-18 2020-06-16 腾讯科技(深圳)有限公司 数据存储中的处理方法和装置
WO2019178839A1 (zh) * 2018-03-23 2019-09-26 华为技术有限公司 为分布式应用创建一致性快照的方法、装置和分布式系统
CN108762984B (zh) * 2018-05-23 2021-05-25 杭州宏杉科技股份有限公司 一种连续性数据备份的方法及装置
CN110825559A (zh) * 2018-08-10 2020-02-21 华为技术有限公司 一种数据处理方法及设备
CN110020935B (zh) * 2018-12-18 2024-01-19 创新先进技术有限公司 一种数据处理、计算方法、装置、设备及介质
CN112214471B (zh) * 2019-07-09 2024-04-05 浙江宇视科技有限公司 数据库管理方法、装置、计算机可读存储介质和电子设备
CN111949447A (zh) * 2020-08-11 2020-11-17 北京天融信网络安全技术有限公司 一种数据处理方法及数据处理系统
CN113885809B (zh) * 2021-12-07 2022-03-18 云和恩墨(北京)信息技术有限公司 数据管理系统及方法
CN116991542B (zh) * 2023-09-26 2024-02-13 苏州元脑智能科技有限公司 一种虚拟机快照方法、系统、电子设备及计算机存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101430657A (zh) * 2008-11-17 2009-05-13 华中科技大学 一种连续数据保护方法
CN101777016A (zh) * 2010-02-08 2010-07-14 北京同有飞骥科技有限公司 一种连续数据保护系统的快照存储和数据恢复方法
US20120144152A1 (en) * 2010-12-03 2012-06-07 Micron Technology, Inc. Transaction log recovery

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101430657A (zh) * 2008-11-17 2009-05-13 华中科技大学 一种连续数据保护方法
CN101777016A (zh) * 2010-02-08 2010-07-14 北京同有飞骥科技有限公司 一种连续数据保护系统的快照存储和数据恢复方法
US20120144152A1 (en) * 2010-12-03 2012-06-07 Micron Technology, Inc. Transaction log recovery

Also Published As

Publication number Publication date
CN103221925A (zh) 2013-07-24

Similar Documents

Publication Publication Date Title
WO2014079028A1 (zh) 数据处理方法和存储设备
US10146640B2 (en) Recovering a volume table and data sets
US8473462B1 (en) Change tracking for shared disks
US8706694B2 (en) Continuous data protection of files stored on a remote storage device
US7415488B1 (en) System and method for redundant storage consistency recovery
US8015157B2 (en) File sharing system, file server, and method for managing files
JP5716099B2 (ja) 情報処理システム及び情報処理システムの制御方法
US8700570B1 (en) Online storage migration of replicated storage arrays
WO2015010327A1 (zh) 数据发送方法、数据接收方法和存储设备
EP2879040B1 (en) Data storage method, data storage apparatus, and storage device
US7617259B1 (en) System and method for managing redundant storage consistency at a file system level
JP2004252686A (ja) 情報処理システム
WO2017132790A1 (zh) 数据恢复方法及存储设备
CN106776147B (zh) 一种差异数据备份方法和差异数据备份装置
US8555009B1 (en) Method and apparatus for enabling and managing application input/output activity while restoring a data store
JP2012507788A (ja) ストレージ・エリア・ネットワークを使用してコンピュータシステムを復旧するための方法およびシステム
US8140886B2 (en) Apparatus, system, and method for virtual storage access method volume data set recovery
WO2015085529A1 (zh) 数据复制方法、数据复制装置和存储设备
CN106528338B (zh) 一种远程数据复制方法、存储设备及存储系统
WO2015035814A1 (zh) 一种写数据方法及存储设备
JP2015527620A (ja) 計算機システム、サーバ、及び、データ管理方法
CN110825559A (zh) 一种数据处理方法及设备
US9367457B1 (en) Systems and methods for enabling write-back caching and replication at different abstraction layers
US11899540B2 (en) Regenerating a chain of backups
CN116339609A (zh) 一种数据处理方法以及存储设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12888757

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12888757

Country of ref document: EP

Kind code of ref document: A1