Snapshot creation method and device, equipment, readable storage medium and program product
By notifying the client to stop the read and write operation during the snapshot creation process of the shared storage device, and creating a snapshot after confirming the stop, the data inconsistency problem during snapshot creation in a distributed system is solved, and the data consistency snapshot creation is achieved.
Patent Information
- Application Number
- CN202411775460.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-03-21
AI Technical Summary
In distributed systems, there may be data inconsistency problems in multi-node environments when creating snapshots of shared storage devices.
After receiving the Create Snapshot command, a notification message is sent to the client, instructing it to stop reading and writing operations to the shared storage device, and after the client responds to the message, a snapshot of the shared storage device is created.
Ensure that the data status of each client remains consistent when creating a snapshot, effectively avoiding the problem of data inconsistency.
Smart Images

Figure CN119669153A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of storage data management, and in particular to a snapshot creation method, apparatus, device, readable storage medium, and program product. Background Art
[0002] With the development of storage technology, shared storage devices have emerged. These devices allocate available storage space to users over a network, offering broad application prospects as a convenient and efficient way to share files. Shared storage device snapshot technology records the state of data on shared storage devices. A snapshot is a static copy of shared storage system data at a specific moment in time. Creating a snapshot provides data protection and rapid recovery. In the event of data loss or corruption, a shared storage system can be quickly restored to its state at the time of the snapshot.
[0003] Currently, in a distributed system, since multiple distributed nodes access data on a shared storage device, there may be a problem of data inconsistency in a multi-node environment when creating a snapshot of the shared storage device. Summary of the Invention
[0004] Based on this, it is necessary to provide a snapshot creation method, device, equipment, readable storage medium and program product that ensures consistency of multi-node data in response to the above technical problems.
[0005] In a first aspect, the present application provides a snapshot creation method, which is applied to a shared storage device. The method includes: after receiving a create snapshot command, sending a first notification message to a client on which the shared storage device is mounted, the first notification message being used to instruct the client to stop reading and writing operations on the shared storage device; after receiving a response message returned by the client, creating a snapshot for the shared storage device, the response message being returned after the client completes stopping reading and writing operations on the shared storage device.
[0006] In one embodiment, creating a snapshot of a shared storage device includes:
[0007] Obtain the first snapshot version number of the last snapshot on the shared storage device and the read and write version number of the current read and write operation;
[0008] Determine a second snapshot version number of the current snapshot based on the first snapshot version number and the read-write version number;
[0009] A snapshot corresponding to the second snapshot version number is created for the shared storage device.
[0010] In one embodiment, the method further comprises:
[0011] After the snapshot of the shared storage device is created, a second notification message is sent to the client, which is used to instruct the client to update the read-write version number and resume the read and write operations on the shared storage device based on the updated read-write version number.
[0012] In a second aspect, the present application provides a snapshot creation method, applied to a client, the method comprising:
[0013] Receive a first notification message sent by the shared storage device, where the first notification message is used to instruct the client to stop reading and writing operations on the shared storage device;
[0014] Get the execution status of the read and write operations issued by the client;
[0015] If the execution status is execution completion, the read and write operations on the shared storage device are stopped, and a response message is sent to the shared storage device. The response message is used to instruct the shared storage device to create a snapshot.
[0016] In one embodiment, the method includes:
[0017] If the second notification message is received, updating the read-write version number for performing read and write operations on the shared storage device, and resuming the read and write operations on the shared storage device based on the updated read-write version number;
[0018] A confirmation message is sent to the control node. The confirmation message is used to indicate that the creation of the snapshot of the shared storage device is complete.
[0019] In a third aspect, the present application further provides a snapshot creation device, which is applied to a shared storage device, and includes:
[0020] A first sending module is configured to send a first notification message to the client on which the shared storage device is mounted after receiving a create snapshot command, wherein the first notification message is used to instruct the client to stop reading and writing operations on the shared storage device;
[0021] The creation module is used to create a snapshot of the shared storage device after receiving a response message returned by the client. The response message is returned after the client stops and completes the read and write operations on the shared storage device.
[0022] In a fourth aspect, the present application further provides a snapshot creation device, which is applied to a client, and includes:
[0023] A receiving module, configured to receive a first notification message sent by the shared storage device, where the first notification message is used to instruct the client to stop reading and writing operations on the shared storage device;
[0024] The acquisition module is used to obtain the execution status of the read and write operations issued by the client;
[0025] The second sending module is configured to stop the read and write operations on the shared storage device if the execution status is execution completion, and send a response message to the shared storage device, where the response message is used to instruct the shared storage device to create a snapshot.
[0026] In a fifth aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the snapshot creation method described in any one of the first aspect or the second aspect is implemented.
[0027] In a sixth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the snapshot creation method described in any one of the first aspect or the second aspect.
[0028] In a seventh aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the snapshot creation method described in any one of the first aspect or the second aspect.
[0029] The above-mentioned snapshot creation method, apparatus, device, readable storage medium, and program product are applied to a shared storage device. First, after receiving a create snapshot command, a first notification message is sent to the client mounted on the shared storage device to instruct the client to stop reading and writing operations on the shared storage device. Then, after receiving a response message returned by the client after the read and write operations on the shared storage device are stopped, a snapshot is created for the shared storage device. In this way, when the shared storage device receives a create snapshot command and needs to create a snapshot, it first notifies each mounted client to stop reading and writing operations, ensuring that no read and write operations can be performed on the data of the shared storage device during the snapshot creation process. This ensures that the data status of each client remains consistent when the snapshot is created, effectively avoiding data inconsistency issues. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.
[0031] Figure 1 A diagram illustrating an application environment of a snapshot creation method according to an embodiment;
[0032] Figure 2 A schematic diagram of a process for creating a snapshot in one embodiment;
[0033] Figure 3A schematic flow chart of a snapshot creation method according to another embodiment;
[0034] Figure 4 A schematic flow chart of a snapshot creation method according to another embodiment;
[0035] Figure 5 A schematic flow chart of a snapshot creation method according to another embodiment;
[0036] Figure 6 A schematic flow chart of a snapshot creation method according to another embodiment;
[0037] Figure 7 A structural block diagram of a snapshot creation device in one embodiment;
[0038] Figure 8 A structural block diagram of a snapshot creation device in one embodiment;
[0039] Figure 9 is a diagram of the internal structure of a computer device in one embodiment;
[0040] Figure 10 FIG. 4 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0042] The snapshot creation method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. The control node 102 communicates with the shared storage device 104 via a network. Multiple clients 106 can be mounted on the shared storage device 104 at the same time, and the clients 106 can perform concurrent read and write access to the shared storage device 104. The clients 106 can be, but are not limited to, various personal computers, laptops, smart phones, tablets, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The control node 102 and the shared storage device 104 can be independent physical servers, or they can be a server cluster or distributed system composed of multiple physical servers, or they can be cloud servers that provide cloud computing services.
[0043] In an exemplary embodiment, Figure 2 As shown, a snapshot creation method is provided, which is applied to Figure 1 The shared storage device in the example is used to illustrate the method, which includes the following steps 201 to 202. Among them:
[0044] Step 201: After receiving a create snapshot command, a first notification message is sent to a client where the shared storage device is mounted.
[0045] The first notification message is used to instruct the client to stop reading and writing to the shared storage device. The client is mounted on the shared storage device and can read and write to the shared storage device. Optionally, multiple clients can be mounted on the shared storage device, and multiple clients can read and write to the shared storage device at the same time.
[0046] Optionally, the shared storage device can be a cloud hard disk, and the command to create a snapshot can be as follows: Figure 1 The control node in the cloud manages and coordinates shared storage devices and clients, managing the lifecycle of cloud resources. This includes operations such as creating, mounting, and snapshotting shared storage devices. When a shared storage device snapshot is needed, the control node sends a create snapshot command to the shared storage device. Creating snapshots of shared storage devices can be used as a means of data backup and recovery in the event of data loss.
[0047] Optionally, after mounting the shared storage device, the client monitors the status changes of the shared storage device through a watch mechanism to ensure that changes such as read and write operations or status updates of the shared storage device can be captured and responded to by the client in a timely manner. When the shared storage device receives a command to create a snapshot, it modifies the metadata of the shared storage device related to snapshot creation, such as updating the status of the shared storage device to "snapshot being created". When the status of the shared storage device changes, the storage engine of the shared storage device sends a first notification message to all mounted clients, instructing each client to stop reading and writing operations on the shared storage device. At the same time, triggering the snapshot creation event can ensure that each client can synchronously receive the first notification message and can collaboratively execute the process of stopping read and write operations.
[0048] Step 202: After receiving the response message returned by the client, create a snapshot for the shared storage device.
[0049] The response message is returned after the client completes the read / write operation on the shared storage device. After receiving the first notification message, the client performs the read / write operation cessation step, which may include confirming whether the issued read / write request is complete and ceasing to send read / write requests to the shared storage device. After confirming that the issued read / write request is complete, the client sends a response message to the shared storage device. The shared storage device receives the response message, confirms that the client's read / write operation has been stopped, and then begins creating a snapshot.
[0050] In the above embodiment, applied to a shared storage device, first, after receiving a create snapshot command, a first notification message is sent to the client mounted on the shared storage device to instruct the client to stop reading and writing operations on the shared storage device. Then, after receiving a response message returned by the client after the read and write operations on the shared storage device have been stopped, a snapshot is created for the shared storage device. In this way, when the shared storage device receives a create snapshot command and needs to create a snapshot, it first notifies each mounted client to stop reading and writing operations, ensuring that no read and write operations can be performed on the data of the shared storage device during the snapshot creation process. This ensures that the data status of each client remains consistent when the snapshot is created, effectively avoiding data inconsistency issues.
[0051] In an embodiment of the present application, the steps of creating a snapshot of a shared storage device are as follows: Figure 3 Shown, including:
[0052] Step 301: Obtain the first snapshot version number of the last snapshot on the shared storage device and the read and write version numbers of the current read and write operations.
[0053] The first snapshot version number is the snapshot version number when the last snapshot was created, and the current read / write version number is the version number used by the client during the current read / write operation. The first snapshot version number and the current read / write version number can be obtained from the local storage space of a shared storage device or from a configuration file.
[0054] Step 302: Determine a second snapshot version number of the current snapshot based on the first snapshot version number and the read-write version number.
[0055] Optionally, the first snapshot version number is incremented by 1, and then combined with the current read-write version number to form a 2-tuple as the second snapshot version number for creating the snapshot. Then, the current read-write version number is incremented by 1.
[0056] Step 303: Create a snapshot corresponding to the second snapshot version number on the shared storage device.
[0057] A snapshot is created for the shared storage device according to the second snapshot version number. After the snapshot creation is completed, the status of the shared storage device may be updated to "snapshot creation completed."
[0058] In the above embodiment, a multi-version data management mechanism is adopted to record the snapshot version number and read / write version number of each snapshot, thereby achieving efficient creation of snapshots. At the same time, when data recovery is required, data can be quickly restored according to the version number.
[0059] In one embodiment, the method further includes: after the snapshot of the shared storage device is created, sending a second notification message to the client.
[0060] The second notification message is used to instruct the client to update the read-write version number and resume read-write operations on the shared storage device based on the updated read-write version number. After the snapshot is created and the status of the shared storage device is updated to "snapshot creation completed", the storage engine of the shared storage device sends a second notification message to all clients, triggering a snapshot creation completion event, so that all clients synchronize the snapshot creation completion event. After receiving the second notification message, the client updates the client's local read-write version number, that is, adds 1 to the read-write version number, and then resumes read-write operations on the shared storage device and continues normal operation. Subsequent read-write operations on the shared storage device are performed based on the updated read-write version number.
[0061] In the above embodiment, after the shared storage device completes creating a snapshot, the client can promptly update the read and write version numbers and resume read and write operations, thereby reducing the impact of the snapshot creation process on system performance.
[0062] In the exemplary embodiment of the present application, Figure 4 As shown, a snapshot creation method is provided, which is applied to Figure 1 The client in the example is used to illustrate the process, including the following steps 401 to 403. Among them:
[0063] Step 401: Receive a first notification message sent by a shared storage device.
[0064] The first notification message instructs the client to cease read and write operations on the shared storage device. Upon receiving the first notification message regarding the snapshot creation event, the client begins processing the event. To ensure data consistency between the clients and the shared storage device during the snapshot creation process, each client is required to cease read and write operations on the shared storage device.
[0065] Step 402: Obtain the execution status of the read and write operations issued by the client.
[0066] Each client obtains the execution status of the currently issued read and write requests and waits for the currently issued read and write requests to be completed.
[0067] Step 403: If the execution status is execution completed, stop the read and write operations on the shared storage device and send a response message to the shared storage device.
[0068] The response message instructs the shared storage device to create a snapshot. If the client's current read and write requests are completed, the shared storage device stops reading and writing to the shared device and sends a response message to the shared storage device. Once all mounted clients have completed their read and write operations, the shared storage device can begin creating a snapshot.
[0069] In the above embodiment, the client monitors the status changes of the shared storage device through the watch-notify mechanism. When the status of the shared storage device changes, the client is promptly notified to stop the read and write operations to ensure data consistency. At the same time, through the watch-notify mechanism, the time window for stopping and resuming the read and write operations is short, the efficiency of creating snapshots is higher, and the impact on system performance is reduced. At the same time, the watch-notify mechanism can coordinate the read and write operations of multiple clients, ensuring that snapshots can be efficiently created even in a multi-client concurrent environment, and can be applied to large-scale distributed storage systems.
[0070] In one embodiment, after the snapshot is created, Figure 5 As shown, the method includes:
[0071] Step 501: If a second notification message is received, the read / write version number for the read / write operation on the shared storage device is updated, and the read / write operation on the shared storage device is restored based on the updated read / write version number.
[0072] After receiving the second notification message sent by the storage engine of the shared storage device,
[0073] Step 502: Send a confirmation message to the control node. The confirmation message is used to indicate that the creation of the snapshot of the shared storage device is completed.
[0074] After the client resumes reading and writing to the shared storage device, it can now access the device normally. The client sends a confirmation message to the control node, indicating that the snapshot creation was successful. The system can then continue processing other management tasks or request the next snapshot creation.
[0075] In an embodiment of the present application, a snapshot creation method is provided, such as Figure 6 Shown, including:
[0076] 1. Multiple client nodes are mounted on a shared disk and can concurrently read and write to the shared disk.
[0077] 2. The client monitors the shared disk status changes.
[0078] 3. The control node sends a command to create a shared disk snapshot.
[0079] 4. After the shared disk receives the command to create a shared disk snapshot, the shared disk status is changed to "Creating snapshot".
[0080] 5. The shared disk sends the first notification message to all clients, triggering the creation of a snapshot event.
[0081] 6. All clients stop reading and writing operations.
[0082] 7. The client sends a response message to notify the shared disk that the read and write operations have stopped.
[0083] 8. Create a snapshot of the shared disk. After the creation is completed, change the status to "Snapshot creation completed".
[0084] 9. The shared disk sends a second notification message to all clients, triggering a snapshot creation completion event.
[0085] 10. All clients resume read and write operations.
[0086] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0087] Based on the same inventive concept, embodiments of the present application also provide a snapshot creation device for implementing the aforementioned snapshot creation method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more snapshot creation device embodiments provided below can be found in the above-described limitations of the snapshot creation method and will not be further elaborated here.
[0088] In an exemplary embodiment, Figure 7 As shown, a snapshot creation device 700 is provided, which is applied to a shared storage device and includes: a first sending module and a creation module, wherein:
[0089] A first sending module is configured to send a first notification message to the client on which the shared storage device is mounted after receiving a create snapshot command, wherein the first notification message is used to instruct the client to stop reading and writing operations on the shared storage device;
[0090] The creation module is used to create a snapshot of the shared storage device after receiving a response message returned by the client. The response message is returned after the client stops and completes the read and write operations on the shared storage device.
[0091] In one embodiment, the creation module is specifically used to obtain the first snapshot version number of the previous snapshot on the shared storage device and the read and write version number of the current read and write operation; determine the second snapshot version number of the current snapshot based on the first snapshot version number and the read and write version number; and create a snapshot corresponding to the second snapshot version number for the shared storage device.
[0092] In one embodiment, a third sending module is further included, which is used to send a second notification message to the client after completing the creation of a snapshot of the shared storage device. The second notification message is used to instruct the client to update the read-write version number and resume the read and write operations on the shared storage device based on the updated read-write version number.
[0093] Each module in the snapshot creation device described above may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in hardware form, or may be stored in a computer device memory in software form, so that the processor can call and execute the corresponding operations of each module.
[0094] In an exemplary embodiment, Figure 8 As shown, a snapshot creation device 800 is provided, which is applied to a client and includes: a receiving module, an acquisition module and a second sending module, wherein:
[0095] A receiving module, configured to receive a first notification message sent by the shared storage device, where the first notification message is used to instruct the client to stop reading and writing operations on the shared storage device;
[0096] The acquisition module is used to obtain the execution status of the read and write operations issued by the client;
[0097] The second sending module is configured to stop the read and write operations on the shared storage device if the execution status is execution completion, and send a response message to the shared storage device, where the response message is used to instruct the shared storage device to create a snapshot.
[0098] In one embodiment, an update module is further included, which is used to update the read-write version number for reading and writing operations on the shared storage device if a second notification message is received, and to restore the read-write operations on the shared storage device based on the updated read-write version number; and send a confirmation message to the control node, and the confirmation message is used to indicate that the creation of a snapshot of the shared storage device is completed.
[0099] Each module in the snapshot creation device described above may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in hardware form, or may be stored in a computer device memory in software form, so that the processor can call and execute the corresponding operations of each module.
[0100] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 9 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store snapshot data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a snapshot creation method is implemented.
[0101] In an exemplary embodiment, a computer device is provided, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: after receiving a command to create a snapshot, sending a first notification message to a client on which a shared storage device is mounted, wherein the first notification message is used to instruct the client to stop reading and writing operations on the shared storage device; after receiving a response message returned by the client, creating a snapshot of the shared storage device, wherein the response message is returned after the client completes stopping reading and writing operations on the shared storage device.
[0102] In one embodiment, when the processor executes the computer program, it further implements the following steps: obtaining a first snapshot version number of a previous snapshot on a shared storage device and a read / write version number of a current read / write operation; determining a second snapshot version number of the current snapshot based on the first snapshot version number and the read / write version number; and creating a snapshot corresponding to the second snapshot version number on the shared storage device.
[0103] In one embodiment, when the processor executes the computer program, it also implements the following steps: after completing the creation of a snapshot of the shared storage device, a second notification message is sent to the client, where the second notification message is used to instruct the client to update the read-write version number and resume the read-write operations on the shared storage device based on the updated read-write version number.
[0104] Those skilled in the art will understand that Figure 9 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0105] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 10 As shown. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals via wired or wireless means, and the wireless means can be implemented via Wi-Fi, a mobile cellular network, near-field communication (NFC), or other technologies. When executed by the processor, the computer program implements a snapshot creation method. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse.
[0106] Those skilled in the art will understand that Figure 10The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0107] In an exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented: receiving a first notification message sent by a shared storage device, the first notification message is used to instruct the client to stop reading and writing operations on the shared storage device; obtaining the execution status of the read and write operations issued by the client; if the execution status is execution completion, stopping the read and write operations on the shared storage device, and sending a response message to the shared storage device, the response message is used to instruct the shared storage device to create a snapshot.
[0108] In one embodiment, when the processor executes the computer program, it also implements the following steps: if a second notification message is received, the read-write version number for the read and write operations on the shared storage device is updated, and the read and write operations on the shared storage device are restored based on the updated read-write version number; a confirmation message is sent to the control node, and the confirmation message is used to indicate that the creation of the snapshot of the shared storage device is completed.
[0109] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: after receiving a create snapshot command, a first notification message is sent to a client on which a shared storage device is mounted, the first notification message being used to instruct the client to stop reading and writing operations on the shared storage device; after receiving a response message returned by the client, a snapshot is created for the shared storage device, the response message being returned after the client completes stopping reading and writing operations on the shared storage device.
[0110] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: obtaining a first snapshot version number of a previous snapshot on a shared storage device and a read / write version number of a current read / write operation; determining a second snapshot version number of the current snapshot based on the first snapshot version number and the read / write version number; and creating a snapshot corresponding to the second snapshot version number on the shared storage device.
[0111] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: after the snapshot of the shared storage device is created, a second notification message is sent to the client, and the second notification message is used to instruct the client to update the read-write version number and resume the read and write operations on the shared storage device based on the updated read-write version number.
[0112] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: receiving a first notification message sent by the shared storage device, the first notification message is used to instruct the client to stop reading and writing operations on the shared storage device; obtaining the execution status of the read and write operations issued by the client; if the execution status is execution completion, stopping the read and write operations on the shared storage device, and sending a response message to the shared storage device, the response message is used to instruct the shared storage device to create a snapshot.
[0113] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: if a second notification message is received, the read-write version number for the read-write operation on the shared storage device is updated, and the read-write operation on the shared storage device is restored based on the updated read-write version number; a confirmation message is sent to the control node, and the confirmation message is used to indicate that the creation of the snapshot of the shared storage device is completed.
[0114] In one embodiment, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the following steps: after receiving a create snapshot command, sending a first notification message to a client on which a shared storage device is mounted, the first notification message being used to instruct the client to stop reading and writing operations on the shared storage device; and after receiving a response message returned by the client, creating a snapshot of the shared storage device, the response message being returned after the client has completed stopping reading and writing operations on the shared storage device.
[0115] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: obtaining a first snapshot version number of a previous snapshot on a shared storage device and a read / write version number of a current read / write operation; determining a second snapshot version number of the current snapshot based on the first snapshot version number and the read / write version number; and creating a snapshot corresponding to the second snapshot version number on the shared storage device.
[0116] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: after the snapshot of the shared storage device is created, a second notification message is sent to the client, and the second notification message is used to instruct the client to update the read-write version number and resume the read and write operations on the shared storage device based on the updated read-write version number.
[0117] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: receiving a first notification message sent by the shared storage device, the first notification message is used to instruct the client to stop reading and writing operations on the shared storage device; obtaining the execution status of the read and write operations issued by the client; if the execution status is execution completion, stopping the read and write operations on the shared storage device, and sending a response message to the shared storage device, the response message is used to instruct the shared storage device to create a snapshot.
[0118] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: if a second notification message is received, the read-write version number for the read-write operation on the shared storage device is updated, and the read-write operation on the shared storage device is restored based on the updated read-write version number; a confirmation message is sent to the control node, and the confirmation message is used to indicate that the creation of the snapshot of the shared storage device is completed.
[0119] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0120] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), quantum computing-based data processing logic devices, artificial intelligence (AI) processors, and the like.
[0121] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0122] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A snapshot creation method, characterized in that: Applied to a shared storage device, the method comprises: After receiving the snapshot creation command, sending a first notification message to the client on which the shared storage device is mounted, the first notification message is used to instruct the client to stop reading and writing operations on the shared storage device; After receiving a response message returned by the client, a snapshot is created for the shared storage device, wherein the response message is returned after the client stops the read and write operations on the shared storage device.
2. The method according to claim 1, characterized in that The step of creating a snapshot of the shared storage device includes: Obtaining a first snapshot version number of a previous snapshot on the shared storage device and a read / write version number of a current read / write operation; Determine a second snapshot version number of the current snapshot according to the first snapshot version number and the read-write version number; A snapshot corresponding to the second snapshot version number is created for the shared storage device.
3. The method according to claim 2, characterized in that The method further comprises: After the snapshot of the shared storage device is created, a second notification message is sent to the client, where the second notification message is used to instruct the client to update the read-write version number and resume the read-write operation on the shared storage device based on the updated read-write version number.
4. A snapshot creation method, characterized in that: Applied to a client, the method comprises: Receiving a first notification message sent by a shared storage device, where the first notification message is used to instruct the client to stop reading and writing operations on the shared storage device; Obtaining the execution status of the read and write operations issued by the client; If the execution status is execution completion, the read and write operations on the shared storage device are stopped, and a response message is sent to the shared storage device, where the response message is used to instruct the shared storage device to create a snapshot.
5. The method according to claim 4, characterized in that The method comprises: If a second notification message is received, updating a read-write version number for performing read-write operations on the shared storage device, and restoring the read-write operations on the shared storage device based on the updated read-write version number; A confirmation message is sent to the control node, where the confirmation message is used to indicate that the creation of the snapshot of the shared storage device is complete.
6. A snapshot creation device, characterized in that: Applied to a shared storage device, the device comprises: A first sending module, configured to send a first notification message to a client mounted with the shared storage device after receiving a command to create a snapshot, wherein the first notification message is used to instruct the client to stop reading and writing operations on the shared storage device; The creation module is used to create a snapshot for the shared storage device after receiving a response message returned by the client, wherein the response message is returned after the client stops the read and write operations on the shared storage device.
7. A snapshot creation device, characterized in that: Applied to a client, the device comprises: A receiving module, used to receive a first notification message sent by a shared storage device, where the first notification message is used to instruct the client to stop reading and writing operations on the shared storage device; An acquisition module, used to acquire the execution status of the read and write operations issued by the client; The second sending module is used to stop the read and write operations on the shared storage device if the execution status is execution completion, and send a response message to the shared storage device, wherein the response message is used to instruct the shared storage device to create a snapshot.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.