Snapshot creation method, computing device and storage medium
By using the data identification management method in the storage system, write request blocking during snapshot creation is avoided, efficiency is improved and data consistency is ensured, and the problems of low efficiency and difficulty in achieving consistency during snapshot creation in the existing technology are solved. question.
Patent Information
- Application Number
- CN202111627093.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-12-28
AI Technical Summary
Existing technology needs to block users' write requests when creating snapshots, resulting in low efficiency of the storage system. In particular, it is difficult to achieve distributed collaboration in distributed storage systems, affecting data consistency.
The computing node sends a write request to the storage node, carrying the write data and data identifier. The storage node stores the data in an orderly manner, obtains the latest data identifier as the snapshot identifier when creating a snapshot, and retains the write data whose data identifier is less than or equal to the snapshot identifier to Avoid blocking user read and write requests.
It realizes that users' read and write requests are not blocked when creating snapshots, improves the efficiency of the storage system, ensures the consistency and atomicity of data, and avoids the complexity of distributed collaboration.
Smart Images

Figure CN114328018B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a snapshot creation method, a computing device, and a storage medium. Background Art
[0002] Snapshots are the core function of storage systems. Based on snapshots, many other storage functions can be derived, such as backup and restore, data sharing instances, etc. Generally, snapshots are implemented independently by the storage system without considering the upper-layer services. This makes snapshot implementation complex. At the same time, when taking a snapshot, the user's write request may be blocked until the snapshot is completed. Summary of the invention
[0003] Multiple aspects of the present application provide a snapshot creation method, a computing device, and a storage medium, so that when creating a snapshot, the snapshot can be created conveniently and quickly without blocking the user's write request to achieve the creation of the snapshot.
[0004] An embodiment of the present application provides a method for creating a snapshot, including: sending a write request to a storage node through a computing node, the write request carrying write data and a data identifier of the write data, the data identifier increasing with time sequence; storing the write data in order according to the data identifier of the write data through the storage node; when creating a snapshot, obtaining the latest data identifier of the corresponding write data through the computing node, and sending the latest data identifier as a snapshot identifier to the storage node, and storing the snapshot identifier through the storage node; retaining the write data corresponding to the data identifier less than or equal to the snapshot identifier through the storage node as the data corresponding to the snapshot, so that when reading the snapshot, the data corresponding to the snapshot can be read.
[0005] An embodiment of the present application also provides a computing device, including: a memory and a processor; the memory is used to store a computer program; the processor executes the computer program to: send a write request to a storage node through a computing node, the write request carries write data and a data identifier of the write data, and the data identifier increases with time series; the storage node sequentially stores the write data according to the data identifier of the write data; when creating a snapshot, the computing node obtains the latest data identifier of the corresponding write data, and sends the latest data identifier to the storage node as a snapshot identifier, and the storage node stores the snapshot identifier; the storage node retains the write data corresponding to the data identifier less than or equal to the snapshot identifier as the data corresponding to the snapshot, so that when reading the snapshot, the data corresponding to the snapshot can be read.
[0006] An embodiment of the present application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by one or more processors, the one or more processors implement the steps in the above method.
[0007] An embodiment of the present application further provides a computer program product, including a computer program or instructions, wherein when the computer program is executed by a processor, the processor is caused to implement the steps in the method described in the claim.
[0008] In an embodiment of the present application, a write request is sent to a storage node through a computing node, and the write request carries the write data and the data identifier of the write data, and the data identifier increases with time series; the storage node stores the write data in order according to the data identifier of the write data; when creating a snapshot, the latest data identifier of the corresponding write data is obtained through the computing node, and the latest data identifier is sent to the storage node as the snapshot identifier, and the snapshot identifier is stored through the storage node; the storage node retains the write data corresponding to the data identifier less than or equal to the snapshot identifier as the data corresponding to the snapshot, so that when reading the snapshot, the data corresponding to the snapshot can be read.
[0009] In the case of creating a snapshot, the latest data identifier of the corresponding write data is obtained through the computing node, and the latest data identifier is sent to the storage node as the snapshot identifier, and the snapshot identifier is stored by the storage node; the write data corresponding to the data identifier less than or equal to the snapshot identifier is retained by the storage node as the data corresponding to the snapshot. And because the write request carries the write data and the data identifier of the write data, the stored write data has the corresponding data identifier, and the corresponding data identifier increases with the time series, so that when creating a snapshot, the write data with a data identifier less than or equal to the snapshot identifier can be selected, so that the stored write data before the snapshot is created can be divided more accurately, and there is no need to create a snapshot by blocking the user's read and write requests (especially write requests), that is, there is no need to block the corresponding read and write IO. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0011] Figure 1 A schematic diagram of a method for creating a snapshot according to an exemplary embodiment of the present application;
[0012] Figure 2 A schematic diagram of a snapshot creation process of an exemplary embodiment of the present application;
[0013] Figure 3 A schematic diagram of the structure of a snapshot creation system according to an exemplary embodiment of the present application;
[0014] Figure 4 A schematic diagram of the structure of a snapshot creation device provided by an exemplary embodiment of the present application;
[0015] Figure 5 A schematic diagram of the structure of a computing device provided for an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0016] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0017] As mentioned above, at the moment of taking a snapshot, if a corresponding request (such as writing IO) is issued, in order to ensure the consistency of data on each storage node, the corresponding request can only be responded to after the request coordination is completed. Therefore, before the request coordination is completed, the corresponding request will be blocked there and wait until the coordination is completed. Generally speaking, for a distributed storage system, in order to solve the consistency of the distributed state, the snapshot implementation of the distributed storage system needs to block the request to implement the snapshot, that is, block the corresponding IO to implement the snapshot.
[0018] In response to the above problems, embodiments of the present application provide a snapshot creation method, a computing device, and a storage medium, thereby avoiding distributed collaboration of snapshots as much as possible.
[0019] The following describes in detail the snapshot creation process in conjunction with the method embodiment.
[0020] Figure 1 The flowchart of a method for creating a snapshot according to an exemplary embodiment of the present application is shown below. The method 100 provided in the embodiment of the present application is executed by a computing device, such as a cloud server. The method 100 includes the following steps:
[0021] 101: Send a write request to the storage node through the computing node.
[0022] The write request carries the write data and the data identifier of the write data, and the data identifier increases with the timing.
[0023] 102: The storage node stores the write data in order according to the data identifier of the write data.
[0024] 103: When creating a snapshot, the latest data identifier of the corresponding write data is obtained through the computing node, and the latest data identifier is sent to the storage node as the snapshot identifier, and the snapshot identifier is stored through the storage node.
[0025] 104: The storage node reserves the write data corresponding to the data identifier being less than or equal to the snapshot identifier as the data corresponding to the snapshot, so that when the snapshot is read, the data corresponding to the snapshot is read.
[0026] It should be noted that, for a cloud server, a corresponding database system may be deployed, and the database system is used to execute the present method 100. The database system may include a storage engine and a storage system, etc. The storage system may be a distributed storage system, a stand-alone storage system, a block storage system, etc. From an architectural perspective, the database system may include computing nodes and storage nodes. Among them, computing nodes refer to upper-layer applications deployed on cloud servers, which may be database nodes. Storage nodes refer to nodes that implement lower-layer storage functions for these computing nodes, such as storage systems, etc.
[0027] In addition, the specific implementation of the embodiment of the present application is not limited to the execution order of the above steps 101-103, and the above steps can also be swapped. It should be understood that the deformation of the above steps and the technical solutions after combination are all within the protection scope of the embodiment of the present application. I will not go into details.
[0028] The following is a detailed description of the above steps:
[0029] 101: Send a write request to the storage node through the computing node.
[0030] Among them, the write request carries the write data and the data identifier of the write data, and the data identifier increases with the time sequence. That is, the stored data (i.e., the write data) has a corresponding data identifier, and the identifier corresponding to the stored write data increases with the time sequence. For the write data at the same time, it can have the same identifier. The identifier can be a serial number, a version number, or other custom numbers, as long as it is sequential according to the time sequence. For example, according to the time sequence, the identifier can be 01, 02, 03, 04, etc. It can be seen that the identifier is gradually increasing.
[0031] Write data may refer to data obtained through data to be written, such as data in a log of a computing node in a database system or data waiting to be stored in a storage node, such as data in a cache page.
[0032] The computing nodes are used to maintain data identifiers that change with time series.
[0033] For example, the computing node in the database system sends the write data that needs to be persistently stored to the storage node in the database through a write request. The write request method is also a write IO method. And the request or the IO carries the write data to be written and the corresponding data identifier. Therefore, after receiving the request, the storage node can store data according to the write data in the request. The write data can also be stored in order through the data identifier. The storage node can obtain the write data and the corresponding data identifier. The corresponding request or the corresponding IO is also marked.
[0034] The following is a detailed description of the data identification maintenance of the computing node:
[0035] Specifically, the method 100 also includes: obtaining the data to be written through the computing node so that the data to be written is written into the corresponding cache page; generating and storing record information of the write operation of the data to be written through the computing node, each record information corresponds to a serial number, and the serial number increases with the time sequence.
[0036] The recorded information may refer to information recorded in a log or other recorded information, as long as it can be recorded, such as information recorded in a text. The recorded information may refer to a write operation corresponding to the data to be written, such as writing the data to be written to the corresponding cache page at xx time.
[0037] For example, as mentioned above, users can send read and write requests through local database applications on their computers, or directly through API (Application Programming Interface) interfaces, such as SQL (Structured Query Language) read and write requests. The cloud server receives the read and write requests sent by the user through the computer. Figure 2As shown, the storage engine 201 in the database system of the cloud server can receive the sent write request, that is, the computing node receives the write request. That is, step 211 is executed: receiving the request. The storage engine 201 can obtain the data to be written in the request. Then the write operation corresponding to the data to be written can be recorded in the redo log 2021 (redo log). That is, the computing node records the log. The redo log 2021 is stored in the storage system 202 (that is, the storage node). That is, the storage engine 201 executes step 212: writes the record information to the redo log 2021. In the log, it is recorded as a log entry. Each log entry has a corresponding sequence number LSN (Log Sequence Number), and the sequence number and the log entry can be a one-to-one correspondence. For log entries in the same batch, it can be by sharing a sequence number as the version number of these log entries. That is, the maximum value of the sequence number corresponding to the log entries in the batch can be used as the version number of the log entries in the batch. For example, the serial numbers corresponding to the batch of log entries can be 50-100, so the version number corresponding to the batch of log entries is 100. Therefore, according to the previous text, the computing node maintains the data identifier and can get the largest serial number from the redo log 2021 as an identifier, or as the serial number or version number of the created snapshot. Figure 2 As shown, 87 is used as the serial number or version number of the snapshot. That is, the computing node determines the identifier of the snapshot through the storage engine 201.
[0038] It should be understood that the serial number also increases over time, so I will not go into details.
[0039] Since the write data in the above log has been marked, when the cache page is subsequently modified, or the corresponding write data is written to the cache page, the cache page can also have the corresponding data mark because of the corresponding data.
[0040] Specifically, the method 100 also includes: writing the data to be written into the corresponding cache page through the computing node so that the corresponding cache page is stored, determining the serial number of the corresponding cache page according to the serial number of the data to be written in the record information, so that the corresponding write data all have corresponding serial numbers; for the record information corresponding to the same batch, the same serial number is selected as the corresponding data identifier.
[0041] For example, according to the above description, the data to be written can be written to the cache page at the same time as the log is written. Alternatively, the log can be written first and then written to the cache page. Figure 2As shown, the storage engine 201 executes step 213: writes data to the cache page 2032 (page) in the cache pool 203. Among them, there may be a clean page 2031 in the cache pool 203, that is, the data stored in the page has been stored in the storage system 202 for data persistence. As for the cache page 2032, it is a dirty page, that is, the write data therein has not yet been stored in the storage system 202 for data persistence. But later, the dirty page also needs to be stored in the storage system 202 for data persistence. That is, execute step 215: write data. Therefore, the identifier of the cache page 2032 can be the corresponding serial number of the data to be written in the corresponding log entry, such as 87, and the storage data version number written into the storage system 202 is also 87. For the record information corresponding to the same batch, by selecting the same serial number as the corresponding identifier, the record information of the same batch can belong to the same request. I will not go into details.
[0042] It should be noted that, as a result, all the stored data in the database system can have corresponding identifiers. When there are multiple data to be written with different sequence numbers that need to be written to a cache page, the cache page can be a collection of these different sequence numbers. Alternatively, the corresponding sequence number is selected from these different sequence numbers according to a preset rule as the sequence number of the page. That is, the version number. For example, the largest sequence number can be selected as the version number of the page, or different writing times can correspond to different selection methods according to the writing time corresponding to the corresponding data to be written. The longer the writing time, the more sequence numbers can be selected, and the shorter the duration, the fewer sequence numbers. The final sequence number is selected from different sequence numbers according to the time interval as the version number. Or directly select the minimum sequence number and the maximum sequence number as the version number of the page.
[0043] like Figure 2 As shown, after the storage engine 201 records the data to be written in the log, it can return the writing result to the user's computer through the computing node and the cloud server to inform the user. That is, step 214: sending the writing result is executed.
[0044] After the device where the database is located crashes (or the physical machine of the cloud server crashes), the non-persistent cache page can be recorded and played back through the above-mentioned recording information to restore the data.
[0045] In addition, when a user's stored write data is distributed on different data blocks in the database (data disks are divided into multiple data blocks), snapshots cannot guarantee the atomicity of a user's data submission. Because of the timing of snapshots, part of the user's write request that occurs at the same time as the snapshot may be in the snapshot, while the other part is not, which leads to the state in the snapshot being inconsistent with the state of the request initiated by the user.
[0046] Although the embodiment of the present application runs on a storage system, such as a distributed storage system. The computing node will determine the modification status of the transaction by submitting log entries in batches and waiting for all submitted log entries to be completed together. In this way, the database realizes the atomicity of transaction modification. By using the LSN on these data, all modifications that are less than or equal to the sequence number SnapLSN of the snapshot are completely recorded in the snapshot Snaphshot, ensuring the atomicity of transactions at the database level. It is relatively difficult to achieve atomicity at the write request level for the prior art.
[0047] The log entries corresponding to the batch have the same version number, such as the log entries corresponding to the same write request. When creating a snapshot, you can divide it according to the version number, so that part of the request will not appear in the snapshot and part of it will not appear outside the snapshot, and consistency is maintained.
[0048] It should be understood that for the read and write requests triggered by the user, the corresponding write requests in the cloud server need to complete the final data reading and data writing. Therefore, when the write data stored therein has a corresponding identifier, the corresponding write request can also have a corresponding data identifier. That is, the identifier has been determined at the moment the write request is generated. The database system of the embodiment of the present application allows the computing node to bring this information to the storage when writing IO. The storage node uses the identifiers on these IOs, such as LSN as the version, to implement snapshots. Since the version numbers of these IOs are determined when the computing nodes write data, the storage system does not need to collaborate for this purpose. For example, distributed collaboration only needs to increase the version number and write it. Without collaboration, IO will not be blocked at the moment of taking a snapshot, which means that the user's request will be blocked.
[0049] 102: The storage node stores the write data in order according to the data identifier of the write data.
[0050] Since the previous article has explained the process of data persistence, it will not be repeated here.
[0051] 103: When creating a snapshot, the latest data identifier of the corresponding write data is obtained through the computing node, and the latest data identifier is sent to the storage node as the snapshot identifier, and the snapshot identifier is stored through the storage node.
[0052] As can be seen from the foregoing, the latest data identifier may be the maximum identifier, or may be the latest data identifier in terms of time.
[0053] Here, the latest data identifier may be directly used as the snapshot identifier corresponding to the snapshot, or the latest data identifier may be transformed, such as +1, +2 or +n, to be used as the snapshot identifier corresponding to the snapshot.
[0054] A snapshot is a completely usable copy of a specified data set, which includes an image of the corresponding data at a certain point in time (the point in time when the copy starts).
[0055] For example, as described above, a user can send a snapshot creation instruction through a local database application on a computer, or directly through an API (Application Programming Interface) interface. Such as SQL (Structured Query Language) to create a snapshot instruction. Here, after the cloud server receives the snapshot creation instruction, specifically, the control node in the database receives the instruction, and then triggers the computing node to create a snapshot through the control node, or receives the instruction sent by the control node. Then, the computing node obtains the latest sequence number in the write data it maintains according to the instruction. The latest sequence number refers to the maximum sequence number, and the maximum sequence number is determined as the identifier for the current snapshot that needs to be created, that is, it is also the version number of the snapshot. The version number of the snapshot is sent to the storage node, and the storage node receives the version number of the snapshot.
[0056] It should be noted that after the snapshot identifier of the snapshot is determined, the write data can be divided into write data that is less than or equal to, or greater than the snapshot identifier.
[0057] In addition to user-triggered snapshot creation, the cloud server's database system can also create snapshots on a scheduled basis. I will not go into details here.
[0058] As can be seen from the foregoing, obtaining the latest data identifier of the corresponding write data through the computing node includes: in the case of creating a snapshot, obtaining the last sequence number from the record information as the latest data identifier.
[0059] For example, as mentioned above, when the computing node in the cloud server obtains the latest data identifier, it can obtain the last serial number from the log, which will not be repeated here.
[0060] 104: The storage node reserves the write data corresponding to the data identifier being less than or equal to the snapshot identifier as the data corresponding to the snapshot, so that when the snapshot is read, the data corresponding to the snapshot is read.
[0061] In addition, after the storage node in the cloud server obtains the corresponding snapshot identifier, it can retain the data in its data whose data identifier is less than or equal to the snapshot identifier as the data corresponding to the snapshot, and then it can generate a snapshot and have the corresponding snapshot data. At the same time, the precise time of the snapshot is the version number, that is, the writing time of the LSN. Figure 2As shown, step 216 is executed: creating a snapshot, thereby generating a corresponding version number and a corresponding snapshot.
[0062] To speed up the creation of snapshots and reduce storage space usage, you can clean up unnecessary data and retain the required data.
[0063] Specifically, the method 100 further includes: obtaining a target data identifier that is less than or equal to the snapshot identifier through a storage node, and retaining write data corresponding to the largest data identifier in the target data identifiers; and deleting write data corresponding to other data identifiers in the target data identifiers.
[0064] For example, as described above, for the snapshot version number, i.e., the serial number SnapLSN, the storage system, i.e., the storage node, needs to retain the latest version that is less than or equal to SnapLSN. Figure 2 As shown, here, taking snapshot SnapLSN=70 as an example, first obtain the version number of the write data less than or equal to 70 from the persistent structure 2022 in the storage system 202 as the target identifier, and then select the version number of the stored write data Pa as 62 as the largest version number, that is, the largest identifier. It needs to be retained. Other version numbers in the target identifier can be deleted.
[0065] Correspondingly, the method 100 may further include: obtaining a target data identifier that is less than or equal to the snapshot identifier through a storage node, and retaining write data corresponding to a preset data identifier in the target data identifier; and deleting write data corresponding to other data identifiers in the target data identifier.
[0066] The preset data identifier may be the largest identifier among the target data identifiers mentioned above, or may be the first few data identifiers among the target data identifiers, such as the first three largest data identifiers to be retained. Alternatively, except for the largest data identifier among the target data identifiers, the write data of the corresponding data identifier may be retained according to the needs of the user. I will not elaborate on this in detail.
[0067] In addition, deleting the write data corresponding to other data identifiers in the target data identifier includes: obtaining multiple snapshot identifiers corresponding to the multiple snapshots, and deleting the write data corresponding to some other data identifiers in the target data identifier according to the multiple snapshot identifiers.
[0068] For example, according to the above, if Figure 2 As shown in , for other unreserved stored write data, if no snapshot requires this version, it can also be cleaned up. Figure 2As shown, here we take snapshots SnapLSN=70 and SnapLSN=15 as examples. Since there are only these two version numbers of the snapshots, and the version number of the stored write data Pa is 30, according to the previous text, since it is not needed by the snapshot and is not the latest version, it can be cleaned up, such as 30.
[0069] It should be noted that the snapshot identifier 70 is used as the maximum identifier when the snapshot is created, and the same is true for the snapshot identifier 15.
[0070] After creating a snapshot, you can read the data corresponding to the created snapshot.
[0071] Specifically, the method 100 further includes: obtaining, through a computing node, an instruction for reading a snapshot, and obtaining, through a storage node, write data corresponding to the snapshot identifier according to the snapshot identifier of the read snapshot.
[0072] For example, as described above, the cloud server may receive a request or instruction to read a snapshot triggered by a user. The request or instruction carries a version number of the read snapshot. Then, the computing node in the cloud server may read the stored write data corresponding to the snapshot according to the version number. For example, the write data that is less than or equal to the version number. The process of reading data is similar to the process of writing data, and can also be implemented by the request method described above, such as read request, read IO, etc. I will not go into details.
[0073] For write data at the same logical storage location offset, if the data identifiers are different, the storage system will physically store the data at other locations on the disk and will not overwrite the data. To reclaim space, when the data identifier of a data is no longer needed by the storage system, the storage node will automatically clear the version.
[0074] Specifically, the method 100 further includes: for write data corresponding to different serial numbers at the same logical storage location, storing the corresponding write data at different physical storage locations through storage nodes.
[0075] The method 100 also includes: retaining the write data corresponding to the maximum sequence number corresponding to the same logical storage location through the storage node; obtaining the sequence number corresponding to the same logical storage location through the storage node, obtaining the target sequence number that is less than or equal to the last sequence number from the corresponding sequence, and retaining the write data corresponding to the maximum sequence number in the target sequence number; deleting the write data corresponding to other unreserved sequence numbers from the physical storage location through the storage node.
[0076] The same logical storage location refers to the same offset logical offset location.
[0077] For example, as mentioned above, due to the different version numbers of write data for the same offset, the storage nodes of the database system in the cloud server need to store the write data of different version numbers separately in different physical storage locations, such as storing them in corresponding data blocks. Therefore, the write data occupied by an offset will no longer be a fixed size, but will increase as the number of version numbers increases. In order to reduce storage space overhead, the storage node needs to recycle the write data of useless version numbers to reclaim space.
[0078] The version number required by the database system is the latest version number of the data written corresponding to each offset. Figure 2 As shown in the figure, for the stored write data Pa, its version number 87 is the latest version, which needs to be retained by the current database system. The version number required for the snapshot is less than or equal to the latest version number of the snapshot, such as 70. Then obtain the version number less than or equal to 70 as the target sequence number, and then select the largest sequence number from them. For example, the version number 62 of the write data Pa is the largest version number, which needs to be retained. Other version numbers can be deleted.
[0079] It should be noted that the method 100 may also include: retaining the write data corresponding to the maximum data identifier corresponding to the same logical storage location through the storage node; obtaining the data identifier corresponding to the same logical storage location through the storage node, obtaining the target data identifier that is less than or equal to the maximum data identifier from the corresponding data identifier, and retaining the write data corresponding to the maximum data identifier in the target data identifier; deleting the write data corresponding to other unreserved data identifiers from the physical storage location through the storage node.
[0080] I will not go into details here.
[0081] When reading data, you can read the data in the following ways.
[0082] Specifically, the method 100 further includes: obtaining a data read instruction through a computing node, and reading write data corresponding to a sequence number less than or equal to the specified sequence number through a storage node according to the specified sequence number carried in the read instruction.
[0083] For example, as described above, the cloud server can receive a read request or read instruction for reading data triggered by a user through a computing node. The computing node in the cloud server can, based on the specified serial number carried in the request or instruction, and by calling the corresponding API, such as calling the read interface, enable the storage node to return the latest stored write data that is "less than or equal to the user-specified LSN". If the computing node wants to read the latest stored write data, it only needs the computing node to read the stored write data through the maximum version number. Then return the acquired stored write data to the user's computer.
[0084] Accordingly, the method 100 further includes: obtaining a data read instruction through a computing node, and reading write data corresponding to a specified data identifier less than or equal to the specified data identifier according to the specified data identifier carried in the read instruction.
[0085] The above method is applicable to dense data version numbers. However, the density of data version numbers may be relatively high. If the user does not want such a high data density, the density of data version numbers can also be compressed. This makes it applicable to sparse data version numbers. The density of compressed version numbers can be completed through the following two operations: "write" and "take a snapshot".
[0086] Specifically, the method 100 further includes: determining, by a computing node, a data identifier corresponding to subsequent data to be written after the snapshot is created, and the data identifier is greater than the snapshot identifier, and the data identifiers of the subsequent data to be written are the same.
[0087] For example, as mentioned above, when creating a snapshot, the computing node can get the latest LSN to set the SnapLSN of the snapshot in the storage node through the SetSnapshot setting method, and can also record the LSN+1 as the corresponding sequence number WriteLSN of the subsequent data to be written. After completing the setting of SnapLSN, the snapshot Snapshot can be generated, and the precise time of the snapshot is the write time of the LSN.
[0088] It should be noted that LSN+2, +3, +4, etc. can also be used, as long as the WriteLSN is greater than the latest LSN. This can achieve sparse version number density. And the sequence numbers of subsequent data to be written are the same.
[0089] Accordingly, the method 100 further includes: determining, by means of a computing node, a sequence number corresponding to subsequent data to be written after the snapshot is created, and the sequence number is greater than the sequence number of the snapshot, and the sequence number of the subsequent data to be written is the same.
[0090] In addition, the method 100 further includes: writing the subsequent data to be written to the corresponding cache page based on the data identifier of the subsequent data to be written by the computing node, and determining the identifier of the corresponding cache page.
[0091] For example, according to the above, the computing node no longer uses the LSN of the data to be written to the cache page Page as its serial number, that is, the version number, but writes the Page by using the above WriteLSN, that is, as the serial number of the page, that is, the version number. For log entries, since a batch of log entries only corresponds to one version number, they can be left unchanged and the LSN corresponding to the log entry can continue to be used as the version number corresponding to the data to be written, which is also the version number corresponding to the stored write data. The above WriteLSN can also be used as its version number.
[0092] Throughout the process, we can see that before setting WriteLSN, the version number in the storage node is smaller than the latest SnapLSN, and after modification, the version number of the corresponding data is larger than SnapLSN, which ensures that the snapshot contains all data states before the snapshot and does not contain all subsequent modifications. For other operations such as data reading and recycling, there is no difference from the dense method described above. I will not go into details.
[0093] In the cloud database scenario, in order to improve the concurrent writing capability, the scenario needs to be provided with multiple computing nodes (that is, the cloud server needs to provide multiple upper-layer database applications) to write data together. In the case where multiple computing nodes write data together, a physical redo log can be assigned to each computing node, so that different nodes can write redo logs at their own pace to complete user modifications without conflicts, as described above. However, it is possible that the data modified by different computing nodes is conflicting, so different computing nodes need to coordinate writing. The specific conflict coordination process can be that the computing node resolves the conflict through a logical LSN.
[0094] Specifically, the method 100 further includes: when writing data to multiple computing nodes, determining a current snapshot identifier, and the current snapshot identifier is greater than a historical snapshot identifier; and the determined current snapshot identifier corresponds to a maximum data identifier of the write data.
[0095] For example, as mentioned above, when multiple computing nodes write data at the same time, the snapshot implementation only needs to use the logical LSN as the version number when calling SetSnapshot to implement the snapshot. The logical LSN needs to be greater than the version number of the previous historical snapshot, that is, the version number of the generated snapshot already exists. If the maximum existing snapshot version number is 50, then the version number of the current snapshot can be set to 51. And the version number of the current snapshot is the version number of the corresponding latest write data, which can be used to divide the previously stored write data and the subsequent write data. For example, the corresponding maximum LSN can be determined through each redo log, thereby associating the current snapshot identifier with the maximum LSN. Alternatively, the maximum LSN can be directly used as the version number of the current snapshot. The other operations are no different from the previous ones, so they will not be repeated.
[0096] In order to ensure ACID (the four characteristics that a database management system must have in order to ensure that a transaction is correct and reliable during the process of writing or updating data) of transaction modifications, computing nodes will use their own transaction processing mechanisms to solve consistency problems. However, it is actually unnecessary to use complex distributed storage systems to achieve consistent snapshots. The storage system can use the database's concurrency control mechanism to solve these consistency problems.
[0097] It should also be noted that the embodiments of the present application can implement functions such as writing and reading data through APIs. For example, writing data to a storage system (storage node), reading data from a storage system, writing data to an offset, reading data to an offset, creating a snapshot, retaining the corresponding version number or data identifier of the written data, etc. All of the above can be implemented by calling the corresponding API.
[0098] In addition, you can also use the computing nodes and operating storage nodes. In this case, only the above redo logs are written without writing pages. The storage nodes will generate real pages based on the redo logs written by the computing nodes. Although the computing nodes do not write specific pages, when the computing nodes need a page, they can directly read the corresponding version of the page from the storage nodes. However, in this case, there is no distributed storage system in the traditional sense, but the computing nodes and storage nodes together form a complete distributed database. It does not have a storage snapshot, but a point-in-time snapshot (POINT IN TIME SNAPSHOT) at the database level. The snapshot contains the physical pages of the current database system and the logs that are not applied to the physical pages. The control link can complete the backup through the snapshot of this database system.
[0099] However, since the storage nodes and computing nodes together form a complete database, a single storage node can no longer provide complete storage functions. In addition, many logics of the database system will be completed in the storage node, so the logic of the storage node will be more complicated. It is more about implementing a snapshot at the computing node level from the storage engine of the database system, which can avoid blocking the modification of the database system. It is also a mechanism to solve the consistency problem of distributed snapshots. However, if the logic of the computing node is embedded in the storage node, the logic of the storage node will become complicated. At the same time, since the computing node and the storage node together form a complete database logic, the two components are highly coupled and it is difficult to develop independently.
[0100] In addition, in this case, the storage node no longer has a complete storage API, and peripheral tools that operate storage based on standard read and write APIs will no longer be applicable and need to be re-adapted. For a distributed storage system, in order to provide an application-consistent distributed snapshot, it is often necessary to add a new mechanism on the IO path to ensure that the state of the snapshot record is consistent with the upper-level database application, namely the computing node. As mentioned above, due to the involvement of a distributed storage system, it is often more complicated to implement. However, the embodiment of the present application still clearly divides storage nodes and computing nodes, so that the two can easily evolve independently. In addition, the storage node can provide a complete storage logic, and all modifications do not have to be completed through the log of the computing node as mentioned above.
[0101] In the scenario of database services, the snapshot implementation of its storage can be implemented in conjunction with the services of the database system, which will greatly simplify the implementation of the snapshot and may also provide more value for the database system. The embodiment of the present application uses the log sequence of the database system to mark IO, that is, request marking, such as write request marking and write IO marking. It avoids the distributed collaboration of implementing snapshots. At the same time, since each data block carries the version information of the database system, it provides opportunities for subsequent database systems to use historical version data for backtracking queries. This implementation method is the core of designing a storage system for a database system. And the modifications at the level of the database system in the embodiment of the present application are atomic and included in the snapshot. There will not be a transaction that is successful in normal operation but fails in the snapshot. In addition, the logic of the storage node and the logic of the computing node still have a clear interface, and the two are less coupled and can develop independently.
[0102] Figure 3 The structure diagram of a snapshot creation system provided by an exemplary embodiment of the present application is as follows. Figure 3 As shown, the system 300 may include: a first device 301 and a second device 302 .
[0103] Among them, the first device 301 can be a device with certain computing capabilities, which can realize the function of sending data to the second device 302, and can also receive data sent by the second device 302. The basic structure of the first device 301 may include: at least one processor. The number of processors may depend on the configuration and type of the device with certain computing capabilities. The device with certain computing capabilities may also include a memory, which may be volatile, such as RAM, or non-volatile, such as read-only memory (ROM), flash memory, etc., or may include both types at the same time. The memory usually stores an operating system (OS), one or more application programs, and may also store program data, etc. In addition to the processing unit and the memory, the device with certain computing capabilities also includes some basic configurations, such as a network card chip, an IO bus, a display component, and some peripheral devices, etc. Optionally, some peripheral devices may include, for example, a keyboard, an input pen, etc. Other peripheral devices are well known in the art and will not be described in detail here. Optionally, the first device 301 may be an intelligent terminal, such as a mobile phone, a desktop computer, a notebook, a tablet computer, etc.
[0104] The second device 302 refers to a device that can provide computing and processing services in a network virtual environment, and can refer to a device that uses the network to create snapshots. In physical implementation, the second device 302 can be any device that can provide computing services, respond to service requests, and obtain information, such as a cloud server, cloud host, virtual center, conventional server, etc., on which a database is constructed. The second device 302 mainly includes a processor, a hard disk, a memory, a system bus, etc., which is similar to a general computer architecture.
[0105] Specifically, the second device 302 sends a write request to the storage node through the computing node, where the write request carries the write data and the data identifier of the write data, and the data identifier increases with time; the storage node stores the write data in order according to the data identifier of the write data; when creating a snapshot, the computing node obtains the latest data identifier of the corresponding write data, and sends the latest data identifier to the storage node as the snapshot identifier, and the storage node stores the snapshot identifier; the storage node retains the write data corresponding to the data identifier less than or equal to the snapshot identifier as the data corresponding to the snapshot, so that when reading the snapshot, the data corresponding to the snapshot can be read.
[0106] The first device 301 may send a snapshot creation instruction to the second device 302 .
[0107] In addition, the second device 302 obtains a target data identifier that is less than or equal to the snapshot identifier through a storage node, and retains the write data corresponding to the largest data identifier in the target data identifier; and deletes the write data corresponding to other data identifiers in the target data identifier.
[0108] Specifically, the second device 302 obtains multiple snapshot identifiers corresponding to the multiple snapshots through the storage node, and deletes the write data corresponding to some other data identifiers in the target data identifier according to the multiple snapshot identifiers.
[0109] In addition, the second device 302 obtains an instruction to read the snapshot through the computing node, and obtains write data corresponding to the snapshot identifier through the storage node according to the snapshot identifier of the read snapshot.
[0110] In addition, the second device 302 obtains the data to be written through the computing node so that the data to be written is written into the corresponding cache page; generates and stores record information of the write operation of the data to be written through the computing node, each record information corresponds to a serial number, and the serial number increases with time; when creating a snapshot, the last serial number is obtained from the record information as the latest data identifier.
[0111] In addition, the second device 302 writes the data to be written into the corresponding cache page through the computing node so that the corresponding cache page is stored, and determines the serial number of the corresponding cache page according to the serial number of the data to be written in the record information so that the corresponding write data all have corresponding serial numbers; for the record information corresponding to the same batch, the same serial number is selected as the corresponding data identifier.
[0112] In addition, the second device 302 obtains a data read instruction through a computing node, and reads write data corresponding to a sequence number less than or equal to the specified sequence number through a storage node according to the specified sequence number carried in the read instruction.
[0113] In addition, the second device 302, for write data corresponding to different serial numbers at the same logical storage location, stores the corresponding write data according to different physical storage locations through a storage node; retains the write data corresponding to the maximum serial number corresponding to the same logical storage location through a storage node; obtains the serial number corresponding to the same logical storage location through a storage node, obtains a target serial number that is less than or equal to the last serial number from the corresponding sequence, and retains the write data corresponding to the maximum serial number in the target serial number; and deletes the write data corresponding to other serial numbers that are not retained from the physical storage location through the storage node.
[0114] In addition, the second device 302 determines, through a computing node, a data identifier corresponding to subsequent data to be written after the snapshot is created, and the data identifier is greater than the snapshot identifier, and the data identifier of the subsequent data to be written is the same.
[0115] In addition, the second device 302 writes the subsequent data to be written to the corresponding cache page based on the data identifier of the subsequent data to be written through the computing node, and determines the identifier of the corresponding cache page.
[0116] In addition, when the second device 302 writes data to multiple computing nodes, it determines the current snapshot identifier through the computing nodes, and the current snapshot identifier is greater than the historical snapshot identifier; the determined current snapshot identifier corresponds to the maximum data identifier of the write data.
[0117] For any incomplete content, please refer to the previous article and I will not repeat it here.
[0118] In the scenario of creating a snapshot, the user can send a read / write request or create a snapshot instruction through the first device 301, such as a computer through a local database application, or directly through an API (Application Programming Interface) interface. Such as SQL (Structured Query Language) read / write request or create a snapshot instruction. For example, a write request can be sent, and then the computing node can determine the corresponding data identifier, such as the data version number, based on the data to be written in the write request. Then, by sending the write request to the storage node, the storage node stores the data according to the corresponding write data and the corresponding data version number in the request.
[0119] Similarly, the user can send a snapshot creation instruction through the first device 301, such as a computer, that is, execute step 311: send a snapshot creation request to the second device 302. Such as a cloud server. Here, after the cloud server receives the snapshot creation instruction, specifically, the control node in the database receives the instruction, and then triggers the computing node to create a snapshot through the control node, or receives the instruction sent by the control node. Then, the computing node obtains the latest sequence number in the write data according to the instruction, such as the computing node can get the largest sequence number from the redo log 2021 as an identifier, or as the sequence number or version number of the created snapshot.
[0120] After determining the version number of the snapshot, the computing node in the cloud server sends the version number to the storage node, so that the storage node stores the version number. Then, the write data corresponding to the data version number less than or equal to the version number is retained to generate the snapshot. At the same time, the precise time of the snapshot is the writing time of the version number.
[0121] After the snapshot is created, the cloud server may also return a successful creation result to the user's computer, that is, executing step 312: sending the successful creation result to the user's computer.
[0122] In addition, the cloud server receives read and write requests sent by the user through the computer. Such as the corresponding SQL request. The storage engine in the database of the cloud server can receive the sent write request. The storage engine can obtain the data to be written in the request. Then the write operation corresponding to the data to be written can be recorded in the redo log. The redo log is stored in the storage system. In the log, it is recorded as a log entry. Each log entry has a corresponding sequence number LSN (Log Sequence Number), and the sequence number and the log entry can be a one-to-one correspondence. For log entries in the same batch, it can be by sharing a sequence number as the version number of these log entries. That is, the maximum value of the sequence numbers corresponding to the batch of log entries can be used as the version number of the batch of log entries. For example, the sequence number corresponding to the batch of log entries can be 50-100, so the final version number corresponding to the batch of log entries is 100.
[0123] The data to be written can be written to the cache page at the same time as the log is written. The log can also be written first and then written to the cache page. Among them, there can be a clean page in the cache pool, that is, the data stored in the page has been stored in the storage system for data persistence. As for the above-mentioned cache page, it is a dirty page, that is, the data therein has not yet been stored in the storage system for data persistence. But later, the dirty page also needs to be stored in the storage system for data persistence. Therefore, the identifier of the cache page can be the corresponding serial number of the data to be written in the corresponding log entry, such as 87, and the version number of the write data written to the storage system is also 87. For the record information corresponding to the same batch, by selecting the same serial number as the corresponding identifier, the record information of the same batch can belong to the same request. I will not go into details.
[0124] For the contents not recorded in detail here, please refer to the previous content and I will not repeat them here.
[0125] In the above embodiment, the first device 301 and the second device 302 are connected to the network. If the first device 301 and the second device 302 are connected for communication, the network standard of the mobile network can be any one of 2G (GSM), 2.5G (GPRS), 3G (WCDMA, TD-SCDMA, CDMA2000, UTMS), 4G (LTE), 4G+ (LTE+), WiMax, 5G, etc.
[0126] Figure 4A schematic diagram of a structure framework of a snapshot creation device provided by an exemplary embodiment of the present application. The device 400 can be applied to a computing device, such as a cloud server. The device 400 includes: a sending module 401, a storage module 402, a creation module 403, and a retention module 404; the functions of each module are described in detail below:
[0127] The sending module 401 is used to send a write request to a storage node through a computing node.
[0128] The write request carries the write data and the data identifier of the write data, and the data identifier increases with the timing.
[0129] The storage module 402 is used to sequentially store the write data according to the data identifier of the write data through the storage node.
[0130] The creation module 403 is used to obtain the latest data identifier of the corresponding write data through the computing node when creating a snapshot, and send the latest data identifier as the snapshot identifier to the storage node, and store the snapshot identifier through the storage node.
[0131] Reservation module 404, for reserving the data identifier less than or equal to the snapshot identifier corresponding to the write data through the storage node as the data corresponding to the snapshot, so that in the case of reading the snapshot, the data corresponding to the snapshot is read.
[0132] In addition, the retention module 404 is used to obtain the target data identifier that is less than or equal to the snapshot identifier through the storage node, and retain the write data corresponding to the largest data identifier in the target data identifier; the device 400 also includes: a deletion module, which is used to delete the write data corresponding to other data identifiers in the target data identifier.
[0133] Specifically, the deletion module is used to obtain multiple snapshot identifiers corresponding to multiple snapshots through the storage node, and delete the write data corresponding to some other data identifiers in the target data identifier according to the multiple snapshot identifiers through the storage node.
[0134] In addition, the device 400 further includes: a reading module, which is used to obtain an instruction for reading a snapshot through a computing node, and obtain write data corresponding to the snapshot identifier according to the snapshot identifier of the read snapshot.
[0135] In addition, the storage module 402 is used to obtain the data to be written through the computing node so that the data to be written is written into the corresponding cache page; the device 400 also includes: a generation module, which is used to generate and store record information of the write operation of the data to be written through the computing node, each record information corresponds to a serial number, and the serial number increases with the time sequence; wherein, the sending module 401 is used to obtain the last serial number from the record information as the latest data identifier when creating a snapshot.
[0136] In addition, the storage module 402 is used to write the data to be written into the corresponding cache page through the computing node so that the corresponding cache page is stored, and the serial number of the corresponding cache page is determined according to the serial number of the data to be written in the record information so that the corresponding write data all have corresponding serial numbers; the device 400 also includes: a selection module, which is used to select the same serial number as the corresponding data identifier for the record information corresponding to the same batch.
[0137] In addition, the reading module is also used to obtain data reading instructions through the computing node, and read the write data corresponding to the specified serial number less than or equal to the specified serial number through the storage node according to the specified serial number carried by the reading instruction.
[0138] In addition, the storage module 402 is used to store the corresponding write data corresponding to different serial numbers of the same logical storage location according to different physical storage locations through the storage node; the retention module 404 is used to retain the write data corresponding to the maximum serial number corresponding to the same logical storage location through the storage node; the retention module 404 is used to obtain the serial number corresponding to the same logical storage location through the storage node, obtain the target serial number that is less than or equal to the last serial number from the corresponding sequence, and retain the write data corresponding to the maximum serial number in the target serial number; the deletion module is used to delete the write data corresponding to other serial numbers that have not been reserved from the physical storage location through the storage node.
[0139] In addition, the sending module 401 is further used to determine, through the computing node, a data identifier corresponding to subsequent data to be written after the snapshot is created, and the data identifier is greater than the snapshot identifier, and the data identifier of the subsequent data to be written is the same.
[0140] In addition, the sending module 401 is further configured to write the subsequent data to be written into the corresponding cache page based on the data identifier of the subsequent data to be written through the computing node, and determine the identifier of the corresponding cache page.
[0141] In addition, the sending module 401 is also used to determine the current snapshot identifier through the computing node when data is written to multiple computing nodes, and the identifier is greater than the historical snapshot identifier; the determined current snapshot identifier corresponds to the maximum data identifier of the write data.
[0142] For details of the device 400 that are not fully described, please refer to the above description and will not be repeated here.
[0143] The above describes Figure 4 The internal functions and structure of the device 400 shown, in one possible design, Figure 4 The structure of the apparatus 400 shown may be implemented as a computing device, such as a server. Figure 5 As shown, the device 500 may include: a memory 501, a processor 502;
[0144] The memory 501 is used to store computer programs.
[0145] Processor 502 is used to execute a computer program, which is used to: send a write request to a storage node through a computing node, the write request carries write data and a data identifier of the write data, and the data identifier increases with time sequence; store the write data in order according to the data identifier of the write data through the storage node; when creating a snapshot, obtain the latest data identifier of the corresponding write data through the computing node, and send the latest data identifier to the storage node as the snapshot identifier, and store the snapshot identifier through the storage node; retain the write data corresponding to the data identifier less than or equal to the snapshot identifier through the storage node as the data corresponding to the snapshot, so that when reading the snapshot, the data corresponding to the snapshot can be read.
[0146] In addition, the processor 502 is further configured to obtain target data identifiers that are less than or equal to the snapshot identifier through the storage node, retain the write data corresponding to the largest data identifier in the target data identifiers, and delete the write data corresponding to other data identifiers in the target data identifiers.
[0147] Specifically, the processor 502 is specifically configured to: obtain multiple snapshot identifiers corresponding to the multiple snapshots through the storage node, and delete the write data corresponding to some other data identifiers in the target data identifier according to the multiple snapshot identifiers.
[0148] In addition, the processor 502 is further configured to obtain an instruction for reading a snapshot through a computing node, and obtain write data corresponding to the snapshot identifier through a storage node according to the snapshot identifier of the read snapshot.
[0149] In addition, processor 502 is also used to obtain the data to be written through the computing node, so that the data to be written is written into the corresponding cache page; generate and store record information of the write operation of the data to be written through the computing node, each record information corresponds to a serial number, and the serial number increases with the time sequence; specifically, processor 502 is specifically used to: when creating a snapshot, obtain the last serial number from the record information as the latest data identifier.
[0150] In addition, processor 502 is also used to write the data to be written into the corresponding cache page through the computing node so that the corresponding cache page is stored, and determine the serial number of the corresponding cache page according to the serial number of the data to be written in the record information so that the corresponding write data all have corresponding serial numbers; for the record information corresponding to the same batch, the same serial number is selected as the corresponding data identifier.
[0151] In addition, the processor 502 is further configured to obtain a data read instruction through a computing node, and read write data corresponding to a sequence number less than or equal to the specified sequence number through a storage node according to the specified sequence number carried in the read instruction.
[0152] In addition, processor 502 is also used to store the corresponding write data corresponding to different serial numbers of the same logical storage location according to different physical storage locations through storage nodes; retain the write data corresponding to the maximum serial number corresponding to the same logical storage location through storage nodes; obtain the serial number corresponding to the same logical storage location through storage nodes, obtain the target serial number that is less than or equal to the last serial number from the corresponding sequence, and retain the write data corresponding to the maximum serial number in the target serial number; and delete the write data corresponding to other serial numbers that are not retained from the physical storage location through the storage node.
[0153] In addition, the processor 502 is further configured to determine, through a computing node, a data identifier corresponding to subsequent data to be written after the snapshot is created, and the data identifier is greater than the snapshot identifier, and the data identifiers of the subsequent data to be written are the same.
[0154] In addition, the processor 502 is further configured to write the subsequent data to be written into the corresponding cache page based on the data identifier of the subsequent data to be written through the computing node, and determine the identifier of the corresponding cache page.
[0155] In addition, the processor 502 is also used to determine the current snapshot identifier through the computing node when writing data to multiple computing nodes, and the current snapshot identifier is greater than the historical snapshot identifier; the determined current snapshot identifier corresponds to the maximum data identifier of the write data.
[0156] An embodiment of the present invention provides a computer storage medium, which, when a computer program is executed by one or more processors, causes the one or more processors to implement Figure 1-Figure 3 The steps of a method for creating a snapshot in the method embodiment will not be described in detail.
[0157] An embodiment of the present invention provides a computer program product, including a computer program or instructions, wherein when the computer program is executed by a processor, the processor is caused to implement Figure 1-Figure 3 The method embodiment provides steps of a method for creating a snapshot.
[0158] In addition, in some of the processes described in the above embodiments and the accompanying drawings, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel, and the sequence numbers of the operations, such as 101, 102, 103, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to be different types.
[0159] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0160] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a computer product, and the present invention can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0161] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable multimedia data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable multimedia data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0162] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable multimedia data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0163] These computer program instructions may also be loaded onto a computer or other programmable multimedia data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0164] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0165] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0166] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0167] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for creating a snapshot, comprising: The data to be written is written into the corresponding cache page by the computing node so that the corresponding cache page is stored, the record information of the write operation of the data to be written is generated and stored by the computing node, and the sequence number of the corresponding cache page is determined according to the sequence number of the data to be written in the record information, so that the corresponding write data has a corresponding sequence number, and the sequence number increases with the time sequence; for the record information corresponding to the same batch, the same sequence number is selected as the corresponding data identifier; Sending a write request to a storage node through a computing node, wherein the write request carries write data and a data identifier of the write data, and the data identifier increases with time sequence; The storage node stores the written data in order according to the data identifier of the written data; When creating a snapshot, the computing node obtains the last sequence number from the record information as the latest data identifier of the corresponding write data, and sends the latest data identifier as the snapshot identifier to the storage node, and the storage node stores the snapshot identifier; The storage node reserves the write data corresponding to the data identifier being less than or equal to the snapshot identifier as the data corresponding to the snapshot, so that when the snapshot is read, the data corresponding to the snapshot is read.
2. The method according to claim 1, further comprising: Obtaining, through a storage node, a target data identifier that is less than or equal to the snapshot identifier, and retaining write data corresponding to the largest data identifier among the target data identifiers; Delete the write data corresponding to other data identifiers in the target data identifier.
3. The method according to claim 2, wherein the step of deleting the write data corresponding to other data identifiers in the target data identifier comprises: A plurality of snapshot identifiers corresponding to the plurality of snapshots are obtained through a storage node, and write data corresponding to some other data identifiers in the target data identifier are deleted according to the plurality of snapshot identifiers.
4. The method according to claim 1, further comprising: An instruction to read the snapshot is obtained through the computing node, and write data corresponding to the snapshot identifier is obtained through the storage node according to the snapshot identifier of the read snapshot.
5. The method according to claim 1, further comprising: A data read instruction is obtained through a computing node, and according to a specified serial number carried in the read instruction, write data corresponding to a serial number less than or equal to the specified serial number is read through a storage node.
6. The method according to claim 1, further comprising: For write data corresponding to different serial numbers of the same logical storage location, the corresponding write data is stored according to different physical storage locations through the storage node; The storage node retains the write data corresponding to the maximum sequence number corresponding to the same logical storage location; Obtaining the sequence number corresponding to the same logical storage location through the storage node, obtaining the target sequence number that is less than or equal to the last sequence number from the corresponding sequence, and retaining the write data corresponding to the largest sequence number among the target sequence numbers; The storage node deletes the write data corresponding to other unreserved sequence numbers from the physical storage location.
7. The method according to claim 1, further comprising: The data identifier corresponding to the subsequent data to be written after the snapshot is created is determined by the computing node, and the data identifier is greater than the snapshot identifier, and the data identifier of the subsequent data to be written is the same.
8. The method according to claim 7, further comprising: The computing node writes the subsequent data to be written into the corresponding cache page based on the data identifier of the subsequent data to be written, and determines the identifier of the corresponding cache page.
9. The method according to claim 1, further comprising: When data is written to multiple computing nodes, the current snapshot identifier is determined by the computing node, and the current snapshot identifier is greater than the historical snapshot identifier; The determined current snapshot identifier corresponds to the maximum data identifier of the write data.
10. A computing device comprising: Memory, processor; The memory is used to store computer programs; The processor executes the computer program to: write the data to be written into the corresponding cache page through the computing node so that the corresponding cache page is stored, generate and store the record information of the write operation of the data to be written through the computing node, determine the sequence number of the corresponding cache page according to the sequence number of the data to be written in the record information, so that the corresponding write data has a corresponding sequence number, and the sequence number increases with the time sequence; for the record information corresponding to the same batch, the same sequence number is selected as the corresponding data identifier; Sending a write request to a storage node through a computing node, wherein the write request carries write data and a data identifier of the write data, and the data identifier increases with time sequence; The storage node stores the written data in order according to the data identifier of the written data; In the case of creating a snapshot, the computing node obtains the last sequence number from the record information as the latest data identifier for obtaining the corresponding write data, and sends the latest data identifier as the snapshot identifier to the storage node, and the storage node stores the snapshot identifier; The storage node reserves the write data corresponding to the data identifier being less than or equal to the snapshot identifier as the data corresponding to the snapshot, so that when the snapshot is read, the data corresponding to the snapshot is read.
11. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by one or more processors, the one or more processors are caused to implement the steps of the method according to any one of claims 1 to 9.
12. A computer program product comprising a computer program or instructions, wherein: When the computer program is executed by a processor, the processor is caused to implement the steps in the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Data backup method and device
CN105653394A
Snapshot object generation method and device
CN110309100A
Global snapshot method and device, electronic equipment and computer readable storage medium
CN111522689A
Data processing method and device, electronic equipment and computer readable medium
CN113076220A
Cloud data archiving using latest snapshot metadata
US10701153B1
