CN116541468A - Snapshot data synchronization method, storage master, electronic device and storage medium - Google Patents

Snapshot data synchronization method, storage master, electronic device and storage medium Download PDF

Info

Publication number
CN116541468A
CN116541468A CN202310819811.3A CN202310819811A CN116541468A CN 116541468 A CN116541468 A CN 116541468A CN 202310819811 A CN202310819811 A CN 202310819811A CN 116541468 A CN116541468 A CN 116541468A
Authority
CN
China
Prior art keywords
physical block
block address
volume
linked list
volume 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.)
Granted
Application number
CN202310819811.3A
Other languages
Chinese (zh)
Other versions
CN116541468B (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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202310819811.3A priority Critical patent/CN116541468B/en
Publication of CN116541468A publication Critical patent/CN116541468A/en
Application granted granted Critical
Publication of CN116541468B publication Critical patent/CN116541468B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/219Managing data history or versioning

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a snapshot data synchronization method, a storage main end, electronic equipment and a storage medium, and relates to the technical field of computer systems and storage; generating a volume version information table in response to a source volume creating operation, wherein the volume version information table comprises an initial volume version number; responding to the snapshot creation operation, updating the version number of the initial volume, and generating an updated volume version number; receiving a write operation, the write operation including writing data; generating a physical block address linked list according to the type of the written data by combining the initial volume version number and the updated volume version number; and synchronizing the volume version information table and the physical block address linked list to an auxiliary end, wherein the auxiliary end is used for generating a snapshot volume of the auxiliary volume according to the volume version information table and the physical block address linked list. According to the embodiment of the invention, the main terminal creates the snapshot of the source volume without other operations on the auxiliary terminal, the auxiliary volume of the auxiliary terminal also has corresponding snapshot information, and the snapshot data of the main terminal and the auxiliary terminal are ensured to be consistent based on time points.

Description

Snapshot data synchronization method, storage master, electronic device and storage medium
Technical Field
The present invention relates to the field of computer systems and storage technologies, and in particular, to a snapshot data synchronization method, a storage master, an electronic device, and a storage medium.
Background
Along with the explosion growth of information data, the requirements on the reliability and protection strategy of the data in various scenes are more and more severe, and the requirements on the purpose of consistent synchronization of the main-end snapshot data and the auxiliary-end snapshot data are higher. However, current remote copy master is creating a snapshot of the logical volume. The adopted scheme time points cannot achieve time consistency or avoid repeated transmission of the synchronized data.
Disclosure of Invention
In view of the foregoing, embodiments of the present invention are directed to providing a snapshot data synchronization method, a storage master, an electronic device, and a storage medium that overcome or at least partially solve the foregoing problems.
In order to solve the above problems, an embodiment of the present invention discloses a snapshot data synchronization method, which is applied to a main terminal, where the main terminal is connected with an auxiliary terminal, and the method includes:
in response to a create source volume operation, generating a volume version information table, the volume version information table including an initial volume version number;
updating the initial volume version number in response to a snapshot creation operation, and generating an updated volume version number;
receiving a write operation, the write operation comprising writing data;
Generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the written data;
and synchronizing the volume version information table and the physical block address linked list to the auxiliary end, wherein the auxiliary end is used for generating a snapshot volume of the auxiliary volume according to the volume version information table and the physical block address linked list.
Optionally, the method further comprises:
and expanding the coding length of the physical block address.
Optionally, the step of generating the volume version information table in response to the creating the source volume operation includes:
initializing the physical block address to generate the initial volume version number;
and combining the initial volume version number with the identification number of the source volume to generate the volume version information table.
Optionally, the step of updating the initial volume version number and generating an updated volume version number includes:
and increasing the initial volume version number to generate the updated volume version number.
Optionally, the method further comprises:
the update volume version number updates the initial volume version number.
Optionally, the step of generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the write data includes:
Judging whether the type of the written data is modified data or not;
generating a physical block address linked list according to the version number of the update volume in response to the written data not being modified data;
and generating a physical block address linked list by combining the initial volume version number and the updated volume version number in response to the written data being modified data.
Optionally, the step of generating a physical block address linked list by combining the initial volume version number and the updated volume version number in response to the write data being modified data includes:
judging whether the physical block corresponding to the modification data is modified for the first time after the snapshot creation operation;
responding to the physical block corresponding to the modification data as the first modification after the snapshot creation operation, recording the initial volume version number and the update volume version number to generate the physical block address linked list, and writing the modification data into the physical block corresponding to the update volume version number;
and in response to that the physical block corresponding to the modification data is not modified for the first time after the snapshot creation operation, recording the initial volume version number to generate the physical block address linked list, and writing the modification data into the physical block corresponding to the initial volume version number.
Optionally, the method further comprises:
responding to a secondary snapshot creation operation, and judging whether the modification of the secondary snapshot creation operation to the physical block is the first modification;
responding to the modification of the physical block by the secondary snapshot creation operation as the first modification, updating the update volume version number in the volume version information table, and generating a secondary update volume version number;
and modifying the data of the physical block address corresponding to the secondary snapshot creation operation in response to the modification of the physical block by the secondary snapshot creation operation being non-primary modification.
Optionally, the method further comprises:
and inserting the secondary updated volume version number into the header of the volume version information table.
Optionally, the step of synchronizing the volume version information table and the physical block address linked list to the secondary side includes:
and in response to the update of the volume version information table, synchronizing the volume version information table and the physical block address linked list to the auxiliary end.
Optionally, the step of synchronizing the volume version information table and the physical block address linked list to the secondary end further includes:
and synchronizing the physical block corresponding to the physical block address linked list to the auxiliary end.
Optionally, the master side is provided with a metadata bitmap, and the method further includes:
and when the physical blocks corresponding to the physical block address linked list are synchronized to the auxiliary end, marking the physical blocks corresponding to the physical block address linked list on the metadata bitmap so as to update the metadata bitmap.
Optionally, the step of synchronizing the physical block corresponding to the physical block address linked list to the auxiliary end includes:
traversing the physical block address linked list to determine a physical block corresponding to a physical block address of the physical block address linked list;
judging whether a physical block corresponding to a physical block address of the physical block address linked list is a marked physical block or not;
in response to judging that a physical block corresponding to a physical block address of the physical block address linked list is a marked physical block, skipping a physical block synchronization operation corresponding to the physical block address of the physical block address linked list;
and responding to the judgment that the physical block corresponding to the physical block address of the physical block address linked list is a non-marked physical block, and synchronizing the physical block corresponding to the physical block address of the physical block address linked list.
The embodiment of the invention also discloses a snapshot data synchronization method which is applied to the auxiliary end, wherein the auxiliary end is connected with the main end, and the main end is used for responding to the operation of creating the source volume to generate a volume version information table which comprises an initial volume version number; updating the initial volume version number in response to a snapshot creation operation, and generating an updated volume version number; receiving a write operation, the write operation comprising writing data; generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the written data; synchronizing the volume version information table and the physical block address linked list to the auxiliary end; the method comprises the following steps:
receiving the volume version information table and the physical block address linked list;
and generating a snapshot volume of the auxiliary volume according to the volume version information table and the physical block address linked list.
Optionally, the step of generating the snapshot volume of the secondary volume according to the volume version information table and the physical block address linked list includes:
generating a logical block address physical block address association tree according to the volume version information table and the physical block address linked list;
And generating the snapshot volume of the auxiliary volume by adopting the logical block address physical block address association tree.
Optionally, the step of generating a logical block address physical block address association tree according to the volume version information table and the physical block address linked list includes:
judging whether the physical blocks corresponding to the physical block addresses in the physical block address linked list are synchronous or not according to the physical block address linked list;
synchronizing the volume version information table in response to the synchronization of the physical block corresponding to the physical block address in the physical block address linked list, and generating the logical block address physical block address association tree according to the synchronized volume version information table;
and in response to the fact that the physical blocks corresponding to the physical block addresses in the physical block address linked list are not synchronous, reading a history volume version information table, and generating the logical block address physical block address association tree according to the history volume version information table and the volume version information table.
Optionally, the step of generating the logical block address physical block address association tree according to the history volume version information table and the volume version information table includes:
Judging whether the historical volume version information table is consistent with the volume version information table or not;
updating data corresponding to the physical block address in the physical block address linked list to generate the logical block address physical block address association tree in response to the fact that the historical volume version information table is consistent with the volume version information table;
and in response to the fact that the historical volume version information table is consistent with the volume version information table, updating the physical block address in the physical block address linked list by adopting the volume version information table, generating an updated physical block address linked list, and generating the logical block address physical block address association tree by adopting the updated physical block address linked list.
Optionally, the step of updating the data corresponding to the physical block address in the physical block address linked list to generate the logical block address physical block address association tree includes:
determining a logical block address according to the physical block address in the physical block address linked list;
determining a physical block address and the logical block address in the physical block address linked list as a first tree node;
and generating the logical block address physical block address association tree according to the first tree node.
Optionally, the step of generating the logical block address physical block address association tree by using the updated physical block address linked list includes:
determining a target physical block address according to the updated physical block address linked list;
determining a target logical block address according to the target physical block address;
determining the target physical block address and the target logical block address as a second tree node;
and generating the logical block address physical block address association tree according to the second tree node.
The embodiment of the invention also discloses a data storage main end which is connected with the data storage auxiliary end, wherein the data storage main end is used for responding to the operation of creating the source volume and generating a volume version information table, and the volume version information table comprises an initial volume version number; updating the initial volume version number in response to a snapshot creation operation, and generating an updated volume version number; receiving a write operation, the write operation comprising writing data; generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the written data; and synchronizing the volume version information table and the physical block address linked list to the auxiliary end.
The embodiment of the invention also discloses an electronic device which comprises a processor, a memory and a computer program stored on the memory and capable of running on the processor, wherein the computer program realizes the steps of the snapshot data synchronization method when being executed by the processor.
The embodiment of the invention also discloses a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program realizes the steps of the snapshot data synchronization method when being executed by a processor.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, a volume version information table is generated in response to a source volume creating operation, wherein the volume version information table comprises an initial volume version number; updating the initial volume version number in response to a snapshot creation operation, and generating an updated volume version number; receiving a write operation, the write operation comprising writing data; generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the written data; and synchronizing the volume version information table and the physical block address linked list to the auxiliary end, wherein the auxiliary end is used for generating a snapshot volume of the auxiliary volume according to the volume version information table and the physical block address linked list. Constructing metadata of the relationship among the source volume, the snapshot volume and the physical block when the snapshot is created on the source volume by the main end, and constructing a volume version information table and a physical block address linked list so as to represent the snapshot relationship; and synchronizing the volume version information table and the physical block address linked list to the auxiliary end during remote copy synchronization, and generating a snapshot relation between the auxiliary volume and the auxiliary volume snapshot volume by the auxiliary end according to the volume version information table and the physical block address linked list to generate a snapshot volume of the auxiliary volume. The main end creates the snapshot to the source volume without carrying out other operations to the auxiliary end, the auxiliary volume of the auxiliary end also has corresponding snapshot information, the snapshot data of the main end and the auxiliary end are ensured to be consistent based on time points, repeated data are not required to be transmitted, and the data transmission efficiency is improved.
Drawings
FIG. 1 is a flow chart of steps of an embodiment of a snapshot data synchronization method of the present invention;
FIG. 2 is a flow chart of steps of another embodiment of a snapshot data synchronization method of the present invention;
FIG. 3 is a flowchart illustrating exemplary steps of a snapshot data synchronization method of the present invention;
FIG. 4 is a second flowchart illustrating exemplary steps of a snapshot data synchronization method of the present invention;
FIG. 5 is a flowchart illustrating three exemplary steps of a snapshot data synchronization method of the present invention;
fig. 6 is a block diagram of an electronic device according to an embodiment of the present invention;
fig. 7 is a block diagram of a storage medium according to an embodiment of the present invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
Referring to fig. 1, a flowchart illustrating steps of an embodiment of a snapshot data synchronization method of the present invention is shown, where the snapshot data synchronization method is applied to a primary side, and the primary side is connected to a secondary side. In the embodiment of the invention, the main end refers to storage main end equipment in a storage product, and the auxiliary end refers to storage auxiliary end equipment in the storage product, and is used for backing up data of the main end.
The snapshot data synchronization method specifically comprises the following steps:
step 101, in response to a source volume creation operation, generating a volume version information table, wherein the volume version information table comprises an initial volume version number;
in the embodiment of the invention, when a source volume is created for a main end, the main end responds to the operation of creating the source volume and generates a volume version information table corresponding to the source volume, wherein the volume version information table comprises an initial volume version number, namely, the initial volume version number of a physical block used by the source volume is recorded through the volume version information table.
Step 102, in response to a snapshot creation operation, updating the initial volume version number to generate an updated volume version number;
when a snapshot needs to be created for the source volume, that is, a snapshot volume is created, the master end may respond to the snapshot creation operation to update the initial volume version number, determine a new updated volume version, and write the updated volume version number information table.
Step 103, receiving a write operation, wherein the write operation comprises writing data;
when the master receives a write operation, the master receives write data in the write operation.
Step 104, generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the writing data;
According to the type of the written data, according to the different types of the written data, determining a storage scene corresponding to the written data, further determining a physical block address of a physical block corresponding to storage by combining the initial volume version number and the updated volume version number, and generating a physical block address linked list.
Step 105, synchronizing the volume version information table and the physical block address linked list to the auxiliary end, where the auxiliary end is configured to generate a snapshot volume of the auxiliary volume according to the volume version information table and the physical block address linked list.
And synchronizing the volume version information table and the physical block address linked list to an auxiliary end by taking the volume version information table and the physical block address linked list as the relation between the snapshot volume and the source volume at the main end, and establishing a corresponding storage relation in a storage data block of the auxiliary end according to the volume version information table and the physical block address linked list by the auxiliary end so as to synchronize snapshot data.
In the embodiment of the invention, a volume version information table is generated in response to a source volume creating operation, wherein the volume version information table comprises an initial volume version number; updating the initial volume version number in response to a snapshot creation operation, and generating an updated volume version number; receiving a write operation, the write operation comprising writing data; generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the written data; and synchronizing the volume version information table and the physical block address linked list to the auxiliary end, wherein the auxiliary end is used for generating a snapshot volume of the auxiliary volume according to the volume version information table and the physical block address linked list. Constructing metadata of the relationship among the source volume, the snapshot volume and the physical block when the snapshot is created on the source volume by the main end, and constructing a volume version information table and a physical block address linked list so as to represent the snapshot relationship; and synchronizing the volume version information table and the physical block address linked list to the auxiliary end during remote copy synchronization, and generating a snapshot relation between the auxiliary volume and the auxiliary volume snapshot volume by the auxiliary end according to the volume version information table and the physical block address linked list to generate a snapshot volume of the auxiliary volume. The main end creates the snapshot to the source volume without carrying out other operations to the auxiliary end, the auxiliary volume of the auxiliary end also has corresponding snapshot information, the snapshot data of the main end and the auxiliary end are ensured to be consistent based on time points, repeated data are not required to be transmitted, and the data transmission efficiency is improved.
In an alternative embodiment of the invention, the method further comprises:
step S1, expanding the coding length of the physical block address.
Before the source volume is created, the encoding length of the physical block address can be expanded to increase the encoding length of the physical block address, so that the version number of the volume can be recorded conveniently. In an example, the encoding length of the physical block address may be extended to 12 bits.
In an alternative embodiment of the present invention, the step of generating the volume version information table in response to the creating the source volume operation includes:
sub-step S1011, initializing the physical block address to generate the initial volume version number;
substep S1012, combining the initial volume version number with the identification number of the source volume, and generating the volume version information table.
In the embodiment of the invention, the physical block address can be initialized, for example, the physical block address is initialized to 000000000000; the generated code is the initial volume version number. The initial volume version number is then combined with an identification number of the source volume, such as an ID (identity) of the source volume, to generate a volume version information table.
In an optional embodiment of the present invention, the step of updating the initial volume version number and generating an updated volume version number includes:
And step S1021, increasing the initial volume version number to generate the updated volume version number.
For the updating of the initial volume version number, the initial volume version number may be incremented to generate an updated volume version number. If the original volume version number is added by one, an update version number is generated.
In an optional embodiment of the invention, the step of generating a physical block address linked list by combining the initial volume version number and the updated volume version number according to the type of the write data includes:
sub-step S1041, judging whether the type of the written data is modified data;
in the embodiment of the invention, after the written data is received, whether the written data is modified data or not can be judged, the modified data is the data modified for the stored data, the data except the modified data can be used as new written data, and the new written data is brand new data, and the data stored in advance does not exist.
Step S1042, in response to the written data not being modified data, generating a physical block address linked list according to the update volume version number;
when the written data is not modified data, namely the written data is written in a new written data scene, the physical block address is applied for in response to the written data not being modified data, the physical block address is determined according to the version number of the updated volume, and a physical block address linked list is generated.
In sub-step S1043, a physical block address linked list is generated in combination with the initial volume version number and the update volume version number in response to the write data being modified data.
When the written data is modified data, that is, the prior physical block address exists, responding to the written data as modified data, and determining the corresponding volume version number according to the corresponding scene from the initial volume version number and the updated volume version number in the volume version information table to generate a physical block address linked list.
Specifically, the step of generating a physical block address linked list by combining the initial volume version number and the updated volume version number in response to the write data being modified data includes: judging whether the physical block corresponding to the modification data is modified for the first time after the snapshot creation operation; responding to the physical block corresponding to the modification data as the first modification after the snapshot creation operation, recording the initial volume version number and the update volume version number to generate the physical block address linked list, and writing the modification data into the physical block corresponding to the update volume version number; and in response to that the physical block corresponding to the modification data is not modified for the first time after the snapshot creation operation, recording the initial volume version number to generate the physical block address linked list, and writing the modification data into the physical block corresponding to the initial volume version number.
In the embodiment of the invention, in the scene of modifying the data, whether the modification is the first modification after creating the snapshot or not can be further judged, if so, a physical block address linked list is generated by recording the initial volume version number and the update volume version number, namely, the new address and the old address are associated and recorded to the physical block address linked list, the corresponding writing data are written into the corresponding physical block, and the physical block corresponding to the update volume version number is updated; if the modification is not the first modification to the data block after the snapshot is created, writing the physical block address corresponding to the direct initial volume version number into a physical block address linked list; and modifying the data on the corresponding physical block address of the corresponding initial volume version number.
In an alternative embodiment of the invention, the method further comprises:
step S2, responding to a secondary snapshot creation operation, and judging whether the modification of the secondary snapshot creation operation to the physical block is the first modification;
step S3, in response to the modification of the physical block by the secondary snapshot creation operation being the first modification, updating the updated volume version number in the volume version information table to generate a secondary updated volume version number;
And step S4, responding to the modification of the physical block by the secondary snapshot creation operation to be non-first modification, and modifying the data of the physical block address corresponding to the secondary snapshot creation operation.
In the embodiment of the invention, after a snapshot volume is created and a physical block address linked list is generated, when a snapshot is created again for a source volume, if the modification is the first modification of the data block after the snapshot is created, a new update volume version number is applied, namely a secondary update volume version number, new data is recorded by adopting a physical block address corresponding to the secondary update volume version number, and the corresponding secondary update volume version number is the latest version number of the current volume; and a new secondary update volume version number can be inserted into the header of the volume version information table. If the modification is not the first modification to the data block after the snapshot is created, the data of the physical block address corresponding to the secondary snapshot creation operation is modified, namely the data is directly modified on the corresponding physical block address.
In an optional embodiment of the invention, the step of synchronizing the volume version information table and the physical block address linked list to the secondary side includes:
Substep S1051, in response to the update of the volume version information table, synchronizes the volume version information table and the physical block address linked list to the secondary side.
In the embodiment of the invention, when the volume version information table is changed, namely the volume version information table is updated, the volume version information table and the physical block address linked list are synchronized to the auxiliary end in response to the update of the volume version information table, so that the auxiliary end can acquire the volume version information table and the physical block address linked list in time, a snapshot volume which is the same as the main end is established at the auxiliary end, and the reliability of data backup is improved.
In an optional embodiment of the invention, the step of synchronizing the volume version information table and the physical block address linked list to the secondary side further includes:
and step S1052, synchronizing the physical block corresponding to the physical block address linked list to the auxiliary terminal.
In the embodiment of the invention, when the volume version information table and the physical block address linked list are synchronized to the auxiliary end, the physical block corresponding to the physical block address linked list is also synchronized to the auxiliary end, namely, the data of the physical block corresponding to the physical block address linked list is synchronized to the physical block address corresponding to the auxiliary end.
In an optional embodiment of the present invention, the master end is provided with a metadata bitmap, and the method further includes:
and S5, when the physical block corresponding to the physical block address linked list is synchronized to the auxiliary end, marking the physical block corresponding to the physical block address linked list in the metadata bitmap so as to update the metadata bitmap.
When the physical block corresponding to the physical block address linked list is synchronized to the auxiliary end, the physical block corresponding to the physical block address linked list can be marked on the metadata bitmap so as to mark the physical block as the physical block which is synchronized, thereby avoiding repeated data transmission during subsequent processing.
Specifically, the step of synchronizing the physical block corresponding to the physical block address linked list to the auxiliary end includes: traversing the physical block address linked list to determine a physical block corresponding to a physical block address of the physical block address linked list; judging whether a physical block corresponding to a physical block address of the physical block address linked list is a marked physical block or not; in response to judging that a physical block corresponding to a physical block address of the physical block address linked list is a marked physical block, skipping a physical block synchronization operation corresponding to the physical block address of the physical block address linked list; and responding to the judgment that the physical block corresponding to the physical block address of the physical block address linked list is a non-marked physical block, and synchronizing the physical block corresponding to the physical block address of the physical block address linked list.
In practical application, when the master end performs remote synchronization on the physical blocks, the version number corresponding to the physical blocks, namely the physical block addresses, are synchronized, meanwhile, the metadata bitmap is updated, the physical block address linked list can be traversed, whether the physical blocks corresponding to the physical block addresses of the physical block address linked list are marked or not is determined, when the physical blocks are marked as the synchronized physical blocks, synchronization is not needed again, and the synchronization operation of the physical blocks corresponding to the physical block addresses of the physical block address linked list can be skipped in response to judging that the physical blocks corresponding to the physical block addresses of the physical block address linked list are marked physical blocks, namely the physical blocks are skipped, so that repeated synchronization is avoided; when the physical block is not marked as an unsynchronized physical block, in response to determining that the physical block corresponding to the physical block address of the physical block address linked list is a non-marked physical block, synchronizing the physical block corresponding to the physical block address of the physical block address linked list, and synchronizing data of the physical block to the auxiliary end.
According to the embodiment of the invention, when the metadata bitmap is set, the synchronized physical blocks are determined through the metadata bitmap, when the data is synchronized, the synchronized physical blocks are skipped, repeated synchronized data are reduced, the unmodified data in the source volume of the main terminal can be ensured to be transmitted only in one part in the remote copy transmission process, the occupation of transmission bandwidth is reduced, the part of data occupies one part in the auxiliary terminal, and the occupation of the space of the auxiliary terminal is reduced.
Referring to FIG. 2, a flowchart illustrating steps of another embodiment of a snapshot data synchronization method of the present invention is shown, the snapshot data synchronization method being applied to a secondary, the secondary being connected to a primary, the primary being configured to generate a volume version information table in response to a create source volume operation, the volume version information table including an initial volume version number; updating the initial volume version number in response to a snapshot creation operation, and generating an updated volume version number; receiving a write operation, the write operation comprising writing data; generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the written data; synchronizing the volume version information table and the physical block address linked list to the auxiliary end; for the processing procedure of the master, reference may be made to the above embodiment, and will not be described herein.
The snapshot data synchronization method specifically comprises the following sub-steps:
step 201, receiving the volume version information table and the physical block address linked list;
the secondary end can receive the volume version information table and the physical block address linked list which are synchronized by the secondary end in the remote copying process.
And 202, generating a snapshot volume of the auxiliary volume according to the volume version information table and the physical block address linked list.
And establishing a snapshot volume relation which is the same as that of the main end at the auxiliary end according to the volume version information table and the physical block address linked list, and generating a snapshot volume of the auxiliary volume based on the snapshot volume relation.
In an optional embodiment of the invention, the step of generating the snapshot volume of the secondary volume according to the volume version information table and the physical block address linked list includes:
step S2021, according to the volume version information table and the physical block address linked list, generating a logical block address physical block address association tree;
determining physical block addresses and logical block addresses of corresponding snapshot volumes according to the volume version information table and the physical block address linked list, and generating a logical block address physical block address association tree; the logical block address physical block address association tree is used for recording the association relation between the physical block address and the logical block address of the snapshot volume.
In a substep S2022, the snapshot volume of the secondary volume is generated using the logical block address physical block address association tree.
And then, based on the logical block address physical block address association tree, establishing a snapshot volume of the secondary volume synchronous with the main snapshot volume.
In an optional embodiment of the invention, the step of generating a logical block address physical block address association tree according to the volume version information table and the physical block address linked list includes:
Step S20211, judging whether the physical block corresponding to the physical block address in the physical block address linked list has completed synchronization according to the physical block address linked list;
step S20212, in response to the physical block corresponding to the physical block address in the physical block address linked list having completed synchronization, synchronizes the volume version information table, and generates the logical block address physical block address association tree according to the synchronized volume version information table;
in sub-step S20213, in response to the physical blocks corresponding to the physical block addresses in the physical block address linked list not being synchronized, the history volume version information table is read, and the logical block address physical block address association tree is generated according to the history volume version information table and the volume version information table.
In the embodiment of the invention, whether the physical block corresponding to the physical block address in the physical block address linked list is synchronous or not can be judged based on the physical block address linked list. When the physical blocks corresponding to the physical block addresses in the physical block address linked list are synchronized, synchronizing the volume version information table in response to the physical blocks corresponding to the physical block addresses in the physical block address linked list being synchronized, keeping the secondary end volume version number information synchronized with the main end, and generating the logical block address physical block address association tree according to the synchronized volume version information table; when the physical blocks corresponding to the physical block addresses in the physical block address linked list are not synchronized, in response to the fact that the physical blocks corresponding to the physical block addresses in the physical block address linked list are not synchronized, the historical volume version information table, namely the volume version information table stored by the auxiliary end is read, and whether the volume version number received at this time is the same as the previous volume version number is judged according to the historical volume version information table and the volume version information table. And then the corresponding volume version number is adopted to generate a physical block address association tree of the logical block address.
Further, the step of generating the logical block address physical block address association tree according to the history volume version information table and the volume version information table includes: judging whether the historical volume version information table is consistent with the volume version information table or not; updating data corresponding to the physical block address in the physical block address linked list to generate the logical block address physical block address association tree in response to the fact that the historical volume version information table is consistent with the volume version information table; and in response to the fact that the historical volume version information table is consistent with the volume version information table, updating the physical block address in the physical block address linked list by adopting the volume version information table, generating an updated physical block address linked list, and generating the logical block address physical block address association tree by adopting the updated physical block address linked list.
The historical volume version information table and the synchronized volume version information can be compared, when one version number in the historical volume version information table is consistent with one version number in the volume version information table, the data block corresponding to the version number is modified for the first time after the snapshot is created by the main end, the data of the auxiliary end does not need to be stored, the data corresponding to the physical block address in the physical block address linked list is updated, and a logical block address physical block address association tree is generated; when the version numbers in the history volume version information table and the volume version information table are inconsistent, the volume version of the volume version information is used as the version number of the data block, and meanwhile, the physical block address in the physical block address linked list is updated to generate an updated physical block address linked list, the updated physical block address linked list is adopted to record the new and old physical block addresses, and a logical block address physical block address association tree is generated.
In an optional embodiment of the present invention, the step of updating data corresponding to a physical block address in the physical block address linked list to generate the logical block address physical block address association tree includes: determining a logical block address according to the physical block address in the physical block address linked list; determining a physical block address and the logical block address in the physical block address linked list as a first tree node; and generating the logical block address physical block address association tree according to the first tree node.
When the version numbers are consistent, the corresponding logical block addresses in the auxiliary end can be determined from the physical block addresses in the physical block address linked list; and then, determining the logical block address and the physical block address as an association relation as a first tree node, namely a node of a logical block address physical block address association tree, and generating the logical block address physical block address association tree by inserting the first tree node into the data tree.
In an optional embodiment of the present invention, the step of generating the logical block address physical block address association tree by using the updated physical block address linked list includes: determining a target physical block address according to the updated physical block address linked list; determining a target logical block address according to the target physical block address; determining the target physical block address and the target logical block address as a second tree node; and generating the logical block address physical block address association tree according to the second tree node.
When the version numbers are inconsistent, a target physical block address in the physical block address linked list can be used, wherein the target physical block address is the updated physical block address, and a target logical block address corresponding to the target physical block address is determined; and then, determining the target logical block address and the target physical block address as an association relation as a second tree node, namely, a node of the logical block address physical block address association tree, and generating the logical block address physical block address association tree by inserting the second tree node into the data tree.
The auxiliary end creates a corresponding logical block address physical block address association tree for each snapshot volume through the version information list of the auxiliary volume so as to establish the corresponding snapshot volume, thereby achieving the purpose of generating the snapshot volume consistent with the main end at the auxiliary end.
In order that the processing of embodiments of the present invention may be apparent to those skilled in the art, the following examples are given by way of illustration:
referring to fig. 3, when creating a volume, a master end generates a volume version information table for recording a version number and a corresponding snapshot volume ID, where the initial volume version number is 0, when allocating PBA space for a volume by writing, the volume version number in the PBA is recorded as 0, and when creating a snapshot for the volume, the volume version information table is updated to add a record (version number+1, snapshot volume ID), and at this time, the writing operation for the source volume is divided into the following scenarios:
a) When a PBA is applied, the corresponding PBA version number is the latest version number of the current volume;
b) For an original data modification scene, if the modification is the first modification of the data block after the snapshot is created, applying PBA for recording new data, wherein the corresponding PBA version number is the latest version number of the current volume; simultaneously generating a linked list (physical block address linked list) of the PP, and recording a new PBA address and an old PBA address; if the modification is not the first modification to the block of data after the snapshot is created, the data corresponding to the PBA address is modified directly.
c) Creating a snapshot again for the source volume based on the b, and if the modification is the first modification of the data block after the snapshot is created, applying for PBA to record new data, wherein the corresponding PBA version number is the latest version number of the current volume; simultaneously, a new PBA address is inserted into the head of a PP linked List, and the new PBA address and the old PBA address are recorded; if the modification is not the first modification to the block of data after the snapshot is created, the data corresponding to the PBA address is modified directly.
The master then performs remote replication to synchronize the data, specifically:
when the version information of the source volume of the main terminal changes, the latest version information is synchronized to the auxiliary terminal.
When the main end carries out remote synchronization on the data block, synchronizing version information corresponding to the data block, updating a metadata bitmap at the same time, marking that the PBA is synchronized, traversing a PP linked list by taking the PBA as a table head to acquire next PBA information, such as PBA1, if PBA1 in the linked list is not synchronized, synchronizing data in the PBA1 to the auxiliary end, updating the metadata bitmap at the same time, and marking that the PBA1 is synchronized; if the PBA1 is synchronized, it is skipped.
After the secondary terminal receives the winding version information and the metadata, the following operations are performed:
referring to fig. 4, it is determined whether the data block PBA has been synchronized, and if not, a new PBA application is applied to record data transmitted from the master, and the version number information of the auxiliary PBA is kept synchronized with the master.
If the data block is synchronized, judging whether the version number information of the newly transmitted PBA data block is consistent with the version number information of the data block stored by the current auxiliary end, and if so, updating the data in the auxiliary end corresponding to the PBA by using the latest data.
If the data block is synchronized and the version number information of the newly transmitted PBA data block is inconsistent with the version number information of the data block stored by the current auxiliary end, a new PBA address is applied to the auxiliary end for storing the newly transmitted data, the version number of the new PBA is consistent with the version number of the newly transmitted data of the main end, a PP linked list is generated at the auxiliary end, and the new PBA address and the old PBA address are recorded.
Referring to FIG. 5, the secondary generates the LP tree of the secondary snapshot volume from the associated metadata. And creating a corresponding LP tree for each snapshot volume according to the version information list of the auxiliary volume at the auxiliary end. Traversing the secondary end secondary volume LP tree, acquiring a corresponding PBA according to the secondary volume LBA, and judging whether the version number of the PBA is consistent with the version number of the corresponding snapshot volume:
a) If the PBA and the LBA are consistent, inserting the PBA and the LBA into an LP tree of a snapshot volume as a node;
b) If the version numbers of the PBA and the corresponding LBAs are inconsistent, the PBA is used as a table header to inquire the PP linked List in the step (3), the PBA which is consistent with the version numbers of the corresponding snapshot volumes in the linked List is searched, and if the PBA and the corresponding LBAs are found, the PBA and the corresponding LBAs are used as a node to be inserted into the LP tree of the snapshot volumes;
c) In the PP linked list, if no PBA consistent with the version number of the corresponding snapshot volume is found in the linked list, the PBA smaller than the version number and closest to the version number and the corresponding LBA are inserted into the LP tree of the snapshot volume as a node.
The secondary end establishes a snapshot volume through the LP tree.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
The embodiment of the invention also discloses a data storage main end which is connected with the data storage auxiliary end, wherein the data storage main end is used for responding to the operation of creating the source volume and generating a volume version information table, and the volume version information table comprises an initial volume version number; updating the initial volume version number in response to a snapshot creation operation, and generating an updated volume version number; receiving a write operation, the write operation comprising writing data; generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the written data; and synchronizing the volume version information table and the physical block address linked list to the auxiliary end.
In an optional embodiment of the present invention, the data storage master is further configured to expand a coding length of the physical block address.
In an optional embodiment of the present invention, the data storage master is configured to initialize the physical block address to generate the initial volume version number; and combining the initial volume version number with the identification number of the source volume to generate the volume version information table.
In an optional embodiment of the present invention, the data storage master is configured to increment the initial volume version number to generate the updated volume version number.
In an alternative embodiment of the present invention, the data storage master is further configured to update the initial volume version number with the update volume version number.
In an optional embodiment of the present invention, the data storage master is configured to determine whether the type of the write data is modified data; generating a physical block address linked list according to the version number of the update volume in response to the written data not being modified data; and generating a physical block address linked list by combining the initial volume version number and the updated volume version number in response to the written data being modified data.
In an optional embodiment of the present invention, the data storage master is configured to determine whether a physical block corresponding to the modification data is modified for the first time after the snapshot creation operation; responding to the physical block corresponding to the modification data as the first modification after the snapshot creation operation, recording the initial volume version number and the update volume version number to generate the physical block address linked list, and writing the modification data into the physical block corresponding to the update volume version number; and in response to that the physical block corresponding to the modification data is not modified for the first time after the snapshot creation operation, recording the initial volume version number to generate the physical block address linked list, and writing the modification data into the physical block corresponding to the initial volume version number.
In an optional embodiment of the invention, the data storage master is further configured to determine, in response to a secondary snapshot creation operation, whether a modification of the physical block by the secondary snapshot creation operation is a first modification; responding to the modification of the physical block by the secondary snapshot creation operation as the first modification, updating the update volume version number in the volume version information table, and generating a secondary update volume version number; and modifying the data of the physical block address corresponding to the secondary snapshot creation operation in response to the modification of the physical block by the secondary snapshot creation operation being non-primary modification.
In an alternative embodiment of the present invention, the data storage master is further configured to insert the secondary update volume version number into a header of the volume version information table.
In an alternative embodiment of the present invention, the primary data storage end is configured to synchronize the volume version information table and the physical block address linked list to the secondary end in response to an update of the volume version information table.
In an optional embodiment of the present invention, the data storage master is configured to synchronize a physical block corresponding to the physical block address linked list to the auxiliary.
In an optional embodiment of the present invention, the primary end is provided with a metadata bitmap, and the data storage primary end is configured to mark the physical block corresponding to the physical block address linked list on the metadata bitmap when the physical block corresponding to the physical block address linked list is synchronized to the secondary end, so as to update the metadata bitmap.
In an optional embodiment of the present invention, the data storage master end is configured to traverse the physical block address linked list and determine a physical block corresponding to a physical block address of the physical block address linked list;
judging whether a physical block corresponding to a physical block address of the physical block address linked list is a marked physical block or not;
in response to judging that a physical block corresponding to a physical block address of the physical block address linked list is a marked physical block, skipping a physical block synchronization operation corresponding to the physical block address of the physical block address linked list;
and responding to the judgment that the physical block corresponding to the physical block address of the physical block address linked list is a non-marked physical block, and synchronizing the physical block corresponding to the physical block address of the physical block address linked list.
The embodiment of the invention discloses a data storage auxiliary end, wherein the auxiliary end is connected with a main end, and the main end is used for responding to an operation of creating a source volume to generate a volume version information table which comprises an initial volume version number; updating the initial volume version number in response to a snapshot creation operation, and generating an updated volume version number; receiving a write operation, the write operation comprising writing data; generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the written data; synchronizing the volume version information table and the physical block address linked list to the auxiliary end; the data storage auxiliary end is used for receiving the volume version information table and the physical block address linked list; and generating a snapshot volume of the auxiliary volume according to the volume version information table and the physical block address linked list.
In an optional embodiment of the present invention, the data storage auxiliary end is configured to generate a logical block address physical block address association tree according to the volume version information table and the physical block address linked list; and generating the snapshot volume of the auxiliary volume by adopting the logical block address physical block address association tree.
In an optional embodiment of the present invention, the data storage auxiliary end is configured to determine, according to the physical block address linked list, whether synchronization of a physical block corresponding to a physical block address in the physical block address linked list has been completed; synchronizing the volume version information table in response to the synchronization of the physical block corresponding to the physical block address in the physical block address linked list, and generating the logical block address physical block address association tree according to the synchronized volume version information table; and in response to the fact that the physical blocks corresponding to the physical block addresses in the physical block address linked list are not synchronous, reading a history volume version information table, and generating the logical block address physical block address association tree according to the history volume version information table and the volume version information table.
In an optional embodiment of the present invention, the data storage auxiliary is configured to determine whether the historical volume version information table is consistent with the volume version information table; updating data corresponding to the physical block address in the physical block address linked list to generate the logical block address physical block address association tree in response to the fact that the historical volume version information table is consistent with the volume version information table; and in response to the fact that the historical volume version information table is consistent with the volume version information table, updating the physical block address in the physical block address linked list by adopting the volume version information table, generating an updated physical block address linked list, and generating the logical block address physical block address association tree by adopting the updated physical block address linked list.
In an optional embodiment of the present invention, the data storage auxiliary end is configured to determine a logical block address according to a physical block address in the physical block address linked list; determining a physical block address and the logical block address in the physical block address linked list as a first tree node; and generating the logical block address physical block address association tree according to the first tree node.
In an optional embodiment of the present invention, the data storage auxiliary end is configured to determine a target physical block address according to the updated physical block address linked list; determining a target logical block address according to the target physical block address; determining the target physical block address and the target logical block address as a second tree node; and generating the logical block address physical block address association tree according to the second tree node.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
Referring to fig. 6, an embodiment of the present invention further provides an electronic device, including:
a processor 601 and a storage medium 602, said storage medium 602 storing a computer program executable by said processor 601, said processor 601 executing said computer program when the electronic device is running to perform a snapshot data synchronization method according to any one of the embodiments of the present invention.
The snapshot data synchronization method is applied to a main terminal, the main terminal is connected with an auxiliary terminal, and the method comprises the following steps:
in response to a create source volume operation, generating a volume version information table, the volume version information table including an initial volume version number;
updating the initial volume version number in response to a snapshot creation operation, and generating an updated volume version number;
receiving a write operation, the write operation comprising writing data;
generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the written data;
and synchronizing the volume version information table and the physical block address linked list to the auxiliary end, wherein the auxiliary end is used for generating a snapshot volume of the auxiliary volume according to the volume version information table and the physical block address linked list.
Optionally, the method further comprises:
and expanding the coding length of the physical block address.
Optionally, the step of generating the volume version information table in response to the creating the source volume operation includes:
initializing the physical block address to generate the initial volume version number;
and combining the initial volume version number with the identification number of the source volume to generate the volume version information table.
Optionally, the step of updating the initial volume version number and generating an updated volume version number includes:
and increasing the initial volume version number to generate the updated volume version number.
Optionally, the method further comprises:
the update volume version number updates the initial volume version number.
Optionally, the step of generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the write data includes:
judging whether the type of the written data is modified data or not;
generating a physical block address linked list according to the version number of the update volume in response to the written data not being modified data;
and generating a physical block address linked list by combining the initial volume version number and the updated volume version number in response to the written data being modified data.
Optionally, the step of generating a physical block address linked list by combining the initial volume version number and the updated volume version number in response to the write data being modified data includes:
judging whether the physical block corresponding to the modification data is modified for the first time after the snapshot creation operation;
responding to the physical block corresponding to the modification data as the first modification after the snapshot creation operation, recording the initial volume version number and the update volume version number to generate the physical block address linked list, and writing the modification data into the physical block corresponding to the update volume version number;
And in response to that the physical block corresponding to the modification data is not modified for the first time after the snapshot creation operation, recording the initial volume version number to generate the physical block address linked list, and writing the modification data into the physical block corresponding to the initial volume version number.
Optionally, the method further comprises:
responding to a secondary snapshot creation operation, and judging whether the modification of the secondary snapshot creation operation to the physical block is the first modification;
responding to the modification of the physical block by the secondary snapshot creation operation as the first modification, updating the update volume version number in the volume version information table, and generating a secondary update volume version number;
and modifying the data of the physical block address corresponding to the secondary snapshot creation operation in response to the modification of the physical block by the secondary snapshot creation operation being non-primary modification.
Optionally, the method further comprises:
and inserting the secondary updated volume version number into the header of the volume version information table.
Optionally, the step of synchronizing the volume version information table and the physical block address linked list to the secondary side includes:
and in response to the update of the volume version information table, synchronizing the volume version information table and the physical block address linked list to the auxiliary end.
Optionally, the step of synchronizing the volume version information table and the physical block address linked list to the secondary end further includes:
and synchronizing the physical block corresponding to the physical block address linked list to the auxiliary end.
Optionally, the master side is provided with a metadata bitmap, and the method further includes:
and when the physical blocks corresponding to the physical block address linked list are synchronized to the auxiliary end, marking the physical blocks corresponding to the physical block address linked list on the metadata bitmap so as to update the metadata bitmap.
Optionally, the step of synchronizing the physical block corresponding to the physical block address linked list to the auxiliary end includes:
traversing the physical block address linked list to determine a physical block corresponding to a physical block address of the physical block address linked list;
judging whether a physical block corresponding to a physical block address of the physical block address linked list is a marked physical block or not;
in response to judging that a physical block corresponding to a physical block address of the physical block address linked list is a marked physical block, skipping a physical block synchronization operation corresponding to the physical block address of the physical block address linked list;
And responding to the judgment that the physical block corresponding to the physical block address of the physical block address linked list is a non-marked physical block, and synchronizing the physical block corresponding to the physical block address of the physical block address linked list.
Secondly, a snapshot data synchronization method is applied to an auxiliary end, the auxiliary end is connected with a main end, the main end is used for responding to the operation of creating a source volume and generating a volume version information table, and the volume version information table comprises an initial volume version number; updating the initial volume version number in response to a snapshot creation operation, and generating an updated volume version number; receiving a write operation, the write operation comprising writing data; generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the written data; synchronizing the volume version information table and the physical block address linked list to the auxiliary end; the method comprises the following steps:
receiving the volume version information table and the physical block address linked list;
and generating a snapshot volume of the auxiliary volume according to the volume version information table and the physical block address linked list.
Optionally, the step of generating the snapshot volume of the secondary volume according to the volume version information table and the physical block address linked list includes:
Generating a logical block address physical block address association tree according to the volume version information table and the physical block address linked list;
and generating the snapshot volume of the auxiliary volume by adopting the logical block address physical block address association tree.
Optionally, the step of generating a logical block address physical block address association tree according to the volume version information table and the physical block address linked list includes:
judging whether the physical blocks corresponding to the physical block addresses in the physical block address linked list are synchronous or not according to the physical block address linked list;
synchronizing the volume version information table in response to the synchronization of the physical block corresponding to the physical block address in the physical block address linked list, and generating the logical block address physical block address association tree according to the synchronized volume version information table;
and in response to the fact that the physical blocks corresponding to the physical block addresses in the physical block address linked list are not synchronous, reading a history volume version information table, and generating the logical block address physical block address association tree according to the history volume version information table and the volume version information table.
Optionally, the step of generating the logical block address physical block address association tree according to the history volume version information table and the volume version information table includes:
Judging whether the historical volume version information table is consistent with the volume version information table or not;
updating data corresponding to the physical block address in the physical block address linked list to generate the logical block address physical block address association tree in response to the fact that the historical volume version information table is consistent with the volume version information table;
and in response to the fact that the historical volume version information table is consistent with the volume version information table, updating the physical block address in the physical block address linked list by adopting the volume version information table, generating an updated physical block address linked list, and generating the logical block address physical block address association tree by adopting the updated physical block address linked list.
Optionally, the step of updating the data corresponding to the physical block address in the physical block address linked list to generate the logical block address physical block address association tree includes:
determining a logical block address according to the physical block address in the physical block address linked list;
determining a physical block address and the logical block address in the physical block address linked list as a first tree node;
and generating the logical block address physical block address association tree according to the first tree node.
Optionally, the step of generating the logical block address physical block address association tree by using the updated physical block address linked list includes:
determining a target physical block address according to the updated physical block address linked list;
determining a target logical block address according to the target physical block address;
determining the target physical block address and the target logical block address as a second tree node;
and generating the logical block address physical block address association tree according to the second tree node.
The memory may include a random access memory (Random Access Memory, abbreviated as RAM) or a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but also digital signal processors (Digital Signal Processing, DSP for short), application specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), field-programmable gate arrays (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
Referring to fig. 7, an embodiment of the present invention further provides a computer readable storage medium 701, where the storage medium 701 stores a computer program, and when the computer program is executed by a processor, the method of snapshot data synchronization according to any one of the embodiments of the present invention is performed.
The snapshot data synchronization method is applied to a main terminal, the main terminal is connected with an auxiliary terminal, and the method comprises the following steps:
in response to a create source volume operation, generating a volume version information table, the volume version information table including an initial volume version number;
updating the initial volume version number in response to a snapshot creation operation, and generating an updated volume version number;
receiving a write operation, the write operation comprising writing data;
generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the written data;
and synchronizing the volume version information table and the physical block address linked list to the auxiliary end, wherein the auxiliary end is used for generating a snapshot volume of the auxiliary volume according to the volume version information table and the physical block address linked list.
Optionally, the method further comprises:
and expanding the coding length of the physical block address.
Optionally, the step of generating the volume version information table in response to the creating the source volume operation includes:
Initializing the physical block address to generate the initial volume version number;
and combining the initial volume version number with the identification number of the source volume to generate the volume version information table.
Optionally, the step of updating the initial volume version number and generating an updated volume version number includes:
and increasing the initial volume version number to generate the updated volume version number.
Optionally, the method further comprises:
the update volume version number updates the initial volume version number.
Optionally, the step of generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the write data includes:
judging whether the type of the written data is modified data or not;
generating a physical block address linked list according to the version number of the update volume in response to the written data not being modified data;
and generating a physical block address linked list by combining the initial volume version number and the updated volume version number in response to the written data being modified data.
Optionally, the step of generating a physical block address linked list by combining the initial volume version number and the updated volume version number in response to the write data being modified data includes:
Judging whether the physical block corresponding to the modification data is modified for the first time after the snapshot creation operation;
responding to the physical block corresponding to the modification data as the first modification after the snapshot creation operation, recording the initial volume version number and the update volume version number to generate the physical block address linked list, and writing the modification data into the physical block corresponding to the update volume version number;
and in response to that the physical block corresponding to the modification data is not modified for the first time after the snapshot creation operation, recording the initial volume version number to generate the physical block address linked list, and writing the modification data into the physical block corresponding to the initial volume version number.
Optionally, the method further comprises:
responding to a secondary snapshot creation operation, and judging whether the modification of the secondary snapshot creation operation to the physical block is the first modification;
responding to the modification of the physical block by the secondary snapshot creation operation as the first modification, updating the update volume version number in the volume version information table, and generating a secondary update volume version number;
and modifying the data of the physical block address corresponding to the secondary snapshot creation operation in response to the modification of the physical block by the secondary snapshot creation operation being non-primary modification.
Optionally, the method further comprises:
and inserting the secondary updated volume version number into the header of the volume version information table.
Optionally, the step of synchronizing the volume version information table and the physical block address linked list to the secondary side includes:
and in response to the update of the volume version information table, synchronizing the volume version information table and the physical block address linked list to the auxiliary end.
Optionally, the step of synchronizing the volume version information table and the physical block address linked list to the secondary end further includes:
and synchronizing the physical block corresponding to the physical block address linked list to the auxiliary end.
Optionally, the master side is provided with a metadata bitmap, and the method further includes:
and when the physical blocks corresponding to the physical block address linked list are synchronized to the auxiliary end, marking the physical blocks corresponding to the physical block address linked list on the metadata bitmap so as to update the metadata bitmap.
Optionally, the step of synchronizing the physical block corresponding to the physical block address linked list to the auxiliary end includes:
traversing the physical block address linked list to determine a physical block corresponding to a physical block address of the physical block address linked list;
Judging whether a physical block corresponding to a physical block address of the physical block address linked list is a marked physical block or not;
in response to judging that a physical block corresponding to a physical block address of the physical block address linked list is a marked physical block, skipping a physical block synchronization operation corresponding to the physical block address of the physical block address linked list;
and responding to the judgment that the physical block corresponding to the physical block address of the physical block address linked list is a non-marked physical block, and synchronizing the physical block corresponding to the physical block address of the physical block address linked list.
Secondly, a snapshot data synchronization method is applied to an auxiliary end, the auxiliary end is connected with a main end, the main end is used for responding to the operation of creating a source volume and generating a volume version information table, and the volume version information table comprises an initial volume version number; updating the initial volume version number in response to a snapshot creation operation, and generating an updated volume version number; receiving a write operation, the write operation comprising writing data; generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the written data; synchronizing the volume version information table and the physical block address linked list to the auxiliary end; the method comprises the following steps:
Receiving the volume version information table and the physical block address linked list;
and generating a snapshot volume of the auxiliary volume according to the volume version information table and the physical block address linked list.
Optionally, the step of generating the snapshot volume of the secondary volume according to the volume version information table and the physical block address linked list includes:
generating a logical block address physical block address association tree according to the volume version information table and the physical block address linked list;
and generating the snapshot volume of the auxiliary volume by adopting the logical block address physical block address association tree.
Optionally, the step of generating a logical block address physical block address association tree according to the volume version information table and the physical block address linked list includes:
judging whether the physical blocks corresponding to the physical block addresses in the physical block address linked list are synchronous or not according to the physical block address linked list;
synchronizing the volume version information table in response to the synchronization of the physical block corresponding to the physical block address in the physical block address linked list, and generating the logical block address physical block address association tree according to the synchronized volume version information table;
And in response to the fact that the physical blocks corresponding to the physical block addresses in the physical block address linked list are not synchronous, reading a history volume version information table, and generating the logical block address physical block address association tree according to the history volume version information table and the volume version information table.
Optionally, the step of generating the logical block address physical block address association tree according to the history volume version information table and the volume version information table includes:
judging whether the historical volume version information table is consistent with the volume version information table or not;
updating data corresponding to the physical block address in the physical block address linked list to generate the logical block address physical block address association tree in response to the fact that the historical volume version information table is consistent with the volume version information table;
and in response to the fact that the historical volume version information table is consistent with the volume version information table, updating the physical block address in the physical block address linked list by adopting the volume version information table, generating an updated physical block address linked list, and generating the logical block address physical block address association tree by adopting the updated physical block address linked list.
Optionally, the step of updating the data corresponding to the physical block address in the physical block address linked list to generate the logical block address physical block address association tree includes:
determining a logical block address according to the physical block address in the physical block address linked list;
determining a physical block address and the logical block address in the physical block address linked list as a first tree node;
and generating the logical block address physical block address association tree according to the first tree node.
Optionally, the step of generating the logical block address physical block address association tree by using the updated physical block address linked list includes:
determining a target physical block address according to the updated physical block address linked list;
determining a target logical block address according to the target physical block address;
determining the target physical block address and the target logical block address as a second tree node;
and generating the logical block address physical block address association tree according to the second tree node.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the invention may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or terminal device comprising the element.
The snapshot data synchronization method, the storage main end, the electronic device and the storage medium provided by the invention are described in detail, and specific examples are applied to illustrate the principle and the implementation of the invention, and the description of the above examples is only used for helping to understand the method and the core idea of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (22)

1. A snapshot data synchronization method, which is characterized by being applied to a main terminal, wherein the main terminal is connected with an auxiliary terminal, and the method comprises:
in response to a create source volume operation, generating a volume version information table, the volume version information table including an initial volume version number;
updating the initial volume version number in response to a snapshot creation operation, and generating an updated volume version number;
receiving a write operation, the write operation comprising writing data;
generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the written data;
and synchronizing the volume version information table and the physical block address linked list to the auxiliary end, wherein the auxiliary end is used for generating a snapshot volume of the auxiliary volume according to the volume version information table and the physical block address linked list.
2. The method according to claim 1, wherein the method further comprises:
and expanding the coding length of the physical block address.
3. The method of claim 2, wherein the step of generating a volume version information table in response to the create source volume operation comprises:
initializing the physical block address to generate the initial volume version number;
And combining the initial volume version number with the identification number of the source volume to generate the volume version information table.
4. The method of claim 1, wherein the step of updating the initial volume version number to generate an updated volume version number comprises:
and increasing the initial volume version number to generate the updated volume version number.
5. The method according to claim 1, wherein the method further comprises:
and updating the initial volume version number by adopting the updated volume version number.
6. The method of claim 1, wherein the step of generating a physical block address linked list in combination with the initial volume version number and the updated volume version number according to the type of the write data comprises:
judging whether the type of the written data is modified data or not;
generating a physical block address linked list according to the version number of the update volume in response to the written data not being modified data;
and generating a physical block address linked list by combining the initial volume version number and the updated volume version number in response to the written data being modified data.
7. The method of claim 6, wherein the step of generating a physical block address linked list in conjunction with the initial volume version number and the updated volume version number in response to the write data being modified data comprises:
Judging whether the physical block corresponding to the modification data is modified for the first time after the snapshot creation operation;
responding to the physical block corresponding to the modification data as the first modification after the snapshot creation operation, recording the initial volume version number and the update volume version number to generate the physical block address linked list, and writing the modification data into the physical block corresponding to the update volume version number;
and in response to that the physical block corresponding to the modification data is not modified for the first time after the snapshot creation operation, recording the initial volume version number to generate the physical block address linked list, and writing the modification data into the physical block corresponding to the initial volume version number.
8. The method of claim 7, wherein the method further comprises:
responding to a secondary snapshot creation operation, and judging whether the modification of the secondary snapshot creation operation to the physical block is the first modification;
responding to the modification of the physical block by the secondary snapshot creation operation as the first modification, updating the update volume version number in the volume version information table, and generating a secondary update volume version number;
and modifying the data of the physical block address corresponding to the secondary snapshot creation operation in response to the modification of the physical block by the secondary snapshot creation operation being non-primary modification.
9. The method of claim 8, wherein the method further comprises:
and inserting the secondary updated volume version number into the header of the volume version information table.
10. The method of claim 1, wherein synchronizing the volume version information table and the physical block address linked list to the secondary comprises:
and in response to the update of the volume version information table, synchronizing the volume version information table and the physical block address linked list to the auxiliary end.
11. The method of claim 10, wherein the step of synchronizing the volume version information table and the physical block address linked list to the secondary further comprises:
and synchronizing the physical block corresponding to the physical block address linked list to the auxiliary end.
12. The method of claim 11, wherein the master is provided with a metadata bitmap, the method further comprising:
and when the physical blocks corresponding to the physical block address linked list are synchronized to the auxiliary end, marking the physical blocks corresponding to the physical block address linked list on the metadata bitmap so as to update the metadata bitmap.
13. The method of claim 12, wherein the step of synchronizing the physical block corresponding to the physical block address linked list to the secondary side comprises:
traversing the physical block address linked list to determine a physical block corresponding to a physical block address of the physical block address linked list;
judging whether a physical block corresponding to a physical block address of the physical block address linked list is a marked physical block or not;
in response to judging that a physical block corresponding to a physical block address of the physical block address linked list is a marked physical block, skipping a physical block synchronization operation corresponding to the physical block address of the physical block address linked list;
and responding to the judgment that the physical block corresponding to the physical block address of the physical block address linked list is a non-marked physical block, and synchronizing the physical block corresponding to the physical block address of the physical block address linked list.
14. The snapshot data synchronization method is characterized by being applied to an auxiliary end, wherein the auxiliary end is connected with a main end, and the main end is used for responding to an operation of creating a source volume to generate a volume version information table which comprises an initial volume version number; updating the initial volume version number in response to a snapshot creation operation, and generating an updated volume version number; receiving a write operation, the write operation comprising writing data; generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the written data; synchronizing the volume version information table and the physical block address linked list to the auxiliary end; the method comprises the following steps:
Receiving the volume version information table and the physical block address linked list;
and generating a snapshot volume of the auxiliary volume according to the volume version information table and the physical block address linked list.
15. The method of claim 14, wherein the step of generating a snapshot volume of the secondary volume from the volume version information table and the physical block address linked list comprises:
generating a logical block address physical block address association tree according to the volume version information table and the physical block address linked list;
and generating the snapshot volume of the auxiliary volume by adopting the logical block address physical block address association tree.
16. The method of claim 15, wherein the step of generating a logical block address physical block address association tree from the volume version information table and the physical block address linked list comprises:
judging whether the physical blocks corresponding to the physical block addresses in the physical block address linked list are synchronous or not according to the physical block address linked list;
synchronizing the volume version information table in response to the synchronization of the physical block corresponding to the physical block address in the physical block address linked list, and generating the logical block address physical block address association tree according to the synchronized volume version information table;
And in response to the fact that the physical blocks corresponding to the physical block addresses in the physical block address linked list are not synchronous, reading a history volume version information table, and generating the logical block address physical block address association tree according to the history volume version information table and the volume version information table.
17. The method of claim 16, wherein generating the logical block address physical block address association tree from the historical volume version information table and the volume version information table comprises:
judging whether the historical volume version information table is consistent with the volume version information table or not;
updating data corresponding to the physical block address in the physical block address linked list to generate the logical block address physical block address association tree in response to the fact that the historical volume version information table is consistent with the volume version information table;
and in response to the fact that the historical volume version information table is consistent with the volume version information table, updating the physical block address in the physical block address linked list by adopting the volume version information table, generating an updated physical block address linked list, and generating the logical block address physical block address association tree by adopting the updated physical block address linked list.
18. The method of claim 17, wherein the step of updating the data corresponding to the physical block addresses in the physical block address linked list to generate the logical block address physical block address association tree comprises:
determining a logical block address according to the physical block address in the physical block address linked list;
determining a physical block address and the logical block address in the physical block address linked list as a first tree node;
and generating the logical block address physical block address association tree according to the first tree node.
19. The method of claim 17, wherein the step of generating the logical block address physical block address association tree using the updated physical block address linked list comprises:
determining a target physical block address according to the updated physical block address linked list;
determining a target logical block address according to the target physical block address;
determining the target physical block address and the target logical block address as a second tree node;
and generating the logical block address physical block address association tree according to the second tree node.
20. A data storage main end, wherein the data storage main end is connected with a data storage auxiliary end, and the data storage main end is used for responding to a source volume creating operation to generate a volume version information table, and the volume version information table comprises an initial volume version number; updating the initial volume version number in response to a snapshot creation operation, and generating an updated volume version number; receiving a write operation, the write operation comprising writing data; generating a physical block address linked list by combining the initial volume version number and the update volume version number according to the type of the written data; and synchronizing the volume version information table and the physical block address linked list to the auxiliary end.
21. An electronic device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program implementing the steps of the snapshot data synchronization method of any one of claims 1 to 19 when executed by the processor.
22. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the snapshot data synchronization method according to any one of claims 1 to 19.
CN202310819811.3A 2023-07-05 2023-07-05 Snapshot data synchronization method, storage master, electronic device and storage medium Active CN116541468B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310819811.3A CN116541468B (en) 2023-07-05 2023-07-05 Snapshot data synchronization method, storage master, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310819811.3A CN116541468B (en) 2023-07-05 2023-07-05 Snapshot data synchronization method, storage master, electronic device and storage medium

Publications (2)

Publication Number Publication Date
CN116541468A true CN116541468A (en) 2023-08-04
CN116541468B CN116541468B (en) 2023-09-29

Family

ID=87452849

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310819811.3A Active CN116541468B (en) 2023-07-05 2023-07-05 Snapshot data synchronization method, storage master, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN116541468B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101154234A (en) * 2006-09-26 2008-04-02 国际商业机器公司 System, method and computer program product for managing data versions
US20110238888A1 (en) * 2010-03-29 2011-09-29 International Business Machines Corporation Providing versioning in a storage device
CN110569221A (en) * 2019-09-09 2019-12-13 东吴证券股份有限公司 file system management method, device, equipment and storage medium with version function

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101154234A (en) * 2006-09-26 2008-04-02 国际商业机器公司 System, method and computer program product for managing data versions
US20110238888A1 (en) * 2010-03-29 2011-09-29 International Business Machines Corporation Providing versioning in a storage device
CN110569221A (en) * 2019-09-09 2019-12-13 东吴证券股份有限公司 file system management method, device, equipment and storage medium with version function

Also Published As

Publication number Publication date
CN116541468B (en) 2023-09-29

Similar Documents

Publication Publication Date Title
CN108376109A (en) Volume and snapshot
CN109032507B (en) Method, system and related assembly for generating source volume storage snapshot
CN106874281B (en) Method and device for realizing database read-write separation
CN110647514B (en) Metadata updating method and device and metadata server
CN107203331B (en) Method and device for writing data
CN106357703B (en) Cluster switching method and device
US9501234B1 (en) System and method for incrementally performing full data backup
CN110147203B (en) File management method and device, electronic equipment and storage medium
CN110442307A (en) Binding method, equipment and the storage medium of disk in a kind of linux system
US9514392B2 (en) Method of creating compound file and data storage device having the compound file
CN111797060B (en) Offline video recording method, device and equipment and computer readable storage medium
CN109753381B (en) Continuous data protection method based on object storage
CN116541468B (en) Snapshot data synchronization method, storage master, electronic device and storage medium
CN109992527B (en) Bitmap management method of full flash memory system
CN106469172B (en) The data-updating method and device of distributed file system
CN113297316A (en) Method, device and system for realizing data synchronization
CN113886352B (en) Metadata recovery method, device, equipment and medium of distributed file system
CN109669623B (en) File management method, file management device, electronic equipment and storage medium
US8166272B2 (en) Method and apparatus for allocation of buffer
CN111147226B (en) Data storage method, device and storage medium
CN110968888B (en) Data processing method and device
CN107526656B (en) Cloud restoration method and device
CN107967188B (en) Processing method and device in data storage
CN112748868A (en) Data storage method and device
CN115344423B (en) Backup method, mount recovery method, server, and computer-readable storage medium

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