A snapshot method, apparatus, related device and database system
By generating and committing transaction logs on compute nodes, the problem of low data snapshot success rate on storage nodes is solved, thus achieving high reliability of the database system.
Patent Information
- Application Number
- CN202011052827.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-29
- Publication Date
- 2026-01-20
- Estimated Expiration
- 2040-09-29
AI Technical Summary
In existing technologies, the success rate of data snapshots on storage nodes in database systems is low, which affects the reliability of the database system.
The compute node generates a transaction log and adds a snapshot command. After the target transaction log is formed, it is committed. The storage node executes a snapshot after receiving the transaction log, reducing the dependence on the response time of the storage node, and performs data snapshot processing after the fault is recovered.
It improves the success rate of data snapshots on storage nodes and enhances the reliability of the database system, especially in situations where storage nodes are under high load or experiencing failures, it can still complete snapshots.
Smart Images

Figure CN114328374B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the snapshot technical field, and particularly relates to a snapshot method, device, equipment, database system and computer readable storage medium. BACKGROUND
[0002] With the development of information technology, the reliability and availability of data are increasingly valued by people. At present, the snapshot backup technology is usually used to back up the stored data, so that the reliability and availability of the data can reach a high level. The snapshot refers to a complete and available copy of a specified data set, which contains a static image of the specified data set at the copy time, and the snapshot can be considered as a copy or a replication of the specified data set.
[0003] In some database systems, a computing node usually sends a snapshot command to each storage node in the database system through a command channel, so that the storage node can take a snapshot of the stored data. However, this way of taking a snapshot of the data in the storage node has a low success rate, thereby affecting the reliability of the database system. SUMMARY
[0004] The present application provides a snapshot method for improving the success rate of taking a snapshot of the data in the storage node and improving the reliability of the database system. In addition, the present application also provides an apparatus, an equipment, a database system, a computer readable storage medium and a computer program product corresponding to the above method.
[0005] In a first aspect, the present application provides a snapshot method, which is applied to a database system, the database system includes a computing node and a storage node, and the method includes the following steps:
[0006] The computing node generates a transaction log and a snapshot command for the data in the storage node;
[0007] The computing node adds the snapshot command to the transaction log to obtain a target transaction log;
[0008] The computing node submits the target transaction log.
[0009] In this embodiment, after successfully submitting the target transaction log, the computing node can generally consider that the snapshot is created successfully without waiting for the storage node to return the snapshot success result within a specified time length, because the target transaction log can be certainly received by the normally running storage node, and thus the storage node can execute the snapshot command. Meanwhile, for the storage node, even if it currently has heavy data reading / writing tasks, it can perform data snapshot processing according to the target transaction log when the load is light, or the storage node fails, and the target transaction log submitted by the computing node is also stored persistently, so that the storage node can complete the corresponding data snapshot process according to the persistently stored target transaction log after completing the fault recovery. In this way, the success rate of the storage node performing data snapshot can be effectively improved, and thus the reliability of the database system can be improved.
[0010] In a possible implementation, the storage node includes a plurality of shards, and the method further includes:
[0011] The computing node performs snapshot on shard information, the shard information including storage of data in the storage node in the plurality of shards.
[0012] In a possible implementation, the method further includes:
[0013] The computing node performs snapshot on the target transaction log.
[0014] In a possible implementation, the transaction log includes a start log sequence number LSN and an end log sequence number LSN, and the end LSN is used to indicate an end position of the snapshot of the data performed by the storage node.
[0015] In a second aspect, an embodiment of the present application provides a snapshot method, the method being applied to a database system, the database system including a computing node and a storage node, and the method including:
[0016] The storage node receives a target transaction log submitted by the computing node, the target transaction log including a snapshot command for data in the storage node.
[0017] The storage node performs snapshot on the stored data according to the snapshot command in the target transaction log.
[0018] In a possible implementation, the method further includes:
[0019] The storage node receives an upload instruction.
[0020] The storage node uploads the stored data and / or snapshot to the cloud in response to the upload instruction.
[0021] In a third aspect, the embodiments of the present application further provide a snapshot device, which is applied to a computing node in a database system, the database system further comprising a storage node, and the snapshot device comprising:
[0022] a generating module, configured to generate a transaction log and a snapshot command for data in the storage node;
[0023] an adding module, configured to add the snapshot command to the transaction log to obtain a target transaction log;
[0024] a submitting module, configured to submit the target transaction log.
[0025] In a possible implementation, the storage node comprises a plurality of shards, and the snapshot device further comprises:
[0026] a snapshot module, configured to snapshot shard information, the shard information comprising storage of data in the storage node in the plurality of shards.
[0027] In a possible implementation, the snapshot module is further configured to snapshot the target transaction log.
[0028] In a possible implementation, the transaction log comprises a start log sequence number (LSN) and an end log sequence number (LSN), and the end LSN is used to indicate an end position of snapshotting data by the storage node.
[0029] In a fourth aspect, the embodiments of the present application further provide a snapshot device, which is applied to a storage node in a database system, the database system comprising a computing node, and the snapshot device comprising:
[0030] a communication module, configured to receive a target transaction log submitted by the computing node, the target transaction log comprising a snapshot command for data in the storage node;
[0031] a snapshot module, configured to snapshot stored data according to the snapshot command in the target transaction log.
[0032] In a possible implementation, the communication module is further configured to:
[0033] receive an upload instruction;
[0034] in response to the upload instruction, upload the stored data and / or the snapshot to a cloud.
[0035] In a fifth aspect, the present application provides a device, which comprises a processor and a memory. The processor and the memory are in communication with each other. The processor is configured to execute instructions stored in the memory, so that the device performs the snapshot method according to the first aspect or any implementation manner of the first aspect.
[0036] In a sixth aspect, the present application provides a device, which comprises a processor and a memory. The processor and the memory are in communication with each other. The processor is configured to execute instructions stored in the memory, so that the device performs the snapshot method according to the second aspect or any implementation manner of the second aspect.
[0037] In a seventh aspect, the present application provides a computer-readable storage medium, which stores instructions. The instructions instruct a device to perform the snapshot method according to the first aspect or any implementation manner of the first aspect.
[0038] In an eighth aspect, the present application provides a computer-readable storage medium, which stores instructions. The instructions instruct a device to perform the snapshot method according to the second aspect or any implementation manner of the second aspect.
[0039] In a ninth aspect, the present application provides a computer program product comprising instructions, which, when executed on a device, cause the device to perform the snapshot method according to the first aspect or any implementation manner of the first aspect, or cause the device to perform the snapshot method according to the second aspect or any implementation manner of the second aspect.
[0040] On the basis of the implementation manners of the aspects described above, the present application can be further combined to provide more implementation manners. BRIEF DESCRIPTION OF DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments described in the present application, and other drawings can also be obtained by those skilled in the art according to these drawings.
[0042] Figure 1 A schematic diagram of the framework of an exemplary database system provided by the embodiments of the present application;
[0043] Figure 2 A structural schematic diagram of a computing node in the embodiments of the present application;
[0044] Figure 3 A structural schematic diagram of a storage node in the embodiments of the present application;
[0045] Figure 4 This is a flowchart illustrating a snapshot method according to an embodiment of this application;
[0046] Figure 5 This is a schematic diagram of a snapshot device applied to a computing node 110 in an embodiment of this application;
[0047] Figure 6 This is a schematic diagram of a snapshot device applied to a storage node 120 in an embodiment of this application. Detailed Implementation
[0048] The terms "first" and "second" used in the embodiments of this application are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first" and "second" may explicitly or implicitly include one or more of that feature.
[0049] See Figure 1 This is a schematic diagram of the architecture of an exemplary database system in an embodiment of this application.
[0050] like Figure 1 As shown, the database system 100 may include at least a compute node 110 and a storage node 120. The compute node 110 may be connected to the storage node 120; for example, the compute node 110 may be connected via a storage node 120. Figure 1 The routing device 130 shown is wirelessly connected to the storage node 120, etc.
[0051] For example, computing node 110 can be a single node or it can include multiple nodes. Figure 1 (This example uses a single node); storage node 120 can be a single node, or it can include nodes such as... Figure 1 The multiple nodes shown are storage node 121, storage node 122, storage node 123 and storage node 124.
[0052] Storage node 120 can be used to store data, while compute node 110 can manage the data storage of storage node 120. For example, compute node 110 can send snapshot commands to storage node 120 so that storage node 120 can take snapshots of the data it stores.
[0053] In some examples, the database system 100 may also include an upper-layer application 140, so that users can perform corresponding operations on the database system through the upper-layer application 140. For example, users can instruct the database system 100 to perform tasks such as data reading, writing, and snapshots through the upper-layer application 140.
[0054] The database system 100 can also generate a corresponding log during the execution of the task, so as to record the execution process and result of the task based on the log, and perform a rollback operation based on the log. The generated log can be stored by the log storage node 150 in the database system 100. The log storage node 150 can include one or more nodes. When storing the log, the log storage node 150 can store one or more log copies, and the multiple log copies can be distributed on different log storage nodes. Figure 1 In the illustrated database system 100, the log storage nodes 151, 152, and 153 are taken as an example for illustration. In actual applications, more or fewer storage nodes can also be included.
[0055] Generally, the computing node 110 can establish a command channel with the storage node 120, and the computing node 110 can send a snapshot command to the storage node 120 through the command channel, and wait for the storage node 120 to successfully execute the snapshot command within a certain time period after sending the snapshot command. However, this implementation has a low snapshot success rate for the data in the storage node 120.
[0056] For example, the running load of the storage node 120 is high in some time period, for example, the storage node 120 can have heavy data reading and / or writing tasks, which makes it difficult for the storage node 120 to respond to the snapshot command and take a snapshot of the currently stored data within a specified time period, so that the computing node 110 determines that the storage node 120 fails to take a snapshot because the waiting time for the storage node 120 to respond to the snapshot command is too long. For another example, when some storage nodes fail, for example, the storage node 121 fails, the computing node 110 can not be able to send a snapshot command to the storage node 121, or the storage node 121 can not be able to respond to the snapshot command issued by the computing node 110 within a specified time period, which leads to the fact that even if the storage node 121 recovers from failure, it will not take a snapshot of the data because it does not receive the snapshot command.
[0057] In addition, in some database systems, each storage node can include multiple shards, and each shard can have multiple copies and be distributed on different storage nodes. Since snapshot data can be used to maintain data consistency when the storage node 120 recovers from failure, only when all copies of the shard successfully complete the snapshot, the snapshot command is determined to be successfully executed. When any copy fails to execute (for example, fails to execute because of storage node failure), the snapshot command is determined to fail to execute.
[0058] Therefore, when the computing node 110 determines that the data stored in the storage node 120 needs to be snapshotted, the computing node 110 can generate a transaction log (redo log) and simultaneously generate a snapshot command. Then, instead of sending the snapshot command to the storage node directly through the command channel, the computing node 110 adds the snapshot command to the generated transaction log, thereby obtaining a transaction log containing the snapshot command (hereinafter referred to as a target transaction log). Finally, the computing node 110 can commit the target transaction log. Since, for the database system, the computing node 110 successfully committed transaction log can be necessarily received by the storage node 120, based on the reliability mechanism of the transaction log, the normally operating storage node 120 can perform snapshot on the stored data according to the snapshot command in the received target transaction log.
[0059] In this way, for the computing node 110, after successfully committing the target transaction log, since it can be necessarily received and executed by the snapshot command by the normally operating storage node, the computing node 110 can consider that the snapshot is successfully created without waiting for the storage node 120 to return the snapshot success result within a specified time period, thereby reducing the dependency between the computing node 110 and the storage node 120 and achieving decoupling. In practical applications, the process can be completed within a time period of milliseconds, so that the snapshot process on the data in the database system 100 can be completed within milliseconds.
[0060] Meanwhile, for the storage node 120, even if it currently has a heavy data read / write task, it can perform data snapshot processing according to the target transaction log when the load is low, or the storage node 120 fails, and the target transaction log committed by the computing node 110 is also stored persistently. In this way, after completing the fault recovery, the storage node 120 can complete the corresponding data snapshot process according to the persistently stored target transaction log. In this way, various fault scenarios of the storage node 120 can be coped with, and the success rate of the storage node 120 performing data snapshot can be effectively improved, thereby improving the reliability of the database system.
[0061] It is worth noting that, Figure 1 The architecture of the database system shown is only an example, and in practical applications, the database system can be adjusted and transformed based on Figure 1 The database system shown. For example, in other possible embodiments, the database system can include more or fewer storage nodes 120, or the storage node 120 and the log storage node 150 can be combined into the same node, and the present embodiment does not limit this.
[0062] A hardware implementation of the computing node 110 and the storage node 120 is described below.
[0063] As shown in Figure 2 The computing node 110 can include a bus 201, a processor 202, a communication interface 203, and a memory 204. The processor 202, the memory 204, and the communication interface 203 communicate with each other through the bus 201. The bus 201 can be a peripheral component interconnect (PCI) bus, a peripheral component interconnect express (PCIe), or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 2 The communication interface 203 is used for external communication, such as receiving a snapshot indication sent by the upper application 140, etc.
[0064] The processor 202 can be a central processing unit (CPU). The memory 204 can include a volatile memory, such as a random access memory (RAM). The memory 204 can also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, an HDD, or an SSD.
[0065] The memory 204 stores programs or instructions, which are executed by the processor 202 to perform the foregoing snapshot method. Of course, the memory 204 can also store data, such as storing the generated transaction log and / or the target transaction log, etc.
[0066] As shown in Figure 3 The storage node 120 includes a bus 301, a processor 302, a communication interface 303, and a memory 304. The processor 302, the memory 304, and the communication interface 303 communicate with each other through the bus 301. The memory 304 stores programs or instructions. The memory 304 stores programs or instructions. The processor 302 executes the programs or instructions to perform the foregoing snapshot method. Of course, the memory 304 can also store data, such as storing user-provided data, etc.
[0067] In some possible implementation manners, the functions of the computing node 110 described above can also be implemented by one or more chips. Each chip includes a processor and a chip interface. The chip interface is configured to receive instructions and transmit the instructions to the processor. The processor executes the instructions to perform the steps of the snapshot method described above. Of course, when the functions of the computing node 110 described above are implemented by multiple chips, the chip interface of each chip receives part of the instructions, and the processor of each chip performs part of the steps of the snapshot method according to the part of the instructions. In this way, multiple processors can perform all the steps of the snapshot method.
[0068] To make the technical solutions of the present application clearer and easier to understand, the resource scheduling method of the embodiments of the present application will be described in detail below from the perspective of the interaction between the computing node 110 and the storage node 120.
[0069] Referring to Figure 4 The snapshot method includes the following steps, as shown in the flowchart of the snapshot method.
[0070] S401: The computing node 110 generates a transaction log.
[0071] In some possible implementation manners, the upper-layer application 140 can send an instruction for snapshot of data to the computing node 110, and the computing node 110 triggers snapshot service execution based on the received snapshot instruction. Specifically, the computing node 110 can generate a transaction for creating a snapshot instruction, and generate a corresponding transaction log for the transaction. The snapshot instruction can instruct the storage node to snapshot a certain shard data, or can also instruct the storage node to snapshot all the data stored thereon.
[0072] In other possible implementation manners, the computing node 110 can also periodically generate snapshot commands to periodically snapshot and backup the data in the storage node 120.
[0073] In this embodiment, the transaction log generated by the computing node 110 can have a start log sequence number (LSN) and an end LSN.
[0074] The end LSN can be used to indicate the end position of snapshot of data by the storage node 120, that is, can indicate which data stored on the storage node 120 is snapshoted.
[0075] The start LSN can be used to identify the transaction log, and the transaction log with an LSN smaller than the start LSN (that is, the transaction log before this time) has been completed and is stored persistently, for example, can be written into the Figure 1The illustrated log storage node 150. For example, when the storage node 120 contains multiple slices, the starting LSN can be a global slice persist LSN, which is the maximum value of the slice persist LSNs corresponding to all slices in the storage node 120, and the slice persist LSN is the maximum LSN at which the log of the data of a slice is continuously written to the log storage node. Accordingly, all log data of the slices before this LSN has been written to the log storage node. Here, a slice is an independent data area in the storage node 120, which can be physically isolated from other slices or logically isolated from other slices.
[0076] S402: The computing node 110 adds a snapshot command to the transaction log to obtain a target transaction log containing the snapshot command.
[0077] In implementation, a column of command data can be added to the multiple columns of data in the transaction log, and the command data is the snapshot command written to the transaction log. In this way, the transaction log containing the snapshot command, which is referred to as the target transaction log below for ease of description, can be obtained.
[0078] S403: The computing node 110 submits the target transaction log.
[0079] Since the database system usually submits the transaction log after determining the completion of the transaction and performs persistent storage on the submitted transaction log, the target transaction log will not be lost like the snapshot command due to long-time non-reception of the storage node, and the snapshot command can be executed when the storage node 120 has the ability to execute the snapshot service. Therefore, in general, after the computing node 110 submits the target transaction log, the storage node 120 can definitely complete the snapshot process subsequently.
[0080] Therefore, in some possible implementations, the computing node 110 can feed back the result of the successful snapshot after submitting the target transaction log, such as feeding back the result of the successful creation of the snapshot to the upper-layer application 140.
[0081] S404: The storage node 120 receives the target transaction log.
[0082] In actual application, the storage node 120 can obtain the target transaction log from the log storage node 150. For example, after completing the fault recovery, the storage node 120 can read a plurality of logs stored in the log storage node 150, and according to the target transaction log in the plurality of logs, the data is snapped and restored to the snapshot position indicated by the end LSN in the target transaction log. Of course, in the case that the storage node 120 is in normal operation, the target transaction log can also be sent to the storage node 120 by the computing node 110 through the routing device 130, etc. In the embodiment, the specific implementation process of how the storage node 120 obtains the target transaction log is not limited, and it can also be obtained in other possible ways.
[0083] S405: The storage node 120 snaps the stored data according to the snapshot command in the target transaction log.
[0084] After obtaining the target transaction log, the storage node 120 can parse the snapshot command from the target transaction log. For example, the storage node 120 can parse the snapshot command from a specific column of the target transaction log, etc. In this way, the storage node 120 can obtain the snapshot command, and can snap the data by executing the snapshot command. In the embodiment, the specific implementation process of the storage node 120 executing the snapshot command is not limited.
[0085] In actual application, the storage node 120 can contain a plurality of shards. Therefore, in order to facilitate the management of the data of each shard in the storage node 120, the computing node 110 can generate a corresponding shard list, which can contain the identification of each shard in the storage node 120, the shards possessed by each storage node 120, and the identification of the data stored by different shards at a certain time. In this way, the computing node 110 can determine which data of which shards to snap according to the shard list.
[0086] Meanwhile, in a further possible implementation, the computing node 110 can also snap the shard information of the storage node 120 to record the shard state at the time when the computing node 110 triggers the data snapshot. For example, the shard information can be the above-mentioned shard list, or in other forms, etc. In addition, the computing node 110 can also snap the target transaction log at the current time. In this way, when the database system 100 as a whole is performing fault recovery or log rollback, the database system can be restored to the state at the time according to the snapped shard list, target transaction log, and snapshot data. In this way, the reliability of the database system 100 can be improved. When performing fault recovery, the restored time point can be the time point corresponding to the end LSN included in the target transaction log.
[0087] It is worth noting that when the target transaction log includes the start LSN and the end LSN, the computing node 110 triggers the execution of the snapshot process at the time corresponding to the start LSN, and continues to execute the process of snapshotting the shard information. In actual application, since the process of snapshotting the shard information by the computing node 110 needs a certain time consumption, which makes the shard information at the time corresponding to the start LSN different from the shard information snapshotted by the computing node 110, for example, in the process of snapshotting the shard information by the computing node 110, some data in some shards of the storage node 120 can be newly written, deleted or changed, etc. Therefore, if the storage node 120 takes the start LSN as the end position of the data snapshot, it will cause the data snapshotted by the storage node 120 and the data on the shard to be inconsistent with the shard information corresponding to the start LSN. In this way, if the database system 100 performs fault recovery based on the shard information snapshotted by the computing node 110 and the data snapshotted by the storage node 120, the data recorded by the computing node 110 is inconsistent with the data actually stored by the storage node 120, so that the fault recovery is abnormal, which affects the reliability of the database system.
[0088] Therefore, the computing node 110 can record the end LSN when completing the snapshot of the shard information, so that the storage node 120 can determine the end position of the snapshot of the data according to the end LSN. Since the time consumption of the computing node 110 recording the end LSN is very short, the shard data on the storage node 120 indicated by the shard information snapshotted by the computing node 110 is consistent with the shard data snapshotted by the storage node 120, so that the reliability of the database system can be improved.
[0089] Further, the shard information snapshotted by the computing node 110, the target transaction log and the data snapshotted by the storage node 120 can also be backed up to the cloud. In this way, the computing node 110 and the storage node 120 can release the storage space occupied by the current snapshot data, so that more new data can be stored.
[0090] In specific implementation, the database system 100 can also include a backup device (not shown in the figure) for backing up the shard information snapshotted by the computing node 110, the target transaction log and the data snapshotted by the storage node 120 to the cloud. Figure 1The backup device can be the computing node 110 or a device independent of the computing node 110. The upper-layer application 140 can send a backup instruction to the backup device, to instruct the database system 100 to perform cloud backup on the snapshot data in the storage node 120 and the computing node 110. The backup device can send an upload command to the storage node 120 through the routing device 130, to instruct the storage node 120 to upload the snapshot data, for example, the command can be issued through a command channel. When the storage node 120 includes multiple shards and each shard has multiple replicas, the backup device can first determine the distribution of the data to be backed up to the cloud in each shard of the storage node 120, so as to select a corresponding shard as an upload object, and send an upload backup command to the storage node where the shard is located, and only one replica of the same data can be uploaded. In this way, while realizing data backup, multiple storage nodes can not need to upload multiple same replicas, which not only can reduce the network bandwidth required for backup data, but also can avoid storing multiple same data in the cloud, to reduce the storage space consumption of the cloud.
[0091] The storage node 120 can determine the shard data to be uploaded according to the received upload command, and upload the shard data to the cloud. Meanwhile, the backup device can obtain the shard information of the snapshot from the computing node 110, and obtain the target transaction log of the backup from the log storage node 150, and then the backup device can upload the shard information and the target transaction log to the cloud. Of course, when the backup device is the same as the computing node 110, the backup device can directly upload the shard information stored by itself to the cloud.
[0092] It is worth noting that, Figure 4 The embodiments shown in the drawings are only used as an exemplary description, and are not used to limit the step implementation of the embodiments in actual application Figure 4 In the examples shown in the drawings, for example, more other steps can be added on the basis of the steps shown in the drawings, such as the process of generating the target transaction log, the snapshot shard information and the log. Figure 4 In the examples shown in the drawings, for example, more other steps can be added on the basis of the steps shown in the drawings, such as the process of generating the target transaction log, the snapshot shard information and the log.
[0093] The database system and the snapshot method provided by the present application are described in detail in the foregoing Figures 1 to 4 The apparatus provided by the present application will be described below with reference to the drawings.
[0094] Referring to Figure 5 The embodiment of the present application further provides a snapshot apparatus applied to the computing node 110, and the apparatus 500 can include:
[0095] The generating module 501 is configured to generate a transaction log and a snapshot command for the data in the storage node 120.
[0096] The adding module 502 is configured to add the snapshot command to the transaction log to obtain a target transaction log.
[0097] The submitting module 503 is configured to submit the target transaction log.
[0098] In a possible implementation, the storage node 120 includes a plurality of shards, and the snapshot apparatus 500 further includes:
[0099] The snapshot module 504 is configured to snapshot shard information, the shard information including storage of data in the storage node in the plurality of shards.
[0100] In a possible implementation, the snapshot module 504 is further configured to snapshot the target transaction log.
[0101] In a possible implementation, the transaction log includes a start log sequence number (LSN) and an end log sequence number (LSN), and the end LSN is used to indicate an end position of snapshotting data by the storage node 120.
[0102] The snapshot apparatus 500 according to the embodiments of the present application can correspond to performing the methods described in the embodiments of the present application, and the above and other operations and / or functions of each module / unit of the snapshot apparatus 500 are respectively implemented to realize the corresponding flow of each method in the embodiments of the present application. Figure 4 The above and other operations and / or functions of each module / unit of the snapshot apparatus 500 are respectively implemented to realize the corresponding flow of each method in the embodiments of the present application.
[0103] Referring to Figure 6 The embodiments of the present application further provide a snapshot apparatus applied to the storage node 120, the apparatus 600 is applied to the storage node 120, and the snapshot apparatus 600 can include:
[0104] The communication module 601 is configured to receive a target transaction log submitted by the computing node, the target transaction log including a snapshot command for data in the storage node;
[0105] The snapshot module 602 is configured to snapshot stored data according to the snapshot command in the target transaction log.
[0106] In a possible implementation, the communication module 601 is further configured to:
[0107] receive an uploading instruction;
[0108] In response to the uploading instruction, upload the stored data and / or the snapshot to the cloud.
[0109] The snapshot device 600 according to the embodiments of the present application can correspond to performing the methods described in the embodiments of the present application, and the above and other operations and / or functions of the various modules / units of the snapshot device 600 are respectively for realizing the functions of the corresponding modules / units in the methods described in the embodiments of the present application. Figure 4 The respective flows of the various methods performed by the storage node 120 in the illustrated embodiments are not described again here for brevity.
[0110] The embodiments of the present application also provide a computer readable storage medium including instructions for instructing a computer to perform the snapshot methods applied to the computing node 110 or the storage node 120.
[0111] The embodiments of the present application also provide a computer program product, which, when executed by a computer, causes the computer to perform any of the foregoing snapshot methods. The computer program product can be a software installation package, and in the case where any of the foregoing snapshot methods needs to be used, the computer program product can be downloaded and executed on the computer.
[0112] The computer program instructions can also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including instruction devices, which realize the functions specified in the flow Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0113] The computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are performed on the computer or other programmable device to produce a computer implemented process, so that the instructions executed on the computer or other programmable device provide steps for realizing the functions specified in the flow Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0114] The above described and the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application. Thus, if the modifications and variations of the embodiments of the present application are within the scope of the claims of the present application and the equivalent technologies, the present application also intends to include these modifications and variations.
Claims
1. A snapshot method, characterized by, The method is applied to a database system comprising a computing node and a storage node, and the method comprises: The computing node generates a transaction log and a snapshot command for data in the storage node; The computing node adds the snapshot command to the transaction log to obtain a target transaction log; The computing node submits the target transaction log, wherein the target transaction log after submission is used to be received by the storage node, and the snapshot command in the target transaction log is used to snapshot data stored in the storage node.
2. The method of claim 1, wherein, The storage node comprises a plurality of shards, and the method further comprises: The computing node snapshots shard information, which contains storage of data in the storage node in the plurality of shards.
3. The method of claim 1, wherein, The method further comprises: The computing node snapshots the target transaction log.
4. The method according to any one of claims 1 to 3, characterized in that, The transaction log comprises a start log sequence number (LSN) and an end log sequence number (LSN), and the end log sequence number (LSN) is used to indicate an end position of snapshotting data by the storage node.
5. A snapshot method, characterized by, The method is applied to a database system comprising a computing node and a storage node, and the method comprises: The storage node receives a target transaction log submitted by the computing node, the target transaction log comprising a snapshot command for data in the storage node, and the target transaction log being obtained by adding the snapshot command to a transaction log; The storage node snapshots stored data according to the snapshot command in the target transaction log.
6. The method of claim 5, wherein, The method further comprises: The storage node receives an upload instruction; The storage node uploads stored data and / or a snapshot to the cloud in response to the upload instruction.
7. A snapshot device, characterized by The snapshot device is applied to a computing node in a database system, and the database system further comprises a storage node, and the snapshot device comprises: A generation module for generating a transaction log and a snapshot command for data in the storage node; An adding module for adding the snapshot command to the transaction log to obtain a target transaction log; A submission module for submitting the target transaction log, wherein the target transaction log after submission is used to be received by the storage node, and the snapshot command in the target transaction log is used to snapshot data stored in the storage node.
8. The snapshot device of claim 7, wherein, The storage node comprises a plurality of shards, and the snapshot device further comprises: A snapshot module for snapshotting shard information, which contains storage of data in the storage node in the plurality of shards.
9. The snapshot device of claim 8, wherein, The snapshot module is further used to snapshot the target transaction log.
10. The snapshot device according to any of claims 7 to 9, characterized in that, The transaction log comprises a start log sequence number (LSN) and an end log sequence number (LSN), and the end log sequence number (LSN) is used to indicate an end position of snapshotting data by the storage node.
11. A snapshot device, characterized by The snapshot device is applied to a storage node in a database system, and the database system comprises a computing node, and the snapshot device comprises: The communication module is configured to receive a target transaction log submitted by the computing node, the target transaction log comprising a snapshot command for data in the storage node, the target transaction log being obtained by adding the snapshot command to a transaction log. The snapshot module is configured to perform a snapshot on the stored data according to the snapshot command in the target transaction log.
12. The snapshot device of claim 11, wherein, The communication module is further configured to: receive an upload instruction; in response to the upload instruction, upload the stored data and / or the snapshot to the cloud.
13. An apparatus, comprising: The device comprises a processor and a memory; The processor is configured to execute instructions stored in the memory, so that the device performs the method of any one of claims 1 to 4.
14. An apparatus, comprising: The device comprises a processor and a memory; The processor is configured to execute instructions stored in the memory, so that the device performs the method of any one of claims 5 to 6.
15. A database system, characterized in that The database system comprises the computing node of any one of claims 1 to 4 and the storage node of any one of claims 5 to 6.
16. A computer-readable storage medium, characterized in that, The instructions instruct a device to perform the method of any one of claims 1 to 4, or to perform the method of any one of claims 5 to 6.
Citation Information
Patent Citations
Data backup method, data backup device and data backup system
CN103885854A
Database journal recording method, device and system
CN104268274A