Directory deletion method and device based on NAS (Network Attached Storage), client and server
By using batch deletion instructions in distributed NAS server clusters, the number of interactions between NAS clients and servers is reduced, resource consumption is solved, resource waste and response time prolonged in the prior art directory deletion, and the performance of deletion operations is improved.
Patent Information
- Application Number
- CN202311035113.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-06-08
- Filing Date
- 2023-08-15
- Publication Date
- 2024-12-10
AI Technical Summary
When an existing NAS client deletes a directory, it needs to traverse the subdirectories, resulting in a large amount of network bandwidth and memory resources consumption, increasing response time, and the client needs to cache a large amount of file metadata, affecting the execution of other operations.
A distributed NAS server cluster is adopted to replace multiple readdir and delete instructions with a single batch delete instruction, reducing the number of interactions between clients and servers, reducing computing and network overhead, and avoiding client cache metadata.
It effectively reduces the computing resources and network bandwidth overhead of NAS clients, reduces memory consumption, and improves the response speed and performance of directory deletion.
Smart Images

Figure CN119106008A_ABST
Abstract
Description
[0001] This application claims priority to Chinese patent application No. 202310678018.6 filed on June 8, 2023, with invention name “A NAS operation method for batch deletion of files”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of storage technology, and in particular to a directory deletion method, device, client and server based on NAS. Background Art
[0003] After a network attached storage (NAS) client mounts a NAS server, if it needs to delete a directory in the NAS server, and the directory includes non-empty subdirectories, the NAS client first traverses the subdirectories in the directory to be deleted, and sends a read (readdir) command to the NAS server for each subdirectory to obtain the metadata of each file under the subdirectory, and caches the metadata of each file obtained; the NAS client sends an open command for the subdirectory to the NAS server, and the NAS server opens the subdirectory and adds a deletion tag for the files under the subdirectory. After adding the deletion tag, the NAS client sends a close command for the subdirectory to the NAS server to close the subdirectory; the NAS client sends a delete (delete) command to the NAS server for each file under the directory, and the NAS server first deletes the files under the subdirectory, then deletes the subdirectory, and finally completes the deletion of the directory.
[0004] However, in the above method, the entire directory deletion process involves a large number of interactions between NAS clients and NAS servers, which occupies a large amount of network bandwidth resources and increases the response time of directory deletion. In addition, after the NAS client traverses the subdirectories in the directory, it needs to cache the metadata of the files under the subdirectories in the memory. When there are many files in the directory to be deleted, a large amount of memory resources and computing resources of the NAS client will be occupied, affecting the NAS client from executing other operations. Summary of the invention
[0005] The embodiment of the present application provides a NAS-based directory deletion method, device, client, and server, which can reduce the computing resource overhead and network bandwidth overhead of the NAS client when deleting the directory in the NAS server, and also avoid the NAS client caching files under the subdirectory, thereby reducing the consumption of NAS client memory resources. The technical solution is as follows.
[0006] In a first aspect, a NAS-based directory deletion method is provided, which is executed by a NAS server that provides background services for a NAS client. The method includes:
[0007] After the first NAS server in the distributed NAS server cluster receives the batch deletion instruction sent by the NAS client to instruct to delete the target directory, it generates distributed deletion instructions for multiple sub-directories under the target directory, and sends the corresponding distributed deletion instructions to the NAS servers where the sub-directories are located, and sends a deletion completion response to the NAS client.
[0008] Among them, the first NAS server is the NAS server that stores the target directory in the distributed NAS server cluster. If the target directory includes subdirectories, the subdirectories are stored in other NAS servers in the distributed NAS server cluster. If the directory target includes files, the files are stored in the first NAS server.
[0009] In the above method, a single batch delete command is used to replace a large number of readdir commands and delete commands of the NAS client, which can greatly reduce the number of interactions between the NAS client and the NAS server, reduce the computing resource overhead and network bandwidth overhead of the NAS client, and also avoid the NAS client caching the metadata of the target directory, thereby reducing the consumption of memory resources of the NAS client.
[0010] Optionally, the target directory also includes multiple files, and the method further includes:
[0011] The first NAS server deletes the multiple files under the target directory from the first NAS server based on the target directory indicated by the batch deletion instruction.
[0012] Among them, if the target directory includes both subdirectories and files, when the first NAS server receives the deletion instruction for the target directory, it generates distributed deletion instructions corresponding to each subdirectory, sends the distributed deletion instructions to the corresponding NAS server, and deletes the files under the target directory from the first NAS server.
[0013] Optionally, the method further comprises:
[0014] The second NAS server in the distributed NAS server cluster receives the distributed deletion instruction, and based on the subdirectory indicated by the received distributed deletion instruction, generates multiple distributed deletion instructions for multiple subdirectories under the subdirectory, and the multiple subdirectories under the subdirectory are distributed on multiple NAS servers in the distributed NAS server cluster; the second NAS server sends the distributed deletion instructions of the corresponding subdirectories to the NAS server where each subdirectory in the subdirectory is located.
[0015] Among them, each NAS server in the distributed NAS server cluster storing subdirectories or files of each level of the target directory executes the above process in sequence according to the corresponding subdirectory level until all subdirectories and files of each level under the target directory are deleted.
[0016] In the above method, each NAS server in the distributed NAS server cluster storing subdirectories or files of each level of the target directory performs the deletion operation in sequence according to the corresponding subdirectory level, avoiding the deletion task by a single NAS server, and reducing the burden on the NAS server.
[0017] Optionally, the subdirectory further includes multiple files, and the method further includes:
[0018] The second NAS server deletes the multiple files under the subdirectory from the second NAS server based on the subdirectory indicated by the received distributed deletion instruction.
[0019] Optionally, the subdirectories indicated by different distributed deletion instructions are located on different NAS servers.
[0020] Optionally, the batch deletion instruction further carries a deletion mode identifier, where the deletion mode identifier is used to indicate a deletion operation mode performed by the first NAS server on the target directory, where the deletion operation mode is any one of a synchronous deletion mode and an asynchronous deletion mode.
[0021] Optionally, the first NAS server sending a deletion completion response to the NAS client includes:
[0022] When the target directory has been deleted within the first preset time period, the first NAS server sends a first deletion response to the NAS client, where the first deletion response indicates that the target directory has been deleted.
[0023] In the above method, in the synchronous deletion mode, if the distributed NAS server cluster completes the deletion of the target directory within the first preset time, the first NAS server actively sends a first deletion response to the NAS client indicating that the directory has been deleted, so that the NAS client does not need to send a query instruction to the NAS server, which can further reduce the interaction between the NAS client and the NAS server, save bandwidth resources, and improve the performance of NAS file deletion operations.
[0024] Optionally, the method further comprises:
[0025] When the directory has not been deleted within the first preset time, the first NAS server sends a second deletion response to the NAS client, where the second deletion response is used to indicate that the target directory has not been deleted;
[0026] The first NAS server sends a deletion completion response to the NAS client, including: the first NAS server receives at least one query instruction sent by the NAS client, each query instruction is separated by a second preset time length, and each query instruction carries a deletion task identifier corresponding to the batch deletion instruction;
[0027] The first NAS server returns a corresponding query response to the NAS client based on each query instruction, each query response carries the execution result of the deletion task, and the query response corresponding to the last query instruction in at least one query instruction indicates that the target directory has been deleted.
[0028] In the above method, in the synchronous deletion mode, if the distributed NAS server cluster fails to complete the deletion of the target directory within the first preset time period, the first NAS server actively sends a second deletion response to the NAS client indicating that the target directory has not been deleted, and the distributed NAS server cluster continues to execute the deletion task, so that the NAS client periodically sends query instructions to the first NAS server, which can ensure that the NAS client can timely learn and synchronize the deletion status of the target directory, thereby improving the performance of the NAS file deletion operation.
[0029] Optionally, the method further comprises:
[0030] When the first NAS server receives the batch deletion instruction, it sends a second deletion response to the NAS client, and the second deletion response is used to indicate that the directory has not been deleted. The first NAS server sends a deletion completion response to the NAS client, including: if the directory has been deleted, sending an asynchronous deletion response to the NAS client, and the asynchronous deletion response indicates that the target directory has been deleted.
[0031] In the above method, in the asynchronous deletion mode, after the distributed NAS server cluster completes the deletion of the target directory, the first server actively sends an asynchronous deletion response to the NAS client indicating that the target directory has been deleted. The NAS client only needs to start an asynchronous listening task to receive the asynchronous deletion response, which can further reduce the interaction between the NAS client and the NAS server, save bandwidth resources, and improve the performance of NAS file deletion operations.
[0032] In a second aspect, a NAS-based directory deletion method is provided, which is executed by a NAS client, and the NAS client is provided with a background service by a NAS server, and the method includes:
[0033] In response to a deletion operation performed on a target directory on the NAS client, the NAS client sends a batch deletion instruction to a first NAS server in the distributed NAS server cluster, wherein the batch deletion instruction indicates that the target directory is to be deleted; the NAS client receives a deletion completion response sent by the first NAS server, wherein the deletion completion response indicates that the target directory has been deleted; the NAS client displays a deletion success prompt of the target directory, wherein the deletion success prompt indicates that the target directory has been deleted.
[0034] Optionally, the batch deletion instruction further carries a deletion mode identifier, where the deletion mode identifier is used to indicate a deletion operation mode performed by the first NAS server on the target directory, where the deletion operation mode is any one of a synchronous deletion mode and an asynchronous deletion mode.
[0035] Optionally, the NAS client receiving the deletion completion response sent by the first NAS server includes:
[0036] The NAS client receives a first deletion response sent by the first NAS server, where the first deletion response indicates that the target directory has been deleted within a first preset time period.
[0037] Optionally, the method further comprises:
[0038] The NAS client receives a second deletion response sent by the first NAS server, and the second deletion response indicates that the target directory has not been deleted; if the NAS client receives the second deletion response sent by the first NAS server after sending the batch deletion instruction for the first preset time period, the NAS client sends a query instruction to the first NAS server every second preset time period, and the query instruction carries a deletion task identifier and a verification code corresponding to the batch deletion instruction; the NAS client receives a query response returned by the first NAS server based on each query instruction, and the query response carries the execution result of the deletion task, and the query response corresponding to the last query instruction sent by the NAS client indicates that the target directory has been deleted.
[0039] Optionally, the method further comprises:
[0040] The NAS client receives a second deletion response sent by the first NAS server, and the second deletion response indicates that the target directory has not been deleted; if the NAS client receives the second deletion response sent by the first NAS server immediately after sending the batch deletion instruction, then the NAS client receives the deletion completion response sent by the first NAS server, including: the NAS client receives an asynchronous deletion response sent by the first NAS server, and the asynchronous deletion response indicates that the target directory has been deleted.
[0041] In a third aspect, a NAS-based directory deletion device is provided, the device comprising at least one functional module, and the at least one functional module is used to execute the NAS-based directory deletion method provided by the first aspect or any possible implementation of the first aspect.
[0042] In a fourth aspect, a NAS-based directory deletion device is provided, the device comprising at least one functional module, and the at least one functional module is used to execute the NAS-based directory deletion method provided by the aforementioned second aspect or any possible implementation of the second aspect.
[0043] In a fifth aspect, a NAS server is provided, comprising a processor and a memory, the memory storing a program code, the processor being used to execute the program code, so that the NAS server executes a NAS-based directory deletion method provided in the aforementioned first aspect or any possible implementation of the first aspect.
[0044] In a sixth aspect, a distributed NAS server cluster is provided, which includes multiple NAS servers, each NAS server includes a processor and a memory, the memory stores a program code, and the processor is used to execute the program code, so that the distributed NAS server cluster executes the NAS-based directory deletion method provided by the first aspect or any possible implementation of the first aspect.
[0045] In a seventh aspect, a NAS client is provided, the NAS client comprising a processor and a memory, the memory storing a program code, the processor being used to execute the program code, so that the NAS client executes the NAS-based directory deletion method provided in the aforementioned first aspect or any possible implementation of the first aspect.
[0046] Based on the implementations provided in the above aspects, this application can also be further combined to provide more implementations. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a schematic diagram of an implementation environment of a NAS-based directory deletion method provided in an embodiment of the present application;
[0048] Figure 2 is a flowchart of a NAS-based directory deletion method provided in an embodiment of the present application;
[0049] Figure 3 is a flowchart of a NAS-based directory deletion method provided in an embodiment of the present application;
[0050] Figure 4It is a flowchart of a directory deletion method based on NAS in a synchronous deletion mode provided by an embodiment of the present application;
[0051] Figure 5 is a flowchart of a NAS-based directory deletion method provided in an embodiment of the present application;
[0052] Figure 6 It is a flowchart of a directory deletion method based on NAS in an asynchronous deletion mode provided in an embodiment of the present application;
[0053] Figure 7 It is a structural diagram of a NAS-based directory deletion device provided in an embodiment of the present application;
[0054] Figure 8 It is a structural diagram of a NAS-based directory deletion device provided in an embodiment of the present application;
[0055] Fig. 9 It is a structural diagram of a NAS client provided in an embodiment of the present application;
[0056] Fig.10 It is a structural diagram of a NAS server provided in an embodiment of the present application;
[0057] Fig.11 It is a structural diagram of a distributed NAS server cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0058] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0059] First, the implementation environment of the embodiments of the present application is introduced.
[0060] Figure 1 FIG. 1 is a schematic diagram of an implementation environment of a NAS-based directory deletion method provided in an embodiment of the present application. Figure 1 As shown, the implementation environment includes a NAS client 101 and a distributed NAS server cluster 102, wherein the distributed NAS server cluster 102 includes multiple NAS servers. The NAS client 101 and the distributed NAS server cluster 102 are connected to each other through a wired network or a wireless network.
[0061] Among them, the NAS client 101 can be a Windows server message block (SMB) client, or a Linux or Unix network file system (NFS) client, which is not limited in the embodiments of the present application. The NAS client 101 can run on at least one terminal of a desktop computer, a laptop, a virtual reality computing device, an augmented reality computing device, a wireless computing device, and a laptop portable computer. The NAS client 101 has a communication function and can access the Internet. The NAS client 101 can generally refer to one of multiple NAS clients. Those skilled in the art can know that the number of the above NAS clients can be more or less. Exemplarily, the NAS client 101 is mounted with a distributed NAS server cluster 102, so that the distributed NAS server cluster 102 provides background services for the NAS client 101. The NAS client 101 may send a deletion instruction or a query instruction for a target directory to the distributed NAS server cluster 102. After receiving the instruction, the first NAS server in the distributed NAS server cluster 102 executes the deletion operation or the query operation corresponding to the instruction, and returns a corresponding response to the NAS client 101. The NAS client 101 also has a display function, and can display a corresponding prompt based on the response from the first NAS server. For example, after the NAS client 101 receives the response sent by the first NAS server indicating that the target directory has been deleted, the directory deletion success prompt is displayed, and the directory deletion success prompt indicates that the target directory has been deleted.
[0062] Among them, the distributed NAS server cluster 102 includes multiple NAS servers, and multiple subdirectories under the same directory are distributed on multiple NAS servers in the distributed NAS server cluster 102. A NAS server is a special dedicated data storage server, including a storage device (such as a disk array, a CD / DVD drive, a tape drive or a removable storage medium) and an embedded system software, which can provide a cross-platform file sharing function. The NAS server can be an SMB server of Windows, or an NFS server of Linux or Unix, which is not limited in the embodiment of the present application. Exemplarily, the distributed NAS server cluster 102 provides background services for the NAS client 101, wherein if the NAS client 101 is an SMB client, the NAS server that provides background services for the NAS client 101 is an SMB server, and if the NAS client 101 is an NFS client, the NAS server that provides background services for the NAS client 101 is an NFS server. Exemplarily, the first NAS server in the distributed NAS server cluster 102 can receive a deletion instruction or a query instruction sent by the NAS client 101, and based on the received instruction, perform a corresponding deletion operation or query operation, and return a corresponding response to the NAS client 101. The deletion operation mode performed by the first NAS server is one of a synchronous deletion mode and an asynchronous deletion mode. In some embodiments, the first NAS server provides a batch deletion interface, which can be called by a batch deletion instruction sent by the NAS client to perform a deletion operation on the directory.
[0063] In some embodiments, the wireless network or wired network uses standard communication technology and / or protocols. The network is typically the Internet, but can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a private network or any combination of a virtual private network. In some embodiments, peer-to-peer (P2P) communication is implemented between the NAS client 101 and the distributed NAS server cluster 102 based on a remote procedure call protocol (RPC). In some embodiments, the NAS client 101 and the distributed NAS server cluster 102 use technologies and / or formats including hypertext markup language (HTML), extensible markup language (XML), etc. to represent data blocks exchanged through the network. In addition, conventional encryption technologies such as secure socket layer (SSL), transport layer security (TLS), virtual private network (VPN), Internet protocol security (IPsec), etc. can be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can be used to replace or supplement the above data communication technologies.
[0064] The embodiment of the present application provides a directory deletion method based on NAS, in which, after the first NAS server in the distributed NAS server cluster receives a batch deletion instruction sent by a NAS client to instruct to delete a target directory, it generates a distributed deletion instruction for multiple subdirectories under the target directory, sends the corresponding distributed deletion instruction to the NAS server where the subdirectories are located, and sends a deletion completion response to the NAS client. In the above method, a single batch deletion instruction is used to replace a large number of readdir instructions and delete instructions of the NAS client, which can greatly reduce the number of interactions between the NAS client and the NAS server, reduce the computing resource overhead and network bandwidth overhead of the NAS client, and also avoid the NAS client caching the metadata of the target directory, thereby reducing the consumption of memory resources of the NAS client.
[0065] The embodiments of the present application define batch deletion instructions, query instructions, and related responses to batch deletion instructions and query instructions. The above instructions and their responses are first introduced below.
[0066] (1) Batch delete command: The batch delete command is used to instruct to delete the target directory. The batch delete command carries a directory identifier and a deletion mode identifier. The directory identifier is used to indicate the target directory to be deleted, and the deletion mode identifier is used to indicate the deletion operation mode performed by the first NAS server in the distributed NAS server cluster on the target directory. The deletion operation mode is any one of a synchronous deletion mode and an asynchronous deletion mode.
[0067] The batch delete instruction can be represented by the following command word FULL_PATH_REMOVE:
[0068]
[0069] Wherein, target represents a directory identifier, and the value of isSync indicates a deletion operation mode, wherein isSync=1 indicates that the deletion operation mode is a synchronous deletion mode, and isSync=0 indicates that the deletion operation mode is an asynchronous deletion mode.
[0070] (2) Response to the batch deletion instruction: The response to the batch deletion instruction is used to return the execution result of the deletion task corresponding to the batch deletion instruction to the NAS client. The batch deletion instruction carries the deletion task identifier, check code and error code corresponding to the batch deletion instruction. The error code is determined based on the execution result of the deletion task. If the execution result of the deletion task is that the target directory has been deleted, the error code is the first error code. If the execution result of the deletion task is that the target directory has not been deleted, the error code is the second error code. The response to the batch deletion instruction includes a first deletion response and a second deletion response, wherein the error code in the first deletion response is the first error code, and the error code in the second deletion response is the second error code.
[0071] The response to the batch delete instruction can be represented by the following command word FULL_PATH_REMOVE_pending:
[0072]
[0073] Among them, query_id represents the deletion task identifier corresponding to the batch deletion instruction, verf represents the verification code, status represents the execution result of the deletion task, FULL_PATH_REMOVEresok res switch (nfsstat4 status) represents the error code, wherein, if status is NFS4_OK, it means that the execution result of the deletion task is that the target directory has been deleted, then the error code is the first error code (NFS4_OK), and if status is NFS4_PENDING, it means that the execution result of the deletion task is that the target directory has not been deleted, then the error code is the second error code (FULL_PATH_REMOVE_pending res).
[0074] (3) Query instruction: This query instruction is used to query the execution result of the deletion task corresponding to the batch deletion instruction. The query instruction carries the deletion task identifier and verification code corresponding to the batch deletion instruction.
[0075] The query instruction can be represented by the following command word QUERY_PATH_DEL:
[0076]
[0077] Wherein, query_id indicates the deletion task identifier corresponding to the batch deletion instruction, and verf indicates the verification code.
[0078] (4) Query response: This query response is used to return the execution result of the deletion task to the NAS client. This query response carries the execution result of the deletion task.
[0079] The query response can be represented by the following command word struct QUERY_PATH_DEL 4res:
[0080] struct QUERY_PATH_DEL 4res{
[0081] nfsstat4 status;
[0082] }
[0083] Among them, status indicates the execution result of the deletion task.
[0084] (5) Asynchronous deletion response: This asynchronous deletion response is used to return the execution result of the deletion task to the NAS client in the asynchronous deletion mode when the target directory has been deleted. This asynchronous deletion response carries the deletion task identifier, the verification code, and the execution result of the deletion task, and the execution result of the deletion task is that the target directory has been deleted.
[0085] The asynchronous delete response may be represented by the following command word CB_FULL_PATH_REMOVE:
[0086]
[0087] Among them, query_id represents the deletion task identifier corresponding to the batch deletion instruction, verf represents the verification code, status represents the execution result of the deletion task, and the execution result of the deletion task is that the target directory has been deleted.
[0088] It should be noted that the various command words used for the instructions or responses defined in the above examples are defined based on the NFS protocol. In some embodiments, the above instructions or responses are also defined based on other protocols, such as the SMB protocol, but the embodiments of the present application do not limit this.
[0089] Based on the above instructions and responses, the following specifically introduces the process of a NAS-based directory deletion method provided in an embodiment of the present application. Among them, the batch deletion instruction sent by the NAS client can carry a deletion mode identifier, and the deletion mode identifier is used to indicate the deletion operation mode performed by the first NAS server in the distributed NAS server cluster on the target directory, and the deletion operation mode is any one of the synchronous deletion mode and the asynchronous deletion mode; correspondingly, after receiving the batch deletion instruction, the NAS server can delete the target directory in the synchronous deletion mode or the asynchronous deletion mode based on the deletion mode identifier in the batch deletion instruction.
[0090] The following first takes the synchronous deletion mode as an example to introduce the method. In the synchronous deletion mode, if the distributed NAS server cluster completes the deletion of the target directory within the first preset time length after the first NAS server receives the batch deletion instruction, the first NAS server directly sends a first deletion response to the NAS client indicating that the target directory has been deleted; if the distributed NAS server cluster does not complete the deletion of the target directory within the first preset time length, the first NAS server first sends a second deletion response to the NAS client indicating that the target directory has not been deleted, and the distributed NAS server cluster continues to execute the deletion task. After receiving the second deletion response, the NAS client can periodically send query instructions to the first NAS server to query the execution result of the deletion task until the deletion task of the target directory has been completed. The above two situations are introduced below respectively.
[0091] First, a case where the distributed NAS server cluster completes the deletion of the target directory within the first preset time period is taken as an example for introduction. Figure 2 is a flowchart of a NAS-based directory deletion method provided in an embodiment of the present application, such as Figure 2As shown, taking the interaction between a NAS client and a distributed NAS server cluster as an example, the method includes the following steps 201 to 205.
[0092] 201. In response to a deletion operation performed on a target directory on the NAS client, a NAS client sends a batch deletion instruction to a first NAS server in a distributed NAS server cluster. The batch deletion instruction instructs to delete the target directory. The batch deletion instruction carries a deletion mode identifier, and the deletion mode identifier is used to indicate that a deletion operation mode performed by the first NAS server on the target directory is a synchronous deletion mode.
[0093] Among them, the deletion operation performed on the target directory on the NAS client can be to first select the target directory on the NAS client and then select the "delete" option by right-clicking the mouse, or to first select the target directory on the NAS client and then click the "delete" button on the keyboard. The deletion operation on the target directory can also be performed on the NAS client in other ways, which is not limited in the embodiments of the present application.
[0094] Among them, the first NAS server is the NAS server that stores the target directory in the distributed NAS server cluster. If the target directory includes subdirectories, the subdirectories are stored in other NAS servers in the distributed NAS server cluster. If the directory target includes files, the files are stored in the first NAS server.
[0095] The NAS client sends the batch deletion instruction to the first NAS server based on a stateful protocol. For example, the NAS client is an SMB client, and the NAS server is an SMB server. The SMB client sends the batch deletion instruction to the SMB server based on a stateful protocol (SMB protocol). In response to a deletion operation performed on a target directory on the SMB client, the SMB client first sends an open instruction for the target directory to the SMB server; after receiving the open instruction, the SMB server opens the target directory, sets deletion tags for files and subdirectories in the target directory, and returns a response to the open instruction to the SMB client; after receiving the response to the open instruction, the SMB client sends a close instruction for the target directory to the SMB server; after receiving the close instruction, the SMB server closes the target directory and returns a response to the close instruction to the SMB client; and after receiving the response to the close instruction, the SMB client sends the batch deletion instruction to the NAS server. For another example, the NAS client is an NFS client, and the NAS server is an NFS server. The NFS client sends a batch deletion instruction to the NFS server based on a stateful protocol (NFS protocol), wherein the NFS client first sends a directory read (readdir) instruction for the target directory to the NFS server in response to a deletion operation on the target directory on the NFS client; after receiving the readdir instruction, the NFS server returns metadata of the files and subdirectories in the target directory to the NFS client; after receiving the metadata, the NFS client sends the batch deletion instruction to the NFS server, wherein the NFS client sends the batch deletion instruction to the NFS server in the form of a combined message.
[0096] 202. The first NAS server receives the batch deletion instruction, and generates multiple distributed deletion instructions based on the target directory indicated by the batch deletion instruction, wherein the multiple distributed deletion instructions indicate deletion of multiple subdirectories under the target directory, and the multiple subdirectories are distributed on multiple NAS servers in the distributed NAS server cluster.
[0097] The process of the first NAS server generating multiple distributed deletion instructions based on the target directory indicated by the batch deletion instruction includes: determining the target directory to be deleted from the directory stored by the first NAS server based on the directory identifier carried by the batch deletion instruction; determining the NAS server where multiple subdirectories under the target directory are located based on the metadata of the target directory to be deleted; and generating distributed deletion instructions corresponding to each NAS server.
[0098] 203. The first NAS server sends a distributed deletion instruction of the corresponding subdirectory to the NAS server where each subdirectory in the multiple subdirectories is located.
[0099] Among them, the subdirectories indicated by different distributed deletion instructions can be located in different NAS servers or in the same NAS server, which is not limited in the embodiment of the present application.
[0100] It should be noted that the above steps 202 and 203 are described by taking the case where the target directory only includes subdirectories as an example. In some embodiments, the target directory only includes files, and the files in the target directory are stored in the first NAS server. When the first NAS server receives a batch deletion instruction for the target directory, the files in the target directory are deleted from the first NAS server. In other embodiments, the target directory includes both subdirectories and files. When the first NAS server receives a deletion instruction for the target directory, it generates a distributed deletion instruction corresponding to each subdirectory, sends the distributed deletion instruction to the corresponding NAS server, and deletes the files in the target directory from the first NAS server.
[0101] After receiving the distributed deletion instruction, the second NAS server in the distributed NAS server cluster performs a deletion operation on the corresponding subdirectory stored in the second NAS server. If the subdirectory of the target directory only includes files, the second NAS server deletes the files in the subdirectory from the second NAS server based on the subdirectory indicated by the received distributed deletion instruction; if the subdirectory of the target directory only includes the next-level subdirectory, the second NAS server generates distributed deletion instructions for multiple subdirectories under the subdirectory, and sends the distributed deletion instructions of the corresponding subdirectories to the NAS server where each subdirectory in the subdirectory is located; if the subdirectory of the target directory includes both files and next-level subdirectories, the second NAS server first generates a distributed deletion instruction corresponding to each subdirectory in the subdirectory, sends the distributed deletion instruction to the NAS server where each subdirectory in the subdirectory is located, and deletes the files in the subdirectory from the second NAS server. This process is the same as the above steps 202 to 203, and will not be repeated. Each NAS server in the distributed NAS server cluster storing subdirectories or files of each level of the target directory executes the above process in sequence according to the corresponding subdirectory level until all subdirectories and files of each level under the target directory are deleted.
[0102] 204. If the target directory has been deleted within the first preset time period, the first NAS server sends a first deletion response to the NAS client, where the first deletion response indicates that the target directory has been deleted.
[0103] The first preset duration can be set by the NAS client sending a setting instruction to the first NAS server, or can be a value preset by the first NAS server. The length of the first preset duration can be set based on actual needs, for example, based on the response delay requirement of the distributed NAS server cluster. If the response delay requirement of the distributed NAS server cluster is shorter, the first preset duration is set shorter. If the response delay requirement of the distributed NAS server cluster is longer, the first preset duration is set longer. This embodiment of the present application does not limit this.
[0104] The target directory has been completely deleted, which means that all subdirectories and files at all levels under the target directory have been completely deleted.
[0105] Among them, the first deletion response carries the deletion task identifier, check code and first error code of the deletion task corresponding to the batch deletion instruction. The first deletion response can be represented by the above-mentioned command word FULL_PATH_REMOVE_pending, which will not be repeated here. Among them, the deletion task identifier and check code can be generated by the first NAS server when the target directory has been deleted within the first preset time length. The first NAS server stores the generated deletion task identifier and check code. In some embodiments, the deletion task identifier and check code are generated by the first NAS server after receiving the batch deletion instruction. The embodiment of the present application does not limit the generation time of the deletion task identifier and the check code. It should be noted that the deletion task identifier and check code can also be generated and stored by any NAS server in the distributed NAS server cluster, and the embodiment of the present application does not limit this.
[0106] 205. The NAS client receives the first deletion response and displays a prompt indicating that the target directory has been deleted successfully. The prompt indicating that the target directory has been deleted.
[0107] Among them, the deletion success prompt may include at least one of the name of the deleted target directory, the storage path, the number of subdirectories or files included in the target directory, the size of the storage resources occupied by the target directory, and the deletion time, which is not limited in the embodiment of the present application.
[0108] In the above method, when deleting a target directory, the NAS client only needs to send a single batch deletion instruction for the target directory to the first NAS server in the distributed NAS server cluster. After receiving the batch deletion instruction, the first NAS server generates multiple distributed deletion instructions for multiple sub-directories in the target directory based on the single batch deletion instruction, and sends the multiple distributed deletion instructions to the NAS servers corresponding to the sub-directories for execution respectively, while the NAS client does not need to send deletion instructions to each sub-directory under the target directory respectively, thereby reducing the number of interactions between the NAS client and the NAS server during the target directory deletion process, avoiding the consumption of a large amount of memory resources, computing resources and bandwidth resources, and shortening the time. The response delay is reduced; further, each NAS server in the distributed NAS server cluster that stores sub-directories or files of each level of the target directory executes the deletion operation in sequence according to the corresponding sub-directory hierarchy, avoiding the deletion task by a single NAS server, which can reduce the burden on the NAS server, and in the synchronous deletion mode, if the distributed NAS server cluster completes the deletion of the target directory within a first preset time, the first NAS server actively sends a first deletion response to the NAS client indicating that the directory has been deleted, so that the NAS client does not need to send a query instruction to the NAS server, which can further reduce the interaction between the NAS client and the NAS server, save bandwidth resources, and improve the performance of the NAS file deletion operation.
[0109] The following takes the case where the distributed NAS server cluster fails to complete the deletion of the target directory within the first preset time period in the synchronous mode as an example for description. Figure 3 is a flowchart of a NAS-based directory deletion method provided in an embodiment of the present application, such as Figure 3 As shown, taking the interaction between a NAS client and a distributed NAS server cluster as an example, the method includes the following steps 301 to 308.
[0110] 301. In response to a deletion operation performed on a target directory on the NAS client, a NAS client sends a batch deletion instruction to a first NAS server in a distributed NAS server cluster. The batch deletion instruction instructs to delete the target directory. The batch deletion instruction carries a deletion mode identifier, and the deletion mode identifier is used to indicate that a deletion operation mode performed by the first NAS server on the target directory is a synchronous deletion mode.
[0111] 302. The first NAS server receives the batch deletion instruction, and generates multiple distributed deletion instructions based on the target directory indicated by the batch deletion instruction, wherein the multiple distributed deletion instructions indicate deletion of multiple subdirectories under the target directory, and the multiple subdirectories are distributed on multiple NAS servers in the distributed NAS server cluster.
[0112] 303. The first NAS server sends a distributed deletion instruction of the corresponding subdirectory to the NAS server where each subdirectory in the multiple subdirectories is located.
[0113] Steps 301 to 303 are the same as the above-mentioned steps 201 to 203 and are not described in detail.
[0114] 304. If the target directory has not been completely deleted within the first preset time period, the first NAS server sends a second deletion response to the NAS client, where the second deletion response indicates that the target directory has not been completely deleted.
[0115] Among them, the second deletion response carries the deletion task identifier, check code and second error code of the deletion task corresponding to the batch deletion instruction. The second deletion response can be represented by the above-mentioned command word FULL_PATH_REMOVE_pending, which will not be repeated here. Among them, the deletion task identifier and check code are generated by the first NAS server when the target directory has not been deleted within the second preset time period. The second NAS server stores the generated deletion task identifier and check code. In some embodiments, the deletion task identifier and check code are generated by the first NAS server after receiving the batch deletion instruction, which is not limited to this in the embodiment of the present application. It should be noted that the deletion task identifier and check code can also be generated and stored by any NAS server in the distributed NAS server cluster, which is not limited to this in the embodiment of the present application.
[0116] While the first NAS server sends the second deletion response to the NAS client, the distributed NAS server cluster continues to execute the deletion task on the target directory.
[0117] 305. The NAS client receives the second deletion response, and stores the deletion task identifier and the verification code carried in the second deletion response.
[0118] Among them, the NAS client stores the deletion task identifier and verification code carried by the second deletion response in the memory, so that when the next response carrying the deletion task identifier is received, the verification code in the received response is verified based on the stored verification code, thereby ensuring that the subsequently received response corresponds to the same deletion task as the second deletion response.
[0119] 306. The NAS client sends a query instruction to the first NAS server every second preset time period. The query instruction carries the deletion task identifier and the verification code carried by the second deletion response.
[0120] Among them, the second preset time length can be set based on actual needs, for example, it can be set based on the amount of storage resources occupied by the target directory. If the target directory occupies more storage resources, the second preset time length is longer, and if the target directory occupies fewer storage resources, the second preset time length is shorter. Since the time required to delete the target directory is related to the amount of storage resources occupied by the target directory, setting the second preset time length based on the amount of storage resources occupied by the target directory can avoid the situation where the target directory is still not deleted after multiple queries due to too frequent query instructions, avoid invalid queries, and thus save bandwidth resources. The embodiment of the present application does not limit the setting method of the second preset time length.
[0121] In the above method, the query instruction sent by the NAS client carries the deletion task identifier and verification code carried in the second deletion response previously received by the NAS client, which can ensure that the query result of the query instruction and the second deletion response are for the same deletion task, thereby ensuring the accuracy of the query result.
[0122] 307. The first NAS server receives at least one query instruction sent by the NAS client, and returns a corresponding query response to the NAS client based on each query instruction. Each query response carries the execution result of the deletion task. The query response corresponding to the last query instruction in at least one query instruction indicates that the target directory has been deleted.
[0123] The query instruction may be represented by the command word QUERY_PATH_DEL, and the query response may be represented by the command word struct QUERY_PATH_DEL 4res, which will not be described in detail here.
[0124] Wherein, each time the first NAS server receives a query instruction, based on the deletion task identifier carried by the query instruction, it queries the execution result of the deletion task indicated by the deletion task identifier, and based on the query execution result, it returns a query response to the NAS client. Wherein, the execution result of the deletion task is either that the target directory has been deleted or that the target directory has not been deleted.
[0125] In some embodiments, each time the first NAS server receives a query instruction, it matches the verification code carried by the query instruction with the verification code stored by the first NAS server; if the match fails, an error message is returned; if the match succeeds, the execution result of the deletion task indicated by the deletion task identifier is queried. In this method, before the first NAS server queries the execution result of the deletion task, it first verifies the verification code carried by the query instruction, and only queries when the verification passes, which can avoid invalid queries and save computing resources of the first NAS server.
[0126] 308. The NAS client receives a query response returned by the first NAS server based on each query instruction.
[0127] Among them, if the execution result of the deletion task carried by any query response indicates that the directory has been deleted, the NAS client displays a prompt that the target directory has been successfully deleted. This process is the same as the above step 205 and will not be repeated; if the execution result of the deletion task carried by any query response indicates that the directory has not been deleted, the NAS client continues to execute the above step 306, that is, sending a query instruction to the first NAS server every second preset time until the target directory has been deleted. In some embodiments, if the target directory has not been deleted within a third preset time, the NAS client no longer sends a query instruction to the first NAS server, but returns an error message, which indicates that the target directory has failed to be deleted.
[0128] In the above method, when deleting a target directory, the NAS client only needs to send a single batch deletion instruction for the target directory to the first NAS server in the distributed NAS server cluster. After receiving the batch deletion instruction, the first NAS server generates multiple distributed deletion instructions for multiple sub-directories in the target directory based on the single batch deletion instruction, and sends the multiple distributed deletion instructions to the NAS servers corresponding to the sub-directories for execution respectively, while the NAS client does not need to send deletion instructions to each sub-directory under the target directory respectively, thereby reducing the number of interactions between the NAS client and the NAS server during the target directory deletion process, avoiding the consumption of a large amount of memory resources, computing resources and bandwidth resources, and shortening the response delay; further, the distributed Each NAS server in the distributed NAS server cluster that stores subdirectories or files of each level of the target directory executes the deletion operation in sequence according to the corresponding subdirectory hierarchy, avoiding a single NAS server from executing the deletion task, and reducing the burden on the NAS server. In the synchronous deletion mode, if the distributed NAS server cluster fails to complete the deletion of the target directory within the first preset time, the first NAS server actively sends a second deletion response to the NAS client indicating that the target directory has not been deleted, and the distributed NAS server cluster continues to execute the deletion task, so that the NAS client periodically sends query instructions to the first NAS server, which can ensure that the NAS client can timely learn and synchronize the deletion status of the target directory, thereby improving the performance of the NAS file deletion operation.
[0129] Below Figure 4 For example, for the above Figure 2 and Figure 3 The process shown is described by way of example. Figure 4FIG. 1 is a flowchart of a directory deletion method based on NAS in a synchronous deletion mode provided in an embodiment of the present application. Figure 4 As shown, the NAS client sends a batch deletion instruction (FULL_PATH_REMOVE) to the first NAS server. In the batch deletion instruction, isSync is set to true, indicating that the first NAS server adopts the synchronous deletion mode when executing the deletion task; the distributed NAS server cluster completes the deletion within the timeout period (that is, the second preset time) as much as possible. If the deletion cannot be completed within the timeout period, the first NAS server generates a deletion task identifier (query_id=1) and a check code (verf=1) corresponding to the batch deletion instruction, sets the error code to the error code when the directory has not been deleted (NFS4_PENDING), that is, the second error code, and returns a second deletion response carrying the query_id and verf and the second error code to the NAS client. After receiving the response, the NAS client checks the error code carried in the response. If the error code is an error code in the case of NFS4_PENDING, the query instruction (QUERY_FULL_PATH_REMOVE) is sent with a delay. In the query instruction, quey_id and verf need to be carried. If the query instruction received by the first NAS server contains query_id and verf information, the first NAS server compares the query_id and verf in the instruction with the cached query_id and verf. If the comparison fails, an error is reported; if the comparison succeeds, a query response is returned to the NAS client to return the execution result of the deletion task to the NAS client. If the distributed NAS server cluster has completed the deletion within the time limit, the first deletion response carrying query_id and verf and the first error code (the error code in the case of NFS4_OK) is returned to the NAS client, and the NAS client displays a prompt that the target directory has been successfully deleted.
[0130] above Figure 2 and Figure 3 The embodiment shown is introduced by taking the synchronous deletion mode as an example, and the following is introduced by taking the asynchronous deletion mode as an example. Figure 5 is a flowchart of a NAS-based directory deletion method provided in an embodiment of the present application, such as Figure 5 As shown, taking the interaction between a NAS client and a distributed NAS server cluster as an example, the method includes the following steps 501 to 508.
[0131] 501. In response to a deletion operation performed on a target directory on the NAS client, a NAS client sends a batch deletion instruction to a first NAS server in a distributed NAS server cluster. The batch deletion instruction instructs to delete the target directory. The batch deletion instruction carries a deletion mode identifier. The deletion mode identifier indicates that the deletion operation performed on the target directory by the first NAS server is in an asynchronous deletion mode.
[0132] This step 501 is the same as the above step 201, the difference is that the deletion mode identifier carried by the batch deletion instruction in step 501 indicates that the deletion operation performed by the first NAS server on the target directory is in asynchronous deletion mode, while the deletion mode identifier carried by the batch deletion instruction in step 201 indicates that the deletion operation performed by the first NAS server on the target directory is in synchronous deletion mode. The similarities are not repeated here.
[0133] 502. The first NAS server receives the batch deletion instruction and sends a second deletion response to the NAS client, where the second deletion response indicates that the target directory has not been completely deleted.
[0134] This step 502 is similar to the above step 302, except that in step 502, after receiving the batch deletion instruction, the first NAS server immediately sends the second deletion response to the NAS client, while in step 302, the first NAS server sends the second deletion response to the NAS client only when it fails to complete the deletion of the target directory within the second preset time period. The similarities are not repeated here.
[0135] 503. The first NAS server generates multiple distributed deletion instructions based on the target directory indicated by the batch deletion instruction. The multiple distributed deletion instructions indicate to delete multiple subdirectories under the target directory. The multiple subdirectories are distributed on multiple NAS servers in the distributed NAS server cluster.
[0136] 504. The first NAS server sends a distributed deletion instruction of the corresponding sub-directory to each NAS server where each sub-directory in the target directory is located.
[0137] Step 503 and step 504 are similar to the above-mentioned step 202 and step 203, and are not described in detail.
[0138] 505. The NAS client receives the second deletion response, and stores the deletion task identifier and the verification code carried in the second deletion response.
[0139] The step 505 is the same as the above step 305 and will not be described in detail.
[0140] 506. The NAS client starts an asynchronous snoop task to receive an asynchronous deletion response sent by the first NAS server.
[0141] 507. After the distributed NAS server cluster completes deleting the target directory, the first NAS server sends an asynchronous deletion response to the NAS client, where the asynchronous deletion response indicates that the target directory has been deleted.
[0142] The asynchronous deletion response carries the deletion task identifier, verification code, and execution result of the deletion task corresponding to the batch deletion instruction, wherein the execution result of the deletion task is that the target directory has been deleted. The asynchronous deletion response can be represented by the above command word CB_FULL_PATH_REMOVE, which will not be repeated here.
[0143] Among them, the first NAS server sends an asynchronous deletion response to the NAS client through a channel different from the channel through which the second deletion response is sent to the NAS client. For example, if the first NAS server is an NFS server and the corresponding NAS client is an NFS client, the first NAS server sends the asynchronous deletion response to the NAS client through the reverse channel of NFS4. This embodiment of the present application is not limited to this.
[0144] 508. The NAS client receives the asynchronous deletion response, and matches the verification code carried in the asynchronous deletion response with the verification code carried by the NAS client. If the match is successful, a prompt indicating that the target directory has been successfully deleted is displayed.
[0145] The process of displaying a prompt indicating that the target directory has been successfully deleted when the match is successful in step 508 is the same as that of step 205 above, and will not be described in detail.
[0146] Below Figure 6 For example, for the above Figure 5 The process shown is described by way of example. Figure 6 FIG. 1 is a flow chart of a directory deletion method based on NAS in an asynchronous deletion mode provided in an embodiment of the present application. Figure 6As shown, the NAS client sends a batch deletion instruction (FULL_PATH_REMOVE) to the first NAS server. In the batch deletion instruction, isSync is set to false, indicating that the first NAS server adopts the asynchronous deletion mode when executing the deletion task; the first NAS server generates a deletion task identifier (query_id=1) and a verification code (verf=1) corresponding to the batch deletion instruction, sets the error code to the error code when the target directory has not been deleted (NFS4_PENDING), that is, the second error code, and returns the second deletion response carrying the query_id and verf and the second error code to NAS client; then the distributed NAS server cluster continues to execute the deletion task; after receiving the response, the NAS client checks the error code. If the error code is the error code in the NFS4_PENDING case (the second error code), the asynchronous listening task is started to receive the asynchronous deletion response sent by the first NAS server; after the distributed NAS server cluster completes the deletion of the target directory, the first NAS server returns the asynchronous deletion response (CB_FULL_PATH_REMOVE) carrying the execution result of the deletion task to the NAS client through the reverse channel of NFS4. The asynchronous deletion response also carries query_id and verf. If the NAS client has not received the asynchronous deletion response sent by the first NAS server, the deletion process (session) of the target directory is destroyed, and the deletion task is forcibly terminated with the destruction of the session.
[0147] In the above method, when deleting a target directory, the NAS client only needs to send a single batch deletion instruction for the target directory to the first NAS server in the distributed NAS server cluster. After receiving the batch deletion instruction, the first NAS server generates multiple distributed deletion instructions for multiple sub-directories in the target directory based on the single batch deletion instruction, and sends the multiple distributed deletion instructions to the NAS servers corresponding to the sub-directories for execution respectively. The NAS client does not need to send deletion instructions to each sub-directory under the target directory respectively, which reduces the number of interactions between the NAS client and the NAS server during the target directory deletion process and avoids the consumption of a large amount of memory resources, computing resources and bandwidth resources. , shortening the response delay; further, each NAS server in the distributed NAS server cluster that stores subdirectories or files of each level of the target directory executes the deletion operation in sequence according to the corresponding subdirectory hierarchy, avoiding the deletion task by a single NAS server, which can reduce the burden on the NAS server, and in the asynchronous deletion mode, after the distributed NAS server cluster completes the deletion of the target directory, the first server actively sends an asynchronous deletion response to the NAS client indicating that the target directory has been deleted, and the NAS client only needs to start an asynchronous listening task to receive the asynchronous deletion response, which can further reduce the interaction between the NAS client and the NAS server, save bandwidth resources, and improve the performance of NAS file deletion operations.
[0148] Figure 7 It is a structural diagram of a NAS-based directory deletion device provided in an embodiment of the present application, which is executed by the first NAS server in the distributed NAS server cluster. The device includes an instruction receiving module 701, an instruction generating module 702, an instruction sending module 703 and a response sending module 704.
[0149] The instruction receiving module 701 is used to receive a batch deletion instruction sent by the NAS client, wherein the batch deletion instruction indicates to delete the target directory;
[0150] An instruction generation module 702 is used to generate multiple distributed deletion instructions based on the target directory indicated by the batch deletion instruction, wherein the multiple distributed deletion instructions indicate to delete multiple subdirectories under the target directory, and the multiple subdirectories are distributed on multiple NAS servers in the distributed NAS server cluster;
[0151] An instruction sending module 703 is used to send a distributed deletion instruction of the corresponding subdirectory to the NAS server where each subdirectory in the multiple subdirectories is located;
[0152] The response sending module 704 is used to send a deletion completion response to the NAS client, where the deletion completion response indicates that the target directory has been deleted.
[0153] Optionally, the target directory also includes multiple files, and the device further includes:
[0154] A deleting module is used to delete multiple files under the target directory from the first NAS server based on the target directory indicated by the batch deletion instruction.
[0155] Optionally, the subdirectories indicated by different distributed deletion instructions are located on different NAS servers.
[0156] Optionally, the batch deletion instruction further carries a deletion mode identifier, where the deletion mode identifier is used to indicate a deletion operation mode performed by the first NAS server on the target directory, and the deletion operation mode is any one of a synchronous deletion mode and an asynchronous deletion mode.
[0157] Optionally, the response sending module 704 is used to:
[0158] When the target directory has been deleted within a first preset time period, a first deletion response is sent to the NAS client, where the first deletion response indicates that the target directory has been deleted.
[0159] Optionally, the response sending module 704 is used to:
[0160] When the target directory has not been completely deleted within the first preset time period, sending a second deletion response to the NAS client, where the second deletion response is used to indicate that the target directory has not been completely deleted;
[0161] receiving at least one query instruction sent by the NAS client, each of the query instructions being separated by a second preset time period, and each of the query instructions carrying a deletion task identifier corresponding to the batch deletion instruction;
[0162] Based on each of the query instructions, a corresponding query response is returned to the NAS client, each of the query responses carries the execution result of the deletion task, and the query response corresponding to the last query instruction in the at least one query instruction indicates that the target directory has been deleted.
[0163] Optionally, the response sending module 704 is used to:
[0164] When receiving the batch deletion instruction, sending a second deletion response to the NAS client, wherein the second deletion response is used to indicate that the directory has not been completely deleted;
[0165] If the directory has been deleted, an asynchronous deletion response is sent to the NAS client, where the asynchronous deletion response indicates that the target directory has been deleted.
[0166] Among them, the instruction receiving module 701, the instruction generating module 702, the instruction sending module 703 and the response sending module 704 can all be implemented by software, or can be implemented by hardware. Exemplarily, the implementation of the instruction receiving module 701 is introduced below by taking the instruction receiving module 701 as an example. Similarly, the implementation of the instruction generating module 702, the instruction sending module 703 and the response sending module 704 can refer to the implementation of the instruction receiving module 701.
[0167] As an example of a software functional unit, the instruction receiving module 701 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the instruction receiving module 701 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including a data center or multiple data centers with similar geographical locations. Among them, usually a region may include multiple AZs.
[0168] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0169] As an example of a hardware functional unit, the instruction receiving module 701 may include at least one computing device, such as a server, etc. Alternatively, the instruction receiving module 701 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0170] The multiple computing devices included in the instruction receiving module 701 can be distributed in the same region or in different regions. The multiple computing devices included in the instruction receiving module 701 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the instruction receiving module 701 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0171] It should be noted that, in other embodiments, the steps that the above modules are responsible for implementing can be specified as needed, and the above modules can respectively implement different steps in the above NAS-based directory deletion method to realize all the functions of the above device. That is, the NAS-based directory deletion device provided in the above embodiment only uses the division of the above functional modules as an example when implementing the NAS-based directory deletion method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device provided in the above embodiment belongs to the same concept as the corresponding method embodiment. The specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0172] Figure 8 It is a structural diagram of a NAS-based directory deletion device provided in an embodiment of the present application, which is executed by a NAS client. The device includes an instruction sending module 801, a response receiving module 802 and a display module 803.
[0173] An instruction sending module 801 is used to send a batch deletion instruction to a first NAS server in a distributed NAS server cluster in response to a deletion operation performed on a target directory on the NAS client, wherein the batch deletion instruction indicates to delete the target directory;
[0174] A response receiving module 802 is used to receive a deletion completion response sent by the first NAS server, where the deletion completion response indicates that the target directory has been deleted;
[0175] The display module 803 is used to display a deletion success prompt of the target directory, where the deletion success prompt indicates that the target directory has been deleted.
[0176] Optionally, the batch deletion instruction further carries a deletion mode identifier, where the deletion mode identifier is used to indicate a deletion operation mode performed by the first NAS server on the target directory, and the deletion operation mode is any one of a synchronous deletion mode and an asynchronous deletion mode.
[0177] Optionally, the response receiving module 802 is used to:
[0178] A first deletion response is received from the first NAS server, where the first deletion response indicates that the target directory has been deleted within a first preset time period.
[0179] Optionally, the response receiving module 802 is used to:
[0180] receiving a second deletion response sent by the first NAS server, wherein the second deletion response indicates that the target directory is not deleted;
[0181] If the NAS client receives a second deletion response sent by the first NAS server after sending the batch deletion instruction for the first preset time period, the NAS client sends a query instruction to the first NAS server every second preset time period, where the query instruction carries a deletion task identifier and a verification code corresponding to the batch deletion instruction;
[0182] Receive a query response returned by the first NAS server based on each query instruction, the query response carrying the execution result of the deletion task, and the query response corresponding to the last query instruction sent by the NAS client indicates that the target directory has been deleted.
[0183] Optionally, the response receiving module 802 is used to:
[0184] receiving a second deletion response sent by the first NAS server, wherein the second deletion response indicates that the target directory is not deleted;
[0185] An asynchronous deletion response is received from the first NAS server, where the asynchronous deletion response indicates that the target directory has been deleted.
[0186] It should be noted that, in other embodiments, the steps that the above modules are responsible for implementing can be specified as needed, and the above modules can respectively implement different steps in the above NAS-based directory deletion method to realize all the functions of the above device. That is, the NAS-based directory deletion device provided in the above embodiment only uses the division of the above functional modules as an example when implementing the NAS-based directory deletion method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device provided in the above embodiment belongs to the same concept as the corresponding method embodiment. The specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0187] This application implements a NAS client such as Fig. 9 As shown, Fig. 9 900 is a schematic diagram of a NAS client provided in an embodiment of the present application. The NAS client 900 may be a host, a server or a personal computer, etc. The NAS client 900 may be implemented by a general bus architecture.
[0188] The NAS client 900 includes at least one processor 901 , a communication bus 902 , a memory 903 , and at least one communication interface 904 .
[0189] The processor 901 is, for example, a general-purpose central processing unit (CPU), a network processor (NP), a graphics processing unit (GPU), a neural-network processing unit (NPU), a data processing unit (DPU), a microprocessor, or one or more integrated circuits for implementing the solution of the present application. For example, the processor 901 includes an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD is, for example, a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0190] The communication bus 902 is used to transmit information between the above components. The communication bus 902 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 The fact that only one line is used in the diagram does not mean that there is only one bus or only one type of bus.
[0191] The memory 903 is, for example, a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, or a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 903 is, for example, independent and connected to the processor 901 via the communication bus 902. The memory 903 can also be integrated with the processor 901.
[0192] The communication interface 904 uses any transceiver-like device for communicating with other devices or communication networks. The communication interface 904 includes a wired communication interface and may also include a wireless communication interface. Among them, the wired communication interface may be, for example, an Ethernet interface. The Ethernet interface may be an optical interface, an electrical interface, or a combination thereof. The wireless communication interface may be a wireless local area network (WLAN) interface, a cellular network communication interface, or a combination thereof, etc.
[0193] As an embodiment, the processor 901 may include one or more CPUs.
[0194] As an embodiment, the NAS client 900 may include multiple processors, each of which may be a single-CPU or a multi-CPU. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0195] As an embodiment, the NAS client 900 may further include an output device and an input device. The output device communicates with the processor 901 and may display information in a variety of ways. For example, the output device may be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector. The input device communicates with the processor 901 and may receive user input in a variety of ways. For example, the input device may be a mouse, a keyboard, a touch screen device, or a sensor device.
[0196] In some embodiments, the memory 903 is used to store program codes for executing the solution of the present application, and the processor 901 can execute the program codes stored in the memory 903. That is, the NAS client 900 can implement the NAS-based directory deletion method provided in the method embodiment through the processor 909 and the program codes in the memory 903.
[0197] Fig.10 1 is a schematic diagram of the structure of a NAS server provided in an embodiment of the present application. The NAS server 1000 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 1001 and one or more memories 1002, wherein at least one program code is stored in the one or more memories 1002, and the at least one program code is loaded and executed by the one or more processors 1001 to implement the above-mentioned NAS-based directory deletion method. Of course, the NAS server 1000 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The NAS server 1000 may also include other components for implementing device functions, which will not be described in detail here.
[0198] Fig.11 is a schematic diagram of the structure of a distributed NAS server cluster provided in an embodiment of the present application, such as Fig.11 The distributed NAS server cluster shown includes multiple NAS servers, each NAS server includes a processor and a memory, the memory stores program code, and the processor is used to execute the program code, so that the distributed NAS server cluster executes to implement the above-mentioned NAS-based directory deletion method.
[0199] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions. For example, the directories and files involved in this application are obtained with full authorization.
[0200] Those of ordinary skill in the art will appreciate that the various method steps and units described in the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the steps and components of each embodiment have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those of ordinary skill in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0201] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0202] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the unit is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or it can be an electrical, mechanical or other form of connection.
[0203] The unit described as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment of the present application.
[0204] In addition, each unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or software unit.
[0205] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computing device (which can be a personal computer, a server, or a computing device, etc.) to execute all or part of the steps of the method in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0206] In this application, the terms "first", "second", etc. are used to distinguish between identical or similar items with substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is the quantity and execution order limited. It should also be understood that although the following description uses the terms first, second, etc. to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another. For example, without departing from the scope of various examples, the first preset duration may be referred to as the second preset duration, and similarly, the second preset duration may be referred to as the first preset duration. Both the first preset duration and the second preset duration may be preset durations, and in some cases, may be separate and different preset durations.
[0207] The term "at least one" in this application means one or more, and the term "multiple" in this application means two or more, for example, multiple delete instructions means two or more delete instructions. The terms "system" and "network" are often used interchangeably herein.
[0208] It should also be understood that the term "if" may be interpreted to mean "when" or "upon" or "in response to determining" or "in response to detecting." Similarly, the phrase "if it is determined that ..." or "if [a stated condition or event] is detected" may be interpreted to mean "upon determining that ..." or "in response to determining that ..." or "upon detecting [a stated condition or event]" or "in response to detecting [a stated condition or event]," depending on the context.
[0209] The above description is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0210] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer program instructions. When the computer program instructions are loaded and executed on a computer, the process or function in accordance with the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
[0211] The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer program instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital video disc (DVD), or a semiconductor medium (e.g., a solid-state drive)), etc.
[0212] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0213] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A directory deletion method based on NAS, characterized in that: The method comprises: A first NAS server in the distributed NAS server cluster receives a batch deletion instruction sent by a NAS client, wherein the batch deletion instruction indicates to delete a target directory; The first NAS server generates a plurality of distributed deletion instructions based on the target directory indicated by the batch deletion instruction, wherein the plurality of distributed deletion instructions indicate deletion of a plurality of subdirectories under the target directory, and the plurality of subdirectories are distributed on a plurality of NAS servers in the distributed NAS server cluster; The first NAS server sends a distributed deletion instruction of the corresponding subdirectory to the NAS server where each subdirectory in the multiple subdirectories is located; The first NAS server sends a deletion completion response to the NAS client, where the deletion completion response indicates that the target directory has been deleted.
2. The method according to claim 1, characterized in that The target directory also includes multiple files, and the method further includes: The first NAS server deletes the multiple files under the target directory from the first NAS server based on the target directory indicated by the batch deletion instruction.
3. The method according to claim 1, characterized in that The method further comprises: The second NAS server in the distributed NAS server cluster receives the distributed deletion instruction, and based on the subdirectory indicated by the received distributed deletion instruction, generates multiple distributed deletion instructions for multiple subdirectories under the subdirectory, where the multiple subdirectories under the subdirectory are distributed to multiple NAS servers in the distributed NAS server cluster; The second NAS server sends a distributed deletion instruction of the corresponding sub-directory to the NAS server where each sub-directory in the sub-directory is located.
4. The method according to claim 3, characterized in that The subdirectory also includes multiple files, and the method further includes: The second NAS server deletes the multiple files under the subdirectory from the second NAS server based on the subdirectory indicated by the received distributed deletion instruction.
5. The method according to any one of claims 1 to 4, characterized in that: The subdirectories indicated by different distributed deletion instructions are located on different NAS servers.
6. The method according to claim 1, characterized in that The batch deletion instruction also carries a deletion mode identifier, and the deletion mode identifier is used to indicate a deletion operation mode performed by the first NAS server on the target directory. The deletion operation mode is any one of a synchronous deletion mode and an asynchronous deletion mode.
7. The method according to any one of claims 1 to 6, characterized in that The first NAS server sending a deletion completion response to the NAS client includes: When the target directory has been deleted within a first preset time period, the first NAS server sends a first deletion response to the NAS client, where the first deletion response indicates that the target directory has been deleted.
8. The method according to any one of claims 1 to 6, characterized in that The method further comprises: When the target directory has not been completely deleted within the first preset time, the first NAS server sends a second deletion response to the NAS client, where the second deletion response is used to indicate that the target directory has not been completely deleted; The first NAS server sending a deletion completion response to the NAS client includes: The first NAS server receives at least one query instruction sent by the NAS client, each of the query instructions is separated by a second preset time length, and each of the query instructions carries a deletion task identifier corresponding to the batch deletion instruction; The first NAS server returns a corresponding query response to the NAS client based on each query instruction, each query response carries the execution result of the deletion task, and the query response corresponding to the last query instruction in the at least one query instruction indicates that the target directory has been deleted.
9. The method according to any one of claims 1 to 6, characterized in that The method further comprises: When the first NAS server receives the batch deletion instruction, it sends a second deletion response to the NAS client, where the second deletion response is used to indicate that the directory has not been deleted; The first NAS server sending a deletion completion response to the NAS client includes: If the directory has been deleted, an asynchronous deletion response is sent to the NAS client, where the asynchronous deletion response indicates that the target directory has been deleted.
10. A directory deletion method based on NAS, characterized in that: The method comprises: The NAS client sends a batch deletion instruction to a first NAS server in the distributed NAS server cluster in response to a deletion operation performed on the target directory on the NAS client, the batch deletion instruction instructing to delete the target directory; The NAS client receives a deletion completion response sent by the first NAS server, wherein the deletion completion response indicates that the target directory has been deleted; The NAS client displays a successful deletion prompt of the target directory, and the successful deletion prompt indicates that the target directory has been deleted.
11. The method according to claim 10, characterized in that The batch deletion instruction also carries a deletion mode identifier, and the deletion mode identifier is used to indicate a deletion operation mode performed by the first NAS server on the target directory. The deletion operation mode is any one of a synchronous deletion mode and an asynchronous deletion mode.
12. The method according to claim 10 or 11, characterized in that: The NAS client receiving the deletion completion response sent by the first NAS server includes: The NAS client receives a first deletion response sent by the first NAS server, where the first deletion response indicates that the target directory has been deleted within a first preset time period.
13. The method according to claim 10 or 11, characterized in that: The method further comprises: The NAS client receives a second deletion response sent by the first NAS server, where the second deletion response indicates that the target directory is not deleted; If the NAS client receives the second deletion response sent by the first NAS server after sending the batch deletion instruction for the first preset time period, the NAS client sends a query instruction to the first NAS server every second preset time period, and the query instruction carries the deletion task identifier and the verification code corresponding to the batch deletion instruction; The NAS client receives a query response returned by the first NAS server based on each query instruction, the query response carrying the execution result of the deletion task, and the query response corresponding to the last query instruction sent by the NAS client indicates that the target directory has been deleted.
14. The method according to claim 10 or 11, characterized in that: The method further comprises: The NAS client receives a second deletion response sent by the first NAS server, where the second deletion response indicates that the target directory is not deleted; If the NAS client receives the second deletion response sent by the first NAS server immediately after sending the batch deletion instruction, the NAS client receiving the deletion completion response sent by the first NAS server includes: The NAS client receives an asynchronous deletion response sent by the first NAS server, where the asynchronous deletion response indicates that the target directory has been deleted.
15. A directory deletion device based on NAS, characterized in that: The device comprises: An instruction receiving module, used for receiving a batch deletion instruction sent by a NAS client, wherein the batch deletion instruction indicates to delete a target directory; An instruction generation module, configured to generate a plurality of distributed deletion instructions based on the target directory indicated by the batch deletion instruction, wherein the plurality of distributed deletion instructions indicate deletion of a plurality of subdirectories under the target directory, the plurality of subdirectories being distributed on a plurality of NAS servers in the distributed NAS server cluster; An instruction sending module, used for sending a distributed deletion instruction of the corresponding subdirectory to the NAS server where each subdirectory in the multiple subdirectories is located; The response sending module is used to send a deletion completion response to the NAS client, where the deletion completion response indicates that the target directory has been deleted.
16. A directory deletion device based on NAS, characterized in that: The device comprises: an instruction sending module, configured to send a batch deletion instruction to a first NAS server in a distributed NAS server cluster in response to a deletion operation performed on a target directory on the NAS client, wherein the batch deletion instruction indicates that the target directory is to be deleted; a response receiving module, configured to receive a deletion completion response sent by the first NAS server, wherein the deletion completion response indicates that the target directory has been deleted; The display module is used to display a deletion success prompt of the target directory, wherein the deletion success prompt indicates that the target directory has been deleted.
17. A NAS server, characterized in that: The NAS server includes a processor and a memory, wherein the memory stores a program code, and the processor is used to execute the program code, so that the NAS server executes the NAS-based directory deletion method according to any one of claims 1 to 9.
18. A distributed NAS server cluster, characterized in that: The distributed NAS server cluster includes multiple NAS servers, each of which includes a processor and a memory, the memory stores a program code, and the processor is used to execute the program code, so that the distributed NAS server cluster executes the NAS-based directory deletion method according to any one of claims 1 to 9.
19. A NAS client, characterized in that: The NAS client includes a processor and a memory, the memory stores a program code, and the processor is used to execute the program code, so that the NAS client executes the NAS-based directory deletion method according to any one of claims 10 to 14.
Citation Information
Cited By
NAS-based directory deletion method and apparatus, and client and server
EP4711942A1
NAS-based directory deletion method and apparatus, and client and server
WO2024250720A1
