CN106909514B - Method and device for positioning snapshot disk address - Google Patents

Method and device for positioning snapshot disk address Download PDF

Info

Publication number
CN106909514B
CN106909514B CN201710117203.2A CN201710117203A CN106909514B CN 106909514 B CN106909514 B CN 106909514B CN 201710117203 A CN201710117203 A CN 201710117203A CN 106909514 B CN106909514 B CN 106909514B
Authority
CN
China
Prior art keywords
snapshot
data
address
disk
version
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710117203.2A
Other languages
Chinese (zh)
Other versions
CN106909514A (en
Inventor
张冲
王幸福
钱兵
王红涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201710117203.2A priority Critical patent/CN106909514B/en
Publication of CN106909514A publication Critical patent/CN106909514A/en
Application granted granted Critical
Publication of CN106909514B publication Critical patent/CN106909514B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • G06F12/0646Configuration or reconfiguration

Landscapes

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

Abstract

The embodiment of the invention discloses a positioning method of a snapshot disk address, which comprises the steps of judging whether a queried snapshot record exists in a snapshot version table in a data disk or not when detecting an address request for searching the snapshot disk; when the snapshot is recorded in the snapshot version table, further judging whether the snapshot version number is in the snapshot version table; when the snapshot version number is in the snapshot version table, determining the address of the snapshot disk according to the snapshot initial address in the snapshot version table and the address mapping table corresponding to the snapshot version number; and when the snapshot version number is judged not to be in the snapshot version table, determining a second snapshot version number meeting preset conditions in the snapshot version table, and determining the address of the snapshot disk according to the snapshot initial address and an address mapping table corresponding to the second snapshot version number. The efficiency of snapshot disk location and the flexibility of snapshots have been greatly improved. In addition, the embodiment of the invention also provides a corresponding implementation device, so that the method has higher practicability and the device has corresponding advantages.

Description

Method and device for positioning snapshot disk address
Technical Field
The embodiment of the invention relates to the field of multi-level snapshot technology and copy-on-write technology, in particular to a method and a device for positioning a snapshot disk address.
Background
With the development of virtualization technologies, the security of a virtualization environment has received great attention. The snapshot can carry out online data backup and recovery, or can carry out rapid data recovery when the application failure or file damage occurs to the storage device, so as to recover the data to the state of a certain available time point; or another data access channel can be provided for the storage user, and the user can access the snapshot data when the original data is subjected to online application processing. Therefore, the snapshot is also developed as one of the security measures for improving the virtualization environment.
A snapshot is an available copy of a given data set that includes an image of the corresponding data at some point in time (the point in time at which the copy began). Either as a copy of the data it represents or as a replica of the data. At present, for practical applications with more reads and less writes, the technology of implementing snapshot can be implemented by Copy-On-Write (COW). That is, when data is written to a certain storage location for the first time, the original content is first read out, and written to another location (snapshot disk), and then the data is written to the storage device. And the next write operation to this location will not perform a copy-on-write operation.
In the execution process of COW, when a certain storage location is written for the first time, one read operation (reading data of the original location) and two write operations (writing the original location and writing the snapshot disk) need to be completed. When reading, if reading the current snapshot version, directly executing the reading operation; if the snapshot version before reading or the earlier snapshot version, the metadata of the corresponding data block needs to be found first, i.e. the address information of the snapshot disk needs to be queried. When inquiring the address information of the snapshot disk, the prior art needs to inquire each snapshot disk in turn, then determine the address of the snapshot disk related to the snapshot time in turn, and then copy the data to the data disk in turn. When the number of snapshots is small, it is feasible to sequentially query each snapshot disk; however, when there are multiple levels of snapshots, it is obvious that determining the snapshot disk position corresponding to the snapshot version for the same data block after several copies requires a lot of time, which is time-consuming and labor-consuming, and the overall positioning rate is low.
In view of this, a problem to be solved by those skilled in the art is how to improve multi-level snapshots based on a copy-on-write technology and quickly locate address information of a snapshot disk.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for positioning a snapshot disk address, so as to quickly identify and position the address of the snapshot disk.
In order to solve the above technical problems, embodiments of the present invention provide the following technical solutions:
an embodiment of the present invention provides a method for positioning a snapshot disk address, including:
when an address request for searching a snapshot disk is detected, a snapshot version table of data disk metadata is obtained;
judging whether the inquired snapshot record exists in the snapshot version table or not;
when the snapshot record is judged to be in the snapshot version table, judging whether the snapshot version number is in the snapshot version table or not;
when the snapshot version number is judged to be in the snapshot version table, determining a snapshot disk address according to a snapshot initial address in the snapshot version table and an address mapping table corresponding to the snapshot version number; and when the snapshot version number is judged not to be in the snapshot version table, determining a second snapshot version number meeting preset conditions in the snapshot version table, and determining a snapshot disk address according to a snapshot initial address in the snapshot version table and an address mapping table corresponding to the second snapshot version number.
Optionally, the detecting, when an address request for searching a snapshot disk is detected, includes:
when it is detected that the data to be written is old data of the data disc, or
When a rollback operation is detected for a version.
Optionally, the method further includes:
and copying a data block to the data disk according to the snapshot address mapping table of the snapshot disk, the address mapping table of the data disk and the snapshot initial address so as to restore the data block of the data disk corresponding to the snapshot time.
Optionally, the snapshot address mapping table of the snapshot disk is address mapping information of the changed data block.
Optionally, the address mapping table of the data disk includes the number of snapshots of the data block and the location of the old data stored in each snapshot.
Optionally, the metadata of the data disk includes disk information, volume information, the snapshot version table, the address mapping table, and a data area.
Optionally, the metadata of the snapshot disk includes disk information, volume information, a snapshot address mapping table, and a snapshot data area.
Another aspect of the embodiments of the present invention provides a snapshot disk address location apparatus, including:
the information acquisition module is used for acquiring a snapshot version table of the metadata of the data disc when an address request for searching the snapshot disc is detected;
the judging module is used for judging whether the inquired snapshot record exists in the snapshot version table or not; when the snapshot record is judged to be in the snapshot version table, judging whether the snapshot version number is in the snapshot version table or not;
the address determination module is used for determining a snapshot disk address according to a snapshot initial address in the snapshot version table and an address mapping table corresponding to the snapshot version number when the snapshot version number is judged to be in the snapshot version table; and when the snapshot version number is judged not to be in the snapshot version table, determining a second snapshot version number meeting preset conditions in the snapshot version table, and determining a snapshot disk address according to a snapshot initial address in the snapshot version table and an address mapping table corresponding to the second snapshot version number.
Optionally, the information obtaining module is a module that obtains a snapshot version table of metadata of the data disc when it is detected that the data to be written is old data of the data disc, or when it is detected that a rollback operation is performed on the version.
Optionally, the method further includes:
and the data restoring module is used for copying the data block to the data disk according to the address mapping table of the snapshot disk, the address mapping table of the data disk and the snapshot initial address so as to restore the data block of the data disk corresponding to the snapshot time.
The embodiment of the invention provides a positioning method of a snapshot disk address, which comprises the steps of judging whether a queried snapshot record exists in a snapshot version table in a data disk or not when an address request for searching the snapshot disk is detected; when the snapshot is recorded in the snapshot version table, further judging whether the snapshot version number is in the snapshot version table; when the snapshot version number is in the snapshot version table, determining the address of the snapshot disk according to the snapshot initial address in the snapshot version table and the address mapping table corresponding to the snapshot version number; and when the snapshot version number is judged not to be in the snapshot version table, determining a second snapshot version number meeting preset conditions in the snapshot version table, and determining the address of the snapshot disk according to the snapshot initial address and an address mapping table corresponding to the second snapshot version number.
The technical scheme provided by the application has the advantages that the snapshot record information is added into the data disk, when the snapshot disk needs to be positioned, the version information of the current query snapshot is determined according to the snapshot version table in the data disk metadata, and then the address of the snapshot disk is determined according to the snapshot initial address in the snapshot version table and the address mapping table corresponding to the snapshot version number, so that the time for querying the snapshot disk is greatly saved, the positioning efficiency of the snapshot disk is improved, the snapshot can be quickly rolled back to any snapshot point in the multi-stage snapshot, the flexibility of the snapshot is improved, and the time consistency of each data block is ensured.
In addition, the embodiment of the invention also provides a corresponding implementation device for the positioning method of the snapshot disk address, so that the method has higher practicability and the device has corresponding advantages.
Drawings
In order to more clearly illustrate the embodiments or technical solutions of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for locating a snapshot disk address according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of another snapshot disk address location method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a data disc metadata structure according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a snapshot disk metadata structure according to an embodiment of the present invention;
FIG. 5 is a block diagram of an illustrative example provided by an embodiment of the present invention;
fig. 6 is a structural diagram of an embodiment of a positioning apparatus for a snapshot disk address according to an embodiment of the present invention;
fig. 7 is a structural diagram of another embodiment of a positioning apparatus for a snapshot disk address according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the 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 terms "first," "second," "third," "fourth," and the like in the description and claims of this application and in the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements but may include other steps or elements not expressly listed.
Various non-limiting embodiments of the present application are described in detail below.
Referring to fig. 1, fig. 1 is a schematic flowchart of a snapshot disk address positioning method according to an embodiment of the present invention, where the embodiment of the present invention includes the following steps:
s101: when an address request for searching the snapshot disk is detected, a snapshot version table of the data disk metadata is obtained.
The snapshot version table is established on the data disk and can include the first address of the snapshot metadata and the snapshot version number, and the first address of the snapshot metadata is the address of the first snapshot. When recording the snapshot version table, the multi-level snapshots are regarded as a whole, for each data block, when copy-on-write occurs, the relevant information of the snapshot version number of the data block is recorded, and simultaneously, the snapshot condition of the data block is recorded in the address mapping area, so as to realize recording the change condition of the data block in the data disk.
The snapshot version table adds the snapshot information mark to the data block address mapping information of the data disc, so that the storage position of the data block on a snapshot time node can be determined only through complex query of a plurality of snapshots for the time node of a certain snapshot when the snapshot version is rolled back.
Correspondingly, when the old data is stored in the snapshot disk after the snapshot occurs, only the address mapping table for changing the data blocks is established, that is, the mapping relationship between the data block address of the old data replaced from the data disk and the data block address stored in the snapshot disk is established, but not the address mapping of all the data blocks in the snapshot disk.
Only the address mapping relation is recorded, namely only the modified data block information is mapped, so that the address space of the snapshot disk is saved, and the time complexity of retrieving the address mapping table is reduced.
Specifically, the snapshot disk needs to be searched, generally when the data to be written is detected to be old data of the data disk, or when a rollback operation is performed on the detected version.
For writing data, it is generally required to first detect whether currently written data covers old data of a data disk, that is, whether a data block that has been snapshot is covered, and determine a location of a snapshot disk where the data block is stored. For example, when the currently written data is an employee internal information registration form, and a new employee continuously enters the information registration form before the employee continues to be in a snapshot, when the employee performs a supplementary registration information form again, the employee information registration form updated when the employee enters the job, that is, the address of the snapshot disk requiring the time of the job entry, needs to be found.
And when the current data does not cover the old data written before, directly copying the data of the current data disk once, and then writing the data to be written into the vacant space of the data disk.
When the rollback of the snapshot version is detected, the data block information and the state of the data disk corresponding to the version number to which the snapshot version needs to be rolled back are required, and the data can be searched by determining the snapshot disk corresponding to the rollback version number.
The metadata structure diagram of the data disk is shown in fig. 2, and may include disk information, volume information, a snapshot version table, an address mapping table, and a data area, where the address mapping table includes the number of snapshots of a data block and the storage location of old data in each snapshot. Of course, other documents may be included, and the present application is not limited thereto.
The metadata structure of the snapshot disk is shown in fig. 3 and may include disk information, volume information, an address mapping table, and a data area, where the address mapping table is an address mapping table of the snapshot disk and includes a mapping of address information of changed data recorded in the snapshot, including a data block address of old data in an original data disk and a data block address information in the snapshot disk. Of course, other documents may be included, and the present application is not limited thereto.
The address mapping table can use the hash table to construct address mapping, thereby reducing the expense of a CPU, and adopting a simple data structure to quickly position the address of a data block when the duplication occurs. Meanwhile, the snapshot condition of the data block is recorded in the data disc metadata, and the snapshot data does not need to be searched in each snapshot in a traversing manner during rollback and can be directly obtained through the address mapping index.
S102: and judging whether the inquired snapshot record exists in the snapshot version table or not.
When a request for searching for a snapshot disk is currently detected, a snapshot record does not necessarily exist in the snapshot version table, possibly because a user forgets or is uncertain whether a snapshot is taken too soon before. When the snapshot record is determined not to be in the snapshot version table, the snapshot disk does not exist, that is, the current data does not pass through the snapshot and is still stored in the data disk.
For the above situation, in the prior art, it is often determined that the data block does not need to be replaced when all snapshots are traversed and no snapshot information is found, but in the technical scheme provided by the application, the snapshot version table of the data disk is searched, and when the data block has no snapshot information, no snapshot disk needs to be searched, so that the search performance is greatly improved.
S103: and when the snapshot record is judged to be in the snapshot version table, judging whether the snapshot version number is in the snapshot version table or not.
When the snapshot record is stored in the snapshot version table, it is indicated that the data block is subjected to snapshot processing, and the snapshot version number of the snapshot record needs to be determined, so as to determine the position of the snapshot disk. But the version number of the snapshot is not saved for a special reason, so that the version number needs to be searched and judged.
S104: and when the snapshot version number is judged to be in the snapshot version table, determining the address of the snapshot disk according to the snapshot initial address in the snapshot version table and the address mapping table corresponding to the snapshot version number.
When the snapshot version number is in the snapshot version table, determining that the snapshot is the snapshot of the second time according to the address mapping table corresponding to the snapshot version number, and storing the data of the snapshot in which snapshot disk, and then finding all the data records of the snapshot before the data block is found according to the address mapping relationship in the snapshot disk and the snapshot initial address.
S105: and when the snapshot version number is judged not to be in the snapshot version table, determining a second snapshot version number meeting preset conditions in the snapshot version table, and determining a snapshot disk address according to a snapshot initial address in the snapshot version table and an address mapping table corresponding to the second snapshot version number.
When the snapshot version number corresponding to the snapshot record to be queried does not exist in the snapshot table, the version record which is the closest to the snapshot version number to be queried and is greater than the version number can be searched, that is, the second snapshot version number meeting the preset condition, for example, for data blocks 1, 2, 3, and 4 in the data disk, the data block 1 is rewritten in the third snapshot, the data block 2 is rewritten in the third snapshot and the second snapshot, and the data block 4 is rewritten in the first snapshot. When the data disc needs to be rolled back to the first snapshot version, the 1 st data block is found to be duplicated in the 3 rd snapshot, and at the time point of the first snapshot, the information stored in the 1 st data block of the data disc is consistent with the information stored in the 1 st data block of the current 3 rd snapshot. For the data block No. 2, the data block is duplicated in the 2 nd snapshot and the 3 rd snapshot, so that the data duplicated for the first time is the oldest data information, and the information shows a trend from the first snapshot version to the high snapshot version in multiple duplications of the same data block. Therefore, when a certain data block of the data disk is rewritten for multiple times in multiple snapshots, it is feasible to rollback to version number version data of the last snapshot of the version to be rolled back.
The technical scheme provided by the application has the advantages that the snapshot record information is added into the data disk, when the snapshot disk needs to be positioned, the version information of the current query snapshot is determined according to the snapshot version table in the data disk metadata, and then the address of the snapshot disk is determined according to the snapshot initial address in the snapshot version table and the address mapping table corresponding to the snapshot version number, so that the time for querying the snapshot disk is greatly saved, the positioning efficiency of the snapshot disk is improved, the snapshot can be quickly rolled back to any snapshot point in the multi-stage snapshot, the flexibility of the snapshot is improved, and the time consistency of each data block is ensured.
In a specific practical situation, after the position of the snapshot disk is determined, the data disk of the current snapshot point needs to be restored. In view of the above, the present application provides another embodiment based on the above-mentioned embodiment, please refer to fig. 4, which specifically includes:
s106: and copying a data block to the data disk according to the snapshot address mapping table of the snapshot disk, the address mapping table of the data disk and the snapshot initial address so as to restore the data block of the data disk corresponding to the snapshot time.
Since the snapshot form is based on copy-on-write implementation, the data disks store the current most recent data messages. When the multi-level snapshots pass, only the data blocks which are changed for the current snapshot are stored in the snapshot disk, so that when the snapshot is rolled back to a certain snapshot version, the address of the positioned snapshot disk is probably not the data corresponding to the real current version, backtracking is needed according to the initial address of the snapshot to find the data which is changed for each previous snapshot of the data block, and then all the data are copied to the data disk, so that the state of the data blocks of the data disk when the snapshot version is rolled back is realized.
For example, referring to fig. 5, the data disc has 6 data blocks, wherein the data blocks No. 1, 3, 5, and 6 have data written therein. After the first snapshot, the data blocks No. 5 and No. 6 are overwritten, and the old data of the data disk is copied to the data blocks No. 5 and No. 6 of the first snapshot disk. After the second snapshot, the data block of data disk number 3 is overwritten, and the same operation is performed. After the third snapshot, the data blocks No. 1, 3 and 5 of the data disk are rewritten, and the same operation is performed. When the snapshot version 1 needs to be backed off, the data blocks 5 and 6 of the snapshot disk are firstly copied to the data disk, and for the data blocks 1 and 3, the data block 1 is found to be rewritten in the snapshot 3, so that it can be inferred that the information stored in the data block 1 of the data disk is consistent with the information stored in the data block 1 of the current snapshot 3 at the time point of the first snapshot. For the data block No. 3, the data block is duplicated in the 2 nd snapshot and the 3 rd snapshot, so that it can be clearly known that the data duplicated for the first time is the oldest data information, and in multiple duplications of the same data block, the information shows a trend from the first snapshot version to the high snapshot version to be newer and newer.
The snapshot form is realized based on copy-on-write, the latest data information stored in the data disk is normally processed when a read request exists, no extra overhead exists, the data disk data block is repeatedly written to be copied, one disk write operation is additionally added, and for the conditions of high read request and low write request, the technical scheme provided by the application can improve the positioning efficiency of the snapshot disk, quickly rollback to any snapshot point, improve the flexibility of the snapshot and ensure the time consistency of each data block.
The embodiment of the invention also provides a corresponding implementation device for the positioning method of the snapshot disk address, so that the method has higher practicability. The following describes a positioning apparatus for a snapshot disk address according to an embodiment of the present invention, and the positioning apparatus for a snapshot disk address described below and the positioning method for a snapshot disk address described above may be referred to correspondingly.
Referring to fig. 6, fig. 6 is a structural diagram of a positioning apparatus for a snapshot disk address according to an embodiment of the present invention, in a specific implementation manner, the apparatus may include:
the obtaining information module 601 is configured to obtain a snapshot version of the metadata of the data disk when an address request for searching for a snapshot disk is detected.
A judging module 602, configured to judge whether the queried snapshot record exists in the snapshot version table; and when the snapshot record is judged to be in the snapshot version table, judging whether the snapshot version number is in the snapshot version table or not.
An address determining module 603, configured to determine, when it is determined that the snapshot version number is in the snapshot version table, a snapshot disk address according to a snapshot initial address in the snapshot version table and an address mapping table corresponding to the snapshot version number; and when the snapshot version number is judged not to be in the snapshot version table, determining a second snapshot version number meeting preset conditions in the snapshot version table, and determining a snapshot disk address according to a snapshot initial address in the snapshot version table and an address mapping table corresponding to the second snapshot version number.
The information obtaining module 601 may be a module that obtains a snapshot version table of metadata of the data disc when it is detected that the data to be written is old data of the data disc or when it is detected that a rollback operation is performed on a version.
Optionally, in other embodiments of this embodiment, referring to fig. 7, the apparatus may further include:
a data restoring module 604, configured to copy a data block to the data disk according to the address mapping table of the snapshot disk, the address mapping table of the data disk, and the snapshot initial address, so as to restore the data block of the data disk corresponding to the snapshot time. The functions of the functional modules for positioning the snapshot disk address in the embodiment of the present invention may be specifically implemented according to the method in the foregoing method embodiment, and the specific implementation process may refer to the related description of the foregoing method embodiment, which is not described herein again.
As can be seen from the above, in the embodiment of the present invention, by adding the snapshot record information to the data disk, when the snapshot disk needs to be located, the version information of the current query snapshot is determined according to the snapshot version table in the data disk metadata, and then the address of the snapshot disk is determined according to the snapshot initial address in the snapshot version table and the address mapping table corresponding to the snapshot version number, so that the time for querying the snapshot disk is greatly saved, the efficiency for locating the snapshot disk is improved, the snapshot can be quickly rolled back to any snapshot point in the multi-level snapshot, the flexibility of the snapshot is improved, and the time consistency of each data block is ensured.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The method and the device for positioning the snapshot disk address provided by the invention are described in detail above. The principles and embodiments of the present invention are explained herein using specific examples, which are presented only to assist in understanding the method and its core concepts. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.

Claims (6)

1. A method for positioning snapshot disk addresses, comprising:
when an address request for searching a snapshot disk is detected, a snapshot version table of data disk metadata is obtained;
judging whether the inquired snapshot record exists in the snapshot version table or not;
when the snapshot record is judged to be in the snapshot version table, judging whether the snapshot version number is in the snapshot version table or not;
when the snapshot version number is judged to be in the snapshot version table, determining a snapshot disk address according to a snapshot initial address in the snapshot version table and an address mapping table corresponding to the snapshot version number; when the snapshot version number is judged not to be in the snapshot version table, determining a second snapshot version number meeting preset conditions in the snapshot version table, and determining a snapshot disk address according to a snapshot initial address in the snapshot version table and an address mapping table corresponding to the second snapshot version number;
copying a data block to the data disk according to the snapshot address mapping table of the snapshot disk, the address mapping table of the data disk and the snapshot initial address, so as to restore the data block of the data disk corresponding to the snapshot time;
the address mapping table corresponding to the snapshot version number is a mapping relation between a data block address of old data replaced from a data disc and a data block address stored in the snapshot disc, the snapshot address mapping table of the snapshot disc is address mapping information of a changed data block in a current snapshot, and the address mapping table of the data disc comprises the snapshot times of the data block and the storage position of the old data in each snapshot; the second snapshot version number is the version number of the last snapshot of the snapshot version numbers, and the second snapshot version number value is greater than the snapshot version number value; the initial address of the snapshot is the initial address of the snapshot metadata, and the initial address of the snapshot metadata is the address of the first snapshot.
2. The method according to claim 1, wherein the detecting an address request for searching a snapshot disk comprises:
when it is detected that the data to be written is old data of the data disc, or
When a rollback operation is detected for a version.
3. The method of claim 1, wherein the metadata of the data disk comprises disk information, volume information, the snapshot version table, an address mapping table of the data disk, and a data area.
4. The method of claim 3, wherein the metadata of the snapshot disk comprises disk information, volume information, a snapshot address mapping table, and a snapshot data area.
5. An apparatus for locating a snapshot disk address, comprising:
the information acquisition module is used for acquiring a snapshot version table of the metadata of the data disc when an address request for searching the snapshot disc is detected;
the judging module is used for judging whether the inquired snapshot record exists in the snapshot version table or not; when the snapshot record is judged to be in the snapshot version table, judging whether the snapshot version number is in the snapshot version table or not;
the address determination module is used for determining a snapshot disk address according to a snapshot initial address in the snapshot version table and an address mapping table corresponding to the snapshot version number when the snapshot version number is judged to be in the snapshot version table; when the snapshot version number is judged not to be in the snapshot version table, determining a second snapshot version number meeting preset conditions in the snapshot version table, and determining a snapshot disk address according to a snapshot initial address in the snapshot version table and an address mapping table corresponding to the second snapshot version number; the second snapshot version number is the version number of the last snapshot of the snapshot version numbers, and the second snapshot version number value is greater than the snapshot version number value; the initial address of the snapshot is the initial address of the snapshot metadata, and the initial address of the snapshot metadata is the address of the first snapshot; the address mapping table corresponding to the snapshot version number is a mapping relation between a data block address of old data replaced from the data disc and a data block address stored in the snapshot disc;
the data restoring module is used for copying a data block to the data disk according to the address mapping table of the snapshot disk, the address mapping table of the data disk and the snapshot initial address so as to restore the data block of the data disk corresponding to the snapshot time; the snapshot address mapping table of the snapshot disk is address mapping information of a changed data block in a current snapshot, and the address mapping table of the data disk comprises the snapshot times of the data block and the storage position of old data in each snapshot.
6. The apparatus according to claim 5, wherein the information obtaining module is a module that obtains a snapshot version table of metadata of the data disc when detecting that the data to be written is old data of the data disc or when detecting that a rollback operation is performed on a version.
CN201710117203.2A 2017-03-01 2017-03-01 Method and device for positioning snapshot disk address Active CN106909514B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710117203.2A CN106909514B (en) 2017-03-01 2017-03-01 Method and device for positioning snapshot disk address

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710117203.2A CN106909514B (en) 2017-03-01 2017-03-01 Method and device for positioning snapshot disk address

Publications (2)

Publication Number Publication Date
CN106909514A CN106909514A (en) 2017-06-30
CN106909514B true CN106909514B (en) 2021-04-30

Family

ID=59185999

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710117203.2A Active CN106909514B (en) 2017-03-01 2017-03-01 Method and device for positioning snapshot disk address

Country Status (1)

Country Link
CN (1) CN106909514B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107526656B (en) * 2017-08-31 2020-11-20 苏州浪潮智能科技有限公司 Cloud restoration method and device
CN110309100B (en) * 2018-03-22 2023-05-23 腾讯科技(深圳)有限公司 Snapshot object generation method and device
CN111007990B (en) * 2019-12-24 2023-09-19 曙光信息产业(北京)有限公司 Positioning method for quickly positioning data block references in snapshot system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009097106A1 (en) * 2008-01-28 2009-08-06 Wms Gaming Inc. Wagering game machine upgrade and rollback
CN105912425A (en) * 2016-04-08 2016-08-31 杭州宏杉科技有限公司 Snapshot image establishment and rollback method and apparatus
CN105938457A (en) * 2016-03-31 2016-09-14 华为技术有限公司 Data filtering method, and device and data reading system

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7043485B2 (en) * 2002-03-19 2006-05-09 Network Appliance, Inc. System and method for storage of snapshot metadata in a remote file
CN100565530C (en) * 2007-12-17 2009-12-02 中国科学院计算技术研究所 A kind of fast photographic system and using method thereof
US9323513B2 (en) * 2014-03-03 2016-04-26 Bank Of America Corporation Build deployment automation for information technology management
CN105095016B (en) * 2014-05-16 2018-05-18 北京云巢动脉科技有限公司 A kind of disk snapshot rollback method and device
CN104407935B (en) * 2014-11-07 2018-05-18 华为数字技术(成都)有限公司 Snapshot rollback method and storage device
CN105988895B (en) * 2015-02-10 2020-11-03 中兴通讯股份有限公司 Snapshot processing method and device
CN105988723A (en) * 2015-02-12 2016-10-05 中兴通讯股份有限公司 Snapshot processing method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009097106A1 (en) * 2008-01-28 2009-08-06 Wms Gaming Inc. Wagering game machine upgrade and rollback
CN105938457A (en) * 2016-03-31 2016-09-14 华为技术有限公司 Data filtering method, and device and data reading system
CN105912425A (en) * 2016-04-08 2016-08-31 杭州宏杉科技有限公司 Snapshot image establishment and rollback method and apparatus

Also Published As

Publication number Publication date
CN106909514A (en) 2017-06-30

Similar Documents

Publication Publication Date Title
US11256715B2 (en) Data backup method and apparatus
US9009429B2 (en) Deduplication of data stored in a copy volume
US9009428B2 (en) Data store page recovery
CN108319602B (en) Database management method and database system
US8250033B1 (en) Replication of a data set using differential snapshots
CN102012852B (en) Method for implementing incremental snapshots-on-write
EP2759942A1 (en) Computer system, file management method and metadata server
US7668875B2 (en) Data storage device, method of rearranging data and recording medium therefor
MX2014002960A (en) Nonvolatile media dirty region tracking.
CN106909514B (en) Method and device for positioning snapshot disk address
JP2017079053A (en) Methods and systems for improving storage journaling
US20170123928A1 (en) Storage space reclamation for zoned storage
CN111581022B (en) Data recovery method and system
CN111382011B (en) File data access method and device and computer readable storage medium
CN109496292A (en) A kind of disk management method, disk management device and electronic equipment
CN108604201B (en) Snapshot rollback method, device, storage controller and system
CN103403709A (en) Method, device and system for data reading and writing
CN108170766B (en) CDP backup and recovery method for ensuring database consistency
CN113448917A (en) Cataloging of files associated with snapshots
CN110795282B (en) Data rollback method, device, equipment and storage medium
CN109325005B (en) Data processing method and electronic equipment
CN107704208B (en) Method, device and medium for repairing metadata
CN110209351B (en) Distributed storage data processing method and device
CN115543685A (en) Database rollback method and device, electronic equipment and storage medium
JPS62245348A (en) Method and device for updating data base

Legal Events

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